Skip to content

Commit 8d6beb9

Browse files
committed
Reply sheet polish.
1 parent bb5edcc commit 8d6beb9

File tree

5 files changed

+55
-43
lines changed

5 files changed

+55
-43
lines changed

app/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiToggle.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package org.thoughtcrime.securesms.components.emoji;
22

33
import android.content.Context;
4+
import android.content.res.TypedArray;
45
import android.graphics.drawable.Drawable;
56
import android.util.AttributeSet;
67

78
import androidx.annotation.NonNull;
9+
import androidx.annotation.Nullable;
810
import androidx.appcompat.widget.AppCompatImageButton;
911

1012
import org.thoughtcrime.securesms.R;
@@ -24,17 +26,17 @@ public class EmojiToggle extends AppCompatImageButton implements MediaKeyboard.M
2426

2527
public EmojiToggle(Context context) {
2628
super(context);
27-
initialize();
29+
initialize(null);
2830
}
2931

3032
public EmojiToggle(Context context, AttributeSet attrs) {
3133
super(context, attrs);
32-
initialize();
34+
initialize(attrs);
3335
}
3436

3537
public EmojiToggle(Context context, AttributeSet attrs, int defStyle) {
3638
super(context, attrs, defStyle);
37-
initialize();
39+
initialize(attrs);
3840
}
3941

