Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41f89c79 authored by Joey's avatar Joey Committed by Luca Stefani
Browse files

parts: styles: add support for more dark overlays



Change-Id: I9730419ce6303a0418f84281789084089dc0ae25
Signed-off-by: default avatarJoey <joey@lineageos.org>
parent 289d9e84
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -419,6 +419,17 @@
        <item>3</item> <!-- Force dark -->
    </string-array>

    <string-array name="dark_overlay_entries" translatable="false">
        <item>@string/style_dark_overlay_default</item>
        <item>@string/style_dark_overlay_black</item>
    </string-array>

    <!-- These should be updated accordingly to the sdk -->
    <string-array name="dark_overlay_values" translatable="false">
        <item>org.lineageos.overlay.dark</item>
        <item>org.lineageos.overlay.black</item>
    </string-array>

    <!-- Sms limit -->
    <string-array name="sms_security_check_limit_entries" translatable="false">
        <item>@string/sms_security_check_limit_always_confirm</item>
+3 −0
Original line number Diff line number Diff line
@@ -694,6 +694,9 @@
    <string name="style_automagic_dialog_content">Suggested style: <b>%1$s</b> with <b>%2$s</b> accent.\nDo you want to apply it?</string>
    <string name="style_automagic_dialog_positive">Apply</string>
    <string name="style_accent_default_name">Default</string>
    <string name="style_dark_overlay_title">Dark mode</string>
    <string name="style_dark_overlay_default">Default</string>
    <string name="style_dark_overlay_black">Black</string>
    <string name="style_permission_error">Storage access permission is needed to analyze your wallpaper, please grant it to use this feature</string>

    <!-- Trust interface -->
+8 −0
Original line number Diff line number Diff line
@@ -29,6 +29,14 @@
        android:key="style_accent"
        android:title="@string/style_accent_title" />

    <lineageos.preference.LineageSystemSettingListPreference
        android:defaultValue="org.lineageos.overlay.dark"
        android:entries="@array/dark_overlay_entries"
        android:entryValues="@array/dark_overlay_values"
        android:key="berry_dark_overlay"
        android:summary="%s"
        android:title="@string/style_dark_overlay_title" />

    <Preference
        android:key="style_automagic"
        android:icon="@drawable/ic_automagic"
+12 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import org.lineageos.lineageparts.style.util.UIUtils;
import java.util.Arrays;
import java.util.List;

import lineageos.preference.LineageSystemSettingListPreference;
import lineageos.providers.LineageSettings;
import lineageos.style.StyleInterface;
import lineageos.style.Suggestion;
@@ -87,6 +88,10 @@ public class StylePreferences extends SettingsPreferenceFragment {
        mAccentPref.setOnPreferenceClickListener(this::onAccentClick);
        setupAccentPref();

        LineageSystemSettingListPreference darkPref = (LineageSystemSettingListPreference)
                findPreference("berry_dark_overlay");
        darkPref.setOnPreferenceChangeListener(this::onDarkChange);

        Preference automagic = findPreference("style_automagic");
        automagic.setOnPreferenceClickListener(p -> onAutomagicClick());
    }
@@ -144,6 +149,13 @@ public class StylePreferences extends SettingsPreferenceFragment {
        mAccentPref.setIcon(UIUtils.getAccentBitmap(getResources(), size, accent.getColor()));
    }

    private boolean onDarkChange(Preference preference, Object newValue) {
        if (!(newValue instanceof String)) {
            return false;
        }
        return mInterface.setDarkOverlay((String) newValue);
    }

    private boolean onAutomagicClick() {
        if (!hasStoragePermission()) {
            Toast.makeText(getContext(), getString(R.string.style_permission_error),