Bug 1400334 - Guard against no theme color in standalone webapp r=nechen draft
authorJames Willcox <snorp@snorp.net>
Mon, 02 Oct 2017 13:24:45 -0500
changeset 673747 05cb92826ff4ea5fc4227e26c1b339f68778b0da
parent 673746 edcbe3e62ccbb57fbccc054651ff618aa04722bd
child 673752 bf3da5473f40b399d32c47d35f7573251d95a25a
push id82627
push userbmo:snorp@snorp.net
push dateMon, 02 Oct 2017 18:26:56 +0000
reviewersnechen
bugs1400334
milestone58.0a1
Bug 1400334 - Guard against no theme color in standalone webapp r=nechen MozReview-Commit-ID: C9LfdSvujS9
mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
--- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
@@ -272,23 +272,27 @@ public class WebAppActivity extends AppC
         }
 
         if (mManifest.isInScope(url) && where != TargetWindow.NEW) {
             // This is in scope and wants to load in the same frame, so
             // let Gecko handle it.
             return false;
         }
 
-        CustomTabsIntent tab = new CustomTabsIntent.Builder()
+        final CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder()
             .addDefaultShareMenuItem()
-            .setToolbarColor(mManifest.getThemeColor())
             .setStartAnimations(this, R.anim.slide_in_right, R.anim.slide_out_left)
-            .setExitAnimations(this, R.anim.slide_in_left, R.anim.slide_out_right)
-            .build();
+            .setExitAnimations(this, R.anim.slide_in_left, R.anim.slide_out_right);
 
+        final Integer themeColor = mManifest.getThemeColor();
+        if (themeColor != null) {
+            builder.setToolbarColor(themeColor);
+        }
+
+        final CustomTabsIntent tab = builder.build();
         tab.intent.setClass(this, CustomTabsActivity.class);
         tab.launchUrl(this, url);
         return true;
     }
 
     private void updateFullScreen() {
         boolean fullScreen = mIsFullScreenContent || mIsFullScreenMode;
         if (ActivityUtils.isFullScreen(this) == fullScreen) {