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

Commit 102f5bee authored by Romain Hunault's avatar Romain Hunault 💻
Browse files

Merge branch 'pie-clean-top-bar' into 'v1-pie'

Pie clean top bar

See merge request !11
parents 0bbf4312 768a7677
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@
         * 1: Display the battery as a circle
         * 2: Display the battery as plain text
    -->
    <integer name="def_battery_style">0</integer>
    <integer name="def_battery_style">2</integer>

    <!-- Default for LineageSettings.Secure.LOCKSCREEN_VISUALIZER_ENABLED -->
    <bool name="def_lockscreen_visualizer">true</bool>
@@ -116,6 +116,6 @@
         * 1: show the clock in the center
         * 2: show the clock in the left position (LTR)
    -->
    <integer name="def_clock_position">2</integer>
    <integer name="def_clock_position">1</integer>

</resources>
+46 −4
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{

    private static final String DATABASE_NAME = "lineagesettings.db";
    private static final int DATABASE_VERSION = 12;
    private static final int E_DB_INCREMENT = 1;
    private static final int E_DATABASE_VERSION = DATABASE_VERSION+E_DB_INCREMENT;

    private static final String DATABASE_NAME_OLD = "cmsettings.db";

@@ -142,7 +144,7 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
     * @param userId
     */
    public LineageDatabaseHelper(Context context, int userId) {
        super(context, dbNameForUser(context, userId, DATABASE_NAME), null, DATABASE_VERSION);
        super(context, dbNameForUser(context, userId, DATABASE_NAME), null, E_DATABASE_VERSION);
        mContext = context;
        mUserHandle = userId;

@@ -199,9 +201,12 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (LOCAL_LOGV) Log.d(TAG, "Upgrading from version: " + oldVersion + " to " + newVersion);
        Log.d(TAG, "Upgrading from version: " + oldVersion + " to " + newVersion);
        int upgradeVersion = oldVersion;

        int eUpgradeVersion = oldVersion;
        if(upgradeVersion>13){
            upgradeVersion = upgradeVersion - E_DB_INCREMENT; //to respect lineage version
	}
        if (upgradeVersion < 2) {
            db.beginTransaction();
            try {
@@ -335,7 +340,7 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{

                    if (value == 0) {
                        stmt = db.compileStatement("UPDATE system SET value=? WHERE name=?");
                        stmt.bindLong(1, 2);
                        stmt.bindLong(1, 1);
                        stmt.bindString(2, LineageSettings.System.STATUS_BAR_CLOCK);
                        stmt.execute();
                    }
@@ -429,6 +434,43 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
            }
            upgradeVersion = 12;
        }

        if(upgradeVersion > eUpgradeVersion)
            eUpgradeVersion = upgradeVersion;
        if (eUpgradeVersion < 13) {
             if (mUserHandle == UserHandle.USER_OWNER) {
                // Update STATUS_BAR_CLOCK
                db.beginTransaction();
                SQLiteStatement stmt = null;
                try {
                    stmt = db.compileStatement("UPDATE system SET value=? WHERE name=?");
                    stmt.bindLong(1, 1);
                    stmt.bindString(2, LineageSettings.System.STATUS_BAR_CLOCK);
                    stmt.execute();
                    db.setTransactionSuccessful();
                } catch (SQLiteDoneException ex) {
                    // LineageSettings.System.STATUS_BAR_CLOCK is not set
                } finally {
                    if (stmt != null) stmt.close();
                    db.endTransaction();
                }
                db.beginTransaction();
                stmt = null;
                try {
                    stmt = db.compileStatement("UPDATE system SET value=? WHERE name=?");
                    stmt.bindLong(1, 2);
                    stmt.bindString(2, LineageSettings.System.STATUS_BAR_BATTERY_STYLE);
                    stmt.execute();
                    db.setTransactionSuccessful();
                } catch (SQLiteDoneException ex) {
                    // LineageSettings.System.STATUS_BAR_BATTERY_STYLE is not set
                } finally {
                    if (stmt != null) stmt.close();
                    db.endTransaction();
               }
            }
            eUpgradeVersion = 14;
        }
        // *** Remember to update DATABASE_VERSION above!
    }