Bug 717681: The URL bar adds a black line on rotation and screen lock. [r=mfinkle]

This commit is contained in:
Sriram Ramasubramanian 2012-01-30 15:10:16 -08:00
parent 99f6891b58
commit aac30e3ab9
3 changed files with 36 additions and 26 deletions

View File

@ -317,4 +317,16 @@ public class BrowserToolbar extends LinearLayout {
else
mSiteSecurity.setImageLevel(0);
}
public void refresh() {
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
setTitle(tab.getDisplayTitle());
setFavicon(tab.getFavicon());
setSecurityMode(tab.getSecurityMode());
setProgressVisibility(tab.isLoading());
setShadowVisibility(!(tab.getURL().startsWith("about:")));
updateTabs(Tabs.getInstance().getCount());
}
}
}

View File

@ -1446,6 +1446,20 @@ abstract public class GeckoApp
});
}
// The ActionBar needs to be refreshed on rotation as different orientation uses different resources
public void refreshActionBar() {
if (Build.VERSION.SDK_INT >= 11) {
mBrowserToolbar = (BrowserToolbar) getLayoutInflater().inflate(R.layout.browser_toolbar, null);
mBrowserToolbar.refresh();
GeckoActionBar.setBackgroundDrawable(this, getResources().getDrawable(R.drawable.gecko_actionbar_bg));
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, mBrowserToolbar);
}
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
@ -1531,14 +1545,7 @@ abstract public class GeckoApp
mOrientation = getResources().getConfiguration().orientation;
if (Build.VERSION.SDK_INT >= 11) {
mBrowserToolbar = (BrowserToolbar) getLayoutInflater().inflate(R.layout.browser_toolbar, null);
GeckoActionBar.setBackgroundDrawable(this, getResources().getDrawable(R.drawable.gecko_actionbar_bg));
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, mBrowserToolbar);
refreshActionBar();
} else {
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
}
@ -1899,6 +1906,13 @@ abstract public class GeckoApp
// Undo whatever we did in onPause.
super.onResume();
int newOrientation = getResources().getConfiguration().orientation;
if (mOrientation != newOrientation) {
mOrientation = newOrientation;
refreshActionBar();
}
// Just in case. Normally we start in onNewIntent
if (checkLaunchState(LaunchState.Launching))
onNewIntent(getIntent());
@ -2012,23 +2026,7 @@ abstract public class GeckoApp
if (mOrientation != newConfig.orientation) {
mOrientation = newConfig.orientation;
mAutoCompletePopup.hide();
if (Build.VERSION.SDK_INT >= 11) {
mBrowserToolbar = (BrowserToolbar) getLayoutInflater().inflate(R.layout.browser_toolbar, null);
Tab tab = Tabs.getInstance().getSelectedTab();
if (tab != null) {
mBrowserToolbar.setTitle(tab.getDisplayTitle());
mBrowserToolbar.setFavicon(tab.getFavicon());
mBrowserToolbar.setSecurityMode(tab.getSecurityMode());
mBrowserToolbar.setProgressVisibility(tab.isLoading());
mBrowserToolbar.setShadowVisibility(!(tab.getURL().startsWith("about:")));
mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
}
GeckoActionBar.setBackgroundDrawable(this, getResources().getDrawable(R.drawable.gecko_actionbar_bg));
GeckoActionBar.setCustomView(mAppContext, mBrowserToolbar);
}
refreshActionBar();
}
}

View File

@ -4,7 +4,7 @@
<item android:right="34dp">
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/address_bar_texture"
android:tileMode="mirror"
android:tileMode="repeat"
android:dither="false"/>
</item>