add functions for dynamic color option

This commit is contained in:
Ishan09811 2024-02-13 14:25:21 +05:30 committed by GitHub
parent 7543b04618
commit c2c713f32c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@ 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.panda3ds.pandroid.R; import com.panda3ds.pandroid.R;
import com.panda3ds.pandroid.app.BaseActivity; import com.panda3ds.pandroid.app.BaseActivity;
@ -23,5 +24,20 @@ 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));
}
} }
} }