[3/3] OmniGears: Ambient Display configurations

make simple options

PS17
-use ListPreference value as summary

fix dependency
change string

PS24
-reworked shake test handling

<!------------------------------------------------------------>

Note :

   since each minimum and maximum value for device is different
   (minimum and maximum value in this patch is for hammerhead and shamu)
   you must replace :

   1. doze_pulse_duration_in_entries and doze_pulse_duration_in_values
   2. doze_pulse_duration_visible_entries and doze_pulse_duration_visible_values

   and put in OmniGears overlay inside your device repo

<!------------------------------------------------------------>

Example :
   my device is falcon a.k.a Moto G, cant handle with value that present in this patch
   so i need to check which minimum and maximum value that working

   after that, i get minimum 1 s and maximum 2s for time in and out
   also i get minimum 2 s and maximum 4 s for visible time

   then i put value into overlay

    <string-array name="doze_pulse_duration_in_entries" translatable="false">
        <item>@string/one_second_default</item>
        <item>@string/onehalf_second</item>
        <item>@string/two_second</item>
    </string-array>

    <string-array name="doze_pulse_duration_in_values" translatable="false">
        <item>1000</item>
        <item>1500</item>
        <item>2000</item>
    </string-array>

    <string-array name="doze_pulse_duration_visible_entries" translatable="false">
        <item>@string/two_second</item>
        <item>@string/twohalf_second</item>
        <item>@string/three_second_default</item>
        <item>@string/threehalf_second</item>
        <item>@string/four_second</item>
    </string-array>

    <string-array name="doze_pulse_duration_visible_values" translatable="false">
        <item>2000</item>
        <item>2500</item>
        <item>3000</item>
        <item>3500</item>
        <item>4000</item>
    </string-array>

    make sure the you keep default value in the array
<!------------------------------------------------------------>

last patch: make sure option not showing in search mode if not support

Change-Id: I48e5f576af7a619b5ad6b030bf606aaee771a095
diff --git a/res/values/custom_arrays.xml b/res/values/custom_arrays.xml
index f645974..dc58e10 100644
--- a/res/values/custom_arrays.xml
+++ b/res/values/custom_arrays.xml
@@ -47,4 +47,80 @@
         <item>10</item>
         <item>11</item>
     </string-array>
+
+    <string-array name="doze_pulse_duration_in_entries" translatable="false">
+        <item>@string/twohundred_ms</item>
+        <item>@string/fivehundred_ms</item>
+        <item>@string/one_second_default</item>
+        <item>@string/onehalf_second</item>
+        <item>@string/two_second</item>
+    </string-array>
+
+    <string-array name="doze_pulse_duration_in_values" translatable="false">
+        <item>200</item>
+        <item>500</item>
+        <item>1000</item>
+        <item>1500</item>
+        <item>2000</item>
+    </string-array>
+
+    <string-array name="doze_pulse_duration_visible_entries" translatable="false">
+        <item>@string/one_second</item>
+        <item>@string/onehalf_second</item>
+        <item>@string/two_second</item>
+        <item>@string/twohalf_second</item>
+        <item>@string/three_second_default</item>
+        <item>@string/threehalf_second</item>
+        <item>@string/four_second</item>
+        <item>@string/fourhalf_second</item>
+        <item>@string/five_second</item>
+    </string-array>
+
+    <string-array name="doze_pulse_duration_visible_values" translatable="false">
+        <item>1000</item>
+        <item>1500</item>
+        <item>2000</item>
+        <item>2500</item>
+        <item>3000</item>
+        <item>3500</item>
+        <item>4000</item>
+        <item>4500</item>
+        <item>5000</item>
+    </string-array>
+
+    <string-array name="doze_shake_acc_threshold_entries" translatable="false">
+        <item>@string/veryeasy_shake</item>
+        <item>@string/easy_shake</item>
+        <item>@string/medium_shake</item>
+        <item>@string/hard_shake</item>
+        <item>@string/veryhard_shake</item>
+        <item>@string/strong_shake</item>
+    </string-array>
+
+    <string-array name="doze_shake_acc_threshold_values" translatable="false">
+        <item>2</item>
+        <item>5</item>
+        <item>10</item>
+        <item>13</item>
+        <item>16</item>
+        <item>20</item>
+    </string-array>
+
+    <string-array name="doze_list_mode_entries" translatable="false">
+        <item>@string/fully_mode</item>
+        <item>@string/pocket_shake_mode</item>
+        <item>@string/pocket_pulse_mode</item>
+        <item>@string/pocket_only_mode</item>
+        <item>@string/shake_pulse_mode</item>
+        <item>@string/pulse_only_mode</item>
+    </string-array>
+
+    <string-array name="doze_list_mode_values" translatable="false">
+        <item>1</item>
+        <item>2</item>
+        <item>3</item>
+        <item>4</item>
+        <item>5</item>
+        <item>6</item>
+    </string-array>
 </resources>
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index 1223f69..421227e 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -18,6 +18,7 @@
  -->
 
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
     <!-- Hardware keys -->
     <string name="button_keys_title">Keys</string>
     <string name="keys_bindings_title">Key actions</string>
