зеркало из 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
|
@Override
|
||||||
View newView(int position, ViewGroup parent) {
|
TabsLayoutItemView newView(int position, ViewGroup parent) {
|
||||||
final TabsLayoutItemView item = (TabsLayoutItemView) super.newView(position, parent);
|
final TabsLayoutItemView item = super.newView(position, parent);
|
||||||
item.setOnClickListener(mSelectClickListener);
|
item.setOnClickListener(mSelectClickListener);
|
||||||
item.setCloseOnClickListener(mCloseClickListener);
|
item.setCloseOnClickListener(mCloseClickListener);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Tab tab) {
|
public void bindView(TabsLayoutItemView view, Tab tab) {
|
||||||
super.bindView(view, 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
|
// If we're recycling this view, there's a chance it was transformed during
|
||||||
// the close animation. Remove any of those properties.
|
// the close animation. Remove any of those properties.
|
||||||
|
|
|
@ -70,23 +70,23 @@ public class TabsLayoutAdapter extends BaseAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public View getView(int position, View convertView, ViewGroup parent) {
|
final public TabsLayoutItemView getView(int position, View convertView, ViewGroup parent) {
|
||||||
final View view;
|
final TabsLayoutItemView view;
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
view = newView(position, parent);
|
view = newView(position, parent);
|
||||||
} else {
|
} else {
|
||||||
view = convertView;
|
view = (TabsLayoutItemView) convertView;
|
||||||
}
|
}
|
||||||
final Tab tab = mTabs.get(position);
|
final Tab tab = mTabs.get(position);
|
||||||
bindView(view, tab);
|
bindView(view, tab);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
View newView(int position, ViewGroup parent) {
|
TabsLayoutItemView newView(int position, ViewGroup parent) {
|
||||||
return mInflater.inflate(R.layout.tabs_layout_item_view, parent, false);
|
return (TabsLayoutItemView) mInflater.inflate(R.layout.tabs_layout_item_view, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindView(View view, Tab tab) {
|
void bindView(TabsLayoutItemView view, Tab tab) {
|
||||||
((TabsLayoutItemView) view).assignValues(tab);
|
view.assignValues(tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -104,8 +104,8 @@ class TabsListLayout extends TwoWayView
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View newView(int position, ViewGroup parent) {
|
public TabsLayoutItemView newView(int position, ViewGroup parent) {
|
||||||
TabsLayoutItemView item = (TabsLayoutItemView) super.newView(position, parent);
|
TabsLayoutItemView item = super.newView(position, parent);
|
||||||
|
|
||||||
item.setCloseOnClickListener(mCloseOnClickListener);
|
item.setCloseOnClickListener(mCloseOnClickListener);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class TabsListLayout extends TwoWayView
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindView(View view, Tab tab) {
|
public void bindView(TabsLayoutItemView view, Tab tab) {
|
||||||
super.bindView(view, tab);
|
super.bindView(view, tab);
|
||||||
|
|
||||||
// If we're recycling this view, there's a chance it was transformed during
|
// If we're recycling this view, there's a chance it was transformed during
|
||||||
|
|
Загрузка…
Ссылка в новой задаче