org.chromium.chrome.browser.metrics.WebappUma Java Examples

The following examples show how to use org.chromium.chrome.browser.metrics.WebappUma. 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 6 votes vote down vote up
private void initializeWebappData() {
    final int backgroundColor = ColorUtils.getOpaqueColor(mWebappInfo.backgroundColor(
            ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_default_bg)));

    mSplashScreen = new FrameLayout(this);
    mSplashScreen.setBackgroundColor(backgroundColor);

    ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
    contentView.addView(mSplashScreen);

    mWebappUma.splashscreenVisible();
    mWebappUma.recordSplashscreenBackgroundColor(mWebappInfo.hasValidBackgroundColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);
    mWebappUma.recordSplashscreenThemeColor(mWebappInfo.hasValidThemeColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);

    initializeSplashScreenWidgets(backgroundColor);
}
 
Example #2
Source File: WebappActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void initializeWebappData() {
    final int backgroundColor = ColorUtils.getOpaqueColor(mWebappInfo.backgroundColor(
            ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_default_bg)));

    mSplashScreen = new FrameLayout(this);
    mSplashScreen.setBackgroundColor(backgroundColor);

    ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
    contentView.addView(mSplashScreen);

    mWebappUma.splashscreenVisible();
    mWebappUma.recordSplashscreenBackgroundColor(mWebappInfo.hasValidBackgroundColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);
    mWebappUma.recordSplashscreenThemeColor(mWebappInfo.hasValidThemeColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);

    initializeSplashScreenWidgets(backgroundColor);
}
 
Example #3
Source File: WebappActivity.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void initializeWebappData() {
    if (mWebappInfo.displayMode() == WebDisplayMode.FULLSCREEN) {
        enterImmersiveMode();
    }

    final int backgroundColor = ColorUtils.getOpaqueColor(mWebappInfo.backgroundColor(
            ApiCompatibilityUtils.getColor(getResources(), R.color.webapp_default_bg)));

    mSplashScreen = new FrameLayout(this);
    mSplashScreen.setBackgroundColor(backgroundColor);

    ViewGroup contentView = (ViewGroup) findViewById(android.R.id.content);
    contentView.addView(mSplashScreen);

    mWebappUma.splashscreenVisible();
    mWebappUma.recordSplashscreenBackgroundColor(mWebappInfo.hasValidBackgroundColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);
    mWebappUma.recordSplashscreenThemeColor(mWebappInfo.hasValidThemeColor()
            ? WebappUma.SPLASHSCREEN_COLOR_STATUS_CUSTOM
            : WebappUma.SPLASHSCREEN_COLOR_STATUS_DEFAULT);

    initializeSplashScreenWidgets(backgroundColor);
}
 
Example #4
Source File: WebappActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Construct all the variables that shouldn't change.  We do it here both to clarify when the
 * objects are created and to ensure that they exist throughout the parallelized initialization
 * of the WebappActivity.
 */
public WebappActivity() {
    mWebappInfo = WebappInfo.createEmpty();
    mDirectoryManager = new WebappDirectoryManager();
    mWebappUma = new WebappUma();
}
 
Example #5
Source File: WebappActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
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 #6
Source File: WebappActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Construct all the variables that shouldn't change.  We do it here both to clarify when the
 * objects are created and to ensure that they exist throughout the parallelized initialization
 * of the WebappActivity.
 */
public WebappActivity() {
    mWebappInfo = createWebappInfo(null);
    mDirectoryManager = new WebappDirectoryManager();
    mWebappUma = new WebappUma();
}
 
Example #7
Source File: WebappActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
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 #8
Source File: WebappActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Construct all the variables that shouldn't change.  We do it here both to clarify when the
 * objects are created and to ensure that they exist throughout the parallelized initialization
 * of the WebappActivity.
 */
public WebappActivity() {
    mWebappInfo = createWebappInfo(null);
    mDirectoryManager = new WebappDirectoryManager();
    mWebappUma = new WebappUma();
}
 
Example #9
Source File: WebappActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
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));
    }
}