public abstract class PreferenceFragment extends AbstractPreferenceFragment
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXTRA_RESTORE_DEFAULTS_BUTTON_TEXT
When attaching this fragment to an activity and using
EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON,
this extra can also be specified to supply a custom text for the button, which allows to
restore the preferences' default values. |
static java.lang.String |
EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON
When attaching this fragment to an activity, the passed bundle can contain this extra boolean
to display the button, which allows to restore the preferences' default values.
|
| Constructor and Description |
|---|
PreferenceFragment() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRestoreDefaultsListener(RestoreDefaultsListener listener)
Adds a new listener, which should be notified, when the preferences' default values should be
restored, to the fragment.
|
android.view.ViewGroup |
getButtonBar()
Returns the view group, which contains the button, which allows to restore the preferences'
default values.
|
android.graphics.drawable.Drawable |
getButtonBarBackground()
Returns the background of the view group, which contains the button, which allows to restore
the preferences' default values.
|
int |
getButtonBarElevation()
Returns the elevation of the view group, which contains the button, which allows to restore
the preferences' default values.
|
android.widget.FrameLayout |
getFrameLayout()
Returns the frame layout, which contains the fragment's views.
|
android.widget.Button |
getRestoreDefaultsButton()
Returns the button, which allows to restore the preferences' default values.
|
java.lang.CharSequence |
getRestoreDefaultsButtonText()
Returns the text of the button, which allows to restore the preferences' default values.
|
boolean |
isRestoreDefaultsButtonShown()
Returns, whether the button, which allows to restore the preferences' default values, is
currently shown, or not.
|
void |
onActivityCreated(android.os.Bundle savedInstanceState) |
void |
onCreate(android.os.Bundle savedInstanceState) |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
android.os.Bundle savedInstanceState) |
void |
removeRestoreDefaultsListener(RestoreDefaultsListener listener)
Removes a specific listener, which should not be notified anymore, when the preferences'
default values should be restored, from the fragment.
|
void |
restoreDefaults()
Restores the default values of all preferences, which are contained by the fragment.
|
void |
setButtonBarBackground(android.graphics.drawable.Drawable background)
Sets the background of the view group, which contains the button, which allows to restore the
preferences' default values.
|
void |
setButtonBarBackground(int resourceId)
Sets the background of the view group, which contains the button, which allows to restore the
preferences' default values.
|
void |
setButtonBarBackgroundColor(int color)
Sets the background color of the view group, which contains the button, which allows to
restore the preferences' default values.
|
void |
setButtonBarElevation(int elevation)
Sets the elevation of the view group, which contains the button, which allows to restore the
preferences' default values.
|
void |
setRestoreDefaultsButtonText(java.lang.CharSequence text)
Sets the text of the button, which allows to restore the preferences' default values.
|
void |
setRestoreDefaultsButtonText(int resourceId)
Sets the text of the button, which allows to restore the preferences' default values.
|
void |
showRestoreDefaultsButton(boolean show)
Shows or hides the button, which allows to restore the preferences' default values.
|
getDividerColor, onCreateAdapter, onCreatePreferenceAdapter, setDividerColorpublic static final java.lang.String EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON
public static final java.lang.String EXTRA_RESTORE_DEFAULTS_BUTTON_TEXT
EXTRA_SHOW_RESTORE_DEFAULTS_BUTTON,
this extra can also be specified to supply a custom text for the button, which allows to
restore the preferences' default values.public final android.widget.FrameLayout getFrameLayout()
FrameLayout or null, if the fragment has not been created yetpublic final android.view.ViewGroup getButtonBar()
ViewGroup or null, if the button is not
shown or if the fragment has not been created yetpublic final android.widget.Button getRestoreDefaultsButton()
Button or null, if the button is not shownpublic final void addRestoreDefaultsListener(RestoreDefaultsListener listener)
listener - The listener, which should be added as an instance of the type RestoreDefaultsListener. The listener may not be nullpublic final void removeRestoreDefaultsListener(RestoreDefaultsListener listener)
listener - The listener, which should be removed as an instance of the type RestoreDefaultsListener. The listener may not be nullpublic final void restoreDefaults()
public final boolean isRestoreDefaultsButtonShown()
public final void showRestoreDefaultsButton(boolean show)
show - True, if the button, which allows to restore the preferences' default values, should
be shown, false otherwisepublic final java.lang.CharSequence getRestoreDefaultsButtonText()
CharSequencepublic final void setRestoreDefaultsButtonText(int resourceId)
resourceId - The resource id of the text, which should be set, as an Integer value. The
resource id must correspond to a valid string resourcepublic final void setRestoreDefaultsButtonText(java.lang.CharSequence text)
text - The text, which should be set, as an instance of the class CharSequence. The
text may neither be null, nor emptypublic final android.graphics.drawable.Drawable getButtonBarBackground()
Drawablepublic final void setButtonBarBackground(int resourceId)
resourceId - The resource id of the background, which should be set, as an Integer value.
The resource id must correspond to a valid drawable resourcepublic final void setButtonBarBackgroundColor(int color)
color - The background color, which should be set, as an Integer valuepublic final void setButtonBarBackground(android.graphics.drawable.Drawable background)
background - The background, which should be set, as an instance of the class Drawable or
null, if no background should be setpublic final int getButtonBarElevation()
Integer valuepublic final void setButtonBarElevation(int elevation)
elevation - The elevation, which should be set, in dp as an Integer value. The elevation
must be at least 1 and at maximum 16public void onCreate(android.os.Bundle savedInstanceState)
onCreate in class AbstractPreferenceFragmentpublic void onActivityCreated(android.os.Bundle savedInstanceState)
public android.view.View onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup parent,
android.os.Bundle savedInstanceState)
onCreateView in class AbstractPreferenceFragment