public class LocalePicker extends ListFragment
Modifier and Type | Class and Description |
---|---|
static class |
LocalePicker.LocaleInfo |
static interface |
LocalePicker.LocaleSelectionListener |
Fragment.InstantiationException, Fragment.SavedState
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description |
---|
LocalePicker() |
Modifier and Type | Method and Description |
---|---|
static ArrayAdapter<LocalePicker.LocaleInfo> |
constructAdapter(Context context)
Constructs an Adapter object containing Locale information.
|
static ArrayAdapter<LocalePicker.LocaleInfo> |
constructAdapter(Context context,
int layoutId,
int fieldId) |
static List<LocalePicker.LocaleInfo> |
getAllAssetLocales(Context context,
boolean isInDeveloperMode) |
static LocaleList |
getLocales()
Get the locale list.
|
static String[] |
getPseudoLocales() |
static String[] |
getSupportedLocales(Context context) |
static String[] |
getSystemAssetLocales() |
void |
onActivityCreated(Bundle savedInstanceState)
Called when the fragment's activity has been created and this
fragment's view hierarchy instantiated.
|
void |
onListItemClick(ListView l,
View v,
int position,
long id)
Each listener needs to call
updateLocale(Locale) to actually change the locale. |
void |
onResume()
Called when the fragment is visible to the user and actively running.
|
void |
setLocaleSelectionListener(LocalePicker.LocaleSelectionListener listener) |
static void |
updateLocale(Locale locale)
Requests the system to update the system locale.
|
static void |
updateLocales(LocaleList locales)
Requests the system to update the list of system locales.
|
getListAdapter, getListView, getSelectedItemId, getSelectedItemPosition, onCreateView, onDestroyView, onViewCreated, setEmptyText, setListAdapter, setListShown, setListShownNoAnimation, setSelection
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, hashCode, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isRemoving, isResumed, isVisible, onActivityResult, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onHiddenChanged, onInflate, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onRequestPermissionsResult, onSaveInstanceState, onStart, onStop, onTrimMemory, onViewStateRestored, registerForContextMenu, requestPermissions, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterSharedElementTransitionCallback, setEnterTransition, setExitSharedElementCallback, setExitSharedElementTransitionCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, toString, unregisterForContextMenu
public static String[] getSystemAssetLocales()
public static String[] getPseudoLocales()
public static List<LocalePicker.LocaleInfo> getAllAssetLocales(Context context, boolean isInDeveloperMode)
public static ArrayAdapter<LocalePicker.LocaleInfo> constructAdapter(Context context)
LocalePicker.LocaleInfo.label
.public static ArrayAdapter<LocalePicker.LocaleInfo> constructAdapter(Context context, int layoutId, int fieldId)
public void onActivityCreated(Bundle savedInstanceState)
Fragment
Fragment.setRetainInstance(boolean)
to retain their instance,
as this callback tells the fragment when it is fully associated with
the new activity instance. This is called after Fragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
and before Fragment.onViewStateRestored(Bundle)
.onActivityCreated
in class Fragment
savedInstanceState
- If the fragment is being re-created from
a previous saved state, this is the state.public void setLocaleSelectionListener(LocalePicker.LocaleSelectionListener listener)
public void onResume()
Fragment
Activity.onResume
of the containing
Activity's lifecycle.public void onListItemClick(ListView l, View v, int position, long id)
updateLocale(Locale)
to actually change the locale.
We don't call updateLocale(Locale)
automatically, as it halt the system for
a moment and some callers won't want it.onListItemClick
in class ListFragment
l
- The ListView where the click happenedv
- The view that was clicked within the ListViewposition
- The position of the view in the listid
- The row id of the item that was clickedpublic static void updateLocale(Locale locale)
updateLocales(LocaleList)
public static void updateLocales(LocaleList locales)
public static LocaleList getLocales()