Bug 1075576 - Change the TabsLayoutAdapter API to use TabsLayoutItemView instead of the generic View (r=lucasr)
authorMartyn Haigh <martyn.haigh@gmail.com>
Thu, 02 Oct 2014 15:39:26 +0100
changeset 208625 02e5436e40edb54c6383b5f060df0052bd87bfa9
parent 208624 69bb4035eba1f700be16de76bbd332718517010e
child 208626 39010225dc9f80a9fa47b6cb718a9c67e2b2aac3
push id27587
push useremorley@mozilla.com
push dateFri, 03 Oct 2014 13:51:36 +0000
treeherdermozilla-central@84204f793602 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs1075576
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1075576 - Change the TabsLayoutAdapter API to use TabsLayoutItemView instead of the generic View (r=lucasr)
mobile/android/base/tabs/TabsGridLayout.java
mobile/android/base/tabs/TabsLayoutAdapter.java
mobile/android/base/tabs/TabsListLayout.java
--- a/mobile/android/base/tabs/TabsGridLayout.java
+++ b/mobile/android/base/tabs/TabsGridLayout.java
@@ -83,27 +83,26 @@ class TabsGridLayout extends GridView
                     TabsLayoutItemView tab = (TabsLayoutItemView) v;
                     Tabs.getInstance().selectTab(tab.id);
                     autoHidePanel();
                 }
             };
         }
 
         @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.
             resetTransforms(view);
         }
     }
 
     @Override
--- a/mobile/android/base/tabs/TabsLayoutAdapter.java
+++ b/mobile/android/base/tabs/TabsLayoutAdapter.java
@@ -65,28 +65,28 @@ public class TabsLayoutAdapter extends B
     final int getPositionForTab(Tab tab) {
         if (mTabs == null || tab == null)
             return -1;
 
         return mTabs.indexOf(tab);
     }
 
     @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);
     }
 }
\ No newline at end of file
--- a/mobile/android/base/tabs/TabsListLayout.java
+++ b/mobile/android/base/tabs/TabsListLayout.java
@@ -99,26 +99,26 @@ class TabsListLayout extends TwoWayView
                     TabsLayoutItemView item = (TabsLayoutItemView) v.getTag();
                     final int pos = (isVertical() ? item.getWidth() : 0 - item.getHeight());
                     animateClose(item, pos);
                 }
             };
         }
 
         @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);
 
             return item;
         }
 
         @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
             // the close animation. Remove any of those properties.
             resetTransforms(view);
         }
 
     }