Skip to content

Commit

Permalink
Add My Story row polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal committed Aug 18, 2022
1 parent 8d4f876 commit 01e4a7f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
Expand Up @@ -19,22 +19,17 @@ object MyStoriesItem {
}

class Model(
val onClick: () -> Unit,
val onClickThumbnail: () -> Unit
val onClick: () -> Unit
) : PreferenceModel<Model>() {
override fun areItemsTheSame(newItem: Model): Boolean = true
}

private class ViewHolder(itemView: View) : MappingViewHolder<Model>(itemView) {

private val thumbnail: View = itemView.findViewById(R.id.story)
private val avatarView: AvatarView = itemView.findViewById(R.id.avatar)

override fun bind(model: Model) {
itemView.setOnClickListener { model.onClick() }
thumbnail.setOnClickListener { model.onClickThumbnail() }
avatarView.setOnClickListener { model.onClickThumbnail() }

avatarView.displayProfileAvatar(Recipient.self())
}
}
Expand Down
Expand Up @@ -172,9 +172,6 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
customPref(
MyStoriesItem.Model(
onClick = {
startActivityIfAble(Intent(requireContext(), MyStoriesActivity::class.java))
},
onClickThumbnail = {
cameraFab.performClick()
}
)
Expand Down
31 changes: 8 additions & 23 deletions app/src/main/res/layout/stories_landing_item_my_stories.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:viewBindingIgnore="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dsl_settings_gutter"
android:layout_marginEnd="@dimen/dsl_settings_gutter">
android:background="@drawable/conversation_list_item_background"
android:paddingStart="@dimen/dsl_settings_gutter"
android:paddingEnd="@dimen/dsl_settings_gutter"
tools:viewBindingIgnore="true">

<org.thoughtcrime.securesms.avatar.view.AvatarView
android:id="@+id/avatar"
Expand Down Expand Up @@ -38,7 +39,7 @@
android:textAppearance="@style/Signal.Text.BodyLarge"
android:textColor="@color/signal_colorOnSurface"
app:layout_constraintBottom_toTopOf="@id/date"
app:layout_constraintEnd_toStartOf="@id/story"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
Expand All @@ -49,28 +50,12 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/StoriesLandingFragment__add_a_story"
android:text="@string/StoriesLandingFragment__tap_to_add_a_story"
android:textAppearance="@style/Signal.Text.BodyMedium"
android:textColor="@color/signal_colorOnSurfaceVariant"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/story"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/avatar"
app:layout_constraintTop_toBottomOf="@id/sender" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/story"
android:layout_width="@dimen/stories_landing_item_thumb_width"
android:layout_height="@dimen/stories_landing_item_thumb_height"
android:layout_marginTop="12dp"
android:layout_marginEnd="2dp"
android:layout_marginBottom="12dp"
android:background="@color/signal_colorSurfaceVariant"
android:scaleType="centerInside"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearance="@style/ShapeAppearanceOverlay.Signal.Story.Preview"
app:srcCompat="@drawable/ic_plus_24"
app:tint="@color/signal_colorOnSurface" />

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Expand Up @@ -4578,7 +4578,7 @@
<!-- Title for "My Stories" row item in Stories landing page -->
<string name="StoriesLandingFragment__my_stories">My Stories</string>
<!-- Subtitle for "My Stories" row item when user has not added stories -->
<string name="StoriesLandingFragment__add_a_story">Add a story</string>
<string name="StoriesLandingFragment__tap_to_add_a_story">Tap to add a story</string>
<!-- Displayed when there are no stories to display -->
<string name="StoriesLandingFragment__no_recent_updates_to_show_right_now_tap_plus_to_add_to_your_story">No recent updates to show right now. Tap + to add to your story.</string>
<!-- Context menu option to hide a story -->
Expand Down

0 comments on commit 01e4a7f

Please sign in to comment.