[1/2] Omnigears: QS panel opacity
Change-Id: I3a35e3c997b2c42f50541e6488c423bf4f278fa5
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index ef89228..592f73a 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -786,4 +786,9 @@
<string name="digital_clock_settings_summary">Style settings</string>
<string name="event_service_settings_title">Events</string>
+
+ <!-- QuickSettings Panel Transparency -->
+ <string name="quick_settings_category">Quick Settings</string>
+ <string name="qs_panel_alpha_title">Quick Settings opacity</string>
+ <string name="qs_panel_alpha_summary">Configure opacity of background</string>
</resources>
diff --git a/res/xml/bars_settings.xml b/res/xml/bars_settings.xml
index 87f9a58..f186f29 100644
--- a/res/xml/bars_settings.xml
+++ b/res/xml/bars_settings.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
+
<!-- Copyright (C) 2017 The OmniROM Project
This program is free software: you can redistribute it and/or modify
@@ -15,6 +16,7 @@
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-auto"
android:key="bars_settings"
android:title="@string/custom_bars_settings_title" >
@@ -70,7 +72,6 @@
android:entries="@array/quick_pulldown_entries"
android:entryValues="@array/quick_pulldown_values"
android:persistent="false" />
-
</PreferenceCategory>
<PreferenceCategory
@@ -88,7 +89,20 @@
android:title="@string/navigation_bar_menu_arrow_keys_title"
android:summary="@string/navigation_bar_menu_arrow_keys_summary"
android:defaultValue="fale"/>
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:key="quick_settings_category"
+ android:title="@string/quick_settings_category">
+
+ <org.omnirom.omnilib.preference.SeekBarPreference
+ android:key="qs_panel_alpha"
+ android:title="@string/qs_panel_alpha_title"
+ android:summary="@string/qs_panel_alpha_summary"
+ android:max="100"
+ settings:min="0"
+ settings:unitsRight="@string/unit_percent"
+ android:persistent="false" />
</PreferenceCategory>
<PreferenceCategory
diff --git a/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java b/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
index f37de41..d6a555c 100644
--- a/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
@@ -39,6 +39,7 @@
import org.omnirom.omnilib.preference.AppMultiSelectListPreference;
import org.omnirom.omnilib.preference.ScrollAppsViewPreference;
+import org.omnirom.omnilib.preference.SeekBarPreference;
import java.util.Arrays;
import java.util.ArrayList;
@@ -56,10 +57,12 @@
private static final String KEY_ASPECT_RATIO_APPS_LIST = "aspect_ratio_apps_list";
private static final String KEY_ASPECT_RATIO_CATEGORY = "aspect_ratio_category";
private static final String KEY_ASPECT_RATIO_APPS_LIST_SCROLLER = "aspect_ratio_apps_list_scroller";
+ private static final String QS_PANEL_ALPHA = "qs_panel_alpha";
private ListPreference mQuickPulldown;
private AppMultiSelectListPreference mAspectRatioAppsSelect;
private ScrollAppsViewPreference mAspectRatioApps;
+ private SeekBarPreference mQsPanelAlpha;
@Override
public int getMetricsCategory() {
@@ -92,6 +95,12 @@
prefScreen.removePreference(findPreference(NETWORK_TRAFFIC_ROOT));
}
+ mQsPanelAlpha = (SeekBarPreference) findPreference(QS_PANEL_ALPHA);
+ int qsPanelAlpha = Settings.System.getInt(getContentResolver(),
+ Settings.System.QS_PANEL_BG_ALPHA, 221);
+ mQsPanelAlpha.setValue((int)(((double) qsPanelAlpha / 255) * 100));
+ mQsPanelAlpha.setOnPreferenceChangeListener(this);
+
final PreferenceCategory aspectRatioCategory =
(PreferenceCategory) getPreferenceScreen().findPreference(KEY_ASPECT_RATIO_CATEGORY);
final boolean supportMaxAspectRatio = getResources().getBoolean(com.android.internal.R.bool.config_haveHigherAspectRatioScreen);
@@ -139,6 +148,12 @@
Settings.System.putString(getContentResolver(), Settings.System.ASPECT_RATIO_APPS_LIST, "");
}
return true;
+ } else if (preference == mQsPanelAlpha) {
+ int bgAlpha = (Integer) newValue;
+ int trueValue = (int) (((double) bgAlpha / 100) * 255);
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.QS_PANEL_BG_ALPHA, trueValue);
+ return true;
}
return false;
}