<commit_before><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <title>AndroidMaterialPreferences &#150; Documentation: Content</title>
        <link rel=stylesheet type=text/css href=style.css />
        <link rel="icon" type="image/png" href="images/favicon.png" />
    </head>
    
    <body>
        <div class="content">
            <div class="header">
                <h1>AndroidMaterialPreferences &#150; Documentation</h1>
                <h2>Documentation of the Android-library "AndroidMaterialPreferences".</h2>
            </div>

            <div class="navigation">
                <div class="navigation-item"><a href="index.html">GENERAL</a></div>
                <div class="navigation-item-selected"><a href="content.html">CONTENT</a></div>
                <div class="navigation-item"><a href="examples.html">EXAMPLES</a></div>
            </div>

            <div class="text">
                <h3>Content</h3>
        
                <h4>Table of contents</h4>

                <ol class="table-of-contents">
                    <li><a href="content.html#implementation-details">Implementation details</a></li>
                    <li><a href="content.html#common-properties">Common properties</a></li>
                    <ul>
                        <li><a href="content.html#common-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#common-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#seek-bar-preference">SeekBarPreference</a></li>
                    <ul>
                        <li><a href="content.html#seek-bar-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#seek-bar-preference-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#edit-text-preference">EditTextPreference</a></li>
                    <ul>
                        <li><a href="content.html#edit-text-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#edit-text-preference-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#list-preference">ListPreference</a></li>
                    <ul>
                        <li><a href="content.html#list-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#list-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#number-picker-preference">NumberPickerPreference</a></li>
                    <ul>
                        <li><a href="content.html#number-picker-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#number-picker-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#digit-picker-preference">DigitPickerPreference</a></li>
                    <ul>
                        <li><a href="content.html#digit-picker-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#digit-picker-preference-xml-attributes">XML attributes</a></li>
                    </ul>
	            <li><a href="content.html#resolution-preference">ResolutionPreference</a></li>
                    <ul>
                        <li><a href="content.html#resolution-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#resolution-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#color-palette-preference">ColorPalettePreference</a></li>
                    <ul>
                        <li><a href="content.html#color-palette-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#color-palette-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#switch-preference">SwitchPreference</a></li>
                    <ul>
                        <li><a href="content.html#switch-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#switch-preference-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#validating-preferences">Validating preferences</a></li>
                </ol>

                <h4><a name="implementation-details">1 Implementation details</a></h4>

                <p>The preferences, which are provided by this library, are implemented as a custom preferences within the classes <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a>, <a href="javadoc/de/mrapp/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a> and <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a>. As all of this preferences show a dialog when clicked by the user in order to enter a value, all of these classes are delegated from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>. Preferences, which support validation, such like the <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a>, are extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractValidateableDialogPreference.html" target="_blank" class="code">AbstractValidateableDialogPreference</a></p>

                <p>All preference implementations provide multiple constructors. The one of them, which only expects an instance of the class <a href="http://developer.android.com/reference/android/content/Context.html" target="_blank" class="code">Context</a> as a parameter, can be used instantiate the appropriate preference programmatically, the others are implicitly used by the Android SDK, when the preference is defined by using a XML resource file. Furthermore, all preference implementations override the method <tt>onSaveInstanceState():Parceable</tt> to store the preference's current state when the preference is destroyed, e.g. when the activity it belongs to loses its focus. This method is implicitly called by the Android SDK. For restoring a saved state afterwards, the method <tt>onRestoreInstanceState(Parceable):void</tt>, which is also implicitly called, is overridden.</tt></p>

                <p>As the preferences, which are provided by this library, are designed according to the Android 5.0 "Material Design" guidelines, which can be found <a href="http://www.google.com/design/spec/material-design/introduction.html" target="_blank" class="code">here</a>, the library uses functionality, which has been introduced with the release of the Android SDK 21. In order to use these functionalities, the library depends on the AppCompat v7 revision 21 support library.</p>

                <h4><a name="common-properties">2 Common properties</a></h4>

                <p>In this section all properties, which are common for all preferences, which are provided by the library, will be discussed. These properties can be set by either using the setter methods, which are provided by the common base class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>, or by specifying the preference via a XML resource.</p>

                <h5><a name="common-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>In case, the preference has been instantiated programatically, the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> provides the following getter and setter methods in addition to the methods, which are inherited from its base class <a href="javadoc/de/mrapp/android/preference/Preference.html" target="_blank" class="code">Preference</a>.</p>


                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 190px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getDialogTitle():CharSequence</br>setDialogTitle(CharSequence):void</br>setDialogTitle(int):void</tt></td>
                        <td>Returns or sets the title of the preference's dialog. If the title is null or empty, the preference's title will be used.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If the title is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogMessage():CharSequence</br>setDialogMessage(CharSequence):void</br>setDialogMessage(int):void</tt></td>
                        <td>Returns or sets the message of the preference's dialog. If the message is null or empty, no message will be shown.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If the message is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogIcon():Drawable</br>setDialogIcon(Drawable):void</br>setDialogIcon(int):void</tt></td>
                        <td>Returns or sets the icon of the preference's dialog. If the icon is null, no icon will be shown.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If the icon is specified via a resource ID, the ID must correspond to a valid drawable resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogTitleColor():int</br>setDialogTitleColor(int):void</tt></td>
                        <td>Returns or sets the color of the title of the preference's dialog. If the color is 0, the color </br><tt>?attr/colorPrimary</tt> is used.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogButtonTextColor():int</br>setDialogButtonTextColor(int):void</tt></td>
                        <td>Returns or sets the color of the button texts of the preference's dialog. If the color is 0, the color </br><tt>?attr/colorAccent</tt> is used.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getNegativeButton():CharSequence</br>setNegativeButton(CharSequence):void</br>setNegativeButton(int):void</tt></td>
                        <td>Returns or sets the text of the negative button of the preference's dialog. If the text is null or empty, no such button will be shown. These methods are already called by the single preference implementations and therefore there should be no need to call them manually.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>If the text is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getPositiveButton():CharSequence</br>setPositiveButton(CharSequence):void</br>setPositiveButton(int):void</tt></td>
                        <td>Returns or sets the text of the positive button of the preference's dialog. If the text is null or empty, no such button will be shown. These methods are already called by the single preference implementations and therefore there should be no need to call them manually.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>If the text is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>isValueShownAsSummary():boolean</br>showValueAsSummary(boolean):void</tt></td>
                        <td>Returns or sets, whether the preference's current value is shown instead of its summary, or not.</td>
                        <td><center><tt>false</tt></center></td>
                        <td>none</td>
                    </tr>
                </table>

                <h5><a name="common-xml-attributes">XML attributes</a></h5>

                <p>If a preference is created by beeing specified within a XML resource file, XML attributes can be used to customize the preference's behaviour and appearance. Besides the inherited attributes, which are defined by the Android SDK, the preference does provide various custom attributes, which can be used to set the same attributes as the setter methods already mentioned above. The custom attributes, respectively the inherited attributes, which are used by the library, are defined within the file <tt>/res/values/attrs.xml</tt>. The following table shows the attributes, all preferences, which are provided by the library, have in common.</p>

                <table>
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th style="min-width: 80px;">Value type</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:dialogMessage</tt></td>
                        <td>The message of the dialog, which is shown by the preference.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:dialogTitle</tt></td>
                        <td>The title of the dialog, which is shown by the preference.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:dialogIcon</tt></td>
                        <td>The icon of the dialog, which is shown by the preference.</td>
                        <td style="text-align: center;"><tt>reference</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:showValueAsSummary</tt></td>
                        <td>Defines, whether the currently persisted value should be shown instead of the preference's summary, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>false</tt></td>
                        <td>none</td>
                    </tr>
                </table>

                <p>For using the custom attributes (with the prefix <tt>custom:</tt>) within a XML resource file, the following namespace has to be added to the root node of the XML file:</p>

                <p><center><tt>xmlns:custom="http://schemas.android.com/apk/res-auto"</tt></center></p>
            
                <h4><a name="seek-bar-preference">3 SeekBarPreference</a></h4>

                <p>The preference, which is implemented in the class <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a>, does provides the possibility to select a <tt>Float</tt> or <tt>Integer</tt> value from a continous range via a <a href="http://developer.android.com/reference/android/widget/SeekBar.html" target="_blank" class="code">SeekBar</a>. The SeekBar is shown within a dialog and the selected value only becomes persisted when the user closes the dialog affirmatively. The preference allows to specify a minimum and maximum value and the number of decimals of the <tt>Float</tt> values, which can be selected by the SeekBar. If integer values should be selected by the preference, the number of decimals can be set to 0. Furthermore, the step size, the value is increased or decreased by, when the SeekBar is moved, can be specified. Optionally, the currently selected value, using a customizable unit, can be shown within the dialog. </p>

                <h5><a name="seek-bar-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>When a <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a> is instantiated programmatically, its properties can be set or retrieved by using the setter and getter methods, which are listed in the table below. As the class is extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>, the methods, which have been already discussed in the previous section, are also available.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 190px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getValue():float</br>setValue(float):void</tt></td>
                        <td>Returns or sets the currently persisted value of the preference. If a value is set, it is instantly persisted. If a step size is set, the value will be eventually rounded.</td>
                        <td><center><tt>50.0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getMinValue():int</br>setMinValue(int):void</tt></td>
                        <td>Returns or sets the minimum value of the preference.</td>
                        <td><center><tt>0.0</tt></center></td>
                        <td>The value must be at least 0 and it must be less than the maximum value.</td>
                    </tr>
                    <tr>
                        <td><tt>getMaxValue():int</br>setMaxValue(int):void</tt></td>
                        <td>Returns or sets the maximum value of the preference.</td>
                        <td><center><tt>100.0</tt></center></td>
                        <td>The value must be greater than the minimum value.</td>
                    </tr>
                    <tr>
                        <td><tt>getRange():int</tt></td>
                        <td>Returns the range of values, the preference allows to choose from (maximum value - minimum value).</td>
                        <td><center><tt>100.0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getStepSize():int</br>setStepSize(int):void</tt></td>
                        <td>Returns or sets the step size, the value is increased or decreased by, when the user moves the preference's seek bar.</td>
                        <td><center><tt>-1</tt></center></td>
                        <td>The value must be -1, if no step size should be used, or it must be at least 1.</td>
                    </tr>
                    <tr>
                        <td><tt>getDecimals():int</br>setDecimals(int):void</tt></td>
                        <td>Returns or sets the number of decimals of the floating point numbers, which can be chosen by using the preference.</td>
                        <td><center><tt>1</tt></center></td>
                        <td>The value must be at least 0.</td>
                    </tr>
                    <tr>
                        <td><tt>getSuffix():String</br>setSuffix(String):void</br>setSuffix(int):void</tt></td>
                        <td>Returns or sets the suffix, which is appended to the preference's currently chosen value for textual representation. It the string is set to null, no suffix is appended.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getFloatingPointSeparator():String</br>setFloatingPointSeparator(String):void</br>setFloatingPointSeparator(int):void</tt></td>
                        <td>Returns or sets the symbol, which is used to separate floating point numbers for textual representation. If the string is set to null, the default symbol, depending on the devices locale, is used.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If not null, the string must have a size of 1.</td>
                    </tr>
                    <tr>
                        <td><tt>isProgressShown():boolean</br>showProgress(boolean):void</tt></td>
                        <td>Returns or sets, whether the currently chosen value of the preference's seek bar is shown, or not.</td>
                        <td><center><tt>true</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getSummaries():String[]</br>setSummaries(String[]):void</tt></td>
                        <td>Returns or sets the summaries, which should be shown as the preferences summary, depending on the currently persisted value. For example, if the array's dimension is 2, the first summary will be shown if the value is between 0% and 49% of the whole range and the second summary will be shown if the value is between 50% and 100% of the range. If the array is set to null, no summaries will be shown depending on the currently persisted value.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>none</td>
                    </tr>
                </table>

                <p>If a value, which violates the appropriate restrictions, should be set by using one of the setter methods mentioned above, an exception will be thrown at runtime.</p>    

                <h5><a name="seek-bar-preference-xml-attributes">XML attributes</a></h5>

                <p>If a <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a> is created by beeing specified within a XML resource file, XML attributes can be used to customize the preference's behaviour and appearance. Besides the inherited attributes, which are defined by the Android API, the library does provide various custom attributes, which can be used to set the same attributes as the setter methods mentioned in the previous section. The custom attributes, respectively the inherited attributes, whose semantic is modified by the library, are defined within the file <tt>/res/values/attrs.xml</tt>. In the following two sections all custom attributes and the most important inherited attributes will be introduced. An example on how to define a <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a> by using a XML resource file, is available in the "Examples" section of this documentation.</p>

                <h5><a name="custom-attributes">Custom attributes</a></h5>

                <p>The following table shows the custom attributes of the <tt>Preference</tt>. All of them are optional.</p>

                <table>
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th style="min-width: 80px;">Value type</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 180px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The preference's default value. If a step size is set, the value will be eventually rounded.</td>
                        <td style="text-align: center;"><tt>float</tt></td>
                        <td style="text-align: center;"><tt>50</tt></td>
                        <td>The value must be at least the minimum value and at maximum the maximum value. It will be rounded to the number of allowed decimals.</td>
                    </tr>
                    <tr>
                        <td><tt>android:max</tt></td>
                        <td>The maximum value of the preference.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>100</tt></td>
                        <td>The value must be greater than the minimum value.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:min</tt></td>
                        <td>The minimum value of the preference.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>0</tt></td>
                        <td>The value must be at least 0 and less than the maximum value.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:decimals</tt></td>
                        <td>The number of decimals of the floating point numbers which can be chosen by using the preference. If the value is set to 0, only integer values can be chosen.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>1</tt></td>
                        <td>The value must be at least 0.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:stepSize</tt></td>
                        <td>The step size the preference's current value is increased or decreased by, when the user moves the seek bar. If the value is set to -1 no step size is used.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>-1</tt></td>
                        <td>The value must be -1 or at least 1 and less than the maximum value.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:suffix</tt></td>
                        <td>The suffix, which is appended to the preference's current value for textual representation. If the string is null, no suffix is appended.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:floatingPointSeparator</tt></td>
                        <td>The symbol, which is used to separate floating point numbers for textual representation. If the string is null, the default separator, depending on the system's locale, is used.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>If the string is not null, its length must be exactly 1.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:showProgress</tt></td>
                        <td>Defines, whether the current chosen value of the preference's seek bar should be shown, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>true</tt></td>
                        <td>none</td>
                    </tr>
                </table>
            
                <p>If the restrictions of an attribute mentioned in the table above are violated, exceptions will be thrown at runtime. </p>

                <h4><a name="edit-text-preference">4 EditTextPreference</a></h4>

                <p>The class <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a> provides an implementation of a preference, whose behavior is equal to the Android SDK's built-in preference <a href="http://developer.android.com/reference/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a>. Its purpose is to provide a preference, which allows to enter a text within the dialog, which is shown when the preference is clicked. Additionaly it is possible to validate the text, which has been entered by using the preference. For further information about how to achieve such a validation, refer to the section "Validating preferences" at the end of this documentation.</p>

                <h5><a name="edit-text-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>When an <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a> is instantiated programmatically, the following getter and setter method can be used to retrieve or set the preference's current value. Like all preferences, which are provided by this library, the class is extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> and therefore the methods of this base class, which have been already discussed, are also available.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getText():String</br>setText(String):void</tt></td>
                        <td>Returns or sets the currently persisted text of the preference. If a text is set, it is instantly persisted.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>none</td>
                    </tr>
                </table>

                <h5><a name="edit-text-preference-xml-attributes">XML attributes</a></h5>

                <p>If the preference's default value should be specified by using XML attributes, the following attribute can be used. For customizing the appearance of the preference's dialog, the attributes, which have already been discussed, can be used.</p>

                <table style="width: 100%">
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th>Value type</th>
                        <th>Default value</th>
                        <th>Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The preference's default text.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                </table>

                <h4><a name="list-preference">5 ListPreference</a></h4>

                <p>The library's class <a href="javadoc/de/mrapp/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a> provides an implementation, whose purpose is equal to the Android SDK's built-in preference <a href="http://developer.android.com/reference/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a>. It allows to select a value from a list, which is shown within the preference's dialog. Only one value can be selected at once and the dialog becomes closed as soon as the list's selection changes. The values, which can be selected by the preference, as well as the corresponding entries, which are shown within the preference's list, can be specified as arrays by either using setter methods or XML attributes.</p>

                <h5><a name="list-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>To specify the properties of a <a href="javadoc/de/mrapp/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a> programmatically, the following getter and setter method are provided. As the class is extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>, the methods of this base class can also be used.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getEntries():CharSequence[]</br>setEntries(CharSequence[]):void</br>setEntries(int):void</tt></td>
                        <td>Returns or sets the entries, which are shown in the preference's list.</td>
                        <td><center>Empty array</center></td>
                        <td>The array may not be null. If the array is specified as a resource ID, the ID must correspond to a valid array resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getEntryValues():CharSequence[]</br>setEntryValues(CharSequence[]):void</br>setEntryValues(int):void</tt></td>
                        <td>Returns or sets the values, which correspond to the entries, which are shown in the preference's list.</td>
                        <td><center>Empty array</center></td>
                        <td>The array may not be null. If the array is specified as a resource ID, the ID must correspond to a valid array resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getValue():String</br>setValue():void</br>setValueIndex(int):void</tt></td>
                        <td>Returns or sets the currently persisted value of the preference. If a value is set, it is instantly persisted.</td>
                        <td><center>null</center></td>
                        <td>If the value is specified by its index, the index must be valid.</td>
                    </tr>
                    <tr>
                        <td><tt>getEntry():CharSequence</tt></td>
                        <td>Returns the entries, which corresponds to the currently selected value.</td>
                        <td><center>null</center></td>
                        <td>none</td>
                    </tr>
                </table>

                <h5><a name="list-preference-xml-attributes">XML attributes</a></h5>

                <p>If the properties, which can be set by the using the setter methods, which have been discussed in the previous section, should be specified by using XML attributes, the following attributes are available.</p>

                <table style="width: 100%">
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th>Value type</th>
                        <th>Default value</th>
                        <th>Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:entries</tt></td>
                        <td>The entries, which are shown in the preference's list.</td>
                        <td style="text-align: center;"><tt>reference</tt></td>
                        <td style="text-align: center;"><tt>Empty array</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:entryValues</tt></td>
                        <td>The values, which correspond to the entries, which are shown in the preference's list.</td>
                        <td style="text-align: center;"><tt>reference</tt></td>
                        <td style="text-align: center;"><tt>Empty array</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The preference's default value.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                </table>

		<h4><a name="number-picker-preference">6 NumberPickerPreference</a></h4>

                <p>The purpose of the class <a href="javadoc/de/mrapp/android/preference/NumberPickerPreference.html" target="_blank" class="code">NumberPickerPreference</a> is to provide a preference implementation, which allows to choose a decimal number by using a <a href="http://developer.android.com/reference/android/widget/NumberPicker.html" target="_blank" class="code">NumberPicker</a> widget. Such a widget allows to scroll through the range of possible numbers.</p>

                <h5><a name="number-picker-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>The library's API provides the following getter and setter methods in order to adjust the properties of a  <a href="javadoc/de/mrapp/android/preference/NumberPickerPreference.html" target="_blank" class="code">NumberPickerPreference</a> programmatically. Furthermore, the methods of the base class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> can also be used.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getNumber():int</br>setNumber(int):void</tt></td>
                        <td>Returns or sets the currently persisted number of the preference. If a number is set, it is instantly persisted.</td>
                        <td><center>0</center></td>
                        <td>The number must be at least the minimum number and at maximum the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>getDefaultNumber():int</br>setDefaultValue(Object):void</tt></td>
                        <td>Returns or sets the default number of the preference.</td>
                        <td><center>0</center></td>
                        <td>The number must be at least the minimum number and at maximum the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>isInputMethodUsed():boolean</br>useInputMethod(boolean):void</tt></td>
                        <td>Returns or sets, whether it is possible to enter a number by using the keyboard, or not.</td>
                        <td><center>false</center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>isSelectorWheelWrapped():boolean</br>wrapSelectorWheel(boolean):void</tt></td>
                        <td>Returns or sets, whether the <tt>NumberPicker</tt>'s selector wheel is wrapped, or not.</td>
                        <td><center>true</center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getMinNumber():int</br>setMinNumber(int):void</tt></td>
                        <td>Returns or sets the minimum number, the preference allows to choose.</td>
                        <td><center>0</center></td>
                        <td>The minimum number must be less than the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>getMaxNumber():int</br>setMaxNumber(int):void</tt></td>
                        <td>Returns or sets the maximum number, the preference allows to choose.</td>
                        <td><center>10</center></td>
                        <td>The maximum number must be greater than the minimum number.</td>
                    </tr>
                </table>

                <h5><a name="number-picker-preference-xml-attributes">XML attributes</a></h5>

                <p>Alternatively, the properties, which can be set by the using the setter methods, which have been discussed in the previous section, can be specified by using XML attributes. The following attributes are available.</p>

                <table style="width: 100%">
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th>Value type</th>
                        <th>Default value</th>
                        <th>Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The default number of the preference.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>0</tt></td>
                        <td>Must be greater than the minimum number and less than the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:useInputMethod</tt></td>
                        <td>Whether it should be possible to enter a number by using the keyboard, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>false</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:wrapSelectorWheel</tt></td>
                        <td>Whether the <tt>NumberPicker</tt>'s selector wheel should be wrapped, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>true</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:minNumber</tt></td>
                        <td>The minimum number, the preference allows to choose.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>0</tt></td>
                        <td>Must be less than the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:maxNumber</tt></td>
                        <td>The maximum number, the preference allows to choose.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>10</tt></td>
                        <td>Must be greater than the minimum number.</td>
                    </tr>
                </table>

		<h4><a name="digit-picker-preference">7 DigitPickerPreference</a></h4>

                <p>The preference, which is provided by the class <a href="javadoc/de/mrapp/android/preference/DigitPickerPreference.html" target="_blank" class="code">DigitPickerPreference</a> is very similar to the preference, which has been discussed in the previous section. It also allows to choose a decimal number by using a <a href="http://developer.android.com/reference/android/widget/NumberPicker.html" target="_blank" class="code">NumberPicker</a> widget. The difference is, that each digit of the number can be chosen individualy by using several <a href="http://developer.android.com/reference/android/widget/NumberPicker.html" target="_blank" class="code">NumberPicker</a> widgets.</p>

                <h5><a name="digit-picker-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>The following getter and setter methods are provided in order to specify the properties of a  <a href="javadoc/de/mrapp/android/preference/DigitPickerPreference.html" target="_blank" class="code">DigitPickerPreference</a> programmatically. The methods of the base class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> can be used as well.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getNumber():int</br>setNumber(int):void</tt></td>
                        <td>Returns or sets the currently persisted number of the preference. If a number is set, it is instantly persisted.</td>
                        <td><center>0</center></td>
                        <td>The number must be at least the minimum number and at maximum the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>getDefaultNumber():int</br>setDefaultValue(Object):void</tt></td>
                        <td>Returns or sets the default number of the preference.</td>
                        <td><center>0</center></td>
                        <td>The number must be at least the minimum number and at maximum the maximum number.</td>
                    </tr><commit_msg>Updated documentation.<commit_after><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <title>AndroidMaterialPreferences &#150; Documentation: Content</title>
        <link rel=stylesheet type=text/css href=style.css />
        <link rel="icon" type="image/png" href="images/favicon.png" />
    </head>
    
    <body>
        <div class="content">
            <div class="header">
                <h1>AndroidMaterialPreferences &#150; Documentation</h1>
                <h2>Documentation of the Android-library "AndroidMaterialPreferences".</h2>
            </div>

            <div class="navigation">
                <div class="navigation-item"><a href="index.html">GENERAL</a></div>
                <div class="navigation-item-selected"><a href="content.html">CONTENT</a></div>
                <div class="navigation-item"><a href="examples.html">EXAMPLES</a></div>
            </div>

            <div class="text">
                <h3>Content</h3>
        
                <h4>Table of contents</h4>

                <ol class="table-of-contents">
                    <li><a href="content.html#implementation-details">Implementation details</a></li>
                    <li><a href="content.html#common-properties">Common properties</a></li>
                    <ul>
                        <li><a href="content.html#common-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#common-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#seek-bar-preference">SeekBarPreference</a></li>
                    <ul>
                        <li><a href="content.html#seek-bar-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#seek-bar-preference-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#edit-text-preference">EditTextPreference</a></li>
                    <ul>
                        <li><a href="content.html#edit-text-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#edit-text-preference-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#list-preference">ListPreference</a></li>
                    <ul>
                        <li><a href="content.html#list-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#list-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#number-picker-preference">NumberPickerPreference</a></li>
                    <ul>
                        <li><a href="content.html#number-picker-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#number-picker-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#digit-picker-preference">DigitPickerPreference</a></li>
                    <ul>
                        <li><a href="content.html#digit-picker-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#digit-picker-preference-xml-attributes">XML attributes</a></li>
                    </ul>
	            <li><a href="content.html#resolution-preference">ResolutionPreference</a></li>
                    <ul>
                        <li><a href="content.html#resolution-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#resolution-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#color-palette-preference">ColorPalettePreference</a></li>
                    <ul>
                        <li><a href="content.html#color-palette-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#color-palette-preference-xml-attributes">XML attributes</a></li>
                    </ul>
		    <li><a href="content.html#switch-preference">SwitchPreference</a></li>
                    <ul>
                        <li><a href="content.html#switch-preference-getter-and-setter-methods">Getter and setter methods</a></li>
                        <li><a href="content.html#switch-preference-xml-attributes">XML attributes</a></li>
                    </ul>
                    <li><a href="content.html#validating-preferences">Validating preferences</a></li>
                </ol>

                <h4><a name="implementation-details">1 Implementation details</a></h4>

                <p>The preferences, which are provided by this library, are implemented as a custom preferences within the classes <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a>, <a href="javadoc/de/mrapp/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a> and <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a>. As all of this preferences show a dialog when clicked by the user in order to enter a value, all of these classes are delegated from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>. Preferences, which support validation, such like the <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a>, are extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractValidateableDialogPreference.html" target="_blank" class="code">AbstractValidateableDialogPreference</a></p>

                <p>All preference implementations provide multiple constructors. The one of them, which only expects an instance of the class <a href="http://developer.android.com/reference/android/content/Context.html" target="_blank" class="code">Context</a> as a parameter, can be used instantiate the appropriate preference programmatically, the others are implicitly used by the Android SDK, when the preference is defined by using a XML resource file. Furthermore, all preference implementations override the method <tt>onSaveInstanceState():Parceable</tt> to store the preference's current state when the preference is destroyed, e.g. when the activity it belongs to loses its focus. This method is implicitly called by the Android SDK. For restoring a saved state afterwards, the method <tt>onRestoreInstanceState(Parceable):void</tt>, which is also implicitly called, is overridden.</tt></p>

                <p>As the preferences, which are provided by this library, are designed according to the Android 5.0 "Material Design" guidelines, which can be found <a href="http://www.google.com/design/spec/material-design/introduction.html" target="_blank" class="code">here</a>, the library uses functionality, which has been introduced with the release of the Android SDK 21. In order to use these functionalities, the library depends on the AppCompat v7 revision 21 support library.</p>

                <h4><a name="common-properties">2 Common properties</a></h4>

                <p>In this section all properties, which are common for all preferences, which are provided by the library, will be discussed. These properties can be set by either using the setter methods, which are provided by the common base class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>, or by specifying the preference via a XML resource.</p>

                <h5><a name="common-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>In case, the preference has been instantiated programatically, the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> provides the following getter and setter methods in addition to the methods, which are inherited from its base class <a href="javadoc/de/mrapp/android/preference/Preference.html" target="_blank" class="code">Preference</a>.</p>


                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 190px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getDialogTitle():CharSequence</br>setDialogTitle(CharSequence):void</br>setDialogTitle(int):void</tt></td>
                        <td>Returns or sets the title of the preference's dialog. If the title is null or empty, the preference's title will be used.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If the title is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogMessage():CharSequence</br>setDialogMessage(CharSequence):void</br>setDialogMessage(int):void</tt></td>
                        <td>Returns or sets the message of the preference's dialog. If the message is null or empty, no message will be shown.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If the message is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogIcon():Drawable</br>setDialogIcon(Drawable):void</br>setDialogIcon(int):void</tt></td>
                        <td>Returns or sets the icon of the preference's dialog. If the icon is null, no icon will be shown.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If the icon is specified via a resource ID, the ID must correspond to a valid drawable resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogTitleColor():int</br>setDialogTitleColor(int):void</tt></td>
                        <td>Returns or sets the color of the title of the preference's dialog. If the color is 0, the color </br><tt>?attr/colorPrimary</tt> is used.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getDialogButtonTextColor():int</br>setDialogButtonTextColor(int):void</tt></td>
                        <td>Returns or sets the color of the button texts of the preference's dialog. If the color is 0, the color </br><tt>?attr/colorAccent</tt> is used.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getNegativeButton():CharSequence</br>setNegativeButton(CharSequence):void</br>setNegativeButton(int):void</tt></td>
                        <td>Returns or sets the text of the negative button of the preference's dialog. If the text is null or empty, no such button will be shown. These methods are already called by the single preference implementations and therefore there should be no need to call them manually.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>If the text is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getPositiveButton():CharSequence</br>setPositiveButton(CharSequence):void</br>setPositiveButton(int):void</tt></td>
                        <td>Returns or sets the text of the positive button of the preference's dialog. If the text is null or empty, no such button will be shown. These methods are already called by the single preference implementations and therefore there should be no need to call them manually.</td>
                        <td><center><tt>0</tt></center></td>
                        <td>If the text is specified via a resource ID, the ID must correspond to a valid string resource.</td>
                    </tr>
                    <tr>
                        <td><tt>isValueShownAsSummary():boolean</br>showValueAsSummary(boolean):void</tt></td>
                        <td>Returns or sets, whether the preference's current value is shown instead of its summary, or not.</td>
                        <td><center><tt>false</tt></center></td>
                        <td>none</td>
                    </tr>
                </table>

                <h5><a name="common-xml-attributes">XML attributes</a></h5>

                <p>If a preference is created by beeing specified within a XML resource file, XML attributes can be used to customize the preference's behaviour and appearance. Besides the inherited attributes, which are defined by the Android SDK, the preference does provide various custom attributes, which can be used to set the same attributes as the setter methods already mentioned above. The custom attributes, respectively the inherited attributes, which are used by the library, are defined within the file <tt>/res/values/attrs.xml</tt>. The following table shows the attributes, all preferences, which are provided by the library, have in common.</p>

                <table>
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th style="min-width: 80px;">Value type</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:dialogMessage</tt></td>
                        <td>The message of the dialog, which is shown by the preference.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:dialogTitle</tt></td>
                        <td>The title of the dialog, which is shown by the preference.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:dialogIcon</tt></td>
                        <td>The icon of the dialog, which is shown by the preference.</td>
                        <td style="text-align: center;"><tt>reference</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:showValueAsSummary</tt></td>
                        <td>Defines, whether the currently persisted value should be shown instead of the preference's summary, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>false</tt></td>
                        <td>none</td>
                    </tr>
                </table>

                <p>For using the custom attributes (with the prefix <tt>custom:</tt>) within a XML resource file, the following namespace has to be added to the root node of the XML file:</p>

                <p><center><tt>xmlns:custom="http://schemas.android.com/apk/res-auto"</tt></center></p>
            
                <h4><a name="seek-bar-preference">3 SeekBarPreference</a></h4>

                <p>The preference, which is implemented in the class <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a>, does provides the possibility to select a <tt>Float</tt> or <tt>Integer</tt> value from a continous range via a <a href="http://developer.android.com/reference/android/widget/SeekBar.html" target="_blank" class="code">SeekBar</a>. The SeekBar is shown within a dialog and the selected value only becomes persisted when the user closes the dialog affirmatively. The preference allows to specify a minimum and maximum value and the number of decimals of the <tt>Float</tt> values, which can be selected by the SeekBar. If integer values should be selected by the preference, the number of decimals can be set to 0. Furthermore, the step size, the value is increased or decreased by, when the SeekBar is moved, can be specified. Optionally, the currently selected value, using a customizable unit, can be shown within the dialog. </p>

                <h5><a name="seek-bar-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>When a <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a> is instantiated programmatically, its properties can be set or retrieved by using the setter and getter methods, which are listed in the table below. As the class is extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>, the methods, which have been already discussed in the previous section, are also available.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 190px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getValue():float</br>setValue(float):void</tt></td>
                        <td>Returns or sets the currently persisted value of the preference. If a value is set, it is instantly persisted. If a step size is set, the value will be eventually rounded.</td>
                        <td><center><tt>50.0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getMinValue():int</br>setMinValue(int):void</tt></td>
                        <td>Returns or sets the minimum value of the preference.</td>
                        <td><center><tt>0.0</tt></center></td>
                        <td>The value must be at least 0 and it must be less than the maximum value.</td>
                    </tr>
                    <tr>
                        <td><tt>getMaxValue():int</br>setMaxValue(int):void</tt></td>
                        <td>Returns or sets the maximum value of the preference.</td>
                        <td><center><tt>100.0</tt></center></td>
                        <td>The value must be greater than the minimum value.</td>
                    </tr>
                    <tr>
                        <td><tt>getRange():int</tt></td>
                        <td>Returns the range of values, the preference allows to choose from (maximum value - minimum value).</td>
                        <td><center><tt>100.0</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getStepSize():int</br>setStepSize(int):void</tt></td>
                        <td>Returns or sets the step size, the value is increased or decreased by, when the user moves the preference's seek bar.</td>
                        <td><center><tt>-1</tt></center></td>
                        <td>The value must be -1, if no step size should be used, or it must be at least 1.</td>
                    </tr>
                    <tr>
                        <td><tt>getDecimals():int</br>setDecimals(int):void</tt></td>
                        <td>Returns or sets the number of decimals of the floating point numbers, which can be chosen by using the preference.</td>
                        <td><center><tt>1</tt></center></td>
                        <td>The value must be at least 0.</td>
                    </tr>
                    <tr>
                        <td><tt>getSuffix():String</br>setSuffix(String):void</br>setSuffix(int):void</tt></td>
                        <td>Returns or sets the suffix, which is appended to the preference's currently chosen value for textual representation. It the string is set to null, no suffix is appended.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getFloatingPointSeparator():String</br>setFloatingPointSeparator(String):void</br>setFloatingPointSeparator(int):void</tt></td>
                        <td>Returns or sets the symbol, which is used to separate floating point numbers for textual representation. If the string is set to null, the default symbol, depending on the devices locale, is used.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>If not null, the string must have a size of 1.</td>
                    </tr>
                    <tr>
                        <td><tt>isProgressShown():boolean</br>showProgress(boolean):void</tt></td>
                        <td>Returns or sets, whether the currently chosen value of the preference's seek bar is shown, or not.</td>
                        <td><center><tt>true</tt></center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getSummaries():String[]</br>setSummaries(String[]):void</tt></td>
                        <td>Returns or sets the summaries, which should be shown as the preferences summary, depending on the currently persisted value. For example, if the array's dimension is 2, the first summary will be shown if the value is between 0% and 49% of the whole range and the second summary will be shown if the value is between 50% and 100% of the range. If the array is set to null, no summaries will be shown depending on the currently persisted value.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>none</td>
                    </tr>
                </table>

                <p>If a value, which violates the appropriate restrictions, should be set by using one of the setter methods mentioned above, an exception will be thrown at runtime.</p>    

                <h5><a name="seek-bar-preference-xml-attributes">XML attributes</a></h5>

                <p>If a <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a> is created by beeing specified within a XML resource file, XML attributes can be used to customize the preference's behaviour and appearance. Besides the inherited attributes, which are defined by the Android API, the library does provide various custom attributes, which can be used to set the same attributes as the setter methods mentioned in the previous section. The custom attributes, respectively the inherited attributes, whose semantic is modified by the library, are defined within the file <tt>/res/values/attrs.xml</tt>. In the following two sections all custom attributes and the most important inherited attributes will be introduced. An example on how to define a <a href="javadoc/de/mrapp/android/preference/SeekBarPreference.html" target="_blank" class="code">SeekBarPreference</a> by using a XML resource file, is available in the "Examples" section of this documentation.</p>

                <h5><a name="custom-attributes">Custom attributes</a></h5>

                <p>The following table shows the custom attributes of the <tt>Preference</tt>. All of them are optional.</p>

                <table>
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th style="min-width: 80px;">Value type</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 180px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The preference's default value. If a step size is set, the value will be eventually rounded.</td>
                        <td style="text-align: center;"><tt>float</tt></td>
                        <td style="text-align: center;"><tt>50</tt></td>
                        <td>The value must be at least the minimum value and at maximum the maximum value. It will be rounded to the number of allowed decimals.</td>
                    </tr>
                    <tr>
                        <td><tt>android:max</tt></td>
                        <td>The maximum value of the preference.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>100</tt></td>
                        <td>The value must be greater than the minimum value.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:min</tt></td>
                        <td>The minimum value of the preference.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>0</tt></td>
                        <td>The value must be at least 0 and less than the maximum value.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:decimals</tt></td>
                        <td>The number of decimals of the floating point numbers which can be chosen by using the preference. If the value is set to 0, only integer values can be chosen.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>1</tt></td>
                        <td>The value must be at least 0.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:stepSize</tt></td>
                        <td>The step size the preference's current value is increased or decreased by, when the user moves the seek bar. If the value is set to -1 no step size is used.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>-1</tt></td>
                        <td>The value must be -1 or at least 1 and less than the maximum value.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:suffix</tt></td>
                        <td>The suffix, which is appended to the preference's current value for textual representation. If the string is null, no suffix is appended.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:floatingPointSeparator</tt></td>
                        <td>The symbol, which is used to separate floating point numbers for textual representation. If the string is null, the default separator, depending on the system's locale, is used.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>If the string is not null, its length must be exactly 1.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:showProgress</tt></td>
                        <td>Defines, whether the current chosen value of the preference's seek bar should be shown, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>true</tt></td>
                        <td>none</td>
                    </tr>
                </table>
            
                <p>If the restrictions of an attribute mentioned in the table above are violated, exceptions will be thrown at runtime. </p>

                <h4><a name="edit-text-preference">4 EditTextPreference</a></h4>

                <p>The class <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a> provides an implementation of a preference, whose behavior is equal to the Android SDK's built-in preference <a href="http://developer.android.com/reference/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a>. Its purpose is to provide a preference, which allows to enter a text within the dialog, which is shown when the preference is clicked. Additionaly it is possible to validate the text, which has been entered by using the preference. For further information about how to achieve such a validation, refer to the section "Validating preferences" at the end of this documentation.</p>

                <h5><a name="edit-text-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>When an <a href="javadoc/de/mrapp/android/preference/EditTextPreference.html" target="_blank" class="code">EditTextPreference</a> is instantiated programmatically, the following getter and setter method can be used to retrieve or set the preference's current value. Like all preferences, which are provided by this library, the class is extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> and therefore the methods of this base class, which have been already discussed, are also available.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getText():String</br>setText(String):void</tt></td>
                        <td>Returns or sets the currently persisted text of the preference. If a text is set, it is instantly persisted.</td>
                        <td><center><tt>null</tt></center></td>
                        <td>none</td>
                    </tr>
                </table>

                <h5><a name="edit-text-preference-xml-attributes">XML attributes</a></h5>

                <p>If the preference's default value should be specified by using XML attributes, the following attribute can be used. For customizing the appearance of the preference's dialog, the attributes, which have already been discussed, can be used.</p>

                <table style="width: 100%">
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th>Value type</th>
                        <th>Default value</th>
                        <th>Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The preference's default text.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                </table>

                <h4><a name="list-preference">5 ListPreference</a></h4>

                <p>The library's class <a href="javadoc/de/mrapp/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a> provides an implementation, whose purpose is equal to the Android SDK's built-in preference <a href="http://developer.android.com/reference/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a>. It allows to select a value from a list, which is shown within the preference's dialog. Only one value can be selected at once and the dialog becomes closed as soon as the list's selection changes. The values, which can be selected by the preference, as well as the corresponding entries, which are shown within the preference's list, can be specified as arrays by either using setter methods or XML attributes.</p>

                <h5><a name="list-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>To specify the properties of a <a href="javadoc/de/mrapp/android/preference/ListPreference.html" target="_blank" class="code">ListPreference</a> programmatically, the following getter and setter method are provided. As the class is extended from the class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a>, the methods of this base class can also be used.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getEntries():CharSequence[]</br>setEntries(CharSequence[]):void</br>setEntries(int):void</tt></td>
                        <td>Returns or sets the entries, which are shown in the preference's list.</td>
                        <td><center>Empty array</center></td>
                        <td>The array may not be null. If the array is specified as a resource ID, the ID must correspond to a valid array resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getEntryValues():CharSequence[]</br>setEntryValues(CharSequence[]):void</br>setEntryValues(int):void</tt></td>
                        <td>Returns or sets the values, which correspond to the entries, which are shown in the preference's list.</td>
                        <td><center>Empty array</center></td>
                        <td>The array may not be null. If the array is specified as a resource ID, the ID must correspond to a valid array resource.</td>
                    </tr>
                    <tr>
                        <td><tt>getValue():String</br>setValue():void</br>setValueIndex(int):void</tt></td>
                        <td>Returns or sets the currently persisted value of the preference. If a value is set, it is instantly persisted.</td>
                        <td><center>null</center></td>
                        <td>If the value is specified by its index, the index must be valid.</td>
                    </tr>
                    <tr>
                        <td><tt>getEntry():CharSequence</tt></td>
                        <td>Returns the entries, which corresponds to the currently selected value.</td>
                        <td><center>null</center></td>
                        <td>none</td>
                    </tr>
                </table>

                <h5><a name="list-preference-xml-attributes">XML attributes</a></h5>

                <p>If the properties, which can be set by the using the setter methods, which have been discussed in the previous section, should be specified by using XML attributes, the following attributes are available.</p>

                <table style="width: 100%">
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th>Value type</th>
                        <th>Default value</th>
                        <th>Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:entries</tt></td>
                        <td>The entries, which are shown in the preference's list.</td>
                        <td style="text-align: center;"><tt>reference</tt></td>
                        <td style="text-align: center;"><tt>Empty array</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:entryValues</tt></td>
                        <td>The values, which correspond to the entries, which are shown in the preference's list.</td>
                        <td style="text-align: center;"><tt>reference</tt></td>
                        <td style="text-align: center;"><tt>Empty array</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The preference's default value.</td>
                        <td style="text-align: center;"><tt>string</tt></td>
                        <td style="text-align: center;"><tt>null</tt></td>
                        <td>none</td>
                    </tr>
                </table>

		<h4><a name="number-picker-preference">6 NumberPickerPreference</a></h4>

                <p>The purpose of the class <a href="javadoc/de/mrapp/android/preference/NumberPickerPreference.html" target="_blank" class="code">NumberPickerPreference</a> is to provide a preference implementation, which allows to choose a decimal number by using a <a href="http://developer.android.com/reference/android/widget/NumberPicker.html" target="_blank" class="code">NumberPicker</a> widget. Such a widget allows to scroll through the range of possible numbers.</p>

                <h5><a name="number-picker-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>The library's API provides the following getter and setter methods in order to adjust the properties of a  <a href="javadoc/de/mrapp/android/preference/NumberPickerPreference.html" target="_blank" class="code">NumberPickerPreference</a> programmatically. Furthermore, the methods of the base class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> can also be used.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getNumber():int</br>setNumber(int):void</tt></td>
                        <td>Returns or sets the currently persisted number of the preference. If a number is set, it is instantly persisted.</td>
                        <td><center>0</center></td>
                        <td>The number must be at least the minimum number and at maximum the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>isInputMethodUsed():boolean</br>useInputMethod(boolean):void</tt></td>
                        <td>Returns or sets, whether it is possible to enter a number by using the keyboard, or not.</td>
                        <td><center>false</center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>isSelectorWheelWrapped():boolean</br>wrapSelectorWheel(boolean):void</tt></td>
                        <td>Returns or sets, whether the <tt>NumberPicker</tt>'s selector wheel is wrapped, or not.</td>
                        <td><center>true</center></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>getMinNumber():int</br>setMinNumber(int):void</tt></td>
                        <td>Returns or sets the minimum number, the preference allows to choose.</td>
                        <td><center>0</center></td>
                        <td>The minimum number must be less than the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>getMaxNumber():int</br>setMaxNumber(int):void</tt></td>
                        <td>Returns or sets the maximum number, the preference allows to choose.</td>
                        <td><center>10</center></td>
                        <td>The maximum number must be greater than the minimum number.</td>
                    </tr>
                </table>

                <h5><a name="number-picker-preference-xml-attributes">XML attributes</a></h5>

                <p>Alternatively, the properties, which can be set by the using the setter methods, which have been discussed in the previous section, can be specified by using XML attributes. The following attributes are available.</p>

                <table style="width: 100%">
                    <tr>
                        <th>Attribute</th>
                        <th>Explaination</th>
                        <th>Value type</th>
                        <th>Default value</th>
                        <th>Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>android:defaultValue</tt></td>
                        <td>The default number of the preference.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>0</tt></td>
                        <td>Must be greater than the minimum number and less than the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:useInputMethod</tt></td>
                        <td>Whether it should be possible to enter a number by using the keyboard, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>false</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:wrapSelectorWheel</tt></td>
                        <td>Whether the <tt>NumberPicker</tt>'s selector wheel should be wrapped, or not.</td>
                        <td style="text-align: center;"><tt>boolean</tt></td>
                        <td style="text-align: center;"><tt>true</tt></td>
                        <td>none</td>
                    </tr>
                    <tr>
                        <td><tt>custom:minNumber</tt></td>
                        <td>The minimum number, the preference allows to choose.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>0</tt></td>
                        <td>Must be less than the maximum number.</td>
                    </tr>
                    <tr>
                        <td><tt>custom:maxNumber</tt></td>
                        <td>The maximum number, the preference allows to choose.</td>
                        <td style="text-align: center;"><tt>integer</tt></td>
                        <td style="text-align: center;"><tt>10</tt></td>
                        <td>Must be greater than the minimum number.</td>
                    </tr>
                </table>

		<h4><a name="digit-picker-preference">7 DigitPickerPreference</a></h4>

                <p>The preference, which is provided by the class <a href="javadoc/de/mrapp/android/preference/DigitPickerPreference.html" target="_blank" class="code">DigitPickerPreference</a> is very similar to the preference, which has been discussed in the previous section. It also allows to choose a decimal number by using a <a href="http://developer.android.com/reference/android/widget/NumberPicker.html" target="_blank" class="code">NumberPicker</a> widget. The difference is, that each digit of the number can be chosen individualy by using several <a href="http://developer.android.com/reference/android/widget/NumberPicker.html" target="_blank" class="code">NumberPicker</a> widgets.</p>

                <h5><a name="digit-picker-preference-getter-and-setter-methods">Getter and setter methods</a></h5>

                <p>The following getter and setter methods are provided in order to specify the properties of a  <a href="javadoc/de/mrapp/android/preference/DigitPickerPreference.html" target="_blank" class="code">DigitPickerPreference</a> programmatically. The methods of the base class <a href="javadoc/de/mrapp/android/preference/AbstractDialogPreference.html" target="_blank" class="code">AbstractDialogPreference</a> can be used as well.</p>

                <table>
                    <tr>
                        <th>Getter and setter methods</th>
                        <th>Explaination</th>
                        <th style="min-width: 90px;">Default value</th>
                        <th style="min-width: 90px;">Restrictions</th>
                    </tr>
                    <tr>
                        <td><tt>getNumber():int</br>setNumber(int):void</tt></td>
                        <td>Returns or sets the currently persisted number of the preference. If a number is set, it is instantly persisted.</td>
                        <td><center>0</center></td>
                        <td>The number must be at least the minimum number and at maximum the maximum number.</td>
                    </tr>
{'fraction_non_alphanumeric': 0.12052530332828235, 'fraction_numerical': 0.003890339706182631, 'mean_word_length': 1.856721824824241, 'pattern_counts': {'":': 0, '<': 2829, '<?xml version=': 0, '>': 2829, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 34}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4070631', 'n_tokens_mistral': 24435, 'n_tokens_neox': 22740, 'n_words': 6962}