Better char counter and custom emoji in compose

This commit is contained in:
Grishka
2022-02-02 09:40:29 +03:00
parent b9bdf7caec
commit c885a5fc28
19 changed files with 927 additions and 16 deletions

View File

@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:pathData="M12 1.998c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10-10.002 10-5.524 0.001-10.002-4.477-10.002-10C1.998 6.476 6.476 1.998 12 1.998zM8.462 14.783c-0.257-0.325-0.728-0.381-1.053-0.125-0.326 0.256-0.382 0.728-0.125 1.053 1.13 1.435 2.853 2.29 4.716 2.29 1.86 0 3.581-0.853 4.712-2.284 0.257-0.325 0.201-0.797-0.124-1.054-0.325-0.256-0.796-0.201-1.053 0.124-0.85 1.075-2.139 1.714-3.535 1.714-1.398 0-2.69-0.64-3.538-1.718zM9 8.75c-0.69 0-1.25 0.56-1.25 1.25S8.31 11.249 9 11.249s1.249-0.56 1.249-1.25S9.69 8.75 9 8.75zm6 0c-0.69 0-1.25 0.56-1.25 1.25s0.56 1.249 1.25 1.249 1.249-0.56 1.249-1.25S15.69 8.75 15 8.75z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:pathData="M12 1.998c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10-10.002 10-5.524 0.001-10.002-4.477-10.002-10C1.998 6.476 6.476 1.998 12 1.998zm0 1.5c-4.695 0-8.502 3.806-8.502 8.502 0 4.695 3.807 8.501 8.502 8.501s8.502-3.806 8.502-8.501c0-4.696-3.807-8.502-8.502-8.502zM8.462 14.783C9.31 15.86 10.602 16.5 12 16.5c1.396 0 2.686-0.639 3.535-1.714 0.257-0.325 0.728-0.38 1.053-0.124 0.325 0.257 0.38 0.729 0.124 1.054C15.582 17.148 13.86 18 12 18c-1.863 0-3.586-0.855-4.716-2.29-0.257-0.325-0.2-0.797 0.125-1.053 0.325-0.256 0.796-0.2 1.053 0.125zM9 8.75c0.69 0 1.249 0.56 1.249 1.25S9.69 11.248 9 11.248s-1.249-0.56-1.249-1.25 0.56-1.249 1.25-1.249zm6 0c0.69 0 1.249 0.56 1.249 1.25s-0.56 1.249-1.25 1.249-1.249-0.56-1.249-1.25S14.31 8.75 15 8.75z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--~ Copyright (c) 2022. ~ Microsoft Corporation. All rights reserved.-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_fluent_emoji_24_filled" android:state_activated="true"/>
<item android:drawable="@drawable/ic_fluent_emoji_24_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_fluent_emoji_24_filled" android:state_selected="true"/>
<item android:drawable="@drawable/ic_fluent_emoji_24_regular"/>
</selector>

View File

@@ -15,7 +15,7 @@
android:layout_alignParentEnd="true"
android:background="?android:selectableItemBackgroundBorderless"
android:scaleType="center"
android:src="@drawable/ic_post_more"/>
android:src="@drawable/ic_post_more" />
<ImageView
android:id="@+id/avatar"

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.joinmastodon.android.ui.views.SizeListenerLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
@@ -57,18 +57,41 @@
android:background="@null"
android:inputType="textMultiLine|textCapSentences"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#20000000"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:orientation="horizontal"
android:padding="8dp">
android:gravity="center_vertical"
android:background="@color/gray_25"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<ImageButton
android:id="@+id/btn_emoji"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:padding="0px"
android:src="@drawable/ic_fluent_emoji_24_selector"/>
<View
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<TextView
android:id="@+id/char_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/m3_body_large"
android:textColor="@color/gray_500"
tools:text="500"/>
</LinearLayout>
</LinearLayout>
</org.joinmastodon.android.ui.views.SizeListenerLinearLayout>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:textSize="12dp"
android:textColor="@color/gray_500"
android:textAllCaps="true"
android:paddingTop="24dp"
android:paddingBottom="12dp"
tools:text="Blob whatever things"/>

View File

@@ -9,10 +9,12 @@
<color name="white">#FFFFFFFF</color>
<color name="fluent_default_icon_tint">@color/gray_800</color>
<color name="gray_25">#FCFCFD</color>
<color name="gray_50t">#CCF9FAFB</color>
<color name="gray_100">#F2F4F7</color>
<color name="gray_800">#282C37</color>
<color name="gray_500">#667085</color>
<color name="gray_50t">#CCF9FAFB</color>
<color name="text_primary">@color/gray_800</color>
<color name="text_secondary">@color/gray_500</color>