Bug 1133770 - Use Refreshable interface instead of TabStrip in BrowserApp to allow builds on API 9. r=mhaigh, a=lizzard
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 20 Feb 2015 09:05:22 -0800
changeset 250078 e7319d343f20
parent 250077 eb261fd50770
child 250079 f18e2aecea6d
push id4497
push userryanvm@gmail.com
push date2015-02-25 20:26 +0000
treeherdermozilla-beta@b23a690fa325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh, lizzard
bugs1133770
milestone37.0
Bug 1133770 - Use Refreshable interface instead of TabStrip in BrowserApp to allow builds on API 9. r=mhaigh, a=lizzard
mobile/android/base/BrowserApp.java
mobile/android/base/tabs/TabStrip.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -62,17 +62,16 @@ import org.mozilla.gecko.mozglue.Context
 import org.mozilla.gecko.preferences.ClearOnShutdownPref;
 import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.prompts.Prompt;
 import org.mozilla.gecko.prompts.PromptListItem;
 import org.mozilla.gecko.sync.setup.SyncAccounts;
 import org.mozilla.gecko.tabs.TabHistoryController;
 import org.mozilla.gecko.tabs.TabHistoryFragment;
 import org.mozilla.gecko.tabs.TabHistoryPage;
-import org.mozilla.gecko.tabs.TabStrip;
 import org.mozilla.gecko.tabs.TabsPanel;
 import org.mozilla.gecko.tabs.TabHistoryController.OnShowTabHistory;
 import org.mozilla.gecko.tiles.TilesRecorder;
 import org.mozilla.gecko.toolbar.AutocompleteHandler;
 import org.mozilla.gecko.toolbar.BrowserToolbar;
 import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState;
 import org.mozilla.gecko.toolbar.ToolbarProgressView;
 import org.mozilla.gecko.util.Clipboard;
@@ -174,17 +173,18 @@ public class BrowserApp extends GeckoApp
 
     private BrowserSearch mBrowserSearch;
     private View mBrowserSearchContainer;
 
     public ViewGroup mBrowserChrome;
     public ViewFlipper mActionBarFlipper;
     public ActionModeCompatView mActionBar;
     private BrowserToolbar mBrowserToolbar;
-    private TabStrip mTabStrip;
+    // We can't name the TabStrip class because it's not included on API 9.
+    private Refreshable mTabStrip;
     private ToolbarProgressView mProgressView;
     private HomePager mHomePager;
     private TabsPanel mTabsPanel;
     private ViewGroup mHomePagerContainer;
     protected Telemetry.Timer mAboutHomeStartupTimer;
     private ActionModeCompat mActionMode;
     private boolean mHideDynamicToolbarOnActionModeEnd;
     private TabHistoryController tabHistoryController;
@@ -546,17 +546,17 @@ public class BrowserApp extends GeckoApp
             mBrowserToolbar.setTitle(intent.getDataString());
 
             Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT);
         } else if (GuestSession.NOTIFICATION_INTENT.equals(action)) {
             GuestSession.handleIntent(this, intent);
         }
 
         if (NewTabletUI.isEnabled(this)) {
-            mTabStrip = (TabStrip) (((ViewStub) findViewById(R.id.new_tablet_tab_strip)).inflate());
+            mTabStrip = (Refreshable) (((ViewStub) findViewById(R.id.new_tablet_tab_strip)).inflate());
         }
 
         ((GeckoApp.MainLayout) mMainLayout).setTouchEventInterceptor(new HideOnTouchListener());
         ((GeckoApp.MainLayout) mMainLayout).setMotionEventInterceptor(new MotionEventInterceptor() {
             @Override
             public boolean onInterceptMotionEvent(View view, MotionEvent event) {
                 // If we get a gamepad panning MotionEvent while the focus is not on the layerview,
                 // put the focus on the layerview and carry on
@@ -3341,9 +3341,13 @@ public class BrowserApp extends GeckoApp
         return new BrowserHealthRecorder(context,
                                          GeckoSharedPrefs.forApp(context),
                                          profilePath,
                                          dispatcher,
                                          osLocale,
                                          appLocale,
                                          previousSession);
     }
+
+    public static interface Refreshable {
+        public void refresh();
+    }
 }
--- a/mobile/android/base/tabs/TabStrip.java
+++ b/mobile/android/base/tabs/TabStrip.java
@@ -10,23 +10,25 @@ import android.graphics.drawable.Drawabl
 import android.graphics.drawable.StateListDrawable;
 import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.TouchDelegate;
 import android.view.View;
 import android.view.ViewTreeObserver;
 
+import org.mozilla.gecko.BrowserApp.Refreshable;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.widget.ThemedImageButton;
 import org.mozilla.gecko.widget.ThemedLinearLayout;
 
-public class TabStrip extends ThemedLinearLayout {
+public class TabStrip extends ThemedLinearLayout
+                      implements Refreshable {
     private static final String LOGTAG = "GeckoTabStrip";
 
     private final TabStripView tabStripView;
     private final ThemedImageButton addTabButton;
 
     private final TabsListener tabsListener;
 
     public TabStrip(Context context) {
@@ -123,16 +125,17 @@ public class TabStrip extends ThemedLine
                 case FAVICON:
                 case RECORDING_CHANGE:
                     tabStripView.updateTab(tab);
                     break;
             }
         }
     }
 
+    @Override
     public void refresh() {
         tabStripView.refresh();
     }
 
     @Override
     public void onLightweightThemeChanged() {
         final Drawable drawable = getTheme().getDrawable(this);
         if (drawable == null) {