-
public class AppLocale
AppLocale is a android library to update the app language dynamically.
-
-
Field Summary
Fields Modifier and Type Field Description private static Boolean
isInitial
private static AppLocaleRepository
appLocaleRepository
private static LocaleMatchingStrategy
localeMatchingStrategy
private static List<Locale>
supportedLocales
private static Locale
currentLocale
private static Locale
desiredLocale
public final static AppLocale
INSTANCE
-
Method Summary
Modifier and Type Method Description final static Unit
addLocaleChangedListener(LocaleChangedListener listener)
Add a listener for changes to the currentLocale final static Unit
removeLocaleChangedListener(LocaleChangedListener listener)
Remove a listener for changes to the currentLocale final static Context
wrap(Context context)
Wraps the context with a ContextWrapper which provides the AppLocaleResources instead of the default resources. final static Boolean
getIsInitial()
final static AppLocaleRepository
getAppLocaleRepository()
A AppLocaleRepository to persist the supportedLocales, the currentLocale and the desiredLocale. final static LocaleMatchingStrategy
getLocaleMatchingStrategy()
The localeMatchingStrategy used to determine the new currentLocale after a change to the desiredLocale. final static List<Locale>
getSupportedLocales()
The Locales supported by the app. final static Locale
getCurrentLocale()
final static Locale
getDesiredLocale()
final static Unit
setIsInitial(Boolean isInitial)
final static Unit
setAppLocaleRepository(AppLocaleRepository appLocaleRepository)
A AppLocaleRepository to persist the supportedLocales, the currentLocale and the desiredLocale. final static Unit
setLocaleMatchingStrategy(LocaleMatchingStrategy localeMatchingStrategy)
The localeMatchingStrategy used to determine the new currentLocale after a change to the desiredLocale. final static Unit
setSupportedLocales(List<Locale> supportedLocales)
The Locales supported by the app. final static Unit
setCurrentLocale(Locale currentLocale)
The locale currently used by the app. final static Unit
setDesiredLocale(Locale desiredLocale)
-
-
Method Detail
-
addLocaleChangedListener
final static Unit addLocaleChangedListener(LocaleChangedListener listener)
Add a listener for changes to the currentLocale
-
removeLocaleChangedListener
final static Unit removeLocaleChangedListener(LocaleChangedListener listener)
Remove a listener for changes to the currentLocale
-
wrap
final static Context wrap(Context context)
Wraps the context with a ContextWrapper which provides the AppLocaleResources instead of the default resources.
-
getIsInitial
final static Boolean getIsInitial()
-
getAppLocaleRepository
final static AppLocaleRepository getAppLocaleRepository()
-
getLocaleMatchingStrategy
final static LocaleMatchingStrategy getLocaleMatchingStrategy()
The localeMatchingStrategy used to determine the new currentLocale after a change to the desiredLocale.
-
getSupportedLocales
final static List<Locale> getSupportedLocales()
The Locales supported by the app.
-
getCurrentLocale
final static Locale getCurrentLocale()
-
getDesiredLocale
final static Locale getDesiredLocale()
-
setIsInitial
final static Unit setIsInitial(Boolean isInitial)
-
setAppLocaleRepository
final static Unit setAppLocaleRepository(AppLocaleRepository appLocaleRepository)
-
setLocaleMatchingStrategy
final static Unit setLocaleMatchingStrategy(LocaleMatchingStrategy localeMatchingStrategy)
The localeMatchingStrategy used to determine the new currentLocale after a change to the desiredLocale.
-
setSupportedLocales
final static Unit setSupportedLocales(List<Locale> supportedLocales)
The Locales supported by the app.
-
setCurrentLocale
final static Unit setCurrentLocale(Locale currentLocale)
The locale currently used by the app.
-
setDesiredLocale
final static Unit setDesiredLocale(Locale desiredLocale)
-
-
-
-