@@ -63,6 +64,68 @@
     <string name="button_home_answers_call_title">Button answers call</string>
     <string name="button_home_answers_call_summary">Pressing the home button will answer incoming call</string>
 
+    <!-- Doze pulse (ambient display) options -->
+    <string name="doze_overwrite_value_title">Overwrite value</string>
+    <string name="doze_overwrite_value_summary">Allow to overwrite default value with user config</string>
+
+    <string name="doze_list_mode_title">Doze mode</string>
+    <string name="doze_list_mode_summary">Option to configure doze mode</string>
+
+    <string name="doze_pulse_title">Time settings</string>
+    <string name="doze_pulse_duration_in_title">Fade in</string>
+    <string name="doze_pulse_duration_in_summary"></string>
+
+    <string name="doze_pulse_duration_visible_title">Visible duration</string>
+    <string name="doze_pulse_duration_visible_summary"></string>
+
+    <string name="doze_pulse_duration_out_title">Fade out</string>
+    <string name="doze_pulse_duration_out_summary"></string>
+
+    <string name="doze_pulse_on_notifications_title">Pulse on notifications</string>
+    <string name="doze_pulse_on_notifications_summary">Trigger activation only on pending notifications</string>
+
+    <string name="doze_shake_title">Shake settings</string>
+    <string name="doze_shake_mode_title">Shake mode</string>
+    <string name="doze_shake_mode_summary">Use shake sensor value to trigger activation</string>
+    <string name="doze_shake_mode_test_summary">Do you want to test shake sensor?</string>
+    <string name="doze_shake_mode_test_result">Apply current value?</string>
+    <string name="doze_shake_test">Shake your device now</string>
+    <string name="doze_shake_it">Shake detected!</string>
+
+    <string name="doze_shake_acc_threshold_title">Shake threshold</string>
+    <string name="doze_shake_acc_threshold_summary">Configure shake strength required to trigger activation</string>
+
+    <string name="doze_time_mode_title">Show clock and date</string>
+    <string name="doze_time_mode_summary">Force showing time when there is no notification</string>
+
+    <string name="twohundred_ms">200 ms</string>
+    <string name="fivehundred_ms">500 ms</string>
+    <string name="one_second">1 s</string>
+    <string name="one_second_default">1 s (default)</string>
+    <string name="onehalf_second">1.5 s</string>
+    <string name="two_second">2 s</string>
+    <string name="twohalf_second">2.5 s</string>
+    <string name="three_second">3 s</string>
+    <string name="three_second_default">3 s (default)</string>
+    <string name="threehalf_second">3.5 s</string>
+    <string name="four_second">4 s</string>
+    <string name="fourhalf_second">4.5 s</string>
+    <string name="five_second">5 s</string>
+
+    <string name="veryeasy_shake">Very easy</string>
+    <string name="easy_shake">Easy</string>
+    <string name="medium_shake">Default</string>
+    <string name="hard_shake">Hard</string>
+    <string name="veryhard_shake">Very hard</string>
+    <string name="strong_shake">Strong</string>
+
+    <string name="fully_mode">Full mode</string>
+    <string name="pocket_shake_mode">Pocket and shake</string>
+    <string name="pocket_pulse_mode">Pocket and pulse</string>
+    <string name="pocket_only_mode">Pocket</string>
+    <string name="shake_pulse_mode">Shake and pulse</string>
+    <string name="pulse_only_mode">Pulse (default)</string>
+
     <!-- Swap volume buttons when the screen is rotated -->
     <string name="swap_volume_buttons_title">Match rotation</string>
     <string name="swap_volume_buttons_summary">Adjust volume buttons action based on current rotation</string>
