kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash and icon change issue with shared element transition.
rodzic
27c3fca324
commit
e143c47c25
|
@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.Navigator
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.FragmentNavigatorExtras
|
||||
import org.signal.core.util.concurrent.SimpleTask
|
||||
|
@ -106,14 +107,23 @@ class MainActivityListHostFragment : Fragment(R.layout.main_activity_list_host_f
|
|||
if (state.tab == ConversationListTab.CHATS) {
|
||||
return
|
||||
} else {
|
||||
val cameraFab = requireView().findViewById<View>(R.id.camera_fab_new)
|
||||
val newConvoFab = requireView().findViewById<View>(R.id.fab_new)
|
||||
|
||||
val extras: Navigator.Extras? = if (cameraFab == null || newConvoFab == null) {
|
||||
null
|
||||
} else {
|
||||
FragmentNavigatorExtras(
|
||||
cameraFab to "camera_fab",
|
||||
newConvoFab to "new_convo_fab"
|
||||
)
|
||||
}
|
||||
|
||||
navController.navigate(
|
||||
R.id.action_conversationListFragment_to_storiesLandingFragment,
|
||||
null,
|
||||
null,
|
||||
FragmentNavigatorExtras(
|
||||
requireView().findViewById<View>(R.id.camera_fab_new) to "camera_fab",
|
||||
requireView().findViewById<View>(R.id.fab_new) to "new_convo_fab"
|
||||
)
|
||||
extras
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
|
|||
setEnterSharedElementCallback(object : SharedElementCallback() {
|
||||
override fun onSharedElementStart(sharedElementNames: MutableList<String>?, sharedElements: MutableList<View>?, sharedElementSnapshots: MutableList<View>?) {
|
||||
if (sharedElementNames?.contains("camera_fab") == true) {
|
||||
cameraFab.setImageResource(R.drawable.ic_compose_24)
|
||||
lifecycleDisposable += Single.timer(200, TimeUnit.MILLISECONDS).subscribeBy {
|
||||
cameraFab.setImageResource(R.drawable.ic_camera_outline_24)
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
app:backgroundTint="@color/signal_colorPrimaryContainer"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@drawable/ic_compose_outline_24"
|
||||
app:srcCompat="@drawable/ic_camera_outline_24"
|
||||
app:tint="@color/signal_colorOnPrimaryContainer" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<transitionSet android:duration="200"
|
||||
<transitionSet android:duration="100"
|
||||
android:interpolator="@anim/camera_fab_cubic_easing_interpolator"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<transition class="org.thoughtcrime.securesms.animation.transitions.FabElevationFadeTransform" />
|
||||
|
|
Ładowanie…
Reference in New Issue