mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Add slide animation to conversation list to archive.
This commit is contained in:
@@ -269,9 +269,6 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||
cameraFab = view.findViewById(R.id.camera_fab_old);
|
||||
}
|
||||
|
||||
Toolbar toolbar = getToolbar(view);
|
||||
toolbar.setVisibility(View.VISIBLE);
|
||||
|
||||
fab.show();
|
||||
cameraFab.show();
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ import org.thoughtcrime.securesms.util.BottomSheetUtil
|
||||
import org.thoughtcrime.securesms.util.TopToastPopup
|
||||
import org.thoughtcrime.securesms.util.TopToastPopup.Companion.show
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.thoughtcrime.securesms.util.runHideAnimation
|
||||
import org.thoughtcrime.securesms.util.runRevealAnimation
|
||||
import org.thoughtcrime.securesms.util.views.Stub
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
import org.whispersystems.signalservice.api.websocket.WebSocketConnectionState
|
||||
@@ -147,16 +149,20 @@ class MainActivityListHostFragment : Fragment(R.layout.main_activity_list_host_f
|
||||
}
|
||||
|
||||
private fun presentToolbarForConversationListFragment() {
|
||||
if (_basicToolbar.resolved() && _basicToolbar.get().visible) {
|
||||
_toolbar.runRevealAnimation(R.anim.slide_to_end)
|
||||
}
|
||||
|
||||
_toolbar.visible = true
|
||||
_searchAction.visible = true
|
||||
if (_basicToolbar.resolved()) {
|
||||
_basicToolbar.get().visible = false
|
||||
_basicToolbar.get().runHideAnimation(R.anim.slide_from_start)
|
||||
}
|
||||
}
|
||||
|
||||
private fun presentToolbarForConversationListArchiveFragment() {
|
||||
_toolbar.visible = false
|
||||
_basicToolbar.get().visible = true
|
||||
_toolbar.runHideAnimation(R.anim.slide_to_start)
|
||||
_basicToolbar.get().runRevealAnimation(R.anim.slide_from_end)
|
||||
}
|
||||
|
||||
private fun presentToolbarForStoriesLandingFragment() {
|
||||
|
||||
27
app/src/main/java/org/thoughtcrime/securesms/util/Views.kt
Normal file
27
app/src/main/java/org/thoughtcrime/securesms/util/Views.kt
Normal file
@@ -0,0 +1,27 @@
|
||||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import android.view.View
|
||||
import android.view.animation.AnimationUtils
|
||||
import androidx.annotation.AnimRes
|
||||
|
||||
/**
|
||||
* Runs the given animation on this view, assuming that the view is in an INVISIBLE or HIDDEN state.
|
||||
*/
|
||||
fun View.runRevealAnimation(@AnimRes anim: Int) {
|
||||
animation = AnimationUtils.loadAnimation(context, anim)
|
||||
visible = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the given animation on this view, assuming that the view is in a VISIBLE state and will
|
||||
* hide on completion
|
||||
*/
|
||||
fun View.runHideAnimation(@AnimRes anim: Int) {
|
||||
startAnimation(
|
||||
AnimationUtils.loadAnimation(context, anim).apply {
|
||||
setListeners(onAnimationEnd = {
|
||||
visible = false
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user