mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-04-04 05:11:02 +02:00
adding a new column for storing the app icons order
This commit is contained in:
parent
27daebaddd
commit
cbd5de6c48
@ -23,11 +23,12 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
private val COL_PKG_NAME = "package_name"
|
private val COL_PKG_NAME = "package_name"
|
||||||
private val COL_POSITION = "position"
|
private val COL_POSITION = "position"
|
||||||
private val COL_WAS_RENAMED = "was_renamed"
|
private val COL_WAS_RENAMED = "was_renamed"
|
||||||
|
private val COL_APP_ORDER = "app_order"
|
||||||
|
|
||||||
private val mDb = writableDatabase
|
private val mDb = writableDatabase
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val DB_VERSION = 5
|
private const val DB_VERSION = 6
|
||||||
val DB_NAME = "applaunchers.db"
|
val DB_NAME = "applaunchers.db"
|
||||||
var dbInstance: DBHelper? = null
|
var dbInstance: DBHelper? = null
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
|
|
||||||
override fun onCreate(db: SQLiteDatabase) {
|
override fun onCreate(db: SQLiteDatabase) {
|
||||||
db.execSQL("CREATE TABLE $MAIN_TABLE_NAME ($COL_ID INTEGER PRIMARY KEY AUTOINCREMENT, $COL_NAME TEXT, $COL_PKG_NAME TEXT UNIQUE, $COL_POSITION INTEGER," +
|
db.execSQL("CREATE TABLE $MAIN_TABLE_NAME ($COL_ID INTEGER PRIMARY KEY AUTOINCREMENT, $COL_NAME TEXT, $COL_PKG_NAME TEXT UNIQUE, $COL_POSITION INTEGER," +
|
||||||
"$COL_WAS_RENAMED INTEGER)")
|
"$COL_WAS_RENAMED INTEGER, $COL_APP_ORDER INTEGER)")
|
||||||
addInitialLaunchers(db)
|
addInitialLaunchers(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +61,10 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
if (oldVersion < 5) {
|
if (oldVersion < 5) {
|
||||||
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_WAS_RENAMED INTEGER NOT NULL DEFAULT 0")
|
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_WAS_RENAMED INTEGER NOT NULL DEFAULT 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldVersion < 6) {
|
||||||
|
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_APP_ORDER INTEGER NOT NULL DEFAULT 0")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addInitialLaunchers(db: SQLiteDatabase) {
|
private fun addInitialLaunchers(db: SQLiteDatabase) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user