Suppress deprecation warning for `onBackPressed()`.

The required change are too big, this will be handled separately.
This commit is contained in:
Benoit Marty 2022-09-28 14:43:00 +02:00 committed by Benoit Marty
parent f2bbdc3906
commit e76b2d7c61
21 changed files with 39 additions and 5 deletions

View File

@ -83,6 +83,7 @@ abstract class SimpleFragmentActivity : VectorBaseActivity<ActivityBinding>() {
// ignore
return
}
@Suppress("DEPRECATION")
super.onBackPressed()
}
}

View File

@ -505,6 +505,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
private fun onBackPressed(fromToolbar: Boolean) {
val handled = recursivelyDispatchOnBackPressed(supportFragmentManager, fromToolbar)
if (!handled) {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}

View File

@ -194,6 +194,7 @@ class VectorCallActivity :
override fun onBackPressed() {
if (!enterPictureInPictureIfRequired()) {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}
@ -231,6 +232,7 @@ class VectorCallActivity :
}
android.R.id.home -> {
// We check here as we want PiP in some cases
@Suppress("DEPRECATION")
onBackPressed()
true
}

View File

@ -78,6 +78,7 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
sharedActionViewModel
.stream()
.onEach { action ->
@Suppress("DEPRECATION")
when (action) {
UserListSharedAction.Close -> finish()
UserListSharedAction.GoBack -> onBackPressed()

View File

@ -52,6 +52,7 @@ class KeysBackupRestoreActivity : SimpleFragmentActivity() {
override fun onBackPressed() {
hideWaitingView()
@Suppress("DEPRECATION")
super.onBackPressed()
}

View File

@ -114,6 +114,7 @@ class KeysBackupManageActivity : SimpleFragmentActivity() {
finish()
return
}
@Suppress("DEPRECATION")
super.onBackPressed()
}
}

View File

@ -183,6 +183,7 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() {
}
.show()
} else {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}

View File

@ -668,7 +668,10 @@ class HomeActivity :
if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) {
views.drawerLayout.closeDrawer(GravityCompat.START)
} else {
validateBackPressed { super.onBackPressed() }
validateBackPressed {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}
}

View File

@ -178,6 +178,7 @@ class RoomDetailActivity :
if (views.drawerLayout.isDrawerOpen(GravityCompat.START)) {
views.drawerLayout.closeDrawer(GravityCompat.START)
} else {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}

View File

@ -68,6 +68,7 @@ class InviteUsersToRoomActivity : SimpleFragmentActivity() {
sharedActionViewModel
.stream()
.onEach { sharedAction ->
@Suppress("DEPRECATION")
when (sharedAction) {
UserListSharedAction.Close -> finish()
UserListSharedAction.GoBack -> onBackPressed()

View File

@ -133,6 +133,7 @@ abstract class AbstractLoginFragment<VB : ViewBinding> : VectorBaseFragment<VB>(
.setMessage(R.string.login_signup_cancel_confirmation_content)
.setPositiveButton(R.string.yes) { _, _ ->
displayCancelDialog = false
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
.setNegativeButton(R.string.no, null)
@ -147,6 +148,7 @@ abstract class AbstractLoginFragment<VB : ViewBinding> : VectorBaseFragment<VB>(
.setMessage(R.string.login_reset_password_cancel_confirmation_content)
.setPositiveButton(R.string.yes) { _, _ ->
displayCancelDialog = false
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
.setNegativeButton(R.string.no, null)

View File

@ -317,7 +317,10 @@ open class LoginActivity : VectorBaseActivity<ActivityLoginBinding>(), UnlockedA
}
override fun onBackPressed() {
validateBackPressed { super.onBackPressed() }
validateBackPressed {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}
private fun onRegistrationStageNotSupported() {

View File

@ -175,6 +175,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), AttachmentInt
transitionImageContainer.isVisible = true
}
isAnimatingOut = true
@Suppress("DEPRECATION")
super.onBackPressed()
}

View File

@ -48,7 +48,10 @@ class OnboardingActivity : VectorBaseActivity<ActivityLoginBinding>(), UnlockedA
}
override fun onBackPressed() {
validateBackPressed { super.onBackPressed() }
validateBackPressed {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}
override fun initUiAndData() {

View File

@ -123,6 +123,7 @@ abstract class AbstractFtueAuthFragment<VB : ViewBinding> : VectorBaseFragment<V
.setMessage(R.string.login_signup_cancel_confirmation_content)
.setPositiveButton(R.string.yes) { _, _ ->
displayCancelDialog = false
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
.setNegativeButton(R.string.no, null)
@ -137,6 +138,7 @@ abstract class AbstractFtueAuthFragment<VB : ViewBinding> : VectorBaseFragment<V
.setMessage(R.string.login_reset_password_cancel_confirmation_content)
.setPositiveButton(R.string.yes) { _, _ ->
displayCancelDialog = false
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
.setNegativeButton(R.string.no, null)

View File

@ -267,6 +267,7 @@ class BugReportActivity :
// Ensure there is no crash status remaining, which will be sent later on by mistake
bugReporter.deleteCrashFile()
@Suppress("DEPRECATION")
super.onBackPressed()
}

View File

@ -100,7 +100,10 @@ class CreateRoomFragment :
.allowBack(useCross = true)
viewModel.observeViewEvents {
when (it) {
CreateRoomViewEvents.Quit -> vectorBaseActivity.onBackPressed()
CreateRoomViewEvents.Quit -> {
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
is CreateRoomViewEvents.Failure -> showFailure(it.throwable)
}
}

View File

@ -106,6 +106,7 @@ class RoomSettingsFragment :
RoomSettingsViewEvents.Success -> showSuccess()
RoomSettingsViewEvents.GoBack -> {
ignoreChanges = true
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
}

View File

@ -107,6 +107,7 @@ class SpaceSettingsFragment :
RoomSettingsViewEvents.Success -> showSuccess()
RoomSettingsViewEvents.GoBack -> {
ignoreChanges = true
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed()
}
}

View File

@ -151,7 +151,10 @@ class UserCodeActivity : VectorBaseActivity<ActivitySimpleBinding>(),
override fun onBackPressed() = withState(sharedViewModel) {
when (it.mode) {
UserCodeState.Mode.SHOW -> super.onBackPressed()
UserCodeState.Mode.SHOW -> {
@Suppress("DEPRECATION")
super.onBackPressed()
}
is UserCodeState.Mode.RESULT,
UserCodeState.Mode.SCAN -> sharedViewModel.handle(UserCodeActions.SwitchMode(UserCodeState.Mode.SHOW))
}

View File

@ -101,6 +101,7 @@ class VectorWebViewActivity : VectorBaseActivity<ActivityVectorWebViewBinding>()
if (views.simpleWebview.canGoBack()) {
views.simpleWebview.goBack()
} else {
@Suppress("DEPRECATION")
super.onBackPressed()
}
}