Skip to content

Commit

Permalink
Revert "Add Dynamic colors option for Android 12 or above (#8)" (#9)
Browse files Browse the repository at this point in the history
This reverts commit 6ee1a39.
  • Loading branch information
GabrielBRDeveloper authored Feb 18, 2024
1 parent 6ee1a39 commit eed85a2
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import android.content.Intent;
import android.content.res.Configuration;
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.R;
Expand All @@ -32,11 +30,6 @@ public void onCreate() {
if (GlobalConfig.get(GlobalConfig.KEY_LOGGER_SERVICE)) {
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.preference.SwitchPreference;
import com.google.android.material.color.DynamicColors;

import com.panda3ds.pandroid.R;
import com.panda3ds.pandroid.app.BaseActivity;
Expand All @@ -25,23 +23,5 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable S
GlobalConfig.set(GlobalConfig.KEY_APP_THEME, (int) value);
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);
}

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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_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<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);
Expand Down
5 changes: 1 addition & 4 deletions src/pandroid/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
<string name="light">Light</string>
<string name="dark">Dark</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 -->
<string name="actions">Actions</string>
<string name="exit">Exit</string>
Expand All @@ -59,8 +56,8 @@
<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_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_summary">Use shader recompiler.</string>
<string name="graphics">Graphics</string>
<string name="loading">Loading</string>
</resources>
18 changes: 2 additions & 16 deletions src/pandroid/app/src/main/res/xml/appearance_preference.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<com.panda3ds.pandroid.view.preferences.SingleSelectionPreferences
app:key="theme"
app:title="@string/theme"
Expand All @@ -13,16 +11,4 @@
<Preference app:title="@string/black"/>

</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>

0 comments on commit eed85a2

Please sign in to comment.