Improve styling of ChooseGroupStoryBottomSheet.

This commit is contained in:
Greyson Parrelli
2022-10-05 16:00:48 -04:00
parent 26709177d2
commit 23ba5c874a
13 changed files with 66 additions and 58 deletions

View File

@@ -34,7 +34,6 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
private lateinit var confirmButton: View
private lateinit var selectedList: RecyclerView
private lateinit var backgroundHelper: View
private lateinit var divider: View
private lateinit var mediator: ContactSearchMediator
@@ -52,7 +51,6 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
confirmButton = bottomBar.findViewById(R.id.share_confirm)
selectedList = bottomBar.findViewById(R.id.selected_list)
backgroundHelper = bottomBar.findViewById(R.id.background_helper)
divider = bottomBar.findViewById(R.id.divider)
val adapter = ShareSelectionAdapter()
@@ -75,7 +73,7 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
addSection(
ContactSearchConfiguration.Section.Groups(
includeHeader = false,
returnAsGroupStories = true,
shortSummary = true,
sortOrder = ContactSearchSortOrder.RECENCY
)
)
@@ -86,7 +84,7 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
mediator.getSelectionState().observe(viewLifecycleOwner) { state ->
adapter.submitList(
state.filterIsInstance(ContactSearchKey.RecipientSearchKey.Story::class.java)
state.filterIsInstance(ContactSearchKey.RecipientSearchKey.KnownRecipient::class.java)
.map { it.recipientId }
.mapIndexed { index, recipientId ->
ShareSelectionMappingModel(
@@ -118,9 +116,8 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
animatorSet?.cancel()
animatorSet = AnimatorSet().apply {
playTogether(
ObjectAnimator.ofFloat(confirmButton, View.ALPHA, 1f),
ObjectAnimator.ofFloat(confirmButton, View.TRANSLATION_Y, 0f),
ObjectAnimator.ofFloat(selectedList, View.TRANSLATION_Y, 0f),
ObjectAnimator.ofFloat(backgroundHelper, View.TRANSLATION_Y, 0f),
ObjectAnimator.ofFloat(divider, View.TRANSLATION_Y, 0f)
)
start()
@@ -128,14 +125,13 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
}
private fun animateOutBottomBar() {
val translationY = DimensionUnit.DP.toPixels(48f)
val translationY = DimensionUnit.SP.toPixels(64f)
animatorSet?.cancel()
animatorSet = AnimatorSet().apply {
playTogether(
ObjectAnimator.ofFloat(confirmButton, View.ALPHA, 0f),
ObjectAnimator.ofFloat(confirmButton, View.TRANSLATION_Y, translationY),
ObjectAnimator.ofFloat(selectedList, View.TRANSLATION_Y, translationY),
ObjectAnimator.ofFloat(backgroundHelper, View.TRANSLATION_Y, translationY),
ObjectAnimator.ofFloat(divider, View.TRANSLATION_Y, translationY)
)
start()
@@ -150,7 +146,7 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
RESULT_SET,
ArrayList(
mediator.getSelectedContacts()
.filterIsInstance(ContactSearchKey.RecipientSearchKey.Story::class.java)
.filterIsInstance(ContactSearchKey.RecipientSearchKey.KnownRecipient::class.java)
.map { it.recipientId }
)
)

View File

@@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.components.settings.conversation.preferences.L
import org.thoughtcrime.securesms.util.fragments.requireListener
class ChooseStoryTypeBottomSheet : DSLSettingsBottomSheetFragment(
layoutId = R.layout.dsl_settings_bottom_sheet_no_handle
layoutId = R.layout.dsl_settings_bottom_sheet
) {
override fun bindAdapter(adapter: DSLSettingsAdapter) {
LargeIconClickPreference.register(adapter)
@@ -24,7 +24,7 @@ class ChooseStoryTypeBottomSheet : DSLSettingsBottomSheetFragment(
textPref(
title = DSLSettingsText.from(
stringId = R.string.ChooseStoryTypeBottomSheet__choose_your_story_type,
DSLSettingsText.CenterModifier, DSLSettingsText.Body1BoldModifier, DSLSettingsText.BoldModifier
DSLSettingsText.CenterModifier, DSLSettingsText.TitleMediumModifier
)
)
@@ -37,11 +37,11 @@ class ChooseStoryTypeBottomSheet : DSLSettingsBottomSheetFragment(
stringId = R.string.ChooseStoryTypeBottomSheet__visible_only_to
),
icon = DSLSettingsIcon.from(
R.drawable.ic_plus_24,
R.color.signal_icon_tint_primary,
R.drawable.circle_tintable,
R.color.signal_button_secondary_ripple,
DimensionUnit.DP.toPixels(8f).toInt()
iconId = R.drawable.ic_plus_24,
iconTintId = R.color.signal_colorOnSurface,
backgroundId = R.drawable.circle_tintable,
backgroundTint = R.color.signal_colorSurface5,
insetPx = DimensionUnit.DP.toPixels(8f).toInt()
),
onClick = {
dismissAllowingStateLoss()
@@ -59,11 +59,11 @@ class ChooseStoryTypeBottomSheet : DSLSettingsBottomSheetFragment(
stringId = R.string.ChooseStoryTypeBottomSheet__share_to_an_existing_group
),
icon = DSLSettingsIcon.from(
R.drawable.ic_group_outline_24,
R.color.signal_icon_tint_primary,
R.drawable.circle_tintable,
R.color.signal_button_secondary_ripple,
DimensionUnit.DP.toPixels(8f).toInt()
iconId = R.drawable.ic_group_outline_24,
iconTintId = R.color.signal_colorOnSurface,
backgroundId = R.drawable.circle_tintable,
backgroundTint = R.color.signal_colorSurface5,
insetPx = DimensionUnit.DP.toPixels(8f).toInt()
),
onClick = {
dismissAllowingStateLoss()