mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 23:59:21 -04:00
New option: sustained performance
This commit is contained in:
parent
154fb36cb0
commit
14529f109b
@ -14,6 +14,7 @@ import net.kdt.pojavlaunch.utils.MCOptionUtils;
|
||||
import java.io.*;
|
||||
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF;
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_SUSTAINED_PERFORMANCE;
|
||||
|
||||
public class MainActivity extends BaseMainActivity {
|
||||
public static ControlLayout mControlLayout;
|
||||
@ -24,6 +25,11 @@ public class MainActivity extends BaseMainActivity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
initLayout(R.layout.main_with_customctrl);
|
||||
|
||||
// Set the sustained performance mode for available APIs
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
getWindow().setSustainedPerformanceMode(PREF_SUSTAINED_PERFORMANCE);
|
||||
|
||||
super.ingameControlsEditorListener = menuItem -> {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.menu_ctrl_load:
|
||||
|
@ -33,6 +33,7 @@ public class LauncherPreferences
|
||||
public static int PREF_CONTROL_RIGHT_OFFSET = 0;
|
||||
public static int PREF_CONTROL_BOTTOM_OFFSET = 0;
|
||||
public static int PREF_CONTROL_LEFT_OFFSET = 0;
|
||||
public static boolean PREF_SUSTAINED_PERFORMANCE = false;
|
||||
|
||||
|
||||
public static void loadPreferences(Context ctx) {
|
||||
@ -61,6 +62,7 @@ public class LauncherPreferences
|
||||
PREF_CONTROL_RIGHT_OFFSET = DEFAULT_PREF.getInt("controlRightOffset", 0);
|
||||
PREF_CONTROL_BOTTOM_OFFSET = DEFAULT_PREF.getInt("controlBottomOffset", 0);
|
||||
PREF_CONTROL_LEFT_OFFSET = DEFAULT_PREF.getInt("controlTopOffset", 0);
|
||||
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
|
||||
|
||||
/*
|
||||
if (PREF_CUSTOM_JAVA_ARGS.isEmpty()) {
|
||||
|
@ -1,12 +1,19 @@
|
||||
package net.kdt.pojavlaunch.prefs.screens;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import net.kdt.pojavlaunch.R;
|
||||
|
||||
public class LauncherPreferenceMiscellaneousFragment extends LauncherPreferenceFragment {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle b, String str) {
|
||||
addPreferencesFromResource(R.xml.pref_misc);
|
||||
|
||||
// Sustained performance is only available since Nougat
|
||||
SwitchPreference sustainedPerfSwitch = findPreference("sustainedPerformance");
|
||||
sustainedPerfSwitch.setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N);
|
||||
}
|
||||
}
|
||||
|
@ -274,6 +274,8 @@
|
||||
<string name="preference_misc_description">Version list, and libs checks</string>
|
||||
<string name="preference_experimental_title">Experimental Stuff</string>
|
||||
<string name="preference_experimental_description">Use things there with consideration, no support.</string>
|
||||
<string name="preference_sustained_performance_title">Enable sustained performance mode</string>
|
||||
<string name="preference_sustained_performance_description">Limit thermal throttling by limiting peak performance</string>
|
||||
|
||||
<string name="preference_back_title">Back to the last screen</string>
|
||||
|
||||
|
@ -6,6 +6,13 @@
|
||||
|
||||
<PreferenceCategory android:title="Miscellaneous settings">
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/preference_sustained_performance_title"
|
||||
android:summary="@string/preference_sustained_performance_description"
|
||||
android:key="sustainedPerformance"
|
||||
android:defaultValue="false"
|
||||
/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="hideSidebar"
|
||||
|
Loading…
x
Reference in New Issue
Block a user