mirror of
https://github.com/SimpleMobileTools/Simple-Thank-You.git
synced 2025-02-16 19:40:39 +01:00
stop using Shared Theme if it has been disabled in the app settings
This commit is contained in:
parent
529b101c28
commit
721e359c29
@ -55,5 +55,5 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.32.9'
|
||||
implementation 'com.simplemobiletools:commons:5.32.10'
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.ContentProvider
|
||||
import android.content.ContentValues
|
||||
import android.net.Uri
|
||||
import com.simplemobiletools.thankyou.dbhelpers.MyContentProviderDbHelper
|
||||
import com.simplemobiletools.thankyou.extensions.config
|
||||
|
||||
class MyContentProvider : ContentProvider() {
|
||||
lateinit var dbHelper: MyContentProviderDbHelper
|
||||
@ -17,7 +18,10 @@ class MyContentProvider : ContentProvider() {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun update(uri: Uri, contentValues: ContentValues?, selection: String?, selectionArgs: Array<out String>?): Int = dbHelper.updateTheme(contentValues!!)
|
||||
override fun update(uri: Uri, contentValues: ContentValues?, selection: String?, selectionArgs: Array<out String>?): Int {
|
||||
context?.config?.shouldUseSharedTheme = true
|
||||
return dbHelper.updateTheme(contentValues!!)
|
||||
}
|
||||
|
||||
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int = 0
|
||||
|
||||
|
@ -15,7 +15,9 @@ import com.simplemobiletools.commons.helpers.MyContentProvider.Companion.COL_NAV
|
||||
import com.simplemobiletools.commons.helpers.MyContentProvider.Companion.COL_PRIMARY_COLOR
|
||||
import com.simplemobiletools.commons.helpers.MyContentProvider.Companion.COL_TEXT_COLOR
|
||||
import com.simplemobiletools.commons.helpers.MyContentProvider.Companion.fillThemeContentValues
|
||||
import com.simplemobiletools.commons.helpers.mydebug
|
||||
import com.simplemobiletools.commons.models.SharedTheme
|
||||
import com.simplemobiletools.thankyou.extensions.config
|
||||
|
||||
class MyContentProviderDbHelper private constructor(private val context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
|
||||
private val mDb = writableDatabase
|
||||
@ -81,6 +83,10 @@ class MyContentProviderDbHelper private constructor(private val context: Context
|
||||
}
|
||||
|
||||
fun getSharedTheme(): Cursor? {
|
||||
if (!context.config.shouldUseSharedTheme) {
|
||||
return null
|
||||
}
|
||||
|
||||
val cols = arrayOf(COL_TEXT_COLOR, COL_BACKGROUND_COLOR, COL_PRIMARY_COLOR, COL_APP_ICON_COLOR, COL_NAVIGATION_BAR_COLOR, COL_LAST_UPDATED_TS)
|
||||
val selection = "$COL_ID = ?"
|
||||
val selectionArgs = arrayOf(THEME_ID.toString())
|
||||
|
Loading…
x
Reference in New Issue
Block a user