mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 10:47:38 +00:00
RepoDB does not need to run on main thread
This commit is contained in:
parent
1f75e63c37
commit
1ababc8c7f
@ -20,5 +20,4 @@ val databaseModule = module {
|
|||||||
fun createRepoDatabase(context: Context) =
|
fun createRepoDatabase(context: Context) =
|
||||||
Room.databaseBuilder(context, RepoDatabase::class.java, "repo.db")
|
Room.databaseBuilder(context, RepoDatabase::class.java, "repo.db")
|
||||||
.fallbackToDestructiveMigration()
|
.fallbackToDestructiveMigration()
|
||||||
.allowMainThreadQueries()
|
|
||||||
.build()
|
.build()
|
||||||
|
@ -33,6 +33,7 @@ import com.topjohnwu.magisk.utils.Utils
|
|||||||
import com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog
|
import com.topjohnwu.magisk.view.dialogs.FingerprintAuthDialog
|
||||||
import com.topjohnwu.net.Networking
|
import com.topjohnwu.net.Networking
|
||||||
import com.topjohnwu.superuser.Shell
|
import com.topjohnwu.superuser.Shell
|
||||||
|
import io.reactivex.Completable
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -83,13 +84,15 @@ class SettingsFragment : BasePreferenceFragment() {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
findPreference("clear").setOnPreferenceClickListener {
|
findPreference("clear").setOnPreferenceClickListener {
|
||||||
repoDB.clear()
|
Completable.fromAction { repoDB.clear() }.subscribeK {
|
||||||
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT)
|
Utils.toast(R.string.repo_cache_cleared, Toast.LENGTH_SHORT)
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
findPreference("hosts").setOnPreferenceClickListener {
|
findPreference("hosts").setOnPreferenceClickListener {
|
||||||
Shell.su("add_hosts_module").exec()
|
Shell.su("add_hosts_module").submit {
|
||||||
Utils.toast(R.string.settings_hosts_toast, Toast.LENGTH_SHORT)
|
Utils.toast(R.string.settings_hosts_toast, Toast.LENGTH_SHORT)
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user