Exemple #1
0
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    Log.d(LOGTAG, "onConfigurationChanged: " + newConfig.locale);

    final Activity context = getActivity();

    final LocaleManager localeManager = BrowserLocaleManager.getInstance();
    final Locale changed =
        localeManager.onSystemConfigurationChanged(context, getResources(), newConfig, lastLocale);
    if (changed != null) {
      applyLocale(changed);
    }
  }
Exemple #2
0
  private void applyLocale(final Locale currentLocale) {
    final Context context = getActivity().getApplicationContext();

    BrowserLocaleManager.getInstance().updateConfiguration(context, currentLocale);

    if (!currentLocale.equals(lastLocale)) {
      // Locales differ. Let's redisplay.
      Log.d(LOGTAG, "Locale changed: " + currentLocale);
      this.lastLocale = currentLocale;

      // Rebuild the list to reflect the current locale.
      getPreferenceScreen().removeAll();
      addPreferencesFromResource(getResource());
    }

    // Fix the parent title regardless.
    updateTitle();
  }