当前位置: 首页>>代码示例>>Java>>正文


Java DataReductionPromoUtils.saveSnackbarPromoDisplayed方法代码示例

本文整理汇总了Java中org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils.saveSnackbarPromoDisplayed方法的典型用法代码示例。如果您正苦于以下问题:Java DataReductionPromoUtils.saveSnackbarPromoDisplayed方法的具体用法?Java DataReductionPromoUtils.saveSnackbarPromoDisplayed怎么用?Java DataReductionPromoUtils.saveSnackbarPromoDisplayed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils的用法示例。


在下文中一共展示了DataReductionPromoUtils.saveSnackbarPromoDisplayed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: maybeShowDataReductionPromoSnackbar

import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils; //导入方法依赖的package包/类
/**
 * Shows the Data Reduction Proxy promo snackbar if the current data savings are over
 * specific thresholds set by finch and the snackbar has not been shown for that
 *
 * @param dataSavingsInBytes The amount of data the Data Reduction Proxy has saved in bytes.
 */
public void maybeShowDataReductionPromoSnackbar(long dataSavingsInBytes) {
    // Prevents users who upgrade and have already saved mPromoDataSavingsInMB from seeing the
    // promo.
    if (!DataReductionPromoUtils.hasSnackbarPromoBeenInitWithStartingSavedBytes()) {
        DataReductionPromoUtils.saveSnackbarPromoDisplayed(dataSavingsInBytes);
        return;
    }

    for (int promoDataSavingsMB : mPromoDataSavingsMB) {
        long promoDataSavingsBytes = promoDataSavingsMB * BYTES_PER_MEGABYTE;
        if (promoDataSavingsMB > 0 && dataSavingsInBytes >= promoDataSavingsBytes
                && DataReductionPromoUtils
                        .getDisplayedSnackbarPromoSavedBytes() < promoDataSavingsBytes) {
            mSnackbarManager.showSnackbar(Snackbar
                    .make(getStringForBytes(promoDataSavingsBytes),
                            this,
                            Snackbar.TYPE_NOTIFICATION, Snackbar.UMA_DATA_REDUCTION_PROMO)
                    .setAction(
                            mContext.getString(R.string.data_reduction_promo_snackbar_button),
                            null));
            DataReductionProxyUma.dataReductionProxySnackbarPromo(promoDataSavingsMB);
            DataReductionPromoUtils.saveSnackbarPromoDisplayed(dataSavingsInBytes);
            break;
        }
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:DataReductionPromoSnackbarController.java

示例2: clearDataSavingStatistics

import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils; //导入方法依赖的package包/类
/**
 * Clears all data saving statistics.
 */
public void clearDataSavingStatistics() {
    // When the data saving statistics are cleared, reset the snackbar promo that tells the user
    // how much data they have saved using Data Saver so far.
    DataReductionPromoUtils.saveSnackbarPromoDisplayed(0);
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putLong(DATA_REDUCTION_FIRST_ENABLED_TIME, System.currentTimeMillis())
            .apply();
    nativeClearDataSavingStatistics(mNativeDataReductionProxySettings);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:14,代码来源:DataReductionProxySettings.java

示例3: DataReductionPromoSnackbarController

import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils; //导入方法依赖的package包/类
/**
 * Creates an instance of a {@link DataReductionPromoSnackbarController}.
 *
 * @param context The {@link Context} in which snackbar is shown.
 * @param snackbarManager The manager that helps to show the snackbar.
 */
public DataReductionPromoSnackbarController(Context context, SnackbarManager snackbarManager) {
    mSnackbarManager = snackbarManager;
    mContext = context;

    String variationParamValue = VariationsAssociatedData
            .getVariationParamValue(PROMO_FIELD_TRIAL_NAME, PROMO_PARAM_NAME);

    if (variationParamValue.isEmpty()) {
        if (CommandLine.getInstance()
                .hasSwitch(ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) {
            mPromoDataSavingsMB = new int[1];
            mPromoDataSavingsMB[0] = 1;
        } else {
            mPromoDataSavingsMB = new int[0];
        }
    } else {
        variationParamValue = variationParamValue.replace(" ", "");
        String[] promoDataSavingStrings = variationParamValue.split(";");

        if (CommandLine.getInstance()
                .hasSwitch(ENABLE_DATA_REDUCTION_PROXY_SAVINGS_PROMO_SWITCH)) {
            mPromoDataSavingsMB = new int[promoDataSavingStrings.length + 1];
            mPromoDataSavingsMB[promoDataSavingStrings.length] = 1;
        } else {
            mPromoDataSavingsMB = new int[promoDataSavingStrings.length];
        }

        for (int i = 0; i < promoDataSavingStrings.length; i++) {
            try {
                mPromoDataSavingsMB[i] = Integer.parseInt(promoDataSavingStrings[i]);
            } catch (NumberFormatException e) {
                mPromoDataSavingsMB[i] = -1;
            }
        }
    }

    if (CommandLine.getInstance().hasSwitch(CLEAR_DATA_REDUCTION_PROXY_DATA_SAVINGS_SWITCH)) {
        DataReductionPromoUtils.saveSnackbarPromoDisplayed(0);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:47,代码来源:DataReductionPromoSnackbarController.java


注:本文中的org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils.saveSnackbarPromoDisplayed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。