From ccff333123d9f446d4456f8d43fa0472fb82c488 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 28 Apr 2022 18:55:35 -0400 Subject: [PATCH] Use Compose for OAuth login loading indicator --- .../sources/MigrationSourcesController.kt | 5 ++-- .../setting/track/BaseOAuthLoginActivity.kt | 26 ++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt index c793c7c75d..3b03e966d6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt @@ -19,8 +19,7 @@ class MigrationSourcesController : ComposeController( setHasOptionsMenu(true) } - override fun createPresenter(): MigrationSourcesPresenter = - MigrationSourcesPresenter() + override fun createPresenter() = MigrationSourcesPresenter() @Composable override fun ComposeContent(nestedScrollInterop: NestedScrollConnection) { @@ -38,7 +37,7 @@ class MigrationSourcesController : ComposeController( onLongClickItem = { source -> val sourceId = source.id.toString() activity?.copyToClipboard(sourceId, sourceId) - } + }, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt index 2c665a6bdb..6f85bb498b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt @@ -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) } }