Bug 711746: ActionBar should be loaded in XML to avoid temporary title screen. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Mon, 13 Feb 2012 10:23:09 -0800
changeset 86731 25d02871313b7bbcdae317850e2c42b08b20e189
parent 86730 19a59b40b90ab3498d1176464f558ef8d087d68d
child 86732 8b995dfd66e1241ac83a027e05aa32f0a003849b
push id22053
push usermak77@bonardo.net
push dateTue, 14 Feb 2012 10:17:02 +0000
treeherdermozilla-central@62695656d7bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs711746
milestone13.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 711746: ActionBar should be loaded in XML to avoid temporary title screen. [r=mfinkle]
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/AwesomeBar.java
mobile/android/base/GeckoActionBar.java
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoPreferences.java
mobile/android/base/resources/values-v11/styles.xml
mobile/android/base/resources/values-v11/themes.xml
mobile/android/base/resources/values/themes.xml
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -51,17 +51,17 @@
 		 android:debuggable="true">
 #endif
 
         <activity android:name="App"
                   android:label="@MOZ_APP_DISPLAYNAME@"
                   android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation"
                   android:windowSoftInputMode="stateUnspecified|adjustResize"
                   android:launchMode="singleTask"
-                  android:theme="@style/Gecko">
+                  android:theme="@style/Gecko.App">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
             <intent-filter>
                 <action android:name="org.mozilla.gecko.UPDATE"/>
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
@@ -141,26 +141,26 @@
             <intent-filter>
                 <action android:name="android.intent.action.CREATE_SHORTCUT" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
         -->
 
         <activity android:name="org.mozilla.gecko.AwesomeBar"
-                  android:theme="@style/Gecko.Light"
+                  android:theme="@style/Gecko.Light.AwesomeBar"
                   android:configChanges="orientation"
                   android:windowSoftInputMode="stateAlwaysVisible|adjustResize"/>
 
         <activity android:name="org.mozilla.gecko.TabsTray"
                   android:theme="@style/Gecko.Translucent"
                   android:launchMode="singleTask"/>
 
         <activity android:name="org.mozilla.gecko.GeckoPreferences"
-                  android:theme="@style/Gecko.TitleBar"
+                  android:theme="@style/Gecko.TitleBar.Preferences"
                   android:label="@string/settings_title"
                   android:excludeFromRecents="true"/>
 
         <provider android:name="@ANDROID_PACKAGE_NAME@.db.BrowserProvider"
                   android:authorities="@ANDROID_PACKAGE_NAME@.db.browser"
                   android:permission="@ANDROID_PACKAGE_NAME@.permissions.BROWSER_PROVIDER"/>
 
         <provider android:name="@ANDROID_PACKAGE_NAME@.db.PasswordsProvider"
--- a/mobile/android/base/AwesomeBar.java
+++ b/mobile/android/base/AwesomeBar.java
@@ -103,24 +103,17 @@ public class AwesomeBar extends Activity
 
         Log.d(LOGTAG, "creating awesomebar");
 
         mResolver = Tabs.getInstance().getContentResolver();
 
         setContentView(R.layout.awesomebar);
 
         if (Build.VERSION.SDK_INT >= 11) {
-            RelativeLayout actionBarLayout = (RelativeLayout) getLayoutInflater().inflate(R.layout.awesomebar_search, null);
-
-            GeckoActionBar.setDisplayOptions(this, ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM |
-                                                                                  ActionBar.DISPLAY_SHOW_HOME |
-                                                                                  ActionBar.DISPLAY_SHOW_TITLE |
-                                                                                  ActionBar.DISPLAY_USE_LOGO);
-            GeckoActionBar.setCustomView(this, actionBarLayout);
-
+            RelativeLayout actionBarLayout = (RelativeLayout) GeckoActionBar.getCustomView(this);
             mGoButton = (ImageButton) actionBarLayout.findViewById(R.id.awesomebar_button);
             mText = (AwesomeBarEditText) actionBarLayout.findViewById(R.id.awesomebar_text);
         } else {
             mGoButton = (ImageButton) findViewById(R.id.awesomebar_button);
             mText = (AwesomeBarEditText) findViewById(R.id.awesomebar_text);
         }
 
         TabWidget tabWidget = (TabWidget) findViewById(android.R.id.tabs);
