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 // ignore
return return
} }
@Suppress("DEPRECATION")
super.onBackPressed() super.onBackPressed()
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -123,6 +123,7 @@ abstract class AbstractFtueAuthFragment<VB : ViewBinding> : VectorBaseFragment<V
.setMessage(R.string.login_signup_cancel_confirmation_content) .setMessage(R.string.login_signup_cancel_confirmation_content)
.setPositiveButton(R.string.yes) { _, _ -> .setPositiveButton(R.string.yes) { _, _ ->
displayCancelDialog = false displayCancelDialog = false
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed() vectorBaseActivity.onBackPressed()
} }
.setNegativeButton(R.string.no, null) .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) .setMessage(R.string.login_reset_password_cancel_confirmation_content)
.setPositiveButton(R.string.yes) { _, _ -> .setPositiveButton(R.string.yes) { _, _ ->
displayCancelDialog = false displayCancelDialog = false
@Suppress("DEPRECATION")
vectorBaseActivity.onBackPressed() vectorBaseActivity.onBackPressed()
} }
.setNegativeButton(R.string.no, null) .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 // Ensure there is no crash status remaining, which will be sent later on by mistake
bugReporter.deleteCrashFile() bugReporter.deleteCrashFile()
@Suppress("DEPRECATION")
super.onBackPressed() super.onBackPressed()
} }

View File

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

View File

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

View File

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

View File

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

View File

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