Use some more KTX and Compat stuff (#3933)

* Use more KTX extensions

* Update Android Studio

* Use more Compat classes
This commit is contained in:
Taco
2020-10-12 16:46:25 -04:00
committed by GitHub
parent a689e4e041
commit 60755d0c26
29 changed files with 68 additions and 108 deletions
@@ -9,6 +9,7 @@ import android.net.Uri
import android.os.Bundle
import android.view.View
import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.preference.PreferenceScreen
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItemsMultiChoice
@@ -251,9 +252,7 @@ class SettingsBackupController : SettingsController() {
class RestoreBackupDialog(bundle: Bundle? = null) : DialogController(bundle) {
constructor(uri: Uri) : this(
Bundle().apply {
putParcelable(KEY_URI, uri)
}
bundleOf(KEY_URI to uri)
)
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
@@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.setting.track
import android.os.Bundle
import android.view.View
import androidx.annotation.StringRes
import androidx.core.os.bundleOf
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.TrackService
@@ -28,7 +29,7 @@ class TrackLoginDialog(
constructor(service: TrackService) : this(service, null)
constructor(service: TrackService, @StringRes usernameLabelRes: Int?) :
this(R.string.login_title, service.name, usernameLabelRes, Bundle().apply { putInt("key", service.id) })
this(R.string.login_title, service.name, usernameLabelRes, bundleOf("key" to service.id))
override fun setCredentialsOnView(view: View) = with(view) {
username.setText(service.getUsername())
@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.setting.track
import android.app.Dialog
import android.os.Bundle
import androidx.core.os.bundleOf
import com.afollestad.materialdialogs.MaterialDialog
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.TrackManager
@@ -15,7 +16,7 @@ class TrackLogoutDialog(bundle: Bundle? = null) : DialogController(bundle) {
private val service = Injekt.get<TrackManager>().getService(args.getInt("key"))!!
constructor(service: TrackService) : this(Bundle().apply { putInt("key", service.id) })
constructor(service: TrackService) : this(bundleOf("key" to service.id))
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
return MaterialDialog(activity!!)