From 8a3717293b327b9414496a5cbcfc27f25319585c Mon Sep 17 00:00:00 2001 From: DrDisagree Date: Tue, 12 Sep 2023 00:41:12 +0600 Subject: [PATCH] Xposed Menu: Separate theming options --- app/src/main/AndroidManifest.xml | 40 +-- .../ui/activities/XposedQuickSettings.java | 73 ---- .../iconify/ui/activities/XposedThemes.java | 110 ++++++ .../iconify/ui/fragments/XposedMenu.java | 2 + .../res/drawable-v24/ic_xposed_themes.xml | 21 ++ .../layout/activity_xposed_quick_settings.xml | 287 ---------------- .../res/layout/activity_xposed_themes.xml | 317 ++++++++++++++++++ app/src/main/res/values/strings.xml | 2 +- 8 files changed, 467 insertions(+), 385 deletions(-) create mode 100644 app/src/main/java/com/drdisagree/iconify/ui/activities/XposedThemes.java create mode 100644 app/src/main/res/drawable-v24/ic_xposed_themes.xml create mode 100644 app/src/main/res/layout/activity_xposed_themes.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 33ad9bed1..7ecd32cb4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,25 +1,17 @@ - - - - - - - - - - + + + + - - + tools:ignore="ScopedStorage" /> @@ -47,6 +39,9 @@ android:supportsRtl="true" android:theme="@style/Theme.Iconify" tools:targetApi="tiramisu"> + @@ -184,14 +179,13 @@ - - + @@ -199,13 +193,13 @@ - + @@ -224,7 +218,6 @@ - - { - RPrefs.putBoolean(LIGHT_QSPANEL, isChecked); - binding.enableDualTone.setEnabled(isChecked); - new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); - }); - binding.lightThemeContainer.setOnClickListener(v -> { - if (binding.enableLightTheme.isEnabled()) - binding.enableLightTheme.toggle(); - }); - binding.enableDualTone.setEnabled(binding.enableLightTheme.isChecked()); - - // Dual Tone - binding.enableDualTone.setChecked(RPrefs.getBoolean(DUALTONE_QSPANEL, false)); - binding.enableDualTone.setOnCheckedChangeListener((buttonView, isChecked) -> { - RPrefs.putBoolean(DUALTONE_QSPANEL, isChecked); - new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::doubleToggleDarkMode, SWITCH_ANIMATION_DELAY); - }); - - binding.dualToneContainer.setOnClickListener(v -> { - if (binding.enableDualTone.isEnabled()) - binding.enableDualTone.toggle(); - }); - - // Pixel Black Theme - binding.enableBlackTheme.setChecked(RPrefs.getBoolean(BLACK_QSPANEL, false)); - binding.enableBlackTheme.setOnCheckedChangeListener((buttonView, isChecked) -> { - RPrefs.putBoolean(BLACK_QSPANEL, isChecked); - new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); - }); - binding.blackThemeContainer.setOnClickListener(v -> { - if (binding.enableBlackTheme.isEnabled()) - binding.enableBlackTheme.toggle(); - }); - - // Fluid QS Theme - binding.enableFluidTheme.setChecked(RPrefs.getBoolean(FLUID_QSPANEL, false)); - binding.enableFluidTheme.setOnCheckedChangeListener((buttonView, isChecked) -> { - RPrefs.putBoolean(FLUID_QSPANEL, isChecked); - binding.enableNotificationTransparency.setEnabled(isChecked); - binding.enablePowermenuTransparency.setEnabled(isChecked); - new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); - }); - binding.fluidThemeContainer.setOnClickListener(v -> { - if (binding.enableFluidTheme.isEnabled()) - binding.enableFluidTheme.toggle(); - }); - binding.enableNotificationTransparency.setEnabled(binding.enableFluidTheme.isChecked()); - binding.enablePowermenuTransparency.setEnabled(binding.enableFluidTheme.isChecked()); - - // Fluid QS Notification Transparency - binding.enableNotificationTransparency.setChecked(RPrefs.getBoolean(FLUID_NOTIF_TRANSPARENCY, false)); - binding.enableNotificationTransparency.setOnCheckedChangeListener((buttonView, isChecked) -> { - RPrefs.putBoolean(FLUID_NOTIF_TRANSPARENCY, isChecked); - new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); - }); - binding.notificationTransparencyContainer.setOnClickListener(v -> { - if (binding.enableNotificationTransparency.isEnabled()) - binding.enableNotificationTransparency.toggle(); - }); - - // Fluid QS Power Menu Transparency - binding.enablePowermenuTransparency.setChecked(RPrefs.getBoolean(FLUID_POWERMENU_TRANSPARENCY, false)); - binding.enablePowermenuTransparency.setOnCheckedChangeListener((buttonView, isChecked) -> { - RPrefs.putBoolean(FLUID_POWERMENU_TRANSPARENCY, isChecked); - new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); - }); - binding.powermenuTransparencyContainer.setOnClickListener(v -> { - if (binding.enablePowermenuTransparency.isEnabled()) - binding.enablePowermenuTransparency.toggle(); - }); - // QQS panel top margin slider binding.qqsTopMarginOutput.setText(getResources().getString(R.string.opt_selected) + ' ' + Prefs.getInt(FABRICATED_QQS_TOPMARGIN, 100) + "dp"); binding.qqsTopMarginSeekbar.setValue(Prefs.getInt(FABRICATED_QQS_TOPMARGIN, 100)); diff --git a/app/src/main/java/com/drdisagree/iconify/ui/activities/XposedThemes.java b/app/src/main/java/com/drdisagree/iconify/ui/activities/XposedThemes.java new file mode 100644 index 000000000..b8f9211de --- /dev/null +++ b/app/src/main/java/com/drdisagree/iconify/ui/activities/XposedThemes.java @@ -0,0 +1,110 @@ +package com.drdisagree.iconify.ui.activities; + +import static com.drdisagree.iconify.common.Const.SWITCH_ANIMATION_DELAY; +import static com.drdisagree.iconify.common.Preferences.BLACK_QSPANEL; +import static com.drdisagree.iconify.common.Preferences.DUALTONE_QSPANEL; +import static com.drdisagree.iconify.common.Preferences.FLUID_NOTIF_TRANSPARENCY; +import static com.drdisagree.iconify.common.Preferences.FLUID_POWERMENU_TRANSPARENCY; +import static com.drdisagree.iconify.common.Preferences.FLUID_QSPANEL; +import static com.drdisagree.iconify.common.Preferences.LIGHT_QSPANEL; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; + +import com.drdisagree.iconify.R; +import com.drdisagree.iconify.config.RPrefs; +import com.drdisagree.iconify.databinding.ActivityXposedQuickSettingsBinding; +import com.drdisagree.iconify.databinding.ActivityXposedThemesBinding; +import com.drdisagree.iconify.ui.utils.ViewHelper; +import com.drdisagree.iconify.utils.SystemUtil; + +public class XposedThemes extends AppCompatActivity { + + private ActivityXposedThemesBinding binding; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + binding = ActivityXposedThemesBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); + + // Header + ViewHelper.setHeader(this, binding.header.toolbar, R.string.activity_title_themes); + + // Light Theme + binding.enableLightTheme.setChecked(RPrefs.getBoolean(LIGHT_QSPANEL, false)); + binding.enableLightTheme.setOnCheckedChangeListener((buttonView, isChecked) -> { + RPrefs.putBoolean(LIGHT_QSPANEL, isChecked); + binding.enableDualTone.setEnabled(isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); + }); + binding.lightThemeContainer.setOnClickListener(v -> { + if (binding.enableLightTheme.isEnabled()) + binding.enableLightTheme.toggle(); + }); + binding.enableDualTone.setEnabled(binding.enableLightTheme.isChecked()); + + // Dual Tone + binding.enableDualTone.setChecked(RPrefs.getBoolean(DUALTONE_QSPANEL, false)); + binding.enableDualTone.setOnCheckedChangeListener((buttonView, isChecked) -> { + RPrefs.putBoolean(DUALTONE_QSPANEL, isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::doubleToggleDarkMode, SWITCH_ANIMATION_DELAY); + }); + + binding.dualToneContainer.setOnClickListener(v -> { + if (binding.enableDualTone.isEnabled()) + binding.enableDualTone.toggle(); + }); + + // Pixel Black Theme + binding.enableBlackTheme.setChecked(RPrefs.getBoolean(BLACK_QSPANEL, false)); + binding.enableBlackTheme.setOnCheckedChangeListener((buttonView, isChecked) -> { + RPrefs.putBoolean(BLACK_QSPANEL, isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); + }); + binding.blackThemeContainer.setOnClickListener(v -> { + if (binding.enableBlackTheme.isEnabled()) + binding.enableBlackTheme.toggle(); + }); + + // Fluid QS Theme + binding.enableFluidTheme.setChecked(RPrefs.getBoolean(FLUID_QSPANEL, false)); + binding.enableFluidTheme.setOnCheckedChangeListener((buttonView, isChecked) -> { + RPrefs.putBoolean(FLUID_QSPANEL, isChecked); + binding.enableNotificationTransparency.setEnabled(isChecked); + binding.enablePowermenuTransparency.setEnabled(isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); + }); + binding.fluidThemeContainer.setOnClickListener(v -> { + if (binding.enableFluidTheme.isEnabled()) + binding.enableFluidTheme.toggle(); + }); + binding.enableNotificationTransparency.setEnabled(binding.enableFluidTheme.isChecked()); + binding.enablePowermenuTransparency.setEnabled(binding.enableFluidTheme.isChecked()); + + // Fluid QS Notification Transparency + binding.enableNotificationTransparency.setChecked(RPrefs.getBoolean(FLUID_NOTIF_TRANSPARENCY, false)); + binding.enableNotificationTransparency.setOnCheckedChangeListener((buttonView, isChecked) -> { + RPrefs.putBoolean(FLUID_NOTIF_TRANSPARENCY, isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); + }); + binding.notificationTransparencyContainer.setOnClickListener(v -> { + if (binding.enableNotificationTransparency.isEnabled()) + binding.enableNotificationTransparency.toggle(); + }); + + // Fluid QS Power Menu Transparency + binding.enablePowermenuTransparency.setChecked(RPrefs.getBoolean(FLUID_POWERMENU_TRANSPARENCY, false)); + binding.enablePowermenuTransparency.setOnCheckedChangeListener((buttonView, isChecked) -> { + RPrefs.putBoolean(FLUID_POWERMENU_TRANSPARENCY, isChecked); + new Handler(Looper.getMainLooper()).postDelayed(SystemUtil::handleSystemUIRestart, SWITCH_ANIMATION_DELAY); + }); + binding.powermenuTransparencyContainer.setOnClickListener(v -> { + if (binding.enablePowermenuTransparency.isEnabled()) + binding.enablePowermenuTransparency.toggle(); + }); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/drdisagree/iconify/ui/fragments/XposedMenu.java b/app/src/main/java/com/drdisagree/iconify/ui/fragments/XposedMenu.java index b6d122526..c1685a5b4 100644 --- a/app/src/main/java/com/drdisagree/iconify/ui/fragments/XposedMenu.java +++ b/app/src/main/java/com/drdisagree/iconify/ui/fragments/XposedMenu.java @@ -49,6 +49,7 @@ import com.drdisagree.iconify.ui.activities.XposedLockscreenClock; import com.drdisagree.iconify.ui.activities.XposedOthers; import com.drdisagree.iconify.ui.activities.XposedQuickSettings; +import com.drdisagree.iconify.ui.activities.XposedThemes; import com.drdisagree.iconify.ui.activities.XposedTransparencyBlur; import com.drdisagree.iconify.utils.FabricatedUtil; import com.drdisagree.iconify.utils.ObservableVariable; @@ -194,6 +195,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, xposed_menu.add(new Object[]{XposedTransparencyBlur.class, getResources().getString(R.string.activity_title_transparency_blur), getResources().getString(R.string.activity_desc_transparency_blur), R.drawable.ic_xposed_transparency_blur}); xposed_menu.add(new Object[]{XposedQuickSettings.class, getResources().getString(R.string.activity_title_quick_settings), getResources().getString(R.string.activity_desc_quick_settings), R.drawable.ic_xposed_quick_settings}); + xposed_menu.add(new Object[]{XposedThemes.class, getResources().getString(R.string.activity_title_themes), getResources().getString(R.string.activity_desc_themes), R.drawable.ic_xposed_themes}); xposed_menu.add(new Object[]{XposedBatteryStyle.class, getResources().getString(R.string.activity_title_battery_style), getResources().getString(R.string.activity_desc_battery_style), R.drawable.ic_colored_battery}); xposed_menu.add(new Object[]{XposedHeaderImage.class, getResources().getString(R.string.activity_title_header_image), getResources().getString(R.string.activity_desc_header_image), R.drawable.ic_xposed_header_image}); xposed_menu.add(new Object[]{XposedHeaderClock.class, getResources().getString(R.string.activity_title_header_clock), getResources().getString(R.string.activity_desc_header_clock), R.drawable.ic_xposed_header_clock}); diff --git a/app/src/main/res/drawable-v24/ic_xposed_themes.xml b/app/src/main/res/drawable-v24/ic_xposed_themes.xml new file mode 100644 index 000000000..55a142330 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_xposed_themes.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/layout/activity_xposed_quick_settings.xml b/app/src/main/res/layout/activity_xposed_quick_settings.xml index cc9cc5f59..ba22f60d4 100644 --- a/app/src/main/res/layout/activity_xposed_quick_settings.xml +++ b/app/src/main/res/layout/activity_xposed_quick_settings.xml @@ -117,293 +117,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index de42c5ed2..1872458fe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -417,7 +417,7 @@ Transparency & Blur Enable QS blur and transparency Themes - Theming related stuffs + Personalize with themes Quick Settings Tweaks related to QS panel Battery Style