public class NavigationPreferenceAdapter extends PreferenceAdapter implements NavigationPreference.Callback
PreferenceAdapter, which is used to visualize the navigation preferences of a PreferenceActivity. It allows to register a callback at the adapter's NavigationPreferences| Modifier and Type | Class and Description |
|---|---|
static interface |
NavigationPreferenceAdapter.Callback
Defines the callback, a class, which should be notified about the adapter's events, must
implement.
|
| Constructor and Description |
|---|
NavigationPreferenceAdapter(PreferenceScreen preferenceScreen,
NavigationPreferenceAdapter.Callback callback)
Creates a new
PreferenceAdapter, which is used to visualize the navigation
preferences of a PreferenceActivity. |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<NavigationPreference> |
getAllNavigationPreferences()
Returns a list, which contains all navigation preferences, which are contained by the
adapter.
|
NavigationPreference |
getNavigationPreference(int index)
Returns the navigation preference, which corresponds to a specific index.
|
int |
getNavigationPreferenceCount()
Returns the number of navigation preferences, which are contained by the adapter.
|
NavigationPreference |
getSelectedNavigationPreference()
Returns the currently selected navigation preference.
|
int |
getSelectedNavigationPreferenceIndex()
Returns the index of the navigation preference, which is currently selected, among all
navigation preferences.
|
int |
indexOfNavigationPreference(NavigationPreference navigationPreference)
Returns the index of a specific navigation preference among all navigation preferences, which
are contained by the adapter.
|
void |
onShowFragment(NavigationPreference navigationPreference)
The method, which is invoked, when the fragment, which is associated with a specific
navigation preference, should be shown.
|
protected void |
onVisualizePreference(Preference preference,
PreferenceViewHolder viewHolder)
The method, which is invoked, when a specific preference is visualized.
|
void |
selectNavigationPreference(int index,
android.os.Bundle arguments)
Selects a specific navigation preference.
|
void |
selectNavigationPreference(NavigationPreference navigationPreference,
android.os.Bundle arguments)
Selects a specific navigation preference.
|
void |
setEnabled(boolean enabled)
Sets, whether the items of the adapter are enabled, i.e.
|
void |
setSelectionColor(int color)
Sets the background color of the currently selected navigation preference.
|
onBindViewHolderpublic NavigationPreferenceAdapter(PreferenceScreen preferenceScreen,
NavigationPreferenceAdapter.Callback callback)
PreferenceAdapter, which is used to visualize the navigation
preferences of a PreferenceActivity.preferenceScreen - The preference screen, which contains the preferences, which should be managed by the
adapter, as an instance of the class PreferenceScreen. The preference screen may not
be nullcallback - The callback, which should be notified about the adapter's events, as an instance of
the type NavigationPreferenceAdapter.Callback or null, if no callback should be notifiedpublic final int getNavigationPreferenceCount()
Integer valuepublic final java.util.List<NavigationPreference> getAllNavigationPreferences()
List or an empty collection, if no navigation
preferences are contained by the adapterpublic final int indexOfNavigationPreference(NavigationPreference navigationPreference)
navigationPreference - The navigation preference, whose index should be returned, as an instance of the
class NavigationPreference. The navigation preference may not be nullInteger value or -1, if
the navigation preference is not contained by the adapterpublic final NavigationPreference getNavigationPreference(int index)
index - The index of the navigation preference, which should be returned, among all
navigation preferences as an Integer valueNavigationPreference. The navigation preference may not be nullpublic final NavigationPreference getSelectedNavigationPreference()
NavigationPreference or null, if no navigation preference is selectedpublic final int getSelectedNavigationPreferenceIndex()
Integer value or -1, if no navigation preference is selectedpublic final void selectNavigationPreference(NavigationPreference navigationPreference, android.os.Bundle arguments)
navigationPreference - The navigation preference, which should be selected, as an instance of the class
NavigationPreference or null, if no navigation preference should be selectedarguments - The arguments, which should be passed to the fragment, which is associated with the
navigation preference, as an instance of the class Bundle or null, if no
arguments should be passed to the fragmentpublic final void selectNavigationPreference(int index,
android.os.Bundle arguments)
index - The index of the navigation preference, which should be selected, among all
navigation preferences, as an Integer value or -1, if no navigation
preference should be selectedarguments - The arguments, which should be passed to the fragment, which is associated with the
navigation preference, as an instance of the class Bundle or null, if no
arguments should be passed to the fragmentpublic final void setSelectionColor(int color)
color - The color, which should be set, as an Integer valuepublic final void setEnabled(boolean enabled)
enabled - True, if the items of the adapter should be enabled, false otherwisepublic final void onShowFragment(NavigationPreference navigationPreference)
NavigationPreference.CallbackonShowFragment in interface NavigationPreference.CallbacknavigationPreference - The navigation preference, whose fragment should be shown, as an instance of the
class NavigationPreference. The navigation preference may not be nullprotected final void onVisualizePreference(Preference preference,
PreferenceViewHolder viewHolder)
PreferenceAdapteronVisualizePreference in class PreferenceAdapterpreference - The preference, which is visualized, as an instance of the class Preference. The
preference may not be nullviewHolder - The view holder, which corresponds to the preference, as an instance of the class
PreferenceViewHolder. The view holder may not be null