--- a/mobile/android/base/GeckoActionBar.java
+++ b/mobile/android/base/GeckoActionBar.java
@@ -37,16 +37,20 @@
 
 package org.mozilla.gecko;
 
 import android.app.Activity;
 import android.graphics.drawable.Drawable;
 import android.view.View;
 
 public class GeckoActionBar {
+
+    public static View getCustomView(Activity activity) {
+        return activity.getActionBar().getCustomView();
+    }
  
     public static void hide(Activity activity) {
         activity.getActionBar().hide();
     }
 
     public static void setBackgroundDrawable(Activity activity, Drawable drawable) {
          activity.getActionBar().setBackgroundDrawable(drawable);
     }
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1663,22 +1663,22 @@ abstract public class GeckoApp
 
         if (ACTION_UPDATE.equals(intent.getAction()) || args != null && args.contains("-alert update-app")) {
             Log.i(LOGTAG,"onCreate: Update request");
             checkAndLaunchUpdate();
         }
 
         super.onCreate(savedInstanceState);
 
+        mOrientation = getResources().getConfiguration().orientation;
+
         setContentView(R.layout.gecko_app);
 
-        mOrientation = getResources().getConfiguration().orientation;
-
         if (Build.VERSION.SDK_INT >= 11) {
-            refreshActionBar();
+            mBrowserToolbar = (BrowserToolbar) GeckoActionBar.getCustomView(this);
         } else {
             mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
         }
 
         mBrowserToolbar.setTitle(mLastTitle);
 
         String passedUri = null;
         String uri = getURIFromIntent(intent);
--- a/mobile/android/base/GeckoPreferences.java
+++ b/mobile/android/base/GeckoPreferences.java
@@ -74,19 +74,16 @@ public class GeckoPreferences
     private ArrayList<String> mPreferencesList = new ArrayList<String>();
     private PreferenceScreen mPreferenceScreen;
     private static boolean sIsCharEncodingEnabled = false;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        if (Build.VERSION.SDK_INT >= 11)
-            GeckoActionBar.setDisplayHomeAsUpEnabled(this, true);
-
         addPreferencesFromResource(R.xml.preferences);
         mPreferenceScreen = getPreferenceScreen();
         GeckoAppShell.registerGeckoEventListener("Preferences:Data", this);
         initGroups(mPreferenceScreen);
         initValues();
     }
 
     @Override
--- a/mobile/android/base/resources/values-v11/styles.xml
+++ b/mobile/android/base/resources/values-v11/styles.xml
@@ -21,10 +21,32 @@
     </style>
 
     <!-- Lists in AwesomeBar -->
     <style name="AwesomeBarList" parent="android:style/Widget.Holo.ListView">
         <item name="android:layout_width">fill_parent</item>
         <item name="android:layout_height">fill_parent</item>
         <item name="android:layout_weight">1</item>
     </style>
+ 
+    <!-- ActionBar -->
+    <style name="ActionBar" parent="android:style/Widget.Holo.ActionBar" />
+
+    <!-- GeckoApp ActionBar -->
+    <style name="ActionBar.GeckoApp">
+         <item name="android:background">@drawable/gecko_actionbar_bg</item>
+         <item name="android:displayOptions">showCustom</item>
+         <item name="android:customNavigationLayout">@layout/browser_toolbar</item>
+    </style>
+ 
+    <!-- AwesomeBar ActionBar -->
+    <style name="ActionBar.AwesomeBar">
+         <item name="android:background">@android:color/transparent</item>
+         <item name="android:displayOptions">showCustom</item>
+         <item name="android:customNavigationLayout">@layout/awesomebar_search</item>
+    </style>
+ 
+    <!-- GeckoPreferences ActionBar -->
+    <style name="ActionBar.GeckoPreferences">
+         <item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
+    </style>
 
 </resources>
--- a/mobile/android/base/resources/values-v11/themes.xml
+++ b/mobile/android/base/resources/values-v11/themes.xml
@@ -1,35 +1,44 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
     <style name="Gecko" parent="@android:style/Theme.Holo">
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.TitleBar" parent="Gecko"/>
 
     <style name="Gecko.NoActionBar" parent="@android:style/Theme.Holo">
         <item name="android:windowActionBar">false</item>
         <item name="android:windowNoTitle">true</item>
         <item name="android:windowBackground">@color/splash_background</item>
     </style>
     
     <style name="Gecko.Light" parent="@android:style/Theme.Holo.Light">
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.Light.TitleBar" parent="Gecko.Light"/>
 
     <style name="Gecko.Light.NoActionBar" parent="@android:style/Theme.Holo.Light">
         <item name="android:windowActionBar">false</item>
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@color/splash_background</item>
     </style>
     
     <style name="Gecko.Translucent" parent="@android:style/Theme.Translucent">
         <item name="android:windowActionBar">true</item>
         <item name="android:windowNoTitle">false</item>
     </style>
+
+    <style name="Gecko.App">
+        <item name="android:actionBarStyle">@style/ActionBar.GeckoApp</item>
+    </style>
+
+    <style name="Gecko.Light.AwesomeBar">
+        <item name="android:actionBarStyle">@style/ActionBar.AwesomeBar</item>
+    </style>
+
+    <style name="Gecko.TitleBar.Preferences">
+        <item name="android:actionBarStyle">@style/ActionBar.GeckoPreferences</item>
+    </style>
     
 </resources>
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -1,32 +1,36 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
 
     <style name="Gecko" parent="@android:style/Theme">
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.TitleBar" parent="Gecko">
         <item name="android:windowNoTitle">false</item>
     </style>
 
     <style name="Gecko.NoActionBar" parent="Gecko"/>
     
     <style name="Gecko.Light" parent="@android:style/Theme.Light">
         <item name="android:windowNoTitle">true</item>
-        <item name="android:windowBackground">@color/splash_background</item>
         <item name="android:windowContentOverlay">@null</item>
     </style>
     
     <style name="Gecko.Light.TitleBar" parent="Gecko.Light">
         <item name="android:windowNoTitle">false</item>
     </style>
 
     <style name="Gecko.Light.NoActionBar" parent="Gecko.Light"/>
     
     <style name="Gecko.Translucent" parent="@android:style/Theme.Translucent">
         <item name="android:windowNoTitle">true</item>
     </style>
 
+    <style name="Gecko.App"/>
+    
+    <style name="Gecko.Light.AwesomeBar"/>
+    
+    <style name="Gecko.TitleBar.Preferences"/>
+
 </resources>