[2/2] OmniGears: rework and cleanup network traffic

Change-Id: Ie7962d2cd58544c2ab956ade9db4cddaaed5b9eb
diff --git a/res/values/custom_arrays.xml b/res/values/custom_arrays.xml
index 64451ee..eff5300 100644
--- a/res/values/custom_arrays.xml
+++ b/res/values/custom_arrays.xml
@@ -149,14 +149,12 @@
 
     <!-- Network Traffic Display States -->
     <string-array name="show_network_traffic_state_entries" translatable="false">
-        <item>@string/show_network_traffic_disable</item>
         <item>@string/show_network_traffic_up</item>
         <item>@string/show_network_traffic_down</item>
         <item>@string/show_network_traffic_all</item>
     </string-array>
 
     <string-array name="show_network_traffic_state_values" translatable="false">
-        <item>0</item>
         <item>1</item>
         <item>2</item>
         <item>3</item>
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index a0c5740..7cebd66 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -271,7 +271,8 @@
 
     <!-- Network traffic -->
     <string name="network_traffic_title">Network traffic</string>
-    <string name="show_network_traffic_state">Status bar traffic monitor</string>
+    <string name="network_traffic_summary">Status bar traffic monitor</string>
+    <string name="show_network_traffic_state">Display traffic type</string>
     <string name="show_network_traffic_unit">Display unit</string>
     <string name="show_network_traffic_frequency">Update interval</string>
     <string name="show_network_traffic_disable">Disabled</string>
@@ -287,6 +288,7 @@
     <string name="network_traffic_autohide_title">Auto hide</string>
     <string name="network_traffic_autohide_summary">Hide the traffic monitor when there is no activity</string>
     <string name="network_traffic_autohide_threshold">Inactivity threshold</string>
+    <string name="network_traffic_enable_title">Enable</string>
 
     <!-- statusbar brightness -->
     <string name="status_bar_brightness_control_title">Brightness control</string>
diff --git a/res/xml/bars_settings.xml b/res/xml/bars_settings.xml
index e813280..9f8d195 100644
--- a/res/xml/bars_settings.xml
+++ b/res/xml/bars_settings.xml
@@ -21,30 +21,31 @@
             android:key="category_statusbar"
             android:title="@string/statusbar_title">
 
-            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+            <org.omnirom.omnigears.preference.SystemSettingSwitchPreference
                 android:key="double_tap_sleep_gesture"
                 android:title="@string/double_tap_to_sleep_title"
                 android:summary="@string/double_tap_to_sleep_summary"
                 android:defaultValue="false" />
 
-            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+            <org.omnirom.omnigears.preference.SystemSettingSwitchPreference
                 android:key="status_bar_ime_notification"
                 android:title="@string/status_bar_ime_notification_title"
                 android:summary="@string/status_bar_ime_notification_summary"
                 android:defaultValue="true"/>
 
-        </PreferenceCategory>
-
-        <PreferenceScreen
+            <Preference
                 android:key="category_network_traffic"
                 android:title="@string/network_traffic_title"
+                android:summary="@string/network_traffic_summary"
                 android:fragment="org.omnirom.omnigears.interfacesettings.NetworkTraffic" />
 
+        </PreferenceCategory>
+
         <PreferenceCategory
             android:key="category_navigationbar"
             android:title="@string/navigationbar_title">
 
-            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+            <org.omnirom.omnigears.preference.SystemSettingSwitchPreference
                 android:key="navigation_bar_ime_button"
                 android:title="@string/navigation_bar_ime_button_title"
                 android:summary="@string/navigation_bar_ime_button_summary"
diff --git a/res/xml/network_traffic.xml b/res/xml/network_traffic.xml
index 6877985..6b73836 100644
--- a/res/xml/network_traffic.xml
+++ b/res/xml/network_traffic.xml
@@ -19,32 +19,42 @@
         android:key="category_network_traffic"
         android:title="@string/network_traffic_title">
 
+           <org.omnirom.omnigears.preference.SystemSettingSwitchPreference
+                android:key="network_traffic_enable"
+                android:title="@string/network_traffic_enable_title"
+                android:defaultValue="false"/>
+
             <ListPreference
                 android:key="network_traffic_state"
                 android:title="@string/show_network_traffic_state"
                 android:entries="@array/show_network_traffic_state_entries"
                 android:entryValues="@array/show_network_traffic_state_values"
-                android:persistent="false" />
+                android:persistent="false"
+                android:defaultValue="1"
+                android:dependency="network_traffic_enable" />
 
             <ListPreference
                 android:key="network_traffic_unit"
                 android:title="@string/show_network_traffic_unit"
                 android:entries="@array/show_network_traffic_unit_entries"
                 android:entryValues="@array/show_network_traffic_unit_values"
-                android:persistent="false" />
+                android:persistent="false"
+                android:dependency="network_traffic_enable" />
 
             <ListPreference
                 android:key="network_traffic_period"
                 android:title="@string/show_network_traffic_frequency"
                 android:entries="@array/show_network_traffic_frequency_entries"
                 android:entryValues="@array/show_network_traffic_frequency_values"
-                android:persistent="false" />
+                android:persistent="false"
+                android:dependency="network_traffic_enable" />
 
-            <org.omnirom.omnigears.preference.SystemCheckBoxPreference
+            <org.omnirom.omnigears.preference.SystemSettingSwitchPreference
                 android:key="network_traffic_autohide"
                 android:title="@string/network_traffic_autohide_title"
                 android:summary="@string/network_traffic_autohide_summary"
-                android:defaultValue="false"/>
+                android:defaultValue="false"
+                android:dependency="network_traffic_enable" />
 
             <org.omnirom.omnigears.preference.SeekBarPreference
                 android:key="network_traffic_autohide_threshold"