Bug 711746: ActionBar should be loaded in XML to avoid temporary title screen. [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2012-02-13 10:23:09 -08:00
Родитель d3530ec59c
Коммит edf9937d74
8 изменённых файлов: 51 добавлений и 22 удалений

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

@ -56,7 +56,7 @@
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" />
@ -146,7 +146,7 @@
-->
<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"/>
@ -155,7 +155,7 @@
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"/>

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

@ -108,14 +108,7 @@ public class AwesomeBar extends Activity implements GeckoEventListener {
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 {

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

@ -42,6 +42,10 @@ 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();

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

@ -1668,12 +1668,12 @@ abstract public class GeckoApp
super.onCreate(savedInstanceState);
setContentView(R.layout.gecko_app);
mOrientation = getResources().getConfiguration().orientation;
setContentView(R.layout.gecko_app);
if (Build.VERSION.SDK_INT >= 11) {
refreshActionBar();
mBrowserToolbar = (BrowserToolbar) GeckoActionBar.getCustomView(this);
} else {
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
}

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

@ -79,9 +79,6 @@ public class GeckoPreferences
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);

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

@ -26,5 +26,27 @@
<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>

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

@ -2,7 +2,6 @@
<resources>
<style name="Gecko" parent="@android:style/Theme.Holo">
<item name="android:windowBackground">@color/splash_background</item>
<item name="android:windowContentOverlay">@null</item>
</style>
@ -15,7 +14,6 @@
</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>
@ -24,12 +22,23 @@
<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>

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

@ -3,7 +3,6 @@
<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>
@ -15,7 +14,6 @@
<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>
@ -29,4 +27,10 @@
<item name="android:windowNoTitle">true</item>
</style>
<style name="Gecko.App"/>
<style name="Gecko.Light.AwesomeBar"/>
<style name="Gecko.TitleBar.Preferences"/>
</resources>