4042
public void setToMedia() {
@@ -45,11 +47,18 @@ public void setToIme() {
4547
setImageDrawable(imeToggle);
4648
}
4749

48-
private void initialize() {
49-
this.emojiToggle = ContextUtil.requireDrawable(getContext(), R.drawable.ic_emoji);
50+
private void initialize(@Nullable AttributeSet attrs) {
51+
boolean forceOutline = false;
52+
if (attrs != null) {
53+
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.EmojiToggle, 0, 0);
54+
forceOutline = typedArray.getBoolean(R.styleable.EmojiToggle_force_outline, false);
55+
typedArray.recycle();
56+
}
57+
58+
this.emojiToggle = ContextUtil.requireDrawable(getContext(), forceOutline ? R.drawable.ic_emoji_outline : R.drawable.ic_emoji);
5059
this.stickerToggle = ContextUtil.requireDrawable(getContext(), R.drawable.ic_sticker_24);
5160
this.gifToggle = ContextUtil.requireDrawable(getContext(), R.drawable.ic_gif_24);
52-
this.imeToggle = ContextUtil.requireDrawable(getContext(), R.drawable.ic_keyboard_24);
61+
this.imeToggle = ContextUtil.requireDrawable(getContext(), forceOutline ? R.drawable.ic_keyboard_outline_24 : R.drawable.ic_keyboard_24);
5362
this.mediaToggle = emojiToggle;
5463

5564
setToMedia();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:fillColor="@color/signal_inverse_primary"
8+
android:pathData="M12,18.7c-2.1,0 -4.2,-1 -5.5,-2.7c-0.2,-0.3 -0.2,-0.8 0.2,-1.1s0.8,-0.2 1.1,0.2l0,0c1,1.3 2.6,2.1 4.3,2.1c1.7,0 3.3,-0.8 4.3,-2.1c0.2,-0.3 0.7,-0.4 1,-0.2c0,0 0,0 0,0c0.3,0.2 0.4,0.7 0.2,1C16.2,17.6 14.2,18.7 12,18.7zM12,2.5c-5.1,-0.2 -9.3,3.8 -9.5,8.9c0,0.2 0,0.4 0,0.6c-0.2,5.1 3.8,9.3 8.9,9.5c0.2,0 0.4,0 0.6,0c5.1,0.2 9.3,-3.8 9.5,-8.9c0,-0.2 0,-0.4 0,-0.6c0.2,-5.1 -3.8,-9.3 -8.9,-9.5C12.4,2.5 12.2,2.5 12,2.5M12,1c5.9,-0.2 10.8,4.5 11,10.4c0,0.2 0,0.4 0,0.6c0.2,5.9 -4.5,10.8 -10.4,11c-0.2,0 -0.4,0 -0.6,0C6.1,23.2 1.2,18.5 1,12.6c0,-0.2 0,-0.4 0,-0.6C0.8,6.1 5.5,1.2 11.4,1C11.6,1 11.8,1 12,1zM8.5,8C7.7,8 7,8.9 7,10s0.7,2 1.5,2s1.5,-0.9 1.5,-2S9.3,8 8.5,8zM15.5,8C14.7,8 14,8.9 14,10s0.7,2 1.5,2s1.5,-0.9 1.5,-2S16.3,8 15.5,8z"/>
9+
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:autoMirrored="true" android:height="24dp"
2+
android:viewportHeight="24" android:viewportWidth="24"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="@color/signal_icon_tint_primary" android:pathData="M20,4.5A1.538,1.538 0,0 1,21.5 6L21.5,17.5A1.538,1.538 0,0 1,20 19L4,19a1.538,1.538 0,0 1,-1.5 -1.5L2.5,6A1.538,1.538 0,0 1,4 4.5L20,4.5M20,3L4,3A2.946,2.946 0,0 0,1 6L1,17.5a2.946,2.946 0,0 0,3 3L20,20.5a2.946,2.946 0,0 0,3 -3L23,6A2.946,2.946 0,0 0,20 3ZM16.5,15h-9v2h9ZM7.5,12h0A1.538,1.538 0,0 0,6 10.5L6,10.5A1.538,1.538 0,0 0,4.5 12h0A1.538,1.538 0,0 0,6 13.5L6,13.5A1.538,1.538 0,0 0,7.5 12ZM11.5,12h0A1.538,1.538 0,0 0,10 10.5h0A1.538,1.538 0,0 0,8.5 12h0A1.538,1.538 0,0 0,10 13.5h0A1.538,1.538 0,0 0,11.5 12ZM15.5,12h0A1.538,1.538 0,0 0,14 10.5h0A1.538,1.538 0,0 0,12.5 12h0A1.538,1.538 0,0 0,14 13.5h0A1.538,1.538 0,0 0,15.5 12ZM19.5,12h0A1.538,1.538 0,0 0,18 10.5h0A1.538,1.538 0,0 0,16.5 12h0A1.538,1.538 0,0 0,18 13.5h0A1.538,1.538 0,0 0,19.5 12ZM7.5,8h0A1.538,1.538 0,0 0,6 6.5L6,6.5A1.538,1.538 0,0 0,4.5 8h0A1.538,1.538 0,0 0,6 9.5L6,9.5A1.538,1.538 0,0 0,7.5 8ZM11.5,8h0A1.538,1.538 0,0 0,10 6.5h0A1.538,1.538 0,0 0,8.5 8h0A1.538,1.538 0,0 0,10 9.5h0A1.538,1.538 0,0 0,11.5 8ZM15.5,8h0A1.538,1.538 0,0 0,14 6.5h0A1.538,1.538 0,0 0,12.5 8h0A1.538,1.538 0,0 0,14 9.5h0A1.538,1.538 0,0 0,15.5 8ZM19.5,8h0A1.538,1.538 0,0 0,18 6.5h0A1.538,1.538 0,0 0,16.5 8h0A1.538,1.538 0,0 0,18 9.5h0A1.538,1.538 0,0 0,19.5 8Z"/>
5+
</vector>

app/src/main/res/layout/stories_reply_to_story_composer_content.xml

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
android:layout_width="match_parent"
66
android:layout_height="wrap_content"
77
android:background="@color/signal_background_tertiary"
8-
android:orientation="horizontal"
98
android:paddingTop="12dp">
109

1110
<org.thoughtcrime.securesms.components.FromTextView
@@ -17,6 +16,8 @@
1716
android:textAppearance="@style/Signal.Text.Caption"
1817
android:textColor="@color/signal_inverse_transparent_60"
1918
android:visibility="gone"
19+
app:layout_constraintBottom_toTopOf="@+id/bubble"
20+
app:layout_constraintEnd_toEndOf="parent"
2021
app:layout_constraintStart_toStartOf="parent"
2122
app:layout_constraintTop_toTopOf="parent"
2223
tools:text="Replying privately to Miles Morales"
@@ -28,16 +29,14 @@
2829
android:layout_height="wrap_content"
2930
android:layout_marginStart="18dp"
3031
android:layout_marginTop="8dp"
31-
android:layout_marginEnd="6dp"
32+
android:layout_marginEnd="8dp"
3233
android:layout_marginBottom="8dp"
33-
android:layout_weight="1"
3434
android:background="@drawable/rounded_rectangle_secondary_18"
35-
android:orientation="vertical"
3635
android:padding="8dp"
3736
app:layout_constraintBottom_toBottomOf="parent"
3837
app:layout_constraintEnd_toStartOf="@id/reply_reaction_switch"
3938
app:layout_constraintStart_toStartOf="parent"
40-
app:layout_constraintTop_toBottomOf="@id/private_reply_recipient"
39+
app:layout_constraintTop_toBottomOf="@+id/private_reply_recipient"
4140
app:layout_goneMarginTop="0dp">
4241

4342
<org.thoughtcrime.securesms.components.QuoteView
@@ -52,13 +51,13 @@
5251
app:message_type="story_reply_preview"
5352
app:quote_colorPrimary="@color/signal_text_primary"
5453
app:quote_colorSecondary="@color/signal_text_primary"
55-
tools:visibility="visible" />
54+
tools:visibility="gone" />
5655

5756
<org.thoughtcrime.securesms.components.ComposeText
5857
android:id="@+id/compose_text"
5958
android:layout_width="0dp"
6059
android:layout_height="wrap_content"
61-
android:layout_marginStart="4dp"
60+
android:layout_marginStart="8dp"
6261
android:layout_marginTop="8dp"
6362
android:background="@null"
6463
android:hint="@string/StoryViewerPageFragment__reply"
@@ -68,67 +67,53 @@
6867
android:maxLines="3"
6968
android:paddingBottom="2dp"
7069
android:textAppearance="@style/Signal.Text.Body"
70+
app:layout_constraintBottom_toBottomOf="parent"
7171
app:layout_constraintEnd_toEndOf="parent"
7272
app:layout_constraintStart_toEndOf="@id/emoji_toggle"
7373
app:layout_constraintTop_toBottomOf="@id/quote_view"
74-
app:layout_goneMarginTop="0dp" />
74+
app:layout_goneMarginTop="0dp"
75+
tools:text="hello\nasdf" />
7576

7677
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
7778
android:id="@+id/emoji_toggle"
7879
android:layout_width="wrap_content"
7980
android:layout_height="wrap_content"
8081
android:layout_marginTop="8dp"
8182
android:background="?selectableItemBackgroundBorderless"
83+
app:force_outline="true"
8284
app:layout_constraintBottom_toBottomOf="parent"
8385
app:layout_constraintStart_toStartOf="parent"
84-
app:layout_constraintTop_toBottomOf="@id/quote_view"
8586
app:layout_goneMarginTop="0dp" />
8687

8788
</androidx.constraintlayout.widget.ConstraintLayout>
8889

89-
<org.thoughtcrime.securesms.components.ComposeText
90-
android:id="@+id/fake_compose_text"
91-
android:layout_width="match_parent"
92-
android:layout_height="wrap_content"
93-
android:layout_marginBottom="8dp"
94-
android:background="@null"
95-
android:clickable="false"
96-
android:enabled="false"
97-
android:focusable="false"
98-
android:paddingBottom="2dp"
99-
android:textAppearance="@style/Signal.Text.Body"
100-
android:visibility="invisible"
101-
app:layout_constraintBottom_toBottomOf="@id/bubble"
102-
app:layout_goneMarginTop="0dp" />
103-
10490
<ViewSwitcher
10591
android:id="@+id/reply_reaction_switch"
106-
android:layout_width="48dp"
107-
android:layout_height="48dp"
92+
android:layout_width="36dp"
93+
android:layout_height="36dp"
10894
android:layout_marginEnd="6dp"
109-
app:layout_constraintBottom_toBottomOf="@id/fake_compose_text"
110-
app:layout_constraintEnd_toEndOf="parent"
111-
app:layout_constraintTop_toTopOf="@id/fake_compose_text">
95+
android:layout_marginBottom="2dp"
96+
app:layout_constraintBottom_toBottomOf="@+id/bubble"
97+
app:layout_constraintEnd_toEndOf="parent">
11298

11399
<ImageView
114100
android:id="@+id/reaction"
115-
android:layout_width="48dp"
116-
android:layout_height="48dp"
117-
android:layout_gravity="bottom"
101+
android:layout_width="36dp"
102+
android:layout_height="36dp"
118103
android:background="?attr/selectableItemBackgroundBorderless"
119104
android:contentDescription="@string/StoryReplyComposer__react_to_this_story"
120-
android:scaleType="centerInside"
105+
android:padding="6dp"
121106
app:srcCompat="@drawable/ic_add_reaction_outline_24"
122107
app:tint="@color/signal_icon_tint_primary" />
123108

124109
<ImageView
125110
android:id="@+id/reply"
126-
android:layout_width="48dp"
127-
android:layout_height="48dp"
111+
android:layout_width="36dp"
112+
android:layout_height="36dp"
128113
android:layout_gravity="bottom"
129-
android:background="@drawable/story_text_circle_button_background_inset_6"
114+
android:background="@drawable/circle_tintable"
130115
android:contentDescription="@string/StoryReplyComposer__react_to_this_story"
131-
android:scaleType="centerInside"
116+
android:padding="6dp"
132117
app:backgroundTint="@color/core_ultramarine"
133118
app:srcCompat="@drawable/ic_send_24" />
134119
</ViewSwitcher>

app/src/main/res/values/attrs.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,8 @@
360360
<enum name="badge_112" value="5" />
361361
</attr>
362362
</declare-styleable>
363+
364+
<declare-styleable name="EmojiToggle">
365+
<attr name="force_outline" format="boolean" />
366+
</declare-styleable>
363367
</resources>

0 commit comments

Comments
 (0)