diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/Preferences.kt b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/Preferences.kt index 5be2bac0fadf..258ff3e2cc06 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/preferences/Preferences.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/preferences/Preferences.kt @@ -39,6 +39,7 @@ import com.google.android.material.appbar.CollapsingToolbarLayout import com.google.android.material.appbar.MaterialToolbar import com.ichi2.anki.R import com.ichi2.anki.SingleFragmentActivity +import com.ichi2.anki.utils.ext.sharedPrefs import com.ichi2.anki.utils.isWindowCompact import com.ichi2.utils.FragmentFactoryUtils import timber.log.Timber @@ -113,7 +114,7 @@ class PreferencesFragment : fragment.arguments = pref.extras childFragmentManager.commit { replace(R.id.settings_container, fragment, fragment::class.jvmName) - setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) + setOpenTransition(this) addToBackStack(null) } return true @@ -125,7 +126,7 @@ class PreferencesFragment : parentFragmentManager.popBackStack() // clear the search fragment from the backstack childFragmentManager.commit { replace(R.id.settings_container, fragment, fragment.javaClass.name) - setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) + setOpenTransition(this) addToBackStack(fragment.javaClass.name) } @@ -140,6 +141,12 @@ class PreferencesFragment : view?.findViewById(R.id.toolbar)?.title = title } + private fun setOpenTransition(fragmentTransaction: FragmentTransaction) { + if (!sharedPrefs().getBoolean("safeDisplay", false)) { + fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) + } + } + /** * Starts the first settings fragment, which by default is [HeaderFragment]. * The initial fragment may be overridden by putting the java class name