kopia lustrzana https://github.com/ryukoposting/Signal-Android
Create nicer animation for moving between pages.
rodzic
740977164b
commit
d29b0609a3
|
@ -13,6 +13,7 @@ import androidx.fragment.app.setFragmentResult
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.Navigation
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.transition.AutoTransition
|
||||
import androidx.transition.TransitionManager
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import org.signal.core.util.EditTextUtil
|
||||
|
@ -24,6 +25,7 @@ import org.thoughtcrime.securesms.avatar.Avatars
|
|||
import org.thoughtcrime.securesms.avatar.picker.AvatarPickerItem
|
||||
import org.thoughtcrime.securesms.components.BoldSelectionTabItem
|
||||
import org.thoughtcrime.securesms.components.ControllableTabLayout
|
||||
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout
|
||||
import org.thoughtcrime.securesms.components.recyclerview.GridDividerDecoration
|
||||
import org.thoughtcrime.securesms.util.MappingAdapter
|
||||
import org.thoughtcrime.securesms.util.ViewUtil
|
||||
|
@ -60,6 +62,7 @@ class TextAvatarCreationFragment : Fragment(R.layout.text_avatar_creation_fragme
|
|||
val toolbar: Toolbar = view.findViewById(R.id.text_avatar_creation_toolbar)
|
||||
val tabLayout: ControllableTabLayout = view.findViewById(R.id.text_avatar_creation_tabs)
|
||||
val doneButton: View = view.findViewById(R.id.text_avatar_creation_done)
|
||||
val keyboardAwareLayout: KeyboardAwareLinearLayout = view.findViewById(R.id.keyboard_aware_layout)
|
||||
|
||||
withRecyclerSet.load(requireContext(), R.layout.text_avatar_creation_fragment_content)
|
||||
withoutRecyclerSet.load(requireContext(), R.layout.text_avatar_creation_fragment_content_hidden_recycler)
|
||||
|
@ -111,6 +114,15 @@ class TextAvatarCreationFragment : Fragment(R.layout.text_avatar_creation_fragme
|
|||
false
|
||||
}
|
||||
}
|
||||
|
||||
keyboardAwareLayout.addOnKeyboardHiddenListener {
|
||||
if (tabLayout.selectedTabPosition == 1) {
|
||||
val transition = AutoTransition().setStartDelay(250L)
|
||||
TransitionManager.endTransitions(content)
|
||||
withRecyclerSet.applyTo(content)
|
||||
TransitionManager.beginDelayedTransition(content, transition)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inner class OnTabSelectedListener : TabLayout.OnTabSelectedListener {
|
||||
|
@ -120,18 +132,12 @@ class TextAvatarCreationFragment : Fragment(R.layout.text_avatar_creation_fragme
|
|||
textInput.isEnabled = true
|
||||
ViewUtil.focusAndShowKeyboard(textInput)
|
||||
|
||||
TransitionManager.endTransitions(content)
|
||||
withoutRecyclerSet.applyTo(content)
|
||||
TransitionManager.beginDelayedTransition(content)
|
||||
textInput.setSelection(textInput.length())
|
||||
}
|
||||
1 -> {
|
||||
textInput.isEnabled = false
|
||||
ViewUtil.hideKeyboard(requireContext(), textInput)
|
||||
|
||||
TransitionManager.endTransitions(content)
|
||||
withRecyclerSet.applyTo(content)
|
||||
TransitionManager.beginDelayedTransition(content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,81 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/keyboard_aware_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<org.thoughtcrime.securesms.util.views.DarkOverflowToolbar
|
||||
android:id="@+id/text_avatar_creation_toolbar"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:theme="?attr/settingsToolbarStyle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navigationIcon="@drawable/ic_arrow_left_24"
|
||||
app:title="@string/TextAvatarCreationFragment__preview"
|
||||
app:titleTextAppearance="@style/Signal.Text.Title" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.thoughtcrime.securesms.util.views.DarkOverflowToolbar
|
||||
android:id="@+id/text_avatar_creation_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:theme="?attr/settingsToolbarStyle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navigationIcon="@drawable/ic_arrow_left_24"
|
||||
app:title="@string/TextAvatarCreationFragment__preview"
|
||||
app:titleTextAppearance="@style/Signal.Text.Title" />
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/text_avatar_creation_hairline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:background="@color/transparent_black_05"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_avatar_creation_tabs" />
|
||||
<View
|
||||
android:id="@+id/text_avatar_creation_hairline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:background="@color/transparent_black_05"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_avatar_creation_tabs" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.ControllableTabLayout
|
||||
android:id="@+id/text_avatar_creation_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_avatar_creation_toolbar"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@color/signal_inverse_primary"
|
||||
app:tabIndicatorFullWidth="false"
|
||||
app:tabMode="fixed"
|
||||
app:tabTextAppearance="@style/TextAppearance.Signal.Body2">
|
||||
<org.thoughtcrime.securesms.components.ControllableTabLayout
|
||||
android:id="@+id/text_avatar_creation_tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_avatar_creation_toolbar"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@color/signal_inverse_primary"
|
||||
app:tabIndicatorFullWidth="false"
|
||||
app:tabMode="fixed"
|
||||
app:tabTextAppearance="@style/TextAppearance.Signal.Body2">
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/text_avatar_creation_tab_text"
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/text_avatar_creation_tab_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/TextAvatarCreationFragment__text" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/text_avatar_creation_tab_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/TextAvatarCreationFragment__color" />
|
||||
|
||||
</org.thoughtcrime.securesms.components.ControllableTabLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_avatar_creation_tabs">
|
||||
|
||||
<include layout="@layout/text_avatar_creation_fragment_content_hidden_recycler" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/text_avatar_creation_done"
|
||||
style="@style/Signal.Widget.Button.Large.Primary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/TextAvatarCreationFragment__text" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:minHeight="48dp"
|
||||
android:text="@string/TextAvatarCreationFragment__done"
|
||||
app:cornerRadius="28dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<com.google.android.material.tabs.TabItem
|
||||
android:id="@+id/text_avatar_creation_tab_color"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/TextAvatarCreationFragment__color" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</org.thoughtcrime.securesms.components.ControllableTabLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/text_avatar_creation_tabs">
|
||||
|
||||
<include layout="@layout/text_avatar_creation_fragment_content_hidden_recycler" />
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/text_avatar_creation_done"
|
||||
style="@style/Signal.Widget.Button.Large.Primary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:minHeight="48dp"
|
||||
android:text="@string/TextAvatarCreationFragment__done"
|
||||
app:cornerRadius="28dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout>
|
||||
|
|
Ładowanie…
Reference in New Issue