Remove default apps from prepaid variant

This commit is contained in:
Naveen 2022-06-12 17:51:32 +05:30
parent e6ada93646
commit 0c5758a2a8
5 changed files with 15 additions and 2 deletions

View File

@ -3,4 +3,5 @@
<bool name="show_donate_in_about">true</bool>
<bool name="hide_google_relations">true</bool>
<bool name="pretend_thank_you_installed">true</bool>
<bool name="add_default_apps">true</bool>
</resources>

View File

@ -5,6 +5,7 @@ import android.content.Intent
import android.content.pm.LauncherApps
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.helpers.Config
import com.simplemobiletools.applauncher.helpers.DBHelper
import com.simplemobiletools.applauncher.models.AppLauncher
@ -68,3 +69,7 @@ fun Context.getAllLaunchers(): ArrayList<AppLauncher> {
val unique = allApps.distinctBy { it.packageName }
return unique.filter { it.packageName != "com.simplemobiletools.applauncher" } as ArrayList<AppLauncher>
}
fun Context.addDefaultApps(): Boolean {
return resources.getBoolean(R.bool.add_default_apps)
}

View File

@ -9,12 +9,12 @@ import android.database.sqlite.SQLiteOpenHelper
import android.graphics.drawable.Drawable
import android.text.TextUtils
import com.simplemobiletools.applauncher.R
import com.simplemobiletools.applauncher.extensions.addDefaultApps
import com.simplemobiletools.applauncher.extensions.getLauncherDrawable
import com.simplemobiletools.applauncher.extensions.isAPredefinedApp
import com.simplemobiletools.applauncher.models.AppLauncher
import com.simplemobiletools.commons.extensions.getIntValue
import com.simplemobiletools.commons.extensions.getStringValue
import java.util.*
class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
private val MAIN_TABLE_NAME = "launchers"
@ -46,7 +46,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
"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_APP_ORDER INTEGER)"
)
addInitialLaunchers(db)
if (context.addDefaultApps()) {
addInitialLaunchers(db)
}
}
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="add_default_apps">true</bool>
</resources>

View File

@ -4,4 +4,5 @@
<bool name="hide_google_relations">true</bool>
<bool name="hide_all_external_links">true</bool>
<bool name="pretend_thank_you_installed">true</bool>
<bool name="add_default_apps">false</bool>
</resources>