Make some changes / improvements to monet theming.

pull/177/head
Fox2Code 2 years ago
parent bb5cb08d76
commit df909178ce

@ -104,8 +104,7 @@ For more information please check the [developer documentation](DEVELOPERS.md)
See [`app/src/main/res/values/strings.xml`](https://github.com/Fox2Code/FoxMagiskModuleManager/blob/master/app/src/main/res/values/strings.xml)
and [`app/src/main/res/values/arrays.xml`](https://github.com/Fox2Code/FoxMagiskModuleManager/blob/master/app/src/main/res/values/arrays.xml)
If your language is right to left you should make a copy of [`app/src/main/res/values/bools.xml`](https://github.com/Fox2Code/FoxMagiskModuleManager/blob/master/app/src/main/res/values/bools.xml)
and set `lang_support_rtl` to `true`.
If your language is right to left don't forget to set `lang_support_rtl` to `true`.
Translators are not expected to have any previous coding experience.

@ -222,7 +222,8 @@ public class MainActivity extends CompatActivity implements SwipeRefreshLayout.O
private void cardIconifyUpdate() {
boolean iconified = this.searchView.isIconified();
int backgroundAttr = iconified ?
int backgroundAttr = iconified ? MainApplication.isMonetEnabled() ?
R.attr.colorSecondaryContainer : // Monet is special...
R.attr.colorSecondary : R.attr.colorPrimarySurface;
Resources.Theme theme = this.searchCard.getContext().getTheme();
TypedValue value = new TypedValue();

@ -26,6 +26,7 @@ import com.fox2code.mmm.utils.GMSProviderInstaller;
import com.fox2code.mmm.utils.Http;
import com.fox2code.rosettax.LanguageSwitcher;
import com.google.android.material.color.DynamicColors;
import com.google.android.material.color.DynamicColorsOptions;
import com.topjohnwu.superuser.Shell;
import java.text.SimpleDateFormat;
@ -122,7 +123,8 @@ public class MainApplication extends CompatApplication {
}
public static boolean isMonetEnabled() {
return getSharedPreferences().getBoolean("pref_enable_monet", false);
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
getSharedPreferences().getBoolean("pref_enable_monet", true);
}
public static boolean isBlurEnabled() {
@ -274,10 +276,10 @@ public class MainApplication extends CompatApplication {
public void onCreate() {
if (INSTANCE == null) INSTANCE = this;
super.onCreate();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
if (MainApplication.isMonetEnabled()) {
DynamicColors.applyToActivitiesIfAvailable(this);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && isMonetEnabled()) {
DynamicColors.applyToActivitiesIfAvailable(this,
new DynamicColorsOptions.Builder().setPrecondition(
(activity, theme) -> isMonetEnabled()).build());
}
SharedPreferences sharedPreferences = MainApplication.getSharedPreferences();
// We are only one process so it's ok to do this

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="monet_enabled_by_default">true</bool>
</resources>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="lang_support_rtl">false</bool>
<bool name="monet_enabled_by_default">false</bool>
</resources>

@ -128,4 +128,6 @@
<string name="backup_module_list">Backup modules</string>
<string name="restore_module_list">Restore modules</string>
<string name="require_internet">This operation require an internet connection</string>
<!-- Set to true in translation file if your language is right to left -->
<bool name="lang_support_rtl">false</bool>
</resources>

@ -63,7 +63,7 @@
app:singleLineTitle="false" />
<SwitchPreferenceCompat
app:defaultValue="false"
app:defaultValue="@bool/monet_enabled_by_default"
app:key="pref_enable_monet"
app:icon="@drawable/ic_baseline_design_services_24"
app:title="@string/enable_monet"

Loading…
Cancel
Save