[2/2] OmniGears: Network Traffic
Change-Id: Id0a7066b7936d4a917cc33e11763eb25c78ebd2a
diff --git a/res/values/custom_arrays.xml b/res/values/custom_arrays.xml
index 8cd1433..8b5677b 100644
--- a/res/values/custom_arrays.xml
+++ b/res/values/custom_arrays.xml
@@ -157,4 +157,45 @@
<item>0</item>
<item>1</item>
</string-array>
+
+ <!-- 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>
+ </string-array>
+
+ <!-- Network Traffic Display Unit -->
+ <string-array name="show_network_traffic_unit_entries" translatable="false">
+ <item>@string/show_network_traffic_bit</item>
+ <item>@string/show_network_traffic_byte</item>
+ </string-array>
+
+ <string-array name="show_network_traffic_unit_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ </string-array>
+
+ <!-- Network Traffic Period -->
+ <string-array name="show_network_traffic_frequency_entries" translatable="false">
+ <item>@string/show_network_traffic_500</item>
+ <item>@string/show_network_traffic_1000</item>
+ <item>@string/show_network_traffic_1500</item>
+ <item>@string/show_network_traffic_2000</item>
+ </string-array>
+
+ <string-array name="show_network_traffic_frequency_values" translatable="false">
+ <item>500</item>
+ <item>1000</item>
+ <item>1500</item>
+ <item>2000</item>
+ </string-array>
</resources>
diff --git a/res/values/custom_integers.xml b/res/values/custom_integers.xml
new file mode 100644
index 0000000..0b75685
--- /dev/null
+++ b/res/values/custom_integers.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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/>.
+ -->
+
+<resources>
+
+ <!-- Overlays for NetworkTraffic to use -->
+ <integer name="maskUp">0x00000001</integer>
+ <integer name="maskDown">0x00000002</integer>
+ <integer name="maskUnit">0x00000004</integer>
+ <integer name="maskPeriod">0xFFFF0000</integer>
+</resources>
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index 33d50d8..69e1693 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -188,4 +188,24 @@
<string name="notification_title">Notification panel</string>
<string name="status_bar_custom_header_title">Custom header image</string>
<string name="status_bar_custom_header_summary">Enable notification panel header image</string>
+
+ <!-- Network traffic -->
+ <string name="network_traffic_title">Network traffic</string>
+ <string name="show_network_traffic_state">Status bar traffic monitor</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>
+ <string name="show_network_traffic_up">Outgoing</string>
+ <string name="show_network_traffic_down">Incoming</string>
+ <string name="show_network_traffic_all">Outgoing and incoming</string>
+ <string name="show_network_traffic_bit">Bits per second</string>
+ <string name="show_network_traffic_byte">Bytes per second</string>
+ <string name="show_network_traffic_500">500 ms</string>
+ <string name="show_network_traffic_1000">1000 ms</string>
+ <string name="show_network_traffic_1500">1500 ms</string>
+ <string name="show_network_traffic_2000">2000 ms</string>
+ <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>
+
</resources>
diff --git a/res/xml/bars_settings.xml b/res/xml/bars_settings.xml
index 09f5053..f9f38a4 100644
--- a/res/xml/bars_settings.xml
+++ b/res/xml/bars_settings.xml
@@ -36,6 +36,50 @@
android:persistent="false"/>
</PreferenceCategory>
+ <!-- Network traffic meter -->
+ <PreferenceCategory
+ android:key="category_network_traffic"
+ android:title="@string/network_traffic_title">
+
+ <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" />
+
+ <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" />
+
+ <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" />
+
+ <com.android.settings.preference.SystemCheckBoxPreference
+ android:key="network_traffic_autohide"
+ android:title="@string/network_traffic_autohide_title"
+ android:summary="@string/network_traffic_autohide_summary"
+ android:defaultValue="false"/>
+
+ <com.android.settings.preference.SeekBarPreference
+ android:key="network_traffic_autohide_threshold"
+ android:title="@string/network_traffic_autohide_threshold"
+ android:max="100"
+ settings:min="0"
+ settings:unitsLeft=""
+ settings:unitsRight="kB/s"
+ android:dependency="network_traffic_autohide"
+ android:persistent="false" />
+
+ </PreferenceCategory>
+
<PreferenceCategory
android:key="notification_category"
android:title="@string/notification_title" >