Search in sources :

Example 1 with Size

use of android.annotation.Size in project platform_frameworks_base by android.

the class LocaleList method getDefault.

/**
     * The result is guaranteed to include the default Locale returned by Locale.getDefault(), but
     * not necessarily at the top of the list. The default locale not being at the top of the list
     * is an indication that the system has set the default locale to one of the user's other
     * preferred locales, having concluded that the primary preference is not supported but a
     * secondary preference is.
     *
     * <p>Note that the default LocaleList would change if Locale.setDefault() is called. This
     * method takes that into account by always checking the output of Locale.getDefault() and
     * recalculating the default LocaleList if needed.</p>
     */
@NonNull
@Size(min = 1)
public static LocaleList getDefault() {
    final Locale defaultLocale = Locale.getDefault();
    synchronized (sLock) {
        if (!defaultLocale.equals(sLastDefaultLocale)) {
            sLastDefaultLocale = defaultLocale;
            // locale list. So let's recalculate the locale list.
            if (sDefaultLocaleList != null && defaultLocale.equals(sDefaultLocaleList.get(0))) {
                // default locale list, so we don't need to construct a new locale list.
                return sDefaultLocaleList;
            }
            sDefaultLocaleList = new LocaleList(defaultLocale, sLastExplicitlySetLocaleList);
            sDefaultAdjustedLocaleList = sDefaultLocaleList;
        }
        // sDefaultLocaleList.
        return sDefaultLocaleList;
    }
}
Also used : Locale(java.util.Locale) ULocale(android.icu.util.ULocale) Size(android.annotation.Size) NonNull(android.annotation.NonNull)

Example 2 with Size

use of android.annotation.Size in project android_frameworks_base by DirtyUnicorns.

the class LocaleList method getDefault.

/**
     * The result is guaranteed to include the default Locale returned by Locale.getDefault(), but
     * not necessarily at the top of the list. The default locale not being at the top of the list
     * is an indication that the system has set the default locale to one of the user's other
     * preferred locales, having concluded that the primary preference is not supported but a
     * secondary preference is.
     *
     * <p>Note that the default LocaleList would change if Locale.setDefault() is called. This
     * method takes that into account by always checking the output of Locale.getDefault() and
     * recalculating the default LocaleList if needed.</p>
     */
@NonNull
@Size(min = 1)
public static LocaleList getDefault() {
    final Locale defaultLocale = Locale.getDefault();
    synchronized (sLock) {
        if (!defaultLocale.equals(sLastDefaultLocale)) {
            sLastDefaultLocale = defaultLocale;
            // locale list. So let's recalculate the locale list.
            if (sDefaultLocaleList != null && defaultLocale.equals(sDefaultLocaleList.get(0))) {
                // default locale list, so we don't need to construct a new locale list.
                return sDefaultLocaleList;
            }
            sDefaultLocaleList = new LocaleList(defaultLocale, sLastExplicitlySetLocaleList);
            sDefaultAdjustedLocaleList = sDefaultLocaleList;
        }
        // sDefaultLocaleList.
        return sDefaultLocaleList;
    }
}
Also used : Locale(java.util.Locale) ULocale(android.icu.util.ULocale) Size(android.annotation.Size) NonNull(android.annotation.NonNull)

Example 3 with Size

use of android.annotation.Size in project android_frameworks_base by AOSPA.

the class LocaleList method getDefault.

/**
     * The result is guaranteed to include the default Locale returned by Locale.getDefault(), but
     * not necessarily at the top of the list. The default locale not being at the top of the list
     * is an indication that the system has set the default locale to one of the user's other
     * preferred locales, having concluded that the primary preference is not supported but a
     * secondary preference is.
     *
     * <p>Note that the default LocaleList would change if Locale.setDefault() is called. This
     * method takes that into account by always checking the output of Locale.getDefault() and
     * recalculating the default LocaleList if needed.</p>
     */
