[Android General] daxgirl:
[UPDATE/V2.1]Major update with functionality addons

New features:

1. GlobalRestorePreference to restore your default colors (you get to set up what colors to restore and to what integers)

2. Inverse dependency for MySwitchPreference and MyCheckboxPreference (works in reverse of regular dependency: if the switch is ON, the reversely dependent preference is DISABLED and vice versa)​

Commits for v.2.1:

1. Functionality update

2. License and support repository update

You can merge the commits into your project. Please backup first to avoid data loss from your original projects. Thiose commits should not affect your xml folder files.​

Using global restore preference:

1. GlobalRestorePreference should be located in the same xml file as the preferences is restores. It can be on any level of nested PreferenceScreen. But it must be in the same xml file.

2. Example:

<com.wubydax.romcontrol.v2.prefs.GlobalRestorePreference
android:title="Restore colors to stock values"
android:summary="This action will restore all status bar colors to their default value as they were originally in stock ui"
app:keysList="@array/restore_colors_keys"
app:titlesList="@array/restore_colors_titles"
app:valuesList="@array/restore_colors_values"/>

Arrays used for single preference:

<string-array name="restore_colors_titles">
<item>Some color to restore</item>
<item>Some other color to restore</item>
<item>Third color to restore</item>
<item>Last color to restore</item>
</string-array>
<string-array name="restore_colors_keys">
<item>one_test_color</item>
<item>two_test_color</item>
<item>three_test_color</item>
<item>four_test_color</item>
</string-array>
[COLOR="Blue"]<!--You need to use actual integer values for colors in thsi array-->[/COLOR]
<integer-array name="restore_colors_values">
<item>-1</item>
<item>-1</item>
<item>-1</item>
<item>-1</item>
</integer-array>

Reverse dependency:

1. Attribute app:reverseDependency="preference_key" will make your preference inversely dependent on the given two state preference (switch or checkbox)

2. You can use reverse dependency on ANY rom control preference except PreferenceScreen (native android preference which cannot be subclassed and hence we cannot add this feature... yet).

3. If you wish to set reverse dependency on a group of preferences inside PreferenceCategory, you need to use the new subclassed PreferenceCategory we created called MyPreferenceCategory. See example below:

As you can see the ColorPickerPreference with key global_sb_color is directrly dependent on switch with key is_global_sb_color, whereas the group of preferences inside MyPreferenceCategory is iversely dependent on the same switch:

<com.wubydax.romcontrol.v2.prefs.MySwitchPreference
android:defaultValue="true"
android:key="[COLOR="darkred"]is_global_sb_color[/COLOR]"
android:summaryOff="Items can be colored individually"
android:summaryOn="Global color will apply"
android:title="Global status bar colors"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#ffffff"
[COLOR="darkred"]android:dependency="is_global_sb_color"[/COLOR]
android:key="global_sb_color"
android:title="Global status bar color"/>
<com.wubydax.romcontrol.v2.prefs.MyPreferenceCategory
android:title="Individual colors"
[COLOR="darkred"] app:reverseDependency="is_global_sb_color"[/COLOR]>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#ffffff"
android:key="gear_clock_color"
android:title="Clock color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#ffffff"
android:key="battery_text_color"
android:title="Battery text color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#ffffff"
android:key="status_icons_color"
android:title="Status icons color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#bcffffff"
android:key="wifi_signal_color"
android:title="Wifi signal color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#bcffffff"
android:key="mobile_signal_color"
android:title="Mobile signal color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#bcffffff"
android:key="mobile_type_color"
android:title="Mobile type and arrows color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#bcffffff"
android:key="mobile_roaming_color"
android:title="Roaming icon color"/>
<com.wubydax.romcontrol.v2.prefs.ColorPickerPreference
android:defaultValue="#bcffffff"
android:key="airplane_mode_color"
android:title="Airplane mode color"/>
</com.wubydax.romcontrol.v2.prefs.MyPreferenceCategory>

Have fun, guys :D

Wuby&Dax