Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
| index c7aac5665dd5181258862445362115df833ebd15..18e9f1678a746fd9bc8da5a97f25997a8e223323 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
| @@ -15,6 +15,8 @@ import android.util.Log; |
| import android.view.LayoutInflater; |
| import android.view.View; |
| import android.view.ViewGroup; |
| +import android.widget.ImageView; |
| +import android.widget.TextView; |
| import org.chromium.base.ActivityState; |
| import org.chromium.base.ApplicationStatus; |
| @@ -29,6 +31,7 @@ import org.chromium.chrome.browser.ssl.ConnectionSecurityLevel; |
| import org.chromium.chrome.browser.tab.EmptyTabObserver; |
| import org.chromium.chrome.browser.tab.Tab; |
| import org.chromium.chrome.browser.tab.TabObserver; |
| +import org.chromium.chrome.browser.util.ColorUtils; |
| import org.chromium.chrome.browser.util.FeatureUtilities; |
| import org.chromium.content.browser.ScreenOrientationProvider; |
| import org.chromium.content_public.browser.LoadUrlParams; |
| @@ -160,16 +163,7 @@ public class WebappActivity extends FullScreenActivity { |
| @Override |
| public void postInflationStartup() { |
| - ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content); |
| - mSplashScreen = (ViewGroup) LayoutInflater.from(this) |
| - .inflate(R.layout.webapp_splashscreen, contentView, false); |
| - |
| - if (mWebappInfo.backgroundColor() == ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING) { |
| - mSplashScreen.setBackgroundResource(R.color.webapp_default_bg); |
| - } else { |
| - mSplashScreen.setBackgroundColor((int) mWebappInfo.backgroundColor()); |
| - } |
| - contentView.addView(mSplashScreen); |
| + addSplashscreen(); |
| super.postInflationStartup(); |
| WebappControlContainer controlContainer = |
| @@ -184,6 +178,45 @@ public class WebappActivity extends FullScreenActivity { |
| return mWebappInfo; |
| } |
| + private void addSplashscreen() { |
|
gone
2015/09/04 18:25:56
nit: initializeSplashscreen? You're doing more th
newt (away)
2015/09/04 18:45:49
Be consistent with whether you treat splash screen
Lalit Maganti
2015/09/04 19:12:02
Done and gone with SplashScreen because it's what
|
| + ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content); |
| + mSplashScreen = (ViewGroup) LayoutInflater.from(this) |
| + .inflate(R.layout.webapp_splashscreen, contentView, false); |
| + |
| + final int backgroundColor; |
| + if (mWebappInfo.backgroundColor() == ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING) { |
| + backgroundColor = getResources().getColor(R.color.webapp_default_bg); |
| + } else { |
| + backgroundColor = (int) mWebappInfo.backgroundColor(); |
| + } |
| + mSplashScreen.setBackgroundColor(backgroundColor); |
| + |
| + contentView.addView(mSplashScreen); |
|
newt (away)
2015/09/04 18:45:49
Where / when does the splash screen get removed fr
Lalit Maganti
2015/09/04 19:12:02
On first paint. The code to do this is already pre
|
| + |
| + WebappDataStorage.open(this, mWebappInfo.id()) |
| + .getSplashScreenImage(new WebappDataStorage.FetchCallback<Bitmap>() { |
| + @Override |
| + public void onDataRetrieved(Bitmap splashIcon) { |
| + if (mSplashScreen == null || splashIcon == null) return; |
| + addSplashscreenIconAndText(splashIcon, backgroundColor); |
| + } |
| + }); |
| + } |
| + |
| + private void addSplashscreenIconAndText(Bitmap splashIcon, int backgroundColor) { |
|
gone
2015/09/04 18:25:56
nit: setSplashscreenIconAndText?
Lalit Maganti
2015/09/04 19:12:02
Done.
|
| + TextView appNameView = (TextView) mSplashScreen.findViewById(R.id |
|
newt (away)
2015/09/04 18:45:49
Don't wrap lines in the middle of a constant (R.id
Lalit Maganti
2015/09/04 19:12:02
Done.
|
| + .webapp_splashscreen_name); |
| + ImageView splashIconView = (ImageView) mSplashScreen.findViewById(R.id |
| + .webapp_splashscreen_icon); |
| + appNameView.setText(mWebappInfo.shortName()); |
| + splashIconView.setImageBitmap(splashIcon); |
| + |
| + if (ColorUtils.shoudUseLightForegroundOnBackground(backgroundColor)) { |
| + appNameView.setTextColor(getResources().getColor(R.color |
| + .webapp_splash_title_light)); |
| + } |
| + } |
| + |
| private void updateUrlBar() { |
| Tab tab = getActivityTab(); |
| if (tab == null || mUrlBar == null) return; |