From 041f9d113ecf5046b2575ca6e72498c497a8422e Mon Sep 17 00:00:00 2001
From: Brayan Oliveira <69634269+BrayanDSO@users.noreply.github.com>
Date: Thu, 21 Dec 2023 14:08:42 -0300
Subject: [PATCH] Remove most of custom activity transition animations in favor
of consistency (#14923)
* replace finishWithAnimation usages with finish()
* replace most usages of startActivityWithAnimation with startActivity()
* Replace startActivityWithoutAnimation with startActivity
* replace startActivityForResultWithoutAnimation with startActivityForResult
* replace launchActivityWithAnimation
* refactor: remove unused animation direction
* refactor: remove translucent theme from activities
it made the opening and closing animation not be the default one
* refactor: remove finishActivityWithFade
* refactor: remove manual slide calls
* remove unused resources
* remove launchActivityForResultWithAnimation
---
AnkiDroid/src/main/AndroidManifest.xml | 6 +--
.../ichi2/anim/ActivityTransitionAnimation.kt | 5 +--
.../com/ichi2/anki/AbstractFlashcardViewer.kt | 6 +--
.../main/java/com/ichi2/anki/AnkiActivity.kt | 20 +---------
.../java/com/ichi2/anki/AnkiDroidJsAPI.kt | 3 +-
.../main/java/com/ichi2/anki/CardBrowser.kt | 13 +++----
.../CardTemplateBrowserAppearanceEditor.kt | 6 +--
.../java/com/ichi2/anki/CardTemplateEditor.kt | 7 ++--
.../com/ichi2/anki/CardTemplatePreviewer.kt | 5 +--
.../main/java/com/ichi2/anki/DeckPicker.kt | 31 +++++++--------
.../java/com/ichi2/anki/DrawingActivity.kt | 2 +-
.../com/ichi2/anki/FilteredDeckOptions.kt | 3 --
.../src/main/java/com/ichi2/anki/Info.kt | 3 +-
.../main/java/com/ichi2/anki/IntentHandler.kt | 6 +--
.../java/com/ichi2/anki/ModelFieldEditor.kt | 3 +-
.../src/main/java/com/ichi2/anki/MyAccount.kt | 3 +-
.../ichi2/anki/NavigationDrawerActivity.kt | 18 +++------
.../main/java/com/ichi2/anki/NoteEditor.kt | 15 +++----
.../src/main/java/com/ichi2/anki/Reviewer.kt | 7 ++--
.../com/ichi2/anki/StudyOptionsActivity.kt | 3 +-
.../com/ichi2/anki/StudyOptionsFragment.kt | 12 +-----
.../src/main/java/com/ichi2/anki/Sync.kt | 3 +-
.../anki/dialogs/DeckPickerContextMenu.kt | 3 +-
.../dialogs/ImportFileSelectionFragment.kt | 13 +------
.../dialogs/customstudy/CustomStudyDialog.kt | 4 +-
.../anki/export/ActivityExportingDelegate.kt | 2 +-
.../fields/BasicImageFieldController.kt | 7 ++--
.../fields/BasicMediaClipFieldController.kt | 7 +---
.../ichi2/anki/notetype/ManageNotetypes.kt | 7 +---
.../AppLoadedFromBackupWorkaround.kt | 3 +-
.../main/java/com/ichi2/utils/ImportUtils.kt | 2 +-
.../main/java/com/ichi2/utils/IntentUtil.kt | 2 +-
.../src/main/res/anim/decelerate_cubic.xml | 21 ----------
.../src/main/res/anim/decelerate_quint.xml | 21 ----------
AnkiDroid/src/main/res/anim/dialog_exit.xml | 39 -------------------
35 files changed, 74 insertions(+), 237 deletions(-)
delete mode 100644 AnkiDroid/src/main/res/anim/decelerate_cubic.xml
delete mode 100644 AnkiDroid/src/main/res/anim/decelerate_quint.xml
delete mode 100644 AnkiDroid/src/main/res/anim/dialog_exit.xml
diff --git a/AnkiDroid/src/main/AndroidManifest.xml b/AnkiDroid/src/main/AndroidManifest.xml
index 73307fdb3c3d..5ff5c5d5166f 100644
--- a/AnkiDroid/src/main/AndroidManifest.xml
+++ b/AnkiDroid/src/main/AndroidManifest.xml
@@ -99,8 +99,7 @@
the full package path is needed for manageSpaceActivity -->
+ android:exported="true"/>
+ />
activity.overridePendingTransition(R.anim.fade_out, R.anim.fade_in)
Direction.UP -> activity.overridePendingTransition(R.anim.slide_up_in, R.anim.slide_up_out)
Direction.DOWN -> activity.overridePendingTransition(R.anim.slide_down_in, R.anim.slide_down_out)
- Direction.DIALOG_EXIT -> activity.overridePendingTransition(R.anim.none, R.anim.dialog_exit)
Direction.NONE -> activity.overridePendingTransition(R.anim.none, R.anim.none)
Direction.DEFAULT -> {
}
@@ -47,7 +46,6 @@ object ActivityTransitionAnimation {
Direction.FADE -> ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.fade_out, R.anim.fade_in)
Direction.UP -> ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.slide_up_in, R.anim.slide_up_out)
Direction.DOWN -> ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.slide_down_in, R.anim.slide_down_out)
- Direction.DIALOG_EXIT -> ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.none, R.anim.dialog_exit)
Direction.NONE -> ActivityOptionsCompat.makeCustomAnimation(activity, R.anim.none, R.anim.none)
Direction.DEFAULT -> // this is the default animation, we shouldn't try to override it
ActivityOptionsCompat.makeBasic()
@@ -61,7 +59,7 @@ object ActivityTransitionAnimation {
@Parcelize
enum class Direction : Parcelable {
- START, END, FADE, UP, DOWN, RIGHT, LEFT, DEFAULT, DIALOG_EXIT, NONE
+ START, END, FADE, UP, DOWN, RIGHT, LEFT, DEFAULT, NONE
}
/**
@@ -81,7 +79,6 @@ object ActivityTransitionAnimation {
Direction.FADE -> Direction.FADE
Direction.DEFAULT -> Direction.DEFAULT
Direction.NONE -> Direction.NONE
- Direction.DIALOG_EXIT -> Direction.DIALOG_EXIT
}
}
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
index ef116f2a834c..f71d04a8fa5a 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
@@ -858,7 +858,7 @@ abstract class AbstractFlashcardViewer :
editCard.putExtra(NoteEditor.EXTRA_CALLER, NoteEditor.CALLER_REVIEWER_EDIT)
editCard.putExtra(FINISH_ANIMATION_EXTRA, getInverseTransition(animation) as Parcelable)
editorCard = currentCard
- launchActivityForResultWithAnimation(editCard, editCurrentCardLauncher, animation)
+ editCurrentCardLauncher.launch(editCard)
}
fun generateQuestionSoundList() {
@@ -1942,7 +1942,7 @@ abstract class AbstractFlashcardViewer :
mPreviousAnswerIndicator!!.stopAutomaticHide()
mLongClickHandler.removeCallbacks(mStartLongClickAction)
this@AbstractFlashcardViewer.setResult(result)
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
protected fun refreshActionBar() {
@@ -2575,7 +2575,7 @@ abstract class AbstractFlashcardViewer :
Timber.d("Opening resolved external link \"%s\" with an Intent: %s", url, intent)
}
try {
- startActivityWithoutAnimation(intent)
+ startActivity(intent)
} catch (e: ActivityNotFoundException) {
Timber.w(e) // Don't crash if the intent is not handled
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AnkiActivity.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AnkiActivity.kt
index 85b9b959cf36..7af9fe961a98 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/AnkiActivity.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/AnkiActivity.kt
@@ -3,7 +3,6 @@
package com.ichi2.anki
-import android.app.Activity
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.ActivityNotFoundException
@@ -220,15 +219,6 @@ open class AnkiActivity : AppCompatActivity, SimpleMessageDialogListener {
}
}
- fun launchActivityForResultWithAnimation(
- intent: Intent,
- launcher: ActivityResultLauncher,
- animation: Direction?
- ) {
- enableIntentAnimation(intent)
- launchActivityForResult(intent, launcher, animation)
- }
-
override fun finish() {
finishWithAnimation(DEFAULT)
}
@@ -302,7 +292,7 @@ open class AnkiActivity : AppCompatActivity, SimpleMessageDialogListener {
val deckPicker = Intent(this, DeckPicker::class.java)
deckPicker.putExtra("collectionLoadError", true) // don't currently do anything with this
deckPicker.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
- startActivityWithAnimation(deckPicker, START)
+ startActivity(deckPicker)
}
fun showProgressBar() {
@@ -503,7 +493,7 @@ open class AnkiActivity : AppCompatActivity, SimpleMessageDialogListener {
if (reload) {
val deckPicker = Intent(this, DeckPicker::class.java)
deckPicker.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
- startActivityWithoutAnimation(deckPicker)
+ startActivity(deckPicker)
}
}
@@ -554,12 +544,6 @@ open class AnkiActivity : AppCompatActivity, SimpleMessageDialogListener {
/** Extra key to set the finish animation of an activity */
const val FINISH_ANIMATION_EXTRA = "finishAnimation"
- /** Finish Activity using FADE animation */
- fun finishActivityWithFade(activity: Activity) {
- activity.finish()
- ActivityTransitionAnimation.slide(activity, FADE)
- }
-
fun showDialogFragment(activity: AnkiActivity, newFragment: DialogFragment) {
showDialogFragment(activity.supportFragmentManager, newFragment)
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidJsAPI.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidJsAPI.kt
index 6227d7840357..38b0f88a8ed0 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidJsAPI.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidJsAPI.kt
@@ -24,7 +24,6 @@ import android.content.Intent
import android.net.Uri
import com.github.zafarkhaja.semver.Version
import com.google.android.material.snackbar.Snackbar
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.AnkiDroidJsAPIConstants.ankiJsErrorCodeBuryCard
import com.ichi2.anki.AnkiDroidJsAPIConstants.ankiJsErrorCodeBuryNote
import com.ichi2.anki.AnkiDroidJsAPIConstants.ankiJsErrorCodeError
@@ -266,7 +265,7 @@ open class AnkiDroidJsAPI(private val activity: AbstractFlashcardViewer) {
putExtra("currentCard", currentCard.id)
putExtra("search_query", apiParams)
}
- activity.startActivityWithAnimation(intent, ActivityTransitionAnimation.Direction.START)
+ activity.startActivity(intent)
convertToByteArray(apiContract, true)
}
"searchCardWithCallback" -> ankiSearchCardWithCallback(apiContract)
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt b/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
index 73b3b0bca8e9..2d8937cd23ea 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
@@ -39,7 +39,6 @@ import anki.collection.OpChanges
import com.afollestad.materialdialogs.utils.MDUtil.ifNotZero
import com.google.android.material.color.MaterialColors
import com.google.android.material.snackbar.Snackbar
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.CollectionManager.TR
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.Previewer.Companion.toIntent
@@ -682,7 +681,7 @@ open class CardBrowser :
val editCard = Intent(this, NoteEditor::class.java)
.putExtra(NoteEditor.EXTRA_CALLER, NoteEditor.CALLER_CARDBROWSER_EDIT)
.putExtra(NoteEditor.EXTRA_CARD_ID, cardBrowserCard!!.id)
- launchActivityForResultWithAnimation(editCard, onEditCardActivityResult, ActivityTransitionAnimation.Direction.START)
+ onEditCardActivityResult.launch(editCard)
// #6432 - FIXME - onCreateOptionsMenu crashes if receiving an activity result from edit card when in multiselect
endMultiSelectMode()
}
@@ -844,8 +843,8 @@ open class CardBrowser :
deckPicker.action = Intent.ACTION_MAIN
deckPicker.addCategory(Intent.CATEGORY_LAUNCHER)
deckPicker.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
- startActivityWithAnimation(deckPicker, ActivityTransitionAnimation.Direction.FADE)
- finishActivityWithFade(this)
+ startActivity(deckPicker)
+ finish()
this.setResult(RESULT_CANCELED)
}
@@ -1159,7 +1158,7 @@ open class CardBrowser :
R.id.action_view_card_info -> {
viewModel.cardInfoDestination?.let { destination ->
val intent: Intent = destination.toIntent(this)
- startActivityWithAnimation(intent, ActivityTransitionAnimation.Direction.FADE)
+ startActivity(intent)
}
return true
}
@@ -1313,7 +1312,7 @@ open class CardBrowser :
}
private fun addNoteFromCardBrowser() {
- launchActivityForResultWithAnimation(addNoteIntent, onAddNoteActivityResult, ActivityTransitionAnimation.Direction.START)
+ onAddNoteActivityResult.launch(addNoteIntent)
}
private val reviewerCardId: CardId
@@ -1700,7 +1699,7 @@ open class CardBrowser :
private fun closeCardBrowser(result: Int, data: Intent? = null) {
// Set result and finish
setResult(result, data)
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
/**
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateBrowserAppearanceEditor.kt b/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateBrowserAppearanceEditor.kt
index d07d7d964c6d..17706f1eae23 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateBrowserAppearanceEditor.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateBrowserAppearanceEditor.kt
@@ -48,7 +48,7 @@ class CardTemplateBrowserAppearanceEditor : AnkiActivity() {
val bundle = savedInstanceState ?: intent.extras
if (bundle == null) {
UIUtils.showThemedToast(this, getString(R.string.card_template_editor_card_browser_appearance_failed), true)
- finishActivityWithFade(this)
+ finish()
return
}
initializeUiFromBundle(bundle)
@@ -157,7 +157,7 @@ class CardTemplateBrowserAppearanceEditor : AnkiActivity() {
private fun discardChangesAndClose() {
Timber.i("Closing and discarding changes")
setResult(RESULT_CANCELED)
- finishActivityWithFade(this)
+ finish()
}
private fun saveAndExit() {
@@ -167,7 +167,7 @@ class CardTemplateBrowserAppearanceEditor : AnkiActivity() {
putExtra(INTENT_ANSWER_FORMAT, answerFormat)
}
setResult(RESULT_OK, data)
- finishActivityWithFade(this)
+ finish()
}
private fun hasChanges(): Boolean {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateEditor.kt b/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateEditor.kt
index 75079c6738ae..a31087c54424 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateEditor.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplateEditor.kt
@@ -39,7 +39,6 @@ import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
-import com.ichi2.anim.ActivityTransitionAnimation.Direction.END
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.dialogs.ConfirmationDialog
import com.ichi2.anki.dialogs.DeckSelectionDialog
@@ -202,7 +201,7 @@ open class CardTemplateEditor : AnkiActivity(), DeckSelectionListener {
// Clear the edited model from any cache files, and clear it from this objects memory to discard changes
CardTemplateNotetype.clearTempModelFiles()
tempModel = null
- finishWithAnimation(END)
+ finish()
}
/** When a deck is selected via Deck Override */
@@ -556,7 +555,7 @@ open class CardTemplateEditor : AnkiActivity(), DeckSelectionListener {
}
} else {
Timber.d("CardTemplateEditor:: model has not changed, exiting")
- mTemplateEditor.finishWithAnimation(END)
+ mTemplateEditor.finish()
}
return true
@@ -583,7 +582,7 @@ open class CardTemplateEditor : AnkiActivity(), DeckSelectionListener {
button.isEnabled = true
}
mTemplateEditor.tempModel = null
- mTemplateEditor.finishWithAnimation(END)
+ mTemplateEditor.finish()
}
fun performPreview() {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplatePreviewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplatePreviewer.kt
index cc7b99bdc39c..d8d98463f510 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplatePreviewer.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/CardTemplatePreviewer.kt
@@ -18,7 +18,6 @@ package com.ichi2.anki
import android.os.Bundle
import android.view.View
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.UIUtils.showThemedToast
import com.ichi2.anki.cardviewer.PreviewLayout
import com.ichi2.anki.cardviewer.PreviewLayout.Companion.createAndDisplay
@@ -117,7 +116,7 @@ open class CardTemplatePreviewer : AbstractFlashcardViewer() {
Timber.d("CardTemplatePreviewer:: closeCardTemplatePreviewer()")
setResult(RESULT_OK)
CardTemplateNotetype.clearTempModelFiles()
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
@Deprecated("Deprecated in Java")
@@ -130,7 +129,7 @@ open class CardTemplatePreviewer : AbstractFlashcardViewer() {
override fun performReload() {
// This should not happen.
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
override fun onNavigationPressed() {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
index f6e8cb2b4f3a..e77ff627a1e5 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
@@ -374,7 +374,7 @@ open class DeckPicker :
Timber.i("Displaying app intro")
val appIntro = Intent(this, IntroductionActivity::class.java)
appIntro.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
- startActivityWithoutAnimation(appIntro)
+ startActivity(appIntro)
finish() // calls onDestroy() immediately
return
} else {
@@ -585,7 +585,7 @@ open class DeckPicker :
showDatabaseErrorDialog(DatabaseErrorDialogType.DIALOG_STORAGE_UNAVAILABLE_AFTER_UNINSTALL)
} else {
val i = AdvancedSettingsFragment.getSubscreenIntent(this)
- launchActivityForResultWithAnimation(i, requestPathUpdateLauncher, NONE)
+ requestPathUpdateLauncher.launch(i)
showThemedToast(this, R.string.directory_inaccessible, false)
}
}
@@ -939,7 +939,7 @@ open class DeckPicker :
val manageNoteTypesTarget =
ManageNotetypes::class.java
val noteTypeBrowser = Intent(this, manageNoteTypesTarget)
- startActivityWithAnimation(noteTypeBrowser, START)
+ startActivity(noteTypeBrowser)
return true
}
R.id.action_restore_backup -> {
@@ -1100,7 +1100,7 @@ open class DeckPicker :
) || mBackButtonPressedToExit
) {
automaticSync()
- finishWithAnimation()
+ finish()
} else {
showSnackbar(R.string.back_pressed_once, Snackbar.LENGTH_SHORT)
}
@@ -1112,10 +1112,6 @@ open class DeckPicker :
}
}
- private fun finishWithAnimation() {
- super.finishWithAnimation(DEFAULT)
- }
-
override fun onKeyUp(keyCode: Int, event: KeyEvent): Boolean {
if (mToolbarSearchView != null && mToolbarSearchView!!.hasFocus()) {
Timber.d("Skipping keypress: search action bar is focused")
@@ -1206,7 +1202,7 @@ open class DeckPicker :
fun addNote() {
val intent = Intent(this@DeckPicker, NoteEditor::class.java)
intent.putExtra(NoteEditor.EXTRA_CALLER, NoteEditor.CALLER_DECKPICKER)
- startActivityWithAnimation(intent, START)
+ startActivity(intent)
}
private fun showStartupScreensAndDialogs(preferences: SharedPreferences, skip: Int) {
@@ -1334,8 +1330,7 @@ open class DeckPicker :
Timber.i("Displaying new features")
val infoIntent = Intent(this, Info::class.java)
infoIntent.putExtra(Info.TYPE_EXTRA, Info.TYPE_NEW_VERSION)
- val transition = if (skip != 0) START else NONE
- launchActivityForResultWithAnimation(infoIntent, showNewVersionInfoLauncher, transition)
+ showNewVersionInfoLauncher.launch(infoIntent)
} else {
Timber.i("Dev Build - not showing 'new features'")
// Don't show new features dialog for development builds
@@ -1603,7 +1598,7 @@ open class DeckPicker :
override fun loginToSyncServer() {
val myAccount = Intent(this, MyAccount::class.java)
myAccount.putExtra("notLoggedIn", true)
- launchActivityForResultWithAnimation(myAccount, loginForSyncLauncher, FADE)
+ loginForSyncLauncher.launch(myAccount)
}
// Callback to import a file -- adding it to existing collection
@@ -1664,13 +1659,13 @@ open class DeckPicker :
fun openAnkiWebSharedDecks() {
val intent = Intent(this, SharedDecksActivity::class.java)
- startActivityWithoutAnimation(intent)
+ startActivity(intent)
}
private fun openFilteredDeckOptions() {
val intent = Intent()
intent.setClass(this, FilteredDeckOptions::class.java)
- startActivityWithAnimation(intent, START)
+ startActivity(intent)
}
private fun openStudyOptions(@Suppress("SameParameterValue") withDeckOptions: Boolean) {
@@ -1681,7 +1676,7 @@ open class DeckPicker :
val intent = Intent()
intent.putExtra("withDeckOptions", withDeckOptions)
intent.setClass(this, StudyOptionsActivity::class.java)
- launchActivityForResultWithAnimation(intent, reviewLauncher, START)
+ reviewLauncher.launch(intent)
}
}
@@ -1924,11 +1919,11 @@ open class DeckPicker :
// open cram options if filtered deck
val i = Intent(this@DeckPicker, FilteredDeckOptions::class.java)
i.putExtra("did", did)
- startActivityWithAnimation(i, FADE)
+ startActivity(i)
} else {
// otherwise open regular options
val intent = com.ichi2.anki.pages.DeckOptions.getIntent(this, did)
- startActivityWithAnimation(intent, FADE)
+ startActivity(intent)
}
}
@@ -2058,7 +2053,7 @@ open class DeckPicker :
private fun openReviewer() {
val reviewer = Intent(this, Reviewer::class.java)
- launchActivityForResultWithAnimation(reviewer, reviewLauncher, START)
+ reviewLauncher.launch(reviewer)
}
override fun onCreateCustomStudySession() {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/DrawingActivity.kt b/AnkiDroid/src/main/java/com/ichi2/anki/DrawingActivity.kt
index c6a64aca24c0..a43e3f01ad70 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/DrawingActivity.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/DrawingActivity.kt
@@ -93,7 +93,7 @@ class DrawingActivity : AnkiActivity() {
} catch (e: FileNotFoundException) {
Timber.w(e)
} finally {
- finishActivityWithFade(this)
+ finish()
}
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/FilteredDeckOptions.kt b/AnkiDroid/src/main/java/com/ichi2/anki/FilteredDeckOptions.kt
index dcdb678b13ea..01fde1c7705e 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/FilteredDeckOptions.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/FilteredDeckOptions.kt
@@ -20,8 +20,6 @@ package com.ichi2.anki
import android.content.SharedPreferences
import android.os.Bundle
import android.preference.*
-import com.ichi2.anim.ActivityTransitionAnimation
-import com.ichi2.anim.ActivityTransitionAnimation.slide
import com.ichi2.anki.analytics.UsageAnalytics
import com.ichi2.annotations.NeedsTest
import com.ichi2.libanki.Collection
@@ -264,7 +262,6 @@ class FilteredDeckOptions :
}
}
finish()
- slide(this, ActivityTransitionAnimation.Direction.FADE)
}
@Suppress("deprecation") // conversion to fragments tracked in github as #5019
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Info.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Info.kt
index 6b663be37109..36e7a082ac7f 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/Info.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/Info.kt
@@ -30,7 +30,6 @@ import android.webkit.WebViewClient
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.widget.ThemeUtils
import com.google.android.material.button.MaterialButton
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.preferences.sharedPrefs
import com.ichi2.utils.AdaptionUtil
import com.ichi2.utils.IntentUtil.canOpenIntent
@@ -182,7 +181,7 @@ class Info : AnkiActivity() {
}
private fun finishWithAnimation() {
- finishWithAnimation(ActivityTransitionAnimation.Direction.START)
+ finish()
}
companion object {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt b/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt
index e4fd584028df..cfa6320a8e03 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/IntentHandler.kt
@@ -121,7 +121,7 @@ class IntentHandler : Activity() {
val reviewIntent = Intent(this, Reviewer::class.java)
CollectionHelper.instance.getColUnsafe(this)!!.decks.select(deckId)
startActivity(reviewIntent)
- AnkiActivity.finishActivityWithFade(this)
+ finish()
}
private fun handleSyncIntent(reloadIntent: Intent, action: String?) {
@@ -130,7 +130,7 @@ class IntentHandler : Activity() {
reloadIntent.action = action
reloadIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(reloadIntent)
- AnkiActivity.finishActivityWithFade(this)
+ finish()
}
private fun handleFileImport(intent: Intent, reloadIntent: Intent, action: String?) {
@@ -173,7 +173,7 @@ class IntentHandler : Activity() {
reloadIntent.action = action
reloadIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(reloadIntent)
- AnkiActivity.finishActivityWithFade(this)
+ finish()
} else {
Timber.i("File import failed")
// Don't import the file if it didn't load properly or doesn't have apkg extension
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/ModelFieldEditor.kt b/AnkiDroid/src/main/java/com/ichi2/anki/ModelFieldEditor.kt
index 792291bfe0c4..64f85eb75734 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/ModelFieldEditor.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/ModelFieldEditor.kt
@@ -31,7 +31,6 @@ import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import com.google.android.material.snackbar.Snackbar
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.UIUtils.showThemedToast
import com.ichi2.anki.dialogs.ConfirmationDialog
@@ -462,7 +461,7 @@ class ModelFieldEditor : AnkiActivity(), LocaleSelectionDialogHandler {
}
private fun closeActivity() {
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
fun handleAction(contextMenuAction: ModelEditorContextMenuAction) {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt b/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt
index 7b2d8a653afb..79ed0f9226ed 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/MyAccount.kt
@@ -26,7 +26,6 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
import com.google.android.material.textfield.TextInputLayout
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.preferences.sharedPrefs
import com.ichi2.ui.TextInputEditField
import com.ichi2.utils.AdaptionUtil.isUserATestClient
@@ -208,7 +207,7 @@ open class MyAccount : AnkiActivity() {
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK && event.repeatCount == 0) {
Timber.i("MyAccount - onBackPressed()")
- finishWithAnimation(ActivityTransitionAnimation.Direction.FADE)
+ finish()
return true
}
return super.onKeyDown(keyCode, event)
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/NavigationDrawerActivity.kt b/AnkiDroid/src/main/java/com/ichi2/anki/NavigationDrawerActivity.kt
index 9c3a4a0cbd8d..54b11ddce984 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/NavigationDrawerActivity.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/NavigationDrawerActivity.kt
@@ -276,7 +276,7 @@ abstract class NavigationDrawerActivity :
*/
protected open fun onNavigationPressed() {
if (mNavButtonGoesBack) {
- finishWithAnimation(END)
+ finish()
} else {
openDrawer()
}
@@ -301,7 +301,7 @@ abstract class NavigationDrawerActivity :
val deckPicker = Intent(this@NavigationDrawerActivity, DeckPicker::class.java)
// opening DeckPicker should use the instance on the back stack & clear back history
deckPicker.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
- startActivityWithAnimation(deckPicker, END)
+ startActivity(deckPicker)
}
R.id.nav_browser -> {
@@ -312,19 +312,13 @@ abstract class NavigationDrawerActivity :
R.id.nav_stats -> {
Timber.i("Navigating to stats")
val intent = com.ichi2.anki.pages.Statistics.getIntent(this)
- startActivityWithAnimation(intent, START)
+ startActivity(intent)
}
R.id.nav_settings -> {
Timber.i("Navigating to settings")
- launchActivityForResultWithAnimation(
- Intent(
- this@NavigationDrawerActivity,
- Preferences::class.java
- ),
- mPreferencesLauncher,
- FADE
- )
+ val intent = Intent(this, Preferences::class.java)
+ mPreferencesLauncher.launch(intent)
}
R.id.nav_help -> {
@@ -347,7 +341,7 @@ abstract class NavigationDrawerActivity :
if (currentCardId != null) {
intent.putExtra("currentCard", currentCardId)
}
- startActivityWithAnimation(intent, START)
+ startActivity(intent)
}
// Override this to specify a specific card id
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt b/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt
index cf83e6f34393..87ad4ed2cab7 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt
@@ -1114,7 +1114,7 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
intent.putExtra(EXTRA_DID, deckId)
// mutate event with additional properties
intentEnricher.accept(intent)
- launchActivityForResultWithAnimation(intent, requestAddLauncher, START)
+ requestAddLauncher.launch(intent)
}
// ----------------------------------------------------------------------------
@@ -1136,7 +1136,7 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
addInstanceStateToBundle(noteEditorBundle)
noteEditorBundle.putBundle("editFields", fieldsAsBundleForPreview)
previewer.putExtra("noteEditorBundle", noteEditorBundle)
- startActivityWithoutAnimation(previewer)
+ startActivity(previewer)
}
/**
@@ -1209,13 +1209,8 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
)
if (animation != null) {
finishWithAnimation(animation)
- return
- }
-
- if (caller == CALLER_NOTEEDITOR_INTENT_ADD) {
- finishWithAnimation(NONE)
} else {
- finishWithAnimation(END)
+ finish()
}
}
@@ -1257,7 +1252,7 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
intent.putExtra("ordId", mCurrentEditedCard!!.ord)
Timber.d("showCardTemplateEditor() with ord %s", mCurrentEditedCard!!.ord)
}
- launchActivityForResultWithAnimation(intent, requestTemplateEditLauncher, START)
+ requestTemplateEditLauncher.launch(intent)
}
/** Appends a string at the selection point, or appends to the end if not in focus */
@@ -1557,7 +1552,7 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
val field = note!!.getField(index)!!
val editCard = Intent(this@NoteEditor, MultimediaEditFieldActivity::class.java)
editCard.putExtra(MultimediaEditFieldActivity.EXTRA_MULTIMEDIA_EDIT_FIELD_ACTIVITY, MultimediaEditFieldActivityExtra(index, field, note))
- launchActivityForResultWithAnimation(editCard, requestMultiMediaEditLauncher, NONE)
+ requestMultiMediaEditLauncher.launch(editCard)
}
private fun initFieldEditText(editText: FieldEditText?, index: Int, enabled: Boolean) {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt
index e05e70fced18..8a64e6267849 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt
@@ -45,7 +45,6 @@ import androidx.core.view.MenuItemCompat
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import com.google.android.material.color.MaterialColors
import com.google.android.material.snackbar.Snackbar
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anim.ActivityTransitionAnimation.getInverseTransition
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.Whiteboard.Companion.createInstance
@@ -170,7 +169,7 @@ open class Reviewer :
super.onCreate(savedInstanceState)
if (handledLaunchFromWebBrowser(intent, this)) {
this.setResult(RESULT_CANCELED)
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
return
}
mColorPalette = findViewById(R.id.whiteboard_editor)
@@ -665,7 +664,7 @@ open class Reviewer :
val animation = getAnimationTransitionFromGesture(fromGesture)
intent.putExtra(NoteEditor.EXTRA_CALLER, NoteEditor.CALLER_REVIEWER_ADD)
intent.putExtra(FINISH_ANIMATION_EXTRA, getInverseTransition(animation) as Parcelable)
- launchActivityForResultWithAnimation(intent, addNoteLauncher, animation)
+ addNoteLauncher.launch(intent)
}
@NeedsTest("Starting animation from swipe is inverse to the finishing one")
@@ -1057,7 +1056,7 @@ open class Reviewer :
message(text = timeboxMessage)
positiveButton(R.string.dialog_continue) {}
negativeButton(text = CollectionManager.TR.studyingFinish()) {
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
cancelable(true)
setOnCancelListener { }
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsActivity.kt b/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsActivity.kt
index 0d9457a28a6d..b4af75781fbd 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsActivity.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsActivity.kt
@@ -18,7 +18,6 @@ package com.ichi2.anki
import android.os.Bundle
import android.view.MenuItem
import androidx.fragment.app.commit
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.StudyOptionsFragment.StudyOptionsListener
import com.ichi2.anki.dialogs.customstudy.CustomStudyDialog.CustomStudyListener
import com.ichi2.anki.dialogs.customstudy.CustomStudyDialogFactory
@@ -70,7 +69,7 @@ class StudyOptionsActivity : NavigationDrawerActivity(), StudyOptionsListener, C
private fun closeStudyOptions(result: Int = RESULT_OK) {
// mCompat.invalidateOptionsMenu(this);
setResult(result)
- finishWithAnimation(ActivityTransitionAnimation.Direction.END)
+ finish()
}
@Deprecated("Deprecated in Java")
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt
index a6b4da2e6e2d..7d4479c62226 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/StudyOptionsFragment.kt
@@ -33,8 +33,6 @@ import androidx.appcompat.widget.Toolbar
import androidx.core.text.HtmlCompat
import androidx.core.view.MenuItemCompat
import androidx.fragment.app.Fragment
-import com.ichi2.anim.ActivityTransitionAnimation
-import com.ichi2.anim.ActivityTransitionAnimation.slide
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.dialogs.customstudy.CustomStudyDialog
import com.ichi2.anki.snackbar.showSnackbar
@@ -124,7 +122,6 @@ class StudyOptionsFragment : Fragment(), Toolbar.OnMenuItemClickListener {
i.putExtra("defaultConfig", defaultConfig)
Timber.i("openFilteredDeckOptions()")
onDeckOptionsActivityResult.launch(i)
- slide(requireActivity(), ActivityTransitionAnimation.Direction.FADE)
}
override fun onCreate(savedInstanceState: Bundle?) {
@@ -167,7 +164,6 @@ class StudyOptionsFragment : Fragment(), Toolbar.OnMenuItemClickListener {
if (!mFragmented && a != null) {
a.setResult(result)
a.finish()
- slide(a, ActivityTransitionAnimation.Direction.END)
} else if (a == null) {
// getActivity() can return null if reference to fragment lingers after parent activity has been closed,
// which is particularly relevant when using AsyncTasks.
@@ -189,11 +185,6 @@ class StudyOptionsFragment : Fragment(), Toolbar.OnMenuItemClickListener {
startActivity(reviewer)
requireActivity().finish()
}
- animateLeft()
- }
-
- private fun animateLeft() {
- slide(requireActivity(), ActivityTransitionAnimation.Direction.START)
}
private fun initAllContentViews(studyOptionsView: View) {
@@ -243,7 +234,6 @@ class StudyOptionsFragment : Fragment(), Toolbar.OnMenuItemClickListener {
val i = com.ichi2.anki.pages.DeckOptions.getIntent(requireContext(), col!!.decks.current().id)
Timber.i("Opening deck options for activity result")
onDeckOptionsActivityResult.launch(i)
- slide(requireActivity(), ActivityTransitionAnimation.Direction.FADE)
}
return true
}
@@ -365,7 +355,7 @@ class StudyOptionsFragment : Fragment(), Toolbar.OnMenuItemClickListener {
val icon = AppCompatResources.getDrawable(requireContext(), R.drawable.ic_arrow_back_white)
icon!!.isAutoMirrored = true
mToolbar!!.navigationIcon = icon
- mToolbar!!.setNavigationOnClickListener { (activity as AnkiActivity).finishWithAnimation(ActivityTransitionAnimation.Direction.END) }
+ mToolbar!!.setNavigationOnClickListener { (activity as AnkiActivity).finish() }
}
} catch (e: IllegalStateException) {
if (!CollectionHelper.instance.colIsOpenUnsafe()) {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt
index 6fa2a2cb316f..bf0731e98852 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt
@@ -26,7 +26,6 @@ import androidx.core.content.edit
import anki.sync.SyncAuth
import anki.sync.SyncCollectionResponse
import anki.sync.syncAuth
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.CollectionManager.TR
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.dialogs.DialogHandlerMessage
@@ -174,7 +173,7 @@ fun MyAccount.handleNewLogin(username: String, password: String) {
}
updateLogin(baseContext, username, auth.hkey)
setResult(RESULT_OK)
- finishWithAnimation(ActivityTransitionAnimation.Direction.FADE)
+ finish()
}
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DeckPickerContextMenu.kt b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DeckPickerContextMenu.kt
index 8dee1a09aed7..a65493db7857 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DeckPickerContextMenu.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/DeckPickerContextMenu.kt
@@ -22,7 +22,6 @@ import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItems
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.CardBrowser
import com.ichi2.anki.DeckPicker
import com.ichi2.anki.R
@@ -154,7 +153,7 @@ class DeckPickerContextMenu(private val collection: Collection) : AnalyticsDialo
DeckPickerContextMenuOption.BROWSE_CARDS -> {
collection.decks.select(deckId)
val intent = Intent(activity, CardBrowser::class.java)
- activity.startActivityWithAnimation(intent, ActivityTransitionAnimation.Direction.START)
+ activity.startActivity(intent)
activity.dismissAllDialogFragments()
}
DeckPickerContextMenuOption.ADD_CARD -> {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/ImportFileSelectionFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/ImportFileSelectionFragment.kt
index 7439f72dc93d..4804b7440e53 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/ImportFileSelectionFragment.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/ImportFileSelectionFragment.kt
@@ -26,7 +26,6 @@ import androidx.appcompat.app.AlertDialog
import androidx.core.os.BundleCompat
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.AnkiActivity
import com.ichi2.anki.R
import com.ichi2.anki.analytics.UsageAnalytics
@@ -167,17 +166,9 @@ class ImportFileSelectionFragment : DialogFragment() {
extraMimes?.let { intent.putExtra(Intent.EXTRA_MIME_TYPES, it) }
if ((fileType == ImportFileType.APKG || fileType == ImportFileType.COLPKG) && activity is ApkgImportResultLauncherProvider) {
- activity.launchActivityForResultWithAnimation(
- intent,
- activity.getApkgFileImportResultLauncher(),
- ActivityTransitionAnimation.Direction.NONE
- )
+ activity.getApkgFileImportResultLauncher().launch(intent)
} else if (fileType == ImportFileType.CSV && activity is CsvImportResultLauncherProvider) {
- activity.launchActivityForResultWithAnimation(
- intent,
- activity.getCsvFileImportResultLauncher(),
- ActivityTransitionAnimation.Direction.NONE
- )
+ activity.getCsvFileImportResultLauncher().launch(intent)
} else {
Timber.w("Activity($activity) can't handle requested import: $fileType")
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/customstudy/CustomStudyDialog.kt b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/customstudy/CustomStudyDialog.kt
index c79eef97e160..943ea7532187 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/customstudy/CustomStudyDialog.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/dialogs/customstudy/CustomStudyDialog.kt
@@ -66,7 +66,7 @@ class CustomStudyDialog(private val collection: Collection, private val customSt
fun onExtendStudyLimits()
fun showDialogFragment(newFragment: DialogFragment)
fun dismissAllDialogFragments()
- fun startActivityWithoutAnimation(intent: Intent)
+ fun startActivity(intent: Intent)
}
fun withArguments(contextMenuAttribute: ContextMenuAttribute<*>, did: DeckId, jumpToReviewer: Boolean = false): CustomStudyDialog {
@@ -490,7 +490,7 @@ class CustomStudyDialog(private val collection: Collection, private val customSt
private fun onLimitsExtended(jumpToReviewer: Boolean) {
if (jumpToReviewer) {
- customStudyListener?.startActivityWithoutAnimation(Intent(requireContext(), Reviewer::class.java))
+ customStudyListener?.startActivity(Intent(requireContext(), Reviewer::class.java))
} else {
customStudyListener?.onExtendStudyLimits()
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/export/ActivityExportingDelegate.kt b/AnkiDroid/src/main/java/com/ichi2/anki/export/ActivityExportingDelegate.kt
index ffcb25b43369..096a116c9eb1 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/export/ActivityExportingDelegate.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/export/ActivityExportingDelegate.kt
@@ -183,7 +183,7 @@ class ActivityExportingDelegate(private val activity: AnkiActivity, private val
activity.getString(R.string.export_share_title)
)
if (shareFileIntent.resolveActivity(activity.packageManager) != null) {
- activity.startActivityWithoutAnimation(shareFileIntent)
+ activity.startActivity(shareFileIntent)
// TODO: find if there is a way to check whether the activity successfully shared the collection.
saveSuccessfulCollectionExportIfRelevant()
} else {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt
index 2f7fdb467c83..9f053929607c 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt
@@ -55,7 +55,6 @@ import androidx.core.content.FileProvider
import androidx.core.content.getSystemService
import androidx.core.os.BundleCompat
import com.canhub.cropper.*
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.AnkiDroidApp
import com.ichi2.anki.CrashReportService
import com.ichi2.anki.DrawingActivity
@@ -187,14 +186,14 @@ class BasicImageFieldController : FieldControllerBase(), IFieldController {
setOnClickListener {
val i = Intent(Intent.ACTION_PICK)
i.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*")
- mActivity.launchActivityForResultWithAnimation(i, selectImageLauncher, ActivityTransitionAnimation.Direction.NONE)
+ selectImageLauncher.launch(i)
}
}
val btnDraw = Button(mActivity).apply {
text = gtxt(R.string.drawing)
setOnClickListener {
- mActivity.launchActivityForResultWithAnimation(Intent(mActivity, DrawingActivity::class.java), drawingLauncher, ActivityTransitionAnimation.Direction.NONE)
+ drawingLauncher.launch(Intent(mActivity, DrawingActivity::class.java))
}
}
@@ -332,7 +331,7 @@ class BasicImageFieldController : FieldControllerBase(), IFieldController {
cancelImageCapture()
return toReturn
}
- mActivity.launchActivityForResultWithAnimation(cameraIntent, takePictureLauncher, ActivityTransitionAnimation.Direction.NONE)
+ takePictureLauncher.launch(cameraIntent)
} catch (e: IOException) {
Timber.w(e, "mBtnCamera::onClickListener() unable to prepare file and launch camera")
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicMediaClipFieldController.kt b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicMediaClipFieldController.kt
index dd1829702b11..3cee9f94d8a7 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicMediaClipFieldController.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicMediaClipFieldController.kt
@@ -27,7 +27,6 @@ import android.widget.LinearLayout
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.StringRes
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.AnkiDroidApp
import com.ichi2.anki.CrashReportService
import com.ichi2.anki.R
@@ -96,11 +95,7 @@ class BasicMediaClipFieldController : FieldControllerBase(), IFieldController {
// Only get openable files, to avoid virtual files issues with Android 7+
i.addCategory(Intent.CATEGORY_OPENABLE)
val chooserPrompt = mActivity.resources.getString(prompt)
- mActivity.launchActivityForResultWithAnimation(
- Intent.createChooser(i, chooserPrompt),
- selectMediaLauncher,
- ActivityTransitionAnimation.Direction.NONE
- )
+ selectMediaLauncher.launch(Intent.createChooser(i, chooserPrompt))
}
override fun setEditingActivity(activity: MultimediaEditFieldActivity) {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/notetype/ManageNotetypes.kt b/AnkiDroid/src/main/java/com/ichi2/anki/notetype/ManageNotetypes.kt
index 3de2cf3a955f..5ba51d7bbf93 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/notetype/ManageNotetypes.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/notetype/ManageNotetypes.kt
@@ -38,7 +38,6 @@ import com.afollestad.materialdialogs.customview.customView
import com.afollestad.materialdialogs.input.getInputField
import com.afollestad.materialdialogs.input.input
import com.google.android.material.floatingactionbutton.FloatingActionButton
-import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anki.*
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.snackbar.showSnackbar
@@ -287,11 +286,7 @@ class ManageNotetypes : AnkiActivity() {
val targetIntent = Intent(this@ManageNotetypes, T::class.java).apply {
extras.forEach { toExtra(it) }
}
- launchActivityForResultWithAnimation(
- targetIntent,
- outsideChangesLauncher,
- ActivityTransitionAnimation.Direction.START
- )
+ outsideChangesLauncher.launch(targetIntent)
}
private fun Intent.toExtra(newExtra: Map.Entry) {
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/AppLoadedFromBackupWorkaround.kt b/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/AppLoadedFromBackupWorkaround.kt
index c5de1ab15a46..21a0222223cd 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/AppLoadedFromBackupWorkaround.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/workarounds/AppLoadedFromBackupWorkaround.kt
@@ -19,7 +19,6 @@ package com.ichi2.anki.workarounds
import android.app.Activity
import android.os.Bundle
import android.os.Process
-import com.ichi2.anki.AnkiActivity
import com.ichi2.anki.AnkiDroidApp
import com.ichi2.anki.R
import com.ichi2.anki.UIUtils
@@ -62,7 +61,7 @@ object AppLoadedFromBackupWorkaround {
Themes.setTheme(this)
// Avoids a SuperNotCalledException
activitySuperOnCreate(savedInstanceState)
- AnkiActivity.finishActivityWithFade(this)
+ finish()
// If we don't kill the process, the backup is not "done" and reopening the app show the same message.
Thread {
diff --git a/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt b/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt
index f8af8101aaad..9a7451f9c817 100644
--- a/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/utils/ImportUtils.kt
@@ -265,7 +265,7 @@ object ImportUtils {
setCancelable(false)
positiveButton(R.string.dialog_ok) {
if (exitActivity) {
- AnkiActivity.finishActivityWithFade(activity)
+ activity.finish()
}
}
}
diff --git a/AnkiDroid/src/main/java/com/ichi2/utils/IntentUtil.kt b/AnkiDroid/src/main/java/com/ichi2/utils/IntentUtil.kt
index 79fca6c72e3d..e4c57019f0c8 100644
--- a/AnkiDroid/src/main/java/com/ichi2/utils/IntentUtil.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/utils/IntentUtil.kt
@@ -39,7 +39,7 @@ object IntentUtil {
fun tryOpenIntent(activity: AnkiActivity, intent: Intent) {
try {
if (canOpenIntent(activity, intent)) {
- activity.startActivityWithoutAnimation(intent)
+ activity.startActivity(intent)
} else {
val errorMsg = activity.getString(R.string.feedback_no_suitable_app_found)
activity.showSnackbar(errorMsg, Snackbar.LENGTH_SHORT)
diff --git a/AnkiDroid/src/main/res/anim/decelerate_cubic.xml b/AnkiDroid/src/main/res/anim/decelerate_cubic.xml
deleted file mode 100644
index 3d5bff5e24bb..000000000000
--- a/AnkiDroid/src/main/res/anim/decelerate_cubic.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/AnkiDroid/src/main/res/anim/decelerate_quint.xml b/AnkiDroid/src/main/res/anim/decelerate_quint.xml
deleted file mode 100644
index 5548aef93bd1..000000000000
--- a/AnkiDroid/src/main/res/anim/decelerate_quint.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
diff --git a/AnkiDroid/src/main/res/anim/dialog_exit.xml b/AnkiDroid/src/main/res/anim/dialog_exit.xml
deleted file mode 100644
index 882ef65c826d..000000000000
--- a/AnkiDroid/src/main/res/anim/dialog_exit.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file