mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Finally found a way to do proper animation
This commit is contained in:
parent
d5c78f58c0
commit
369a6f1977
7 changed files with 25 additions and 14 deletions
|
|
@ -22,7 +22,6 @@ package org.linphone.ui
|
|||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
|
|
@ -110,12 +109,4 @@ class MainActivity : AppCompatActivity() {
|
|||
private fun getNavBar(): NavigationBarView? {
|
||||
return binding.mainNavView ?: binding.mainNavRail
|
||||
}
|
||||
|
||||
fun hideNavBar() {
|
||||
binding.mainNavView?.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun showNavBar() {
|
||||
binding.mainNavView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
|
@ -31,7 +33,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.linphone.R
|
||||
import org.linphone.databinding.ConversationsFragmentBinding
|
||||
import org.linphone.ui.MainActivity
|
||||
|
||||
class ConversationsFragment : Fragment() {
|
||||
private lateinit var binding: ConversationsFragmentBinding
|
||||
|
|
@ -56,6 +57,10 @@ class ConversationsFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onCreateAnimation(transit: Int, enter: Boolean, nextAnim: Int): Animation? {
|
||||
return AnimationUtils.loadAnimation(activity, R.anim.hold)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
binding.conversationsList.adapter = null
|
||||
adapter.unregisterAdapterDataObserver(observer)
|
||||
|
|
@ -107,7 +112,6 @@ class ConversationsFragment : Fragment() {
|
|||
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
(requireActivity() as MainActivity).showNavBar()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import org.linphone.R
|
||||
import org.linphone.contacts.ContactsSelectionAdapter
|
||||
import org.linphone.databinding.NewConversationFragmentBinding
|
||||
import org.linphone.ui.MainActivity
|
||||
|
||||
class NewConversationFragment : Fragment() {
|
||||
private lateinit var binding: NewConversationFragmentBinding
|
||||
|
|
@ -70,7 +69,6 @@ class NewConversationFragment : Fragment() {
|
|||
|
||||
(view.parent as? ViewGroup)?.doOnPreDraw {
|
||||
startPostponedEnterTransition()
|
||||
(requireActivity() as MainActivity).hideNavBar()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
5
app/src/main/res/anim/hold.xml
Normal file
5
app/src/main/res/anim/hold.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
5
app/src/main/res/anim/slide_in.xml
Normal file
5
app/src/main/res/anim/slide_in.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fromYDelta="100%"
|
||||
android:toYDelta="0%"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
5
app/src/main/res/anim/slide_out.xml
Normal file
5
app/src/main/res/anim/slide_out.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<translate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:fromYDelta="0%"
|
||||
android:toYDelta="100%"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
|
|
@ -12,7 +12,10 @@
|
|||
tools:layout="@layout/conversations_fragment">
|
||||
<action
|
||||
android:id="@+id/action_conversationsFragment_to_newConversationFragment"
|
||||
app:destination="@id/newConversationFragment" />
|
||||
app:destination="@id/newConversationFragment"
|
||||
app:enterAnim="@anim/slide_in"
|
||||
app:launchSingleTop="true"
|
||||
app:popExitAnim="@anim/slide_out" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue