Java Code Examples for org.chromium.chrome.browser.metrics.WebappUma#SPLASHSCREEN_ICON_TYPE_CUSTOM
The following examples show how to use
org.chromium.chrome.browser.metrics.WebappUma#SPLASHSCREEN_ICON_TYPE_CUSTOM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebappActivity.java From delion with Apache License 2.0 | 4 votes |
protected void initializeSplashScreenWidgets(int backgroundColor, Bitmap splashImage) { Bitmap displayIcon = splashImage == null ? mWebappInfo.icon() : splashImage; int minimiumSizeThreshold = getResources().getDimensionPixelSize( R.dimen.webapp_splash_image_size_minimum); int bigThreshold = getResources().getDimensionPixelSize( R.dimen.webapp_splash_image_size_threshold); // Inflate the correct layout for the image. int layoutId; if (displayIcon == null || displayIcon.getWidth() < minimiumSizeThreshold || (displayIcon == mWebappInfo.icon() && mWebappInfo.isIconGenerated())) { mWebappUma.recordSplashscreenIconType(WebappUma.SPLASHSCREEN_ICON_TYPE_NONE); layoutId = R.layout.webapp_splash_screen_no_icon; } else { // The size of the splash screen image determines which layout to use. boolean isUsingSmallSplashImage = displayIcon.getWidth() <= bigThreshold || displayIcon.getHeight() <= bigThreshold; if (isUsingSmallSplashImage) { layoutId = R.layout.webapp_splash_screen_small; } else { layoutId = R.layout.webapp_splash_screen_large; } // Record stats about the splash screen. int splashScreenIconType; if (splashImage == null) { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_FALLBACK; } else if (isUsingSmallSplashImage) { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_CUSTOM_SMALL; } else { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_CUSTOM; } mWebappUma.recordSplashscreenIconType(splashScreenIconType); mWebappUma.recordSplashscreenIconSize( Math.round(displayIcon.getWidth() / getResources().getDisplayMetrics().density)); } ViewGroup subLayout = (ViewGroup) LayoutInflater.from(WebappActivity.this) .inflate(layoutId, mSplashScreen, true); // Set up the elements of the splash screen. TextView appNameView = (TextView) subLayout.findViewById( R.id.webapp_splash_screen_name); ImageView splashIconView = (ImageView) subLayout.findViewById( R.id.webapp_splash_screen_icon); appNameView.setText(mWebappInfo.name()); if (splashIconView != null) splashIconView.setImageBitmap(displayIcon); if (ColorUtils.shouldUseLightForegroundOnBackground(backgroundColor)) { appNameView.setTextColor(ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_splash_title_light)); } }
Example 2
Source File: WebappActivity.java From AndroidChromium with Apache License 2.0 | 4 votes |
protected void initializeSplashScreenWidgets(int backgroundColor, Bitmap splashImage) { Bitmap displayIcon = splashImage == null ? mWebappInfo.icon() : splashImage; int minimiumSizeThreshold = getResources().getDimensionPixelSize( R.dimen.webapp_splash_image_size_minimum); int bigThreshold = getResources().getDimensionPixelSize( R.dimen.webapp_splash_image_size_threshold); // Inflate the correct layout for the image. int layoutId; if (displayIcon == null || displayIcon.getWidth() < minimiumSizeThreshold || (displayIcon == mWebappInfo.icon() && mWebappInfo.isIconGenerated())) { mWebappUma.recordSplashscreenIconType(WebappUma.SPLASHSCREEN_ICON_TYPE_NONE); layoutId = R.layout.webapp_splash_screen_no_icon; } else { // The size of the splash screen image determines which layout to use. boolean isUsingSmallSplashImage = displayIcon.getWidth() <= bigThreshold || displayIcon.getHeight() <= bigThreshold; if (isUsingSmallSplashImage) { layoutId = R.layout.webapp_splash_screen_small; } else { layoutId = R.layout.webapp_splash_screen_large; } // Record stats about the splash screen. int splashScreenIconType; if (splashImage == null) { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_FALLBACK; } else if (isUsingSmallSplashImage) { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_CUSTOM_SMALL; } else { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_CUSTOM; } mWebappUma.recordSplashscreenIconType(splashScreenIconType); mWebappUma.recordSplashscreenIconSize( Math.round(displayIcon.getWidth() / getResources().getDisplayMetrics().density)); } ViewGroup subLayout = (ViewGroup) LayoutInflater.from(WebappActivity.this) .inflate(layoutId, mSplashScreen, true); // Set up the elements of the splash screen. TextView appNameView = (TextView) subLayout.findViewById( R.id.webapp_splash_screen_name); ImageView splashIconView = (ImageView) subLayout.findViewById( R.id.webapp_splash_screen_icon); appNameView.setText(mWebappInfo.name()); if (splashIconView != null) splashIconView.setImageBitmap(displayIcon); if (ColorUtils.shouldUseLightForegroundOnBackground(backgroundColor)) { appNameView.setTextColor(ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_splash_title_light)); } }
Example 3
Source File: WebappActivity.java From 365browser with Apache License 2.0 | 4 votes |
protected void initializeSplashScreenWidgets(int backgroundColor, Bitmap splashImage) { Bitmap displayIcon = splashImage == null ? mWebappInfo.icon() : splashImage; int minimiumSizeThreshold = getResources().getDimensionPixelSize( R.dimen.webapp_splash_image_size_minimum); int bigThreshold = getResources().getDimensionPixelSize( R.dimen.webapp_splash_image_size_threshold); // Inflate the correct layout for the image. int layoutId; if (displayIcon == null || displayIcon.getWidth() < minimiumSizeThreshold || (displayIcon == mWebappInfo.icon() && mWebappInfo.isIconGenerated())) { mWebappUma.recordSplashscreenIconType(WebappUma.SPLASHSCREEN_ICON_TYPE_NONE); layoutId = R.layout.webapp_splash_screen_no_icon; } else { // The size of the splash screen image determines which layout to use. boolean isUsingSmallSplashImage = displayIcon.getWidth() <= bigThreshold || displayIcon.getHeight() <= bigThreshold; if (isUsingSmallSplashImage) { layoutId = R.layout.webapp_splash_screen_small; } else { layoutId = R.layout.webapp_splash_screen_large; } // Record stats about the splash screen. int splashScreenIconType; if (splashImage == null) { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_FALLBACK; } else if (isUsingSmallSplashImage) { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_CUSTOM_SMALL; } else { splashScreenIconType = WebappUma.SPLASHSCREEN_ICON_TYPE_CUSTOM; } mWebappUma.recordSplashscreenIconType(splashScreenIconType); mWebappUma.recordSplashscreenIconSize( Math.round(displayIcon.getWidth() / getResources().getDisplayMetrics().density)); } ViewGroup subLayout = (ViewGroup) LayoutInflater.from(WebappActivity.this) .inflate(layoutId, mSplashScreen, true); // Set up the elements of the splash screen. TextView appNameView = (TextView) subLayout.findViewById( R.id.webapp_splash_screen_name); ImageView splashIconView = (ImageView) subLayout.findViewById( R.id.webapp_splash_screen_icon); appNameView.setText(mWebappInfo.name()); if (splashIconView != null) splashIconView.setImageBitmap(displayIcon); if (ColorUtils.shouldUseLightForegroundOnBackground(backgroundColor)) { appNameView.setTextColor(ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_splash_title_light)); } }