mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1055595 - Part 3: introduce newView/bindView constructs in to adapter (r=lucasr)
This commit is contained in:
parent
569276ea5c
commit
d8b38fd683
@ -253,25 +253,39 @@ class TabsListLayout extends TwoWayView
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TabsLayoutItemView item;
|
||||
|
||||
final View view;
|
||||
if (convertView == null) {
|
||||
convertView = mInflater.inflate(R.layout.tabs_row, null);
|
||||
item = new TabsLayoutItemView(convertView);
|
||||
item.close.setOnClickListener(mOnCloseClickListener);
|
||||
convertView.setTag(item);
|
||||
view = newView(position, parent);
|
||||
} else {
|
||||
item = (TabsLayoutItemView) convertView.getTag();
|
||||
view = convertView;
|
||||
|
||||
// If we're recycling this view, there's a chance it was transformed during
|
||||
// the close animation. Remove any of those properties.
|
||||
resetTransforms(convertView);
|
||||
resetTransforms(view);
|
||||
}
|
||||
|
||||
Tab tab = mTabs.get(position);
|
||||
item.assignValues(tab);
|
||||
final Tab tab = mTabs.get(position);
|
||||
bindView(view, tab);
|
||||
|
||||
return convertView;
|
||||
return view;
|
||||
}
|
||||
|
||||
View newView(int position, ViewGroup parent) {
|
||||
final View view = mInflater.inflate(R.layout.tabs_row, parent, false);
|
||||
|
||||
final TabsLayoutItemView item = new TabsLayoutItemView(view);
|
||||
item.close.setOnClickListener(mOnCloseClickListener);
|
||||
|
||||
view.setTag(item);
|
||||
return view;
|
||||
}
|
||||
|
||||
void bindView(View view, Tab tab) {
|
||||
TabsLayoutItemView item = (TabsLayoutItemView) view.getTag();
|
||||
item.assignValues(tab);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void resetTransforms(View view) {
|
||||
|
Loading…
Reference in New Issue
Block a user