add the selected launchers in the db

This commit is contained in:
tibbi 2016-08-14 20:46:14 +02:00
parent 178d453dd6
commit c8c78a0df5
2 changed files with 4 additions and 2 deletions

View File

@ -81,7 +81,9 @@ class MainActivity : SimpleActivity(), AddAppDialog.AddLaunchersInterface {
} }
override fun selectedLaunchers(launchers: ArrayList<AppLauncher>) { override fun selectedLaunchers(launchers: ArrayList<AppLauncher>) {
for ((name, pkgName) in launchers) {
dbHelper.addLauncher(name, pkgName)
}
} }
override fun onDestroy() { override fun onDestroy() {

View File

@ -36,7 +36,7 @@ class DbHelper(context: Context) : SQLiteOpenHelper(context, "launchers.db", nul
addLauncher("Simple Notes", "com.simplemobiletools.notes", R.mipmap.notes, db) addLauncher("Simple Notes", "com.simplemobiletools.notes", R.mipmap.notes, db)
} }
fun addLauncher(name: String, pkgName: String, iconId: Int, db: SQLiteDatabase = writableDatabase) { fun addLauncher(name: String, pkgName: String, iconId: Int = 0, db: SQLiteDatabase = writableDatabase) {
val contentValues = ContentValues() val contentValues = ContentValues()
contentValues.put(NAME, name) contentValues.put(NAME, name)
contentValues.put(PKG_NAME, pkgName) contentValues.put(PKG_NAME, pkgName)