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

Commit a8c8918d authored by Steve Kondik's avatar Steve Kondik
Browse files

settingsprovider: Set default value of animator duration scale

 * In case some crazy person wants to overlay it.

Change-Id: I8072a794a7530012e99e1d3fa42f8757e7fad853
parent fef17446
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
    <bool name="def_screen_brightness_automatic_mode">false</bool>
    <fraction name="def_window_animation_scale">100%</fraction>
    <fraction name="def_window_transition_scale">100%</fraction>
    <fraction name="def_animator_duration_scale">100%</fraction>
    <bool name="def_haptic_feedback">true</bool>

    <bool name="def_bluetooth_on">false</bool>
+18 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 100;
    private static final int DATABASE_VERSION = 101;

    private Context mContext;
    private int mUserHandle;
@@ -1617,7 +1617,6 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 99;
        }


        if (upgradeVersion == 99) {
            if (mUserHandle == UserHandle.USER_OWNER) {
                loadScreenAnimationStyle(db);
@@ -1625,6 +1624,21 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 100;
        }

        if (upgradeVersion == 100) {
            // We're setting some new defaults on these for certain devices, and adding
            // a default for animator duration. Load them if the user hasn't set them.
            db.beginTransaction();
            SQLiteStatement stmt = null;
            try {
                stmt = db.compileStatement("INSERT OR IGNORE INTO system(name,value) VALUES(?,?);");
                loadDefaultAnimationSettings(stmt);
                    db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }
            upgradeVersion = 101;
        }

        // *** Remember to update DATABASE_VERSION above!

        if (upgradeVersion != currentVersion) {
@@ -2157,6 +2171,8 @@ public class DatabaseHelper extends SQLiteOpenHelper {
                R.fraction.def_window_animation_scale, 1);
        loadFractionSetting(stmt, Settings.System.TRANSITION_ANIMATION_SCALE,
                R.fraction.def_window_transition_scale, 1);
        loadFractionSetting(stmt, Settings.System.ANIMATOR_DURATION_SCALE,
                R.fraction.def_animator_duration_scale, 1);
    }

    private void loadDefaultHapticSettings(SQLiteStatement stmt) {