org.chromium.chrome.browser.preferences.PrefServiceBridge.AboutVersionStrings Java Examples

The following examples show how to use org.chromium.chrome.browser.preferences.PrefServiceBridge.AboutVersionStrings. 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: AboutChromePreferences.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivity().setTitle(R.string.prefs_about_chrome);
    addPreferencesFromResource(R.xml.about_chrome_preferences);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        ChromeBasePreference deprecationWarning = new ChromeBasePreference(
                new ContextThemeWrapper(getActivity(),
                        R.style.DeprecationWarningPreferenceTheme));
        deprecationWarning.setOrder(-1);
        deprecationWarning.setTitle(R.string.deprecation_warning);
        deprecationWarning.setIcon(R.drawable.exclamation_triangle);
        getPreferenceScreen().addPreference(deprecationWarning);
    }

    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
    AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
    Preference p = findPreference(PREF_APPLICATION_VERSION);
    p.setSummary(getApplicationVersion(getActivity(), versionStrings.getApplicationVersion()));
    p = findPreference(PREF_OS_VERSION);
    p.setSummary(versionStrings.getOSVersion());
    p = findPreference(PREF_LEGAL_INFORMATION);
    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    p.setSummary(getString(R.string.legal_information_summary, currentYear));
}
 
Example #2
Source File: AboutChromePreferences.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivity().setTitle(R.string.prefs_about_chrome);
    addPreferencesFromResource(R.xml.about_chrome_preferences);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        ChromeBasePreference deprecationWarning = new ChromeBasePreference(
                new ContextThemeWrapper(getActivity(),
                        R.style.DeprecationWarningPreferenceTheme));
        deprecationWarning.setOrder(-1);
        deprecationWarning.setTitle(R.string.deprecation_warning);
        deprecationWarning.setIcon(R.drawable.exclamation_triangle);
        getPreferenceScreen().addPreference(deprecationWarning);
    }

    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
    AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
    Preference p = findPreference(PREF_APPLICATION_VERSION);
    p.setSummary(getApplicationVersion(getActivity(), versionStrings.getApplicationVersion()));
    p = findPreference(PREF_OS_VERSION);
    p.setSummary(versionStrings.getOSVersion());
    p = findPreference(PREF_LEGAL_INFORMATION);
    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    p.setSummary(getString(R.string.legal_information_summary, currentYear));
}
 
Example #3
Source File: DataReductionPromoUtils.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Saves shared prefs indicating that the data reduction proxy first run experience or second
 * run promo screen has been displayed at the current time.
 */
public static void saveFreOrSecondRunPromoDisplayed() {
    AboutVersionStrings versionStrings = PrefServiceBridge.getInstance()
            .getAboutVersionStrings();
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_RUN_PROMO, true)
            .putLong(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_TIME_MS,
                    System.currentTimeMillis())
            .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION,
                    versionStrings.getApplicationVersion())
            .apply();
}
 
Example #4
Source File: DataReductionPromoUtils.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Saves shared prefs indicating that the data reduction proxy infobar promo has been displayed
 * at the current time.
 */
public static void saveInfoBarPromoDisplayed() {
    AboutVersionStrings versionStrings = PrefServiceBridge.getInstance()
            .getAboutVersionStrings();
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true)
            .putString(SHARED_PREF_DISPLAYED_INFOBAR_PROMO_VERSION,
                    versionStrings.getApplicationVersion())
            .apply();
}
 
Example #5
Source File: DataReductionPromoUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Saves shared prefs indicating that the data reduction proxy first run experience or second
 * run promo screen has been displayed at the current time.
 */
public static void saveFreOrSecondRunPromoDisplayed() {
    AboutVersionStrings versionStrings = PrefServiceBridge.getInstance()
            .getAboutVersionStrings();
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_RUN_PROMO, true)
            .putLong(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_TIME_MS,
                    System.currentTimeMillis())
            .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION,
                    versionStrings.getApplicationVersion())
            .apply();
}
 
Example #6
Source File: DataReductionPromoUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Saves shared prefs indicating that the data reduction proxy infobar promo has been displayed
 * at the current time.
 */
public static void saveInfoBarPromoDisplayed() {
    AboutVersionStrings versionStrings = PrefServiceBridge.getInstance()
            .getAboutVersionStrings();
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true)
            .putString(SHARED_PREF_DISPLAYED_INFOBAR_PROMO_VERSION,
                    versionStrings.getApplicationVersion())
            .apply();
}
 
Example #7
Source File: DataReductionPromoUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Saves shared prefs indicating that the data reduction proxy first run experience or second
 * run promo screen has been displayed at the current time.
 */
public static void saveFreOrSecondRunPromoDisplayed() {
    AboutVersionStrings versionStrings = PrefServiceBridge.getInstance()
            .getAboutVersionStrings();
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_RUN_PROMO, true)
            .putLong(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_TIME_MS,
                    System.currentTimeMillis())
            .putString(SHARED_PREF_DISPLAYED_FRE_OR_SECOND_PROMO_VERSION,
                    versionStrings.getApplicationVersion())
            .apply();
}
 
Example #8
Source File: DataReductionPromoUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Saves shared prefs indicating that the data reduction proxy infobar promo has been displayed
 * at the current time.
 */
public static void saveInfoBarPromoDisplayed() {
    AboutVersionStrings versionStrings = PrefServiceBridge.getInstance()
            .getAboutVersionStrings();
    ContextUtils.getAppSharedPreferences()
            .edit()
            .putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true)
            .putString(SHARED_PREF_DISPLAYED_INFOBAR_PROMO_VERSION,
                    versionStrings.getApplicationVersion())
            .apply();
}
 
Example #9
Source File: AboutChromePreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@SuppressLint("ObsoleteSdkInt")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivity().setTitle(R.string.prefs_about_chrome);
    PreferenceUtils.addPreferencesFromResource(this, R.xml.about_chrome_preferences);

    // TODO(crbug.com/635567): Fix this properly.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        ChromeBasePreference deprecationWarning = new ChromeBasePreference(
                new ContextThemeWrapper(getActivity(),
                        R.style.DeprecationWarningPreferenceTheme));
        deprecationWarning.setOrder(-1);
        deprecationWarning.setTitle(R.string.deprecation_warning);
        deprecationWarning.setIcon(R.drawable.exclamation_triangle);
        getPreferenceScreen().addPreference(deprecationWarning);
    }

    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
    AboutVersionStrings versionStrings = prefServiceBridge.getAboutVersionStrings();
    Preference p = findPreference(PREF_APPLICATION_VERSION);
    p.setSummary(getApplicationVersion(getActivity(), versionStrings.getApplicationVersion()));
    p = findPreference(PREF_OS_VERSION);
    p.setSummary(versionStrings.getOSVersion());
    p = findPreference(PREF_LEGAL_INFORMATION);
    int currentYear = Calendar.getInstance().get(Calendar.YEAR);
    p.setSummary(getString(R.string.legal_information_summary, currentYear));
}