Bug 1403980 - Hide Splash screen in new tab opened from the search widget. r?jwu
MozReview-Commit-ID: 9RBOfHe80CW
--- a/mobile/android/app/src/main/res/layout/splash_screen.xml
+++ b/mobile/android/app/src/main/res/layout/splash_screen.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<org.mozilla.gecko.widget.SplashScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/splash_root"
+ android:background="@drawable/url_bar_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="116dp"
android:layout_height="121dp"
android:layout_centerInParent="true"
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -2758,16 +2758,22 @@ public class BrowserApp extends GeckoApp
return;
}
// History will only store that we were visiting about:home, however the specific panel
// isn't stored. (We are able to navigate directly to homepanels using an about:home?panel=...
// URL, but the reverse doesn't apply: manually switching panels doesn't update the URL.)
// Hence we need to restore the panel, in addition to panel state, here.
if (isAboutHome(tab)) {
+ // For some reason(e.g. from SearchWidget) we are showing the splash schreen. We should hide it now.
+ if (splashScreen != null && splashScreen.getVisibility() == View.VISIBLE) {
+ // Below line will be run when LOCATION_CHANGE. Which means the page load is almost completed.
+ splashScreen.hide();
+ }
+
String panelId = AboutPages.getPanelIdFromAboutHomeUrl(tab.getURL());
Bundle panelRestoreData = null;
if (panelId == null) {
// No panel was specified in the URL. Try loading the most recent
// home panel for this tab.
// Note: this isn't necessarily correct. We don't update the URL when we switch tabs.
// If a user explicitly navigated to about:reader?panel=FOO, and then switches
// to panel BAR, the history URL still contains FOO, and we restore to FOO. In most
@@ -2793,17 +2799,17 @@ public class BrowserApp extends GeckoApp
showSplashScreen = false;
} else {
// The tab going to load is not about page. It's a web page.
// If showSplashScreen is true, it means the app is first launched. We want to show the SlashScreen
// But if GeckoThread.isRunning, the will be 0 sec for web rendering.
// In that case, we don't want to show the SlashScreen/
if (showSplashScreen && !GeckoThread.isRunning()) {
- final ViewGroup main = (ViewGroup) findViewById(R.id.main_layout);
+ final ViewGroup main = (ViewGroup) findViewById(R.id.gecko_layout);
final View splashLayout = LayoutInflater.from(this).inflate(R.layout.splash_screen, main);
splashScreen = (SplashScreen) splashLayout.findViewById(R.id.splash_root);
showSplashScreen = false;
} else if (splashScreen != null) {
// Below line will be run when LOCATION_CHANGE. Which means the page load is almost completed.
splashScreen.hide();
}