diff --git a/res/xml/ambient_settings.xml b/res/xml/ambient_settings.xml
new file mode 100644
index 0000000..b2b0aff
--- /dev/null
+++ b/res/xml/ambient_settings.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--  Copyright (C) 2015 The OmniROM Project
+
+  This program is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ -->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+                  xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+        android:title="@string/doze_title"
+        settings:keywords="@string/doze_title">
+
+            <SwitchPreference
+                    android:key="doze"
+                    android:title="@string/doze_title"
+                    android:summary="@string/doze_summary"
+                    android:persistent="false" />
+
+            <ListPreference
+                    android:entries="@array/doze_list_mode_entries"
+                    android:entryValues="@array/doze_list_mode_values"
+                    android:key="doze_list_mode"
+                    android:title="@string/doze_list_mode_title"
+                    android:summary="@string/doze_list_mode_summary"
+                    android:persistent="false"
+                    android:dependency="doze" />
+
+            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+                    android:key="doze_time_mode"
+                    android:title="@string/doze_time_mode_title"
+                    android:summary="@string/doze_time_mode_summary"
+                    android:dependency="doze" />
+
+            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+                    android:key="doze_overwrite_value"
+                    android:title="@string/doze_overwrite_value_title"
+                    android:summary="@string/doze_overwrite_value_summary"
+                    android:dependency="doze" />
+
+            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+                    android:key="doze_pulse_on_notifications"
+                    android:title="@string/doze_pulse_on_notifications_title"
+                    android:summary="@string/doze_pulse_on_notifications_summary"
+                    android:defaultValue="true"
+                    android:dependency="doze_overwrite_value" />
+
+            <PreferenceCategory
+                    android:key="doze_pulse_category"
+                    android:title="@string/doze_pulse_title" >
+                    <ListPreference
+                          android:entries="@array/doze_pulse_duration_in_entries"
+                          android:entryValues="@array/doze_pulse_duration_in_values"
+                          android:key="doze_pulse_in"
+                          android:title="@string/doze_pulse_duration_in_title"
+                          android:summary="@string/doze_pulse_duration_in_summary"
+                          android:persistent="false"
+                          android:dependency="doze_overwrite_value" />
+
+                    <ListPreference
+                          android:entries="@array/doze_pulse_duration_visible_entries"
+                          android:entryValues="@array/doze_pulse_duration_visible_values"
+                          android:key="doze_pulse_visible"
+                          android:title="@string/doze_pulse_duration_visible_title"
+                          android:summary="@string/doze_pulse_duration_visible_summary"
+                          android:persistent="false"
+                          android:dependency="doze_overwrite_value" />
+
+                    <ListPreference
+                          android:entries="@array/doze_pulse_duration_in_entries"
+                          android:entryValues="@array/doze_pulse_duration_in_values"
+                          android:key="doze_pulse_out"
+                          android:title="@string/doze_pulse_duration_out_title"
+                          android:summary="@string/doze_pulse_duration_out_summary"
+                          android:persistent="false"
+                          android:dependency="doze_overwrite_value" />
+
+            </PreferenceCategory>
+
+            <PreferenceCategory
+                    android:key="doze_shake_category"
+                    android:title="@string/doze_shake_title" >
+
+                <ListPreference
+                        android:entries="@array/doze_shake_acc_threshold_entries"
+                        android:entryValues="@array/doze_shake_acc_threshold_values"
+                        android:key="doze_shake_threshold"
+                        android:title="@string/doze_shake_acc_threshold_title"
+                        android:summary="@string/doze_shake_acc_threshold_summary"
+                        android:persistent="false"
+                        android:dependency="doze" />
+            </PreferenceCategory>
+</PreferenceScreen>