Revert "Add Dynamic colors option for Android 12 or above (#8)" (#9)

This reverts commit 6ee1a39fb4.
This commit is contained in:
Gabriel Machado 2024-02-18 02:29:17 -04:00 committed by GitHub
parent 6ee1a39fb4
commit eed85a2c7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 49 deletions

View file

@ -5,8 +5,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import com.google.android.material.color.DynamicColors;
import com.google.android.material.color.DynamicColorsOptions;
import com.panda3ds.pandroid.AlberDriver; import com.panda3ds.pandroid.AlberDriver;
import com.panda3ds.pandroid.R; import com.panda3ds.pandroid.R;
@ -32,11 +30,6 @@ public class PandroidApplication extends Application {
if (GlobalConfig.get(GlobalConfig.KEY_LOGGER_SERVICE)) { if (GlobalConfig.get(GlobalConfig.KEY_LOGGER_SERVICE)) {
startService(new Intent(this, LoggerService.class)); startService(new Intent(this, LoggerService.class));
} }
if (GlobalConfig.get(GlobalConfig.KEY_DYNAMIC_COLORS)) {
DynamicColorsOptions dynamicColorsOptions = new DynamicColorsOptions.Builder()
.build();
DynamicColors.applyToActivitiesIfAvailable(this, dynamicColorsOptions);
}
} }
public static int getThemeId() { public static int getThemeId() {

View file

@ -3,8 +3,6 @@ package com.panda3ds.pandroid.app.preferences;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.preference.SwitchPreference;
import com.google.android.material.color.DynamicColors;
import com.panda3ds.pandroid.R; import com.panda3ds.pandroid.R;
import com.panda3ds.pandroid.app.BaseActivity; import com.panda3ds.pandroid.app.BaseActivity;
@ -25,23 +23,5 @@ public class AppearancePreferences extends BasePreferenceFragment {
GlobalConfig.set(GlobalConfig.KEY_APP_THEME, (int) value); GlobalConfig.set(GlobalConfig.KEY_APP_THEME, (int) value);
return false; return false;
}); });
setItemClick("dynamic_colors", pref -> GlobalConfig.set(GlobalConfig.KEY_DYNAMIC_COLORS, ((SwitchPreference) pref).isChecked()));
refresh();
}
@Override
public void onResume() {
super.onResume();
refresh();
}
private void refresh() {
((SwitchPreference) findPreference("dynamic_colors")).setChecked(GlobalConfig.get(GlobalConfig.KEY_DYNAMIC_COLORS));
if (!DynamicColors.isDynamicColorAvailable()) {
((SwitchPreference) findPreference("dynamic_colors")).setEnabled(false);
}
} }
}
}

View file

@ -20,7 +20,6 @@ public class GlobalConfig {
public static final Key<Boolean> KEY_SHADER_JIT = new Key<>("emu.shader_jit", false); public static final Key<Boolean> KEY_SHADER_JIT = new Key<>("emu.shader_jit", false);
public static final Key<Boolean> KEY_SHOW_PERFORMANCE_OVERLAY = new Key<>("dev.performanceOverlay", false); public static final Key<Boolean> KEY_SHOW_PERFORMANCE_OVERLAY = new Key<>("dev.performanceOverlay", false);
public static final Key<Boolean> KEY_DYNAMIC_COLORS = new Key<>("app.dynamic_colors", false);
public static final Key<Boolean> KEY_LOGGER_SERVICE = new Key<>("dev.loggerService", false); public static final Key<Boolean> KEY_LOGGER_SERVICE = new Key<>("dev.loggerService", false);
public static final Key<Integer> KEY_APP_THEME = new Key<>("app.theme", THEME_ANDROID); public static final Key<Integer> KEY_APP_THEME = new Key<>("app.theme", THEME_ANDROID);
public static final Key<Boolean> KEY_SCREEN_GAMEPAD_VISIBLE = new Key<>("app.screen_gamepad.visible", true); public static final Key<Boolean> KEY_SCREEN_GAMEPAD_VISIBLE = new Key<>("app.screen_gamepad.visible", true);

View file

@ -34,9 +34,6 @@
<string name="light">Light</string> <string name="light">Light</string>
<string name="dark">Dark</string> <string name="dark">Dark</string>
<string name="black">Black</string> <string name="black">Black</string>
<string name="colors">Colors</string>
<string name="pref_dynamic_colors_title">Use Dynamic Colors</string>
<string name="pref_dynamic_colors_summary">Dynamic colors will be used.</string>
<!-- Game Menu --> <!-- Game Menu -->
<string name="actions">Actions</string> <string name="actions">Actions</string>
<string name="exit">Exit</string> <string name="exit">Exit</string>
@ -59,8 +56,8 @@
<string name="pref_performance_monitor_summary">Show overlay with fps, memory, etc.</string> <string name="pref_performance_monitor_summary">Show overlay with fps, memory, etc.</string>
<string name="pref_logger_service_title">Logger</string> <string name="pref_logger_service_title">Logger</string>
<string name="pref_logger_service_summary">Store application logs to file.</string> <string name="pref_logger_service_summary">Store application logs to file.</string>
<string name="graphics">Graphics</string>
<string name="pref_shader_jit_title">Shader JIT</string> <string name="pref_shader_jit_title">Shader JIT</string>
<string name="pref_shader_jit_summary">Use shader recompiler.</string> <string name="pref_shader_jit_summary">Use shader recompiler.</string>
<string name="graphics">Graphics</string>
<string name="loading">Loading</string> <string name="loading">Loading</string>
</resources> </resources>

View file

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.panda3ds.pandroid.view.preferences.SingleSelectionPreferences <com.panda3ds.pandroid.view.preferences.SingleSelectionPreferences
app:key="theme" app:key="theme"
app:title="@string/theme" app:title="@string/theme"
@ -13,16 +11,4 @@
<Preference app:title="@string/black"/> <Preference app:title="@string/black"/>
</com.panda3ds.pandroid.view.preferences.SingleSelectionPreferences> </com.panda3ds.pandroid.view.preferences.SingleSelectionPreferences>
<PreferenceCategory
app:iconSpaceReserved="false"
app:title="@string/colors">
<SwitchPreference
android:key="dynamic_colors"
app:title="@string/pref_dynamic_colors_title"
app:summary="@string/pref_dynamic_colors_summary"
app:iconSpaceReserved="false"/>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>