Skip to content

Commit

Permalink
Xposed Menu: Separate theming options
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Sep 11, 2023
1 parent fbc5ef9 commit 8a37172
Show file tree
Hide file tree
Showing 8 changed files with 467 additions and 385 deletions.
40 changes: 16 additions & 24 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<!-- Re-apply customizations on boot (deprecated) -->
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> -->

<!-- Access to the internet for checking for updates -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Schedule a job to check for updates -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- Notify about new iconify updates -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- Access storage for compilation of APKs in .iconify folder -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Read storage to be able to see what the compilation created -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- Schedule a job to check for updates -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!-- Notify about new iconify updates -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <!-- Access storage for compilation of APKs in .iconify folder -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- Read storage to be able to see what the compilation created -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />

<!-- Checking for Installed Music Players -->
tools:ignore="ScopedStorage" /> <!-- Checking for Installed Music Players -->
<queries>
<package android:name="com.maxmpz.audioplayer" />
<package android:name="code.name.monkey.retromusic" />
Expand Down Expand Up @@ -47,6 +39,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.Iconify"
tools:targetApi="tiramisu">
<activity
android:name=".ui.activities.XposedThemes"
android:exported="false" />
<activity
android:name=".ui.activities.QsPanelMargin"
android:exported="false" />
Expand Down Expand Up @@ -184,28 +179,27 @@

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</activity> <!-- Custom App Icons -->
<activity-alias
android:name=".SplashActivityThemed"
android:name=".SplashActivityRetro"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_themed"
android:roundIcon="@mipmap/ic_launcher_round_themed"
android:icon="@mipmap/ic_launcher_retro"
android:roundIcon="@mipmap/ic_launcher_round_retro"
android:targetActivity=".SplashActivity"
android:theme="@style/Theme.Iconify.SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias> <!-- Custom App Icons -->
</activity-alias>
<activity-alias
android:name=".SplashActivityRetro"
android:name=".SplashActivityThemed"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_retro"
android:roundIcon="@mipmap/ic_launcher_round_retro"
android:icon="@mipmap/ic_launcher_themed"
android:roundIcon="@mipmap/ic_launcher_round_themed"
android:targetActivity=".SplashActivity"
android:theme="@style/Theme.Iconify.SplashScreen">
<intent-filter>
Expand All @@ -224,7 +218,6 @@
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>

<!--
@Deprecated
<service
Expand All @@ -233,7 +226,6 @@
android:exported="true"
tools:ignore="ExportedService" />
-->

<!-- Quick Settings Tiles -->
<service
android:name=".services.TileNotchBarKiller"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,79 +67,6 @@ protected void onCreate(Bundle savedInstanceState) {
binding.hideTileLabel.toggle();
});

// 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();
});

// 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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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});
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/res/drawable-v24/ic_xposed_themes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M9.02,19.75C8.16,19.75 7.3,19.34 6.48,18.52L2.47,14.51C1.66,13.7 1.25,12.85 1.25,11.97C1.25,11.1 1.66,10.24 2.47,9.43L9.15,2.75C9.29,2.61 9.48,2.53 9.68,2.53C9.88,2.53 10.07,2.61 10.21,2.75L17.56,10.1C17.88,10.42 18.06,10.84 18.06,11.3C18.06,11.75 17.88,12.18 17.56,12.5L11.54,18.52C10.74,19.34 9.88,19.75 9.02,19.75ZM9.69,4.35L3.54,10.5C3.02,11.02 2.76,11.52 2.76,11.98C2.76,12.44 3.02,12.94 3.54,13.45L7.55,17.46C8.6,18.51 9.45,18.51 10.5,17.46L16.52,11.44C16.58,11.38 16.59,11.23 16.52,11.16L9.69,4.35Z"
android:fillColor="#292D32"/>
<path
android:pathData="M9.689,4.04C9.499,4.04 9.309,3.97 9.159,3.82L7.819,2.48C7.529,2.19 7.529,1.71 7.819,1.42C8.109,1.13 8.589,1.13 8.879,1.42L10.219,2.76C10.509,3.05 10.509,3.53 10.219,3.82C10.069,3.97 9.879,4.04 9.689,4.04Z"
android:fillColor="#292D32"/>
<path
android:pathData="M2.071,12.67C1.671,12.67 1.341,12.36 1.321,11.95C1.301,11.54 1.621,11.19 2.041,11.17L17.171,10.51C17.581,10.49 17.931,10.81 17.951,11.23C17.971,11.64 17.651,11.99 17.231,12.01L2.101,12.67C2.091,12.67 2.081,12.67 2.071,12.67Z"
android:fillColor="#292D32"/>
<path
android:pathData="M16,22.75H3C2.59,22.75 2.25,22.41 2.25,22C2.25,21.59 2.59,21.25 3,21.25H16C16.41,21.25 16.75,21.59 16.75,22C16.75,22.41 16.41,22.75 16,22.75Z"
android:fillColor="#292D32"/>
<path
android:pathData="M18.85,20.83C17.42,20.83 16.25,19.66 16.25,18.23C16.25,16.78 17.96,14.86 18.3,14.48C18.58,14.17 19.12,14.17 19.4,14.48C19.74,14.85 21.45,16.77 21.45,18.22C21.45,19.67 20.28,20.83 18.85,20.83ZM18.85,16.17C18.3,16.89 17.75,17.77 17.75,18.24C17.75,18.85 18.24,19.34 18.85,19.34C19.46,19.34 19.95,18.85 19.95,18.24C19.95,17.76 19.4,16.88 18.85,16.17Z"
android:fillColor="#292D32"/>
</vector>
Loading

0 comments on commit 8a37172

Please sign in to comment.