зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1075576 - Change the TabsLayoutAdapter API to use TabsLayoutItemView instead of the generic View (r=lucasr)
This commit is contained in:
Родитель
49612ba0d9
Коммит
c6ab7dc50c
|
@ -88,17 +88,16 @@ class TabsGridLayout extends GridView
|
|||
}
|
||||
|
||||
@Override
|
||||
View newView(int position, ViewGroup parent) {
|
||||
final TabsLayoutItemView item = (TabsLayoutItemView) super.newView(position, parent);
|
||||
TabsLayoutItemView newView(int position, ViewGroup parent) {
|
||||
final TabsLayoutItemView item = super.newView(position, parent);
|
||||
item.setOnClickListener(mSelectClickListener);
|
||||
item.setCloseOnClickListener(mCloseClickListener);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindView(View view, Tab tab) {
|
||||
public void bindView(TabsLayoutItemView view, Tab tab) {
|
||||
super.bindView(view, tab);
|
||||
((TabsLayoutItemView) view).close.setVisibility(View.VISIBLE);
|
||||
|
||||
// If we're recycling this view, there's a chance it was transformed during
|
||||
// the close animation. Remove any of those properties.
|
||||
|
|
|
@ -70,23 +70,23 @@ public class TabsLayoutAdapter extends BaseAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
final public View getView(int position, View convertView, ViewGroup parent) {
|
||||
final View view;
|
||||
final public TabsLayoutItemView getView(int position, View convertView, ViewGroup parent) {
|
||||
final TabsLayoutItemView view;
|
||||
if (convertView == null) {
|
||||
view = newView(position, parent);
|
||||
} else {
|
||||
view = convertView;
|
||||
view = (TabsLayoutItemView) convertView;
|
||||
}
|
||||
final Tab tab = mTabs.get(position);
|
||||
bindView(view, tab);
|
||||
return view;
|
||||
}
|
||||
|
||||
View newView(int position, ViewGroup parent) {
|
||||
return mInflater.inflate(R.layout.tabs_layout_item_view, parent, false);
|
||||
TabsLayoutItemView newView(int position, ViewGroup parent) {
|
||||
return (TabsLayoutItemView) mInflater.inflate(R.layout.tabs_layout_item_view, parent, false);
|
||||
}
|
||||
|
||||
void bindView(View view, Tab tab) {
|
||||
((TabsLayoutItemView) view).assignValues(tab);
|
||||
void bindView(TabsLayoutItemView view, Tab tab) {
|
||||
view.assignValues(tab);
|
||||
}
|
||||
}
|
|
@ -104,8 +104,8 @@ class TabsListLayout extends TwoWayView
|
|||
}
|
||||
|
||||
@Override
|
||||
public View newView(int position, ViewGroup parent) {
|
||||
TabsLayoutItemView item = (TabsLayoutItemView) super.newView(position, parent);
|
||||
public TabsLayoutItemView newView(int position, ViewGroup parent) {
|
||||
TabsLayoutItemView item = super.newView(position, parent);
|
||||
|
||||
item.setCloseOnClickListener(mCloseOnClickListener);
|
||||
|
||||
|
@ -113,7 +113,7 @@ class TabsListLayout extends TwoWayView
|
|||
}
|
||||
|
||||
@Override
|
||||
public void bindView(View view, Tab tab) {
|
||||
public void bindView(TabsLayoutItemView view, Tab tab) {
|
||||
super.bindView(view, tab);
|
||||
|
||||
// If we're recycling this view, there's a chance it was transformed during
|
||||
|
|
Загрузка…
Ссылка в новой задаче