@NonNull
@Size(min = 1)
public static LocaleList getDefault() {
    final Locale defaultLocale = Locale.getDefault();
    synchronized (sLock) {
        if (!defaultLocale.equals(sLastDefaultLocale)) {
            sLastDefaultLocale = defaultLocale;
            // locale list. So let's recalculate the locale list.
            if (sDefaultLocaleList != null && defaultLocale.equals(sDefaultLocaleList.get(0))) {
                // default locale list, so we don't need to construct a new locale list.
                return sDefaultLocaleList;
            }
            sDefaultLocaleList = new LocaleList(defaultLocale, sLastExplicitlySetLocaleList);
            sDefaultAdjustedLocaleList = sDefaultLocaleList;
        }
        // sDefaultLocaleList.
        return sDefaultLocaleList;
    }
}
Also used : Locale(java.util.Locale) ULocale(android.icu.util.ULocale) Size(android.annotation.Size) NonNull(android.annotation.NonNull)

Example 4 with Size

use of android.annotation.Size in project android_frameworks_base by crdroidandroid.

the class LocaleList method getDefault.

/**
     * The result is guaranteed to include the default Locale returned by Locale.getDefault(), but
     * not necessarily at the top of the list. The default locale not being at the top of the list
     * is an indication that the system has set the default locale to one of the user's other
     * preferred locales, having concluded that the primary preference is not supported but a
     * secondary preference is.
     *
     * <p>Note that the default LocaleList would change if Locale.setDefault() is called. This
     * method takes that into account by always checking the output of Locale.getDefault() and
     * recalculating the default LocaleList if needed.</p>
     */
@NonNull
@Size(min = 1)
public static LocaleList getDefault() {
    final Locale defaultLocale = Locale.getDefault();
    synchronized (sLock) {
        if (!defaultLocale.equals(sLastDefaultLocale)) {
            sLastDefaultLocale = defaultLocale;
            // locale list. So let's recalculate the locale list.
            if (sDefaultLocaleList != null && defaultLocale.equals(sDefaultLocaleList.get(0))) {
                // default locale list, so we don't need to construct a new locale list.
                return sDefaultLocaleList;
            }
            sDefaultLocaleList = new LocaleList(defaultLocale, sLastExplicitlySetLocaleList);
            sDefaultAdjustedLocaleList = sDefaultLocaleList;
        }
        // sDefaultLocaleList.
        return sDefaultLocaleList;
    }
}
Also used : Locale(java.util.Locale) ULocale(android.icu.util.ULocale) Size(android.annotation.Size) NonNull(android.annotation.NonNull)

Example 5 with Size

use of android.annotation.Size in project android_frameworks_base by ResurrectionRemix.

the class LocaleList method getDefault.

/**
     * The result is guaranteed to include the default Locale returned by Locale.getDefault(), but
     * not necessarily at the top of the list. The default locale not being at the top of the list
     * is an indication that the system has set the default locale to one of the user's other
     * preferred locales, having concluded that the primary preference is not supported but a
     * secondary preference is.
     *
     * <p>Note that the default LocaleList would change if Locale.setDefault() is called. This
     * method takes that into account by always checking the output of Locale.getDefault() and
     * recalculating the default LocaleList if needed.</p>
     */
@NonNull
@Size(min = 1)
public static LocaleList getDefault() {
    final Locale defaultLocale = Locale.getDefault();
    synchronized (sLock) {
        if (!defaultLocale.equals(sLastDefaultLocale)) {
            sLastDefaultLocale = defaultLocale;
            // locale list. So let's recalculate the locale list.
            if (sDefaultLocaleList != null && defaultLocale.equals(sDefaultLocaleList.get(0))) {
                // default locale list, so we don't need to construct a new locale list.
                return sDefaultLocaleList;
            }
            sDefaultLocaleList = new LocaleList(defaultLocale, sLastExplicitlySetLocaleList);
            sDefaultAdjustedLocaleList = sDefaultLocaleList;
        }
        // sDefaultLocaleList.
        return sDefaultLocaleList;
    }
}
Also used : Locale(java.util.Locale) ULocale(android.icu.util.ULocale) Size(android.annotation.Size) NonNull(android.annotation.NonNull)

Aggregations

NonNull (android.annotation.NonNull)5 Size (android.annotation.Size)5 ULocale (android.icu.util.ULocale)5 Locale (java.util.Locale)5