Removed tabs slide-in/slide-out animations

This commit is contained in:
Sylvain Berfini 2021-04-09 15:07:53 +02:00
parent e8696fc700
commit e2a39b868e
5 changed files with 18 additions and 92 deletions

View file

@ -27,7 +27,6 @@ import android.os.Parcelable
import android.view.Gravity
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.FragmentContainerView
import androidx.lifecycle.ViewModelProvider
@ -160,19 +159,10 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
statusFragment.visibility = View.VISIBLE
}
val motionLayout: MotionLayout = binding.content as MotionLayout
if (corePreferences.enableAnimations) {
when (destination.id) {
R.id.masterCallLogsFragment, R.id.masterContactsFragment, R.id.dialerFragment, R.id.masterChatRoomsFragment ->
motionLayout.transitionToState(R.id.visible)
else -> motionLayout.transitionToState(R.id.gone)
}
} else {
when (destination.id) {
R.id.masterCallLogsFragment, R.id.masterContactsFragment, R.id.dialerFragment, R.id.masterChatRoomsFragment ->
motionLayout.setTransition(R.id.visible, R.id.visible)
else -> motionLayout.setTransition(R.id.gone, R.id.gone)
}
when (destination.id) {
R.id.masterCallLogsFragment, R.id.masterContactsFragment, R.id.dialerFragment, R.id.masterChatRoomsFragment ->
tabsFragment.visibility = View.VISIBLE
else -> tabsFragment.visibility = View.GONE
}
}

View file

@ -1,19 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/motion_main_activity_tabs_land">
android:layout_alignParentBottom="true">
<!-- For proper snack bar placement -->
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toRightOf="@id/tabs_fragment"
app:layout_constraintRight_toRightOf="parent">
android:layout_toRightOf="@id/tabs_fragment">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
@ -31,7 +30,7 @@
android:name="org.linphone.activities.main.fragments.TabsFragment"
android:layout_width="@dimen/main_activity_tabs_fragment_size"
android:layout_height="match_parent"
tools:layout="@layout/tabs_fragment"
app:layout_constraintLeft_toLeftOf="parent"/>
android:layout_alignParentLeft="true"
tools:layout="@layout/tabs_fragment"/>
</androidx.constraintlayout.motion.widget.MotionLayout>
</RelativeLayout>

View file

@ -1,20 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
app:layoutDescription="@xml/motion_main_activity_tabs">
android:layout_alignParentBottom="true">
<!-- For proper snack bar placement -->
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/tabs_fragment">
android:layout_height="match_parent"
android:layout_above="@id/tabs_fragment">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
@ -32,7 +30,7 @@
android:name="org.linphone.activities.main.fragments.TabsFragment"
android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_tabs_fragment_size"
tools:layout="@layout/tabs_fragment"
app:layout_constraintBottom_toBottomOf="parent"/>
android:layout_alignParentBottom="true"
tools:layout="@layout/tabs_fragment"/>
</androidx.constraintlayout.motion.widget.MotionLayout>
</RelativeLayout>

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:duration="100"
motion:constraintSetStart="@+id/visible"
motion:constraintSetEnd="@+id/gone" />
<ConstraintSet android:id="@+id/visible">
<Constraint
android:id="@id/tabs_fragment"
android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_tabs_fragment_size"
motion:layout_constraintBottom_toBottomOf="parent"/>
</ConstraintSet>
<ConstraintSet android:id="@+id/gone">
<Constraint
android:id="@id/tabs_fragment"
android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_tabs_fragment_size"
motion:layout_constraintTop_toBottomOf="parent"/>
</ConstraintSet>
</MotionScene>

View file

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
<Transition
motion:duration="100"
motion:constraintSetStart="@+id/visible"
motion:constraintSetEnd="@+id/gone" />
<ConstraintSet android:id="@+id/visible">
<Constraint
android:id="@id/tabs_fragment"
android:layout_width="@dimen/main_activity_tabs_fragment_size"
android:layout_height="match_parent"
motion:layout_constraintLeft_toLeftOf="parent"
motion:layout_constraintRight_creator="0"/>
</ConstraintSet>
<ConstraintSet android:id="@+id/gone">
<Constraint
android:id="@id/tabs_fragment"
android:layout_width="@dimen/main_activity_tabs_fragment_size"
android:layout_height="match_parent"
motion:layout_constraintRight_toLeftOf="parent"/>
</ConstraintSet>
</MotionScene>