LocalePreferences
@RequiresApi(value = VERSION_CODES.LOLLIPOP)
class LocalePreferences
Provides friendly APIs to get the user's locale preferences. The data can refer to external/cldr/common/main/en.xml.
Summary
Nested types |
|---|
|
APIs to get the user's preference of Calendar. |
|
APIs to get the user's preference of the first day of week. |
|
APIs to get the user's preference of the hour cycle. |
|
APIs to get the user's preference of temperature unit. |
Public functions |
|
|---|---|
java-static String |
Return the user's preference of the calendar type which is from |
java-static String |
getCalendarType(locale: Locale)Return the calendar type of the inputted |
java-static String |
getCalendarType(resolved: Boolean)Return the user's preference of the calendar type which is from |
java-static String |
getCalendarType(locale: Locale, resolved: Boolean)Return the calendar type of the inputted |
java-static String |
Return the user's preference of the first day of week which is from |
java-static String |
getFirstDayOfWeek(locale: Locale)Return the first day of week of the inputted |
java-static String |
getFirstDayOfWeek(resolved: Boolean)Return the user's preference of the first day of week which is from |
java-static String |
getFirstDayOfWeek(locale: Locale, resolved: Boolean)Return the first day of week of the inputted |
java-static String |
Return the user's preference of the hour cycle which is from |
java-static String |
getHourCycle(locale: Locale)Return the hour cycle setting of the inputted |
java-static String |
getHourCycle(resolved: Boolean)Return the user's preference of the hour cycle which is from |
java-static String |
getHourCycle(locale: Locale, resolved: Boolean)Return the hour cycle setting of the inputted |
java-static String |
Return the user's preference of the temperature unit which is from |
java-static String |
getTemperatureUnit(locale: Locale)Return the temperature unit of the inputted |
java-static String |
getTemperatureUnit(resolved: Boolean)Return the user's preference of the temperature unit which is from |
java-static String |
getTemperatureUnit(locale: Locale, resolved: Boolean)Return the temperature unit of the inputted |
Public functions
getCalendarType
java-static fun getCalendarType(): String
Return the user's preference of the calendar type which is from getDefault. The returned result is resolved and bases on the Locale#getDefault(Locale.Category) settings. It is one of the strings defined in {@see CalendarType}, e.g. CalendarType#CHINESE.
getCalendarType
java-static fun getCalendarType(locale: Locale): String
Return the calendar type of the inputted Locale. The returned result is resolved and based on the input Locale settings. It is one of the strings defined in {@see CalendarType}, e.g. CalendarType#CHINESE.
getCalendarType
java-static fun getCalendarType(resolved: Boolean): String
Return the user's preference of the calendar type which is from getDefault, e.g. CalendarType#CHINESE.
| Parameters | |
|---|---|
resolved: Boolean |
If the |
| Returns | |
|---|---|
String |
|
getCalendarType
java-static fun getCalendarType(locale: Locale, resolved: Boolean): String
Return the calendar type of the inputted Locale, e.g. CalendarType#CHINESE.
| Parameters | |
|---|---|
locale: Locale |
The |
resolved: Boolean |
If the given |
| Returns | |
|---|---|
String |
|
getFirstDayOfWeek
java-static fun getFirstDayOfWeek(): String
Return the user's preference of the first day of week which is from getDefault. The returned result is resolved and bases on the Locale#getDefault(Locale.Category) settings. It is one of the strings defined in {@see FirstDayOfWeek}, e.g. FirstDayOfWeek#SUNDAY.
getFirstDayOfWeek
java-static fun getFirstDayOfWeek(locale: Locale): String
Return the first day of week of the inputted Locale. The returned result is resolved and based on the input Locale settings. It is one of the strings defined in {@see FirstDayOfWeek}, e.g. FirstDayOfWeek#SUNDAY.
getFirstDayOfWeek
java-static fun getFirstDayOfWeek(resolved: Boolean): String
Return the user's preference of the first day of week which is from getDefault, e.g. FirstDayOfWeek#SUNDAY.
| Parameters | |
|---|---|
resolved: Boolean |
If the |
| Returns | |
|---|---|
String |
|
getFirstDayOfWeek
java-static fun getFirstDayOfWeek(locale: Locale, resolved: Boolean): String
Return the first day of week of the inputted Locale, e.g. FirstDayOfWeek#SUNDAY.
| Parameters | |
|---|---|
locale: Locale |
The |
resolved: Boolean |
If the given |
| Returns | |
|---|---|
String |
|
getHourCycle
java-static fun getHourCycle(): String
Return the user's preference of the hour cycle which is from getDefault. The returned result is resolved and bases on the Locale#getDefault(Locale.Category). It is one of the strings defined in {@see HourCycle}, e.g. HourCycle#H11.
getHourCycle
java-static fun getHourCycle(locale: Locale): String
Return the hour cycle setting of the inputted Locale. The returned result is resolved and based on the input Locale. It is one of the strings defined in {@see HourCycle}, e.g. HourCycle#H11.
getHourCycle
java-static fun getHourCycle(resolved: Boolean): String
Return the user's preference of the hour cycle which is from getDefault, e.g. HourCycle#H11.
| Parameters | |
|---|---|
resolved: Boolean |
If the |
| Returns | |
|---|---|
String |
|
getHourCycle
java-static fun getHourCycle(locale: Locale, resolved: Boolean): String
Return the hour cycle setting of the inputted Locale. E.g. "en-US-u-hc-h23".
| Parameters | |
|---|---|
locale: Locale |
The |
resolved: Boolean |
If the given |
| Returns | |
|---|---|
String |
|
getTemperatureUnit
java-static fun getTemperatureUnit(): String
Return the user's preference of the temperature unit which is from getDefault. The returned result is resolved and bases on the Locale#getDefault(Locale.Category) settings. It is one of the strings defined in {@see TemperatureUnit}, e.g. TemperatureUnit#FAHRENHEIT.
getTemperatureUnit
java-static fun getTemperatureUnit(locale: Locale): String
Return the temperature unit of the inputted Locale. It is one of the strings defined in {@see TemperatureUnit}, e.g. TemperatureUnit#FAHRENHEIT.
getTemperatureUnit
java-static fun getTemperatureUnit(resolved: Boolean): String
Return the user's preference of the temperature unit which is from getDefault, e.g. TemperatureUnit#FAHRENHEIT.
| Parameters | |
|---|---|
resolved: Boolean |
If the |
| Returns | |
|---|---|
String |
|
getTemperatureUnit
java-static fun getTemperatureUnit(locale: Locale, resolved: Boolean): String
Return the temperature unit of the inputted Locale. E.g. "fahrenheit"
| Parameters | |
|---|---|
locale: Locale |
The |
resolved: Boolean |
If the given |
| Returns | |
|---|---|
String |
|