Use Compose for OAuth login loading indicator

This commit is contained in:
arkon 2022-04-28 18:55:35 -04:00
parent 891406cc7f
commit ccff333123
2 changed files with 13 additions and 18 deletions

View file

@ -19,8 +19,7 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
setHasOptionsMenu(true)
}
override fun createPresenter(): MigrationSourcesPresenter =
MigrationSourcesPresenter()
override fun createPresenter() = MigrationSourcesPresenter()
@Composable
override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) {
@ -38,7 +37,7 @@ class MigrationSourcesController : ComposeController<MigrationSourcesPresenter>(
onLongClickItem = { source ->
val sourceId = source.id.toString()
activity?.copyToClipboard(sourceId, sourceId)
}
},
)
}

View file

@ -3,10 +3,9 @@ package eu.kanade.tachiyomi.ui.setting.track
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.Gravity
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ProgressBar
import androidx.activity.compose.setContent
import eu.kanade.presentation.components.LoadingScreen
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
import eu.kanade.tachiyomi.ui.main.MainActivity
@ -21,15 +20,11 @@ abstract class BaseOAuthLoginActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val view = ProgressBar(this)
setContentView(
view,
FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
Gravity.CENTER,
),
)
setContent {
TachiyomiTheme {
LoadingScreen()
}
}
handleResult(intent.data)
}
@ -37,8 +32,9 @@ abstract class BaseOAuthLoginActivity : BaseActivity() {
internal fun returnToSettings() {
finish()
val intent = Intent(this, MainActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
val intent = Intent(this, MainActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
}
startActivity(intent)
}
}