From 405df016e5505edf013d134550ce7c49bd4eaeb3 Mon Sep 17 00:00:00 2001 From: Pranav Vashi Date: Mon, 29 Apr 2024 09:04:35 +0900 Subject: [PATCH] Evolver: Network traffic mode for status bar [3/3] Signed-off-by: Pranav Vashi Change-Id: Id540c34fc53851203495680dacf93b08098b4ce0 Signed-off-by: AnierinB --- res/values/evolution_arrays.xml | 37 +++++++++ res/values/evolution_strings.xml | 37 +++++++++ res/xml/evolution_settings_status_bar.xml | 7 ++ res/xml/network_traffic_settings.xml | 76 +++++++++++++++++++ .../statusbar/NetworkTrafficSettings.java | 60 +++++++++++++++ 5 files changed, 217 insertions(+) create mode 100644 res/xml/network_traffic_settings.xml create mode 100644 src/org/evolution/settings/fragments/statusbar/NetworkTrafficSettings.java diff --git a/res/values/evolution_arrays.xml b/res/values/evolution_arrays.xml index e68f414..dd3bd3d 100644 --- a/res/values/evolution_arrays.xml +++ b/res/values/evolution_arrays.xml @@ -234,4 +234,41 @@ 1 + + + @string/network_traffic_location_disable + @string/network_traffic_location_statusbar + + + + + 0 + 1 + + + + + @string/network_traffic_mode_all + @string/network_traffic_mode_up + @string/network_traffic_mode_down + + + + 0 + 1 + 2 + + + + @string/network_traffic_units_bits + @string/network_traffic_units_bytes + + + + 0 + 1 + 2 + 3 + + diff --git a/res/values/evolution_strings.xml b/res/values/evolution_strings.xml index 2d19411..2629dd6 100644 --- a/res/values/evolution_strings.xml +++ b/res/values/evolution_strings.xml @@ -153,6 +153,8 @@ Display battery status for the connected Bluetooth device, if available Colored icons Use launcher icons for app notifications + Network traffic monitor + Display and customize current network traffic levels Notification count Display the number of unread notifications on each app icon Privacy indicators @@ -163,6 +165,32 @@ Screen projection Display an indicator when the screen is being projected + + Location + Disabled + Statusbar + Quick Statusbar + Display mode + Upload only + Download only + Upload and download + Auto hide + Hide the traffic monitor when inactive + Kb/s + KB/s + Inactivity threshold + Refresh interval + Duration after which speed is remeasured + Traffic measurement units + Bits per second (b/s) + Kilobits per second (kb/s) + Megabits per second (Mb/s) + Bytes per second (B/s) + Kilobytes per second (kB/s) + Megabytes per second (MB/s) + Hide arrows + Hide the network traffic indicator arrows + Interface Brightness slider @@ -284,4 +312,13 @@ by default Default value: %s\nLong tap to set Default value is set + + + Enable + Disable + + + milliseconds + dp + seconds diff --git a/res/xml/evolution_settings_status_bar.xml b/res/xml/evolution_settings_status_bar.xml index 4d00f41..237b28a 100644 --- a/res/xml/evolution_settings_status_bar.xml +++ b/res/xml/evolution_settings_status_bar.xml @@ -99,6 +99,13 @@ android:summary="@string/status_bar_colored_icons_summary" android:defaultValue="false" /> + + + + + + + + + + + + + + + + + + + + diff --git a/src/org/evolution/settings/fragments/statusbar/NetworkTrafficSettings.java b/src/org/evolution/settings/fragments/statusbar/NetworkTrafficSettings.java new file mode 100644 index 0000000..851c5a5 --- /dev/null +++ b/src/org/evolution/settings/fragments/statusbar/NetworkTrafficSettings.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2017-2024 crDroid Android Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.evolution.settings.fragments.statusbar; + +import android.content.ContentResolver; +import android.content.Context; +import android.os.Bundle; +import android.os.UserHandle; + +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.settings.R; +import com.android.settings.search.BaseSearchIndexProvider; +import com.android.settings.SettingsPreferenceFragment; +import com.android.settingslib.search.SearchIndexable; + +import java.util.List; + +import lineageos.providers.LineageSettings; + +@SearchIndexable +public class NetworkTrafficSettings extends SettingsPreferenceFragment { + + private static final String TAG = "NetworkTrafficSettings"; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.network_traffic_settings); + } + + @Override + public int getMetricsCategory() { + return MetricsEvent.EVOLVER; + } + + public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider(R.xml.network_traffic_settings) { + + @Override + public List getNonIndexableKeys(Context context) { + List keys = super.getNonIndexableKeys(context); + return keys; + } + }; +}