OmniGears: Add option to enable activity indicators on status bar (2/2)

It needs that OmniGears patch: https://gerrit.omnirom.org/#/c/2509/

Change-Id: I298948d106161bafa9cd5c0b8624ce474e701e7a
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index d3ecf63..e79bcb6 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -163,6 +163,10 @@
     <string name="show_network_speed">Network speed indicator</string>
     <string name="show_network_speed_summary">Show network speed in statusbar</string>
 
+    <!-- Status Bar Activity Indicators -->
+    <string name="show_activity_indicators_on_status_bar_title">Network activity indicator</string>
+    <string name="show_activity_indicators_on_status_bar_summary">Show network activity in statusbar</string>
+
     <!-- Hardware keys -->
     <string name="button_keys_title">Keys</string>
     <string name="keys_bindings_title">Key actions</string>
diff --git a/res/xml/bars_and_menus_settings.xml b/res/xml/bars_and_menus_settings.xml
index 0eec521..11f08e6 100644
--- a/res/xml/bars_and_menus_settings.xml
+++ b/res/xml/bars_and_menus_settings.xml
@@ -43,6 +43,12 @@
             android:summary="@string/show_network_speed_summary"
             android:defaultValue="false" />
 
+    <CheckBoxPreference
+            android:key="status_bar_network_activity"
+            android:title="@string/show_activity_indicators_on_status_bar_title"
+            android:summary="@string/show_activity_indicators_on_status_bar_summary"
+            android:defaultValue="false" />
+
     <PreferenceCategory
             android:key="category_recent_panel"
             android:title="@string/bars_and_menus_category_recent_panel_title"/>
diff --git a/src/org/omnirom/omnigears/BarsAndMenusSettings.java b/src/org/omnirom/omnigears/BarsAndMenusSettings.java
index 7fecbe5..5764728 100644
--- a/src/org/omnirom/omnigears/BarsAndMenusSettings.java
+++ b/src/org/omnirom/omnigears/BarsAndMenusSettings.java
@@ -55,12 +55,14 @@
     private static final String STATUS_BAR_TRAFFIC = "status_bar_traffic";
     private static final String RECENT_MENU_CLEAR_ALL = "recent_menu_clear_all";
     private static final String RECENT_MENU_CLEAR_ALL_LOCATION = "recent_menu_clear_all_location";
+    private static final String STATUS_BAR_NETWORK_ACTIVITY = "status_bar_network_activity";
 
     private CheckBoxPreference mStatusBarBrightnessControl;
     private CheckBoxPreference mStatusBarNotifCount;
     private CheckBoxPreference mStatusBarTraffic;
     private CheckBoxPreference mRecentClearAll;
     private ListPreference mRecentClearAllPosition;
+    private CheckBoxPreference mStatusBarNetworkActivity;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -102,6 +104,11 @@
              mRecentClearAllPosition.setValue(recentClearAllPosition);
         }
         mRecentClearAllPosition.setOnPreferenceChangeListener(this);
+
+        mStatusBarNetworkActivity = (CheckBoxPreference) prefSet.findPreference(STATUS_BAR_NETWORK_ACTIVITY);
+        mStatusBarNetworkActivity.setChecked(Settings.System.getInt(resolver,
+            Settings.System.STATUS_BAR_NETWORK_ACTIVITY, 0) == 1);
+         mStatusBarNetworkActivity.setOnPreferenceChangeListener(this);
     }
 
     @Override
@@ -127,6 +134,10 @@
         } else if (preference == mRecentClearAllPosition) {
             String value = (String) objValue;
             Settings.System.putString(resolver, Settings.System.CLEAR_RECENTS_BUTTON_LOCATION, value);
+        } else if (preference == mStatusBarNetworkActivity) {
+            boolean value = (Boolean) objValue;
+            Settings.System.putInt(resolver,
+                Settings.System.STATUS_BAR_NETWORK_ACTIVITY, value ? 1 : 0);
         } else {
             return false;
         }