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

The following examples show how to use org.chromium.chrome.browser.preferences.PrefServiceBridge.AboutVersionStrings. These examples are extracted from open source projects. 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 Project: delion   Source File: AboutChromePreferences.java    License: 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 Project: AndroidChromium   Source File: AboutChromePreferences.java    License: 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 Project: delion   Source File: DataReductionPromoUtils.java    License: 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 Project: delion   Source File: DataReductionPromoUtils.java    License: 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 Project: AndroidChromium   Source File: DataReductionPromoUtils.java    License: 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 Project: AndroidChromium   Source File: DataReductionPromoUtils.java    License: 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 Project: 365browser   Source File: DataReductionPromoUtils.java    License: 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 Project: 365browser   Source File: DataReductionPromoUtils.java    License: 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 Project: 365browser   Source File: AboutChromePreferences.java    License: 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));
}