Search in sources :

Example 36 with Locale

use of java.util.Locale in project android_frameworks_base by ParanoidAndroid.

the class WebSettingsClassic method getCurrentAcceptLanguage.

/**
     * Looks at sLocale and returns current AcceptLanguage String.
     * @return Current AcceptLanguage String.
     */
private String getCurrentAcceptLanguage() {
    Locale locale;
    synchronized (sLockForLocaleSettings) {
        locale = sLocale;
    }
    StringBuilder buffer = new StringBuilder();
    addLocaleToHttpAcceptLanguage(buffer, locale);
    if (!Locale.US.equals(locale)) {
        if (buffer.length() > 0) {
            buffer.append(", ");
        }
        buffer.append(ACCEPT_LANG_FOR_US_LOCALE);
    }
    return buffer.toString();
}
Also used : Locale(java.util.Locale)

Example 37 with Locale

use of java.util.Locale in project android_frameworks_base by ParanoidAndroid.

the class Chronometer method updateText.

private synchronized void updateText(long now) {
    long seconds = now - mBase;
    seconds /= 1000;
    String text = DateUtils.formatElapsedTime(mRecycle, seconds);
    if (mFormat != null) {
        Locale loc = Locale.getDefault();
        if (mFormatter == null || !loc.equals(mFormatterLocale)) {
            mFormatterLocale = loc;
            mFormatter = new Formatter(mFormatBuilder, loc);
        }
        mFormatBuilder.setLength(0);
        mFormatterArgs[0] = text;
        try {
            mFormatter.format(mFormat, mFormatterArgs);
            text = mFormatBuilder.toString();
        } catch (IllegalFormatException ex) {
            if (!mLogged) {
                Log.w(TAG, "Illegal format string: " + mFormat);
                mLogged = true;
            }
        }
    }
    setText(text);
}
Also used : Locale(java.util.Locale) Formatter(java.util.Formatter) IllegalFormatException(java.util.IllegalFormatException)

Example 38 with Locale

use of java.util.Locale in project android_frameworks_base by ParanoidAndroid.

the class OverlayBaseTest method setLocale.

private void setLocale(String code) {
    Locale locale = new Locale(code);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    mResources.updateConfiguration(config, mResources.getDisplayMetrics());
}
Also used : Locale(java.util.Locale) Configuration(android.content.res.Configuration)

Example 39 with Locale

use of java.util.Locale in project android_frameworks_base by ParanoidAndroid.

the class DateView method updateClock.

protected void updateClock() {
    final String weekdayFormat = getContext().getString(R.string.system_ui_weekday_pattern);
    final String dateFormat = getContext().getString(R.string.system_ui_date_pattern);
    final Locale l = Locale.getDefault();
    final Date now = new Date();
    String weekdayFmt = ICU.getBestDateTimePattern(weekdayFormat, l.toString());
    String dateFmt = ICU.getBestDateTimePattern(dateFormat, l.toString());
    StringBuilder builder = new StringBuilder();
    builder.append(new SimpleDateFormat(weekdayFmt, l).format(now));
    builder.append("\n");
    builder.append(new SimpleDateFormat(dateFmt, l).format(now));
    setText(builder.toString());
}
Also used : Locale(java.util.Locale) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 40 with Locale

use of java.util.Locale in project android_frameworks_base by ParanoidAndroid.

the class AppWidgetServiceImpl method onConfigurationChanged.

void onConfigurationChanged() {
    if (DBG)
        log("Got onConfigurationChanged()");
    Locale revised = Locale.getDefault();
    if (revised == null || mLocale == null || !(revised.equals(mLocale))) {
        mLocale = revised;
        synchronized (mAppWidgetIds) {
            ensureStateLoadedLocked();
            // Note: updateProvidersForPackageLocked() may remove providers, so we must copy the
            // list of installed providers and skip providers that we don't need to update.
            // Also note that remove the provider does not clear the Provider component data.
            ArrayList<Provider> installedProviders = new ArrayList<Provider>(mInstalledProviders);
            HashSet<ComponentName> removedProviders = new HashSet<ComponentName>();
            int N = installedProviders.size();
            for (int i = N - 1; i >= 0; i--) {
                Provider p = installedProviders.get(i);
                ComponentName cn = p.info.provider;
                if (!removedProviders.contains(cn)) {
                    updateProvidersForPackageLocked(cn.getPackageName(), removedProviders);
                }
            }
            saveStateAsync();
        }
    }
}
Also used : Locale(java.util.Locale) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) Point(android.graphics.Point) HashSet(java.util.HashSet)

Aggregations

Locale (java.util.Locale)2214 Test (org.junit.Test)262 ArrayList (java.util.ArrayList)179 HashMap (java.util.HashMap)108 ResourceBundle (java.util.ResourceBundle)83 SimpleDateFormat (java.text.SimpleDateFormat)78 Date (java.util.Date)77 MissingResourceException (java.util.MissingResourceException)68 IOException (java.io.IOException)67 TimeZone (java.util.TimeZone)63 File (java.io.File)50 Map (java.util.Map)49 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)49 Calendar (java.util.Calendar)46 Configuration (android.content.res.Configuration)41 LocaleList (android.os.LocaleList)39 HashSet (java.util.HashSet)39 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)39 HttpSession (javax.servlet.http.HttpSession)38 Resources (android.content.res.Resources)37