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

View file

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