Bug 1075576 - Change the TabsLayoutAdapter API to use TabsLayoutItemView instead of the generic View (r=lucasr)

This commit is contained in:
Martyn Haigh 2014-10-02 15:39:26 +01:00
Родитель 49612ba0d9
Коммит c6ab7dc50c
3 изменённых файлов: 13 добавлений и 14 удалений

Просмотреть файл

@ -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