From 022a8d529bcf4290b56f59dd3a17ec6405ce8801 Mon Sep 17 00:00:00 2001 From: erosenthal Date: Wed, 20 Mar 2019 12:16:29 -0400 Subject: [PATCH 1/2] standardize our transitions --- .../rocket/android/chatrooms/ui/ChatRoomsFragment.kt | 10 ++++++---- .../rocket/android/main/presentation/MainNavigator.kt | 1 + app/src/main/res/anim/close_enter.xml | 4 ++-- app/src/main/res/anim/close_exit.xml | 2 +- app/src/main/res/anim/enter_from_left.xml | 2 +- app/src/main/res/anim/enter_from_right.xml | 2 +- app/src/main/res/anim/exit_to_left.xml | 2 +- app/src/main/res/anim/exit_to_right.xml | 2 +- app/src/main/res/anim/open_enter.xml | 2 +- app/src/main/res/anim/open_exit.xml | 4 ++-- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt b/app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt index c1d91c64a9..d5d4677a2b 100644 --- a/app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt +++ b/app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt @@ -330,6 +330,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { val newFragment = SettingsFragment() val fragmentManager = fragmentManager val fragmentTransaction = fragmentManager!!.beginTransaction() + fragmentTransaction?.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right); fragmentTransaction.replace(R.id.fragment_container, newFragment) fragmentTransaction.addToBackStack(null) fragmentTransaction.commit() @@ -506,6 +507,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { val newFragment = ProfileFragment() val fragmentManager = fragmentManager val fragmentTransaction = fragmentManager!!.beginTransaction() + fragmentTransaction?.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right); fragmentTransaction.replace(R.id.fragment_container, newFragment) fragmentTransaction.addToBackStack(null) fragmentTransaction.commit() @@ -544,10 +546,10 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { create_new_channel_fab.setOnClickListener { view -> currentUserStatusIcon?.isGone = true val contactsFragment = ContactsFragment() - val transaction = activity?.supportFragmentManager?.beginTransaction(); - transaction?.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right); - transaction?.replace(this.id, contactsFragment, "contactsFragment"); - transaction?.addToBackStack("contactsFragment")?.commit(); + val transaction = activity?.supportFragmentManager?.beginTransaction() + transaction?.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right) + transaction?.replace(this.id, contactsFragment, "contactsFragment") + transaction?.addToBackStack("contactsFragment")?.commit() } } diff --git a/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt b/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt index 6b9161654a..fe076e6a76 100644 --- a/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt +++ b/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt @@ -72,6 +72,7 @@ class MainNavigator(internal val activity: MainActivity) { ) ) activity.overridePendingTransition(R.anim.open_enter, R.anim.open_exit) + } /** diff --git a/app/src/main/res/anim/close_enter.xml b/app/src/main/res/anim/close_enter.xml index 74d1f407b7..e6c034c935 100644 --- a/app/src/main/res/anim/close_enter.xml +++ b/app/src/main/res/anim/close_enter.xml @@ -8,13 +8,13 @@ android:zAdjustment="top"> diff --git a/app/src/main/res/anim/enter_from_left.xml b/app/src/main/res/anim/enter_from_left.xml index 3bd58a304f..78bfe60cb4 100644 --- a/app/src/main/res/anim/enter_from_left.xml +++ b/app/src/main/res/anim/enter_from_left.xml @@ -2,7 +2,7 @@ diff --git a/app/src/main/res/anim/open_exit.xml b/app/src/main/res/anim/open_exit.xml index 8bbb84f848..381caa9927 100644 --- a/app/src/main/res/anim/open_exit.xml +++ b/app/src/main/res/anim/open_exit.xml @@ -8,13 +8,13 @@ android:zAdjustment="normal"> Date: Wed, 20 Mar 2019 12:19:29 -0400 Subject: [PATCH 2/2] cleanup --- .../java/chat/rocket/android/main/presentation/MainNavigator.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt b/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt index fe076e6a76..6b9161654a 100644 --- a/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt +++ b/app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt @@ -72,7 +72,6 @@ class MainNavigator(internal val activity: MainActivity) { ) ) activity.overridePendingTransition(R.anim.open_enter, R.anim.open_exit) - } /**