kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add slide animation to conversation list to archive.
rodzic
e770241ed4
commit
756eafe3c8
|
@ -269,9 +269,6 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||||
cameraFab = view.findViewById(R.id.camera_fab_old);
|
cameraFab = view.findViewById(R.id.camera_fab_old);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toolbar toolbar = getToolbar(view);
|
|
||||||
toolbar.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
fab.show();
|
fab.show();
|
||||||
cameraFab.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
|
||||||
import org.thoughtcrime.securesms.util.TopToastPopup.Companion.show
|
import org.thoughtcrime.securesms.util.TopToastPopup.Companion.show
|
||||||
import org.thoughtcrime.securesms.util.Util
|
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.views.Stub
|
||||||
import org.thoughtcrime.securesms.util.visible
|
import org.thoughtcrime.securesms.util.visible
|
||||||
import org.whispersystems.signalservice.api.websocket.WebSocketConnectionState
|
import org.whispersystems.signalservice.api.websocket.WebSocketConnectionState
|
||||||
|
@ -147,16 +149,20 @@ class MainActivityListHostFragment : Fragment(R.layout.main_activity_list_host_f
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun presentToolbarForConversationListFragment() {
|
private fun presentToolbarForConversationListFragment() {
|
||||||
|
if (_basicToolbar.resolved() && _basicToolbar.get().visible) {
|
||||||
|
_toolbar.runRevealAnimation(R.anim.slide_to_end)
|
||||||
|
}
|
||||||
|
|
||||||
_toolbar.visible = true
|
_toolbar.visible = true
|
||||||
_searchAction.visible = true
|
_searchAction.visible = true
|
||||||
if (_basicToolbar.resolved()) {
|
if (_basicToolbar.resolved()) {
|
||||||
_basicToolbar.get().visible = false
|
_basicToolbar.get().runHideAnimation(R.anim.slide_from_start)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun presentToolbarForConversationListArchiveFragment() {
|
private fun presentToolbarForConversationListArchiveFragment() {
|
||||||
_toolbar.visible = false
|
_toolbar.runHideAnimation(R.anim.slide_to_start)
|
||||||
_basicToolbar.get().visible = true
|
_basicToolbar.get().runRevealAnimation(R.anim.slide_from_end)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun presentToolbarForStoriesLandingFragment() {
|
private fun presentToolbarForStoriesLandingFragment() {
|
||||||
|
|
|
@ -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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
|
@ -7,10 +7,14 @@
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/conversationListFragment"
|
android:id="@+id/conversationListFragment"
|
||||||
android:name="org.thoughtcrime.securesms.conversationlist.ConversationListFragment"
|
android:name="org.thoughtcrime.securesms.conversationlist.ConversationListFragment"
|
||||||
android:label="conversation_list_fragment" >
|
android:label="conversation_list_fragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_conversationListFragment_to_conversationListArchiveFragment"
|
android:id="@+id/action_conversationListFragment_to_conversationListArchiveFragment"
|
||||||
app:destination="@id/conversationListArchiveFragment" />
|
app:destination="@id/conversationListArchiveFragment"
|
||||||
|
app:enterAnim="@anim/slide_from_end"
|
||||||
|
app:exitAnim="@anim/slide_to_start"
|
||||||
|
app:popEnterAnim="@anim/slide_to_end"
|
||||||
|
app:popExitAnim="@anim/slide_from_start" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_conversationListFragment_to_storiesLandingFragment"
|
android:id="@+id/action_conversationListFragment_to_storiesLandingFragment"
|
||||||
app:destination="@id/storiesLandingFragment" />
|
app:destination="@id/storiesLandingFragment" />
|
||||||
|
|
Ładowanie…
Reference in New Issue