Port Signal's emoji implementation to Briar

Add functionality to save and restore recently used Emojis

Update emoji and add new categories based on AOSP's XML file
This commit is contained in:
Torsten Grote
2016-09-13 18:55:17 -03:00
committed by akwizgran
parent 1fdbe65dde
commit d5beca5351
105 changed files with 4560 additions and 258 deletions
@@ -3,9 +3,9 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".android.contact.ConversationActivity">
<android.support.v7.widget.Toolbar
@@ -38,17 +38,18 @@
</android.support.v7.widget.Toolbar>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/conversationView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
android:layout_weight="1"
android:background="@color/window_background"/>
<View style="@style/Divider.Horizontal"/>
<include
layout="@layout/text_input_field"
<org.briarproject.android.view.TextInputView
android:id="@+id/text_input_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:background="@color/button_bar_background"
android:elevation="@dimen/margin_tiny"/>
</LinearLayout>
+6 -4
View File
@@ -6,16 +6,18 @@
android:layout_height="match_parent"
android:orientation="vertical">
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/forum_discussion_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:scrollToEnd="false"/>
<include
layout="@layout/text_input_field"
<org.briarproject.android.view.TextInputView
android:id="@+id/text_input_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:background="@color/button_bar_background"
android:elevation="@dimen/margin_tiny"/>
</LinearLayout>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/invitationsView"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
@@ -19,7 +19,7 @@
<View style="@style/Divider.ForumList"/>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/sharedByView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -36,7 +36,7 @@
<View style="@style/Divider.ForumList"/>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/sharedWithView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+1 -1
View File
@@ -37,7 +37,7 @@
android:textSize="@dimen/text_size_small"
tools:text="Author Name"/>
<org.briarproject.android.util.TrustIndicatorView
<org.briarproject.android.view.TrustIndicatorView
android:id="@+id/trustIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+53
View File
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<View
style="@style/Divider.Horizontal"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/emoji_pager_background"
android:orientation="horizontal">
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
app:pstsIndicatorColor="@color/briar_accent"
app:pstsIndicatorHeight="@dimen/emoji_drawer_indicator_height"
app:pstsShouldExpand="true"
app:pstsTabPaddingLeftRight="@dimen/emoji_drawer_left_right_padding"/>
<View
android:layout_width="@dimen/margin_separator"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="@color/divider"/>
<org.thoughtcrime.securesms.components.RepeatableImageKey
android:id="@+id/backspace"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/emoji_pager_background"
android:paddingLeft="@dimen/margin_medium"
android:paddingRight="@dimen/margin_medium"
android:src="@drawable/ic_backspace_black"/>
</LinearLayout>
<View
style="@style/Divider.Horizontal"/>
<android.support.v4.view.ViewPager
android:id="@+id/emoji_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/window_background"
android:visibility="visible"/>
</merge>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/emoji"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:columnWidth="@dimen/emoji_drawer_size"
android:gravity="center"
android:horizontalSpacing="0dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:verticalSpacing="0dp"
android:visibility="visible"/>
</FrameLayout>
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/postList"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contactList"
android:layout_width="match_parent"
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
android:id="@+id/forumList"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.briarproject.android.util.CameraView
<org.briarproject.android.view.CameraView
android:id="@+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<org.briarproject.android.util.BriarRecyclerView
<org.briarproject.android.view.BriarRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/contactList"
+1 -1
View File
@@ -8,7 +8,7 @@
android:layout_marginStart="@dimen/listitem_horizontal_margin"
android:background="?attr/selectableItemBackground">
<org.briarproject.android.util.TextAvatarView
<org.briarproject.android.view.TextAvatarView
android:id="@+id/avatarView"
android:layout_width="@dimen/listitem_picture_frame_size"
android:layout_height="@dimen/listitem_picture_frame_size"
@@ -11,7 +11,7 @@
android:id="@+id/inputDivider"
style="@style/Divider.Horizontal"/>
<org.briarproject.android.util.AuthorView
<org.briarproject.android.view.AuthorView
android:id="@+id/authorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -19,7 +19,7 @@
android:layout_height="wrap_content"
android:padding="@dimen/listitem_vertical_margin">
<org.briarproject.android.util.AuthorView
<org.briarproject.android.view.AuthorView
android:id="@+id/rebloggerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -29,7 +29,7 @@
android:layout_toLeftOf="@+id/commentView"
app:persona="reblogger"/>
<org.briarproject.android.util.AuthorView
<org.briarproject.android.view.AuthorView
android:id="@+id/authorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+1 -1
View File
@@ -8,7 +8,7 @@
android:layout_marginStart="@dimen/listitem_horizontal_margin"
android:background="?attr/selectableItemBackground">
<org.briarproject.android.util.TextAvatarView
<org.briarproject.android.view.TextAvatarView
android:id="@+id/avatarView"
android:layout_width="@dimen/listitem_picture_frame_size"
android:layout_height="@dimen/listitem_picture_frame_size"
@@ -72,7 +72,7 @@
android:layout_marginLeft="@dimen/margin_medium"
android:layout_weight="1">
<TextView
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -85,59 +85,13 @@
android:textColor="@color/briar_text_primary"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/avatar"
android:layout_width="@dimen/forum_avatar_size"
android:layout_height="@dimen/forum_avatar_size"
android:layout_alignLeft="@id/text"
android:layout_below="@id/text"
android:layout_marginRight="@dimen/margin_small"
android:layout_marginTop="@dimen/margin_small"
android:src="@drawable/ic_launcher"
app:civ_border_color="@color/briar_primary"
app:civ_border_width="@dimen/avatar_border_width"
tools:src="@drawable/ic_launcher"
/>
<TextView
<org.briarproject.android.view.AuthorView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/avatar"
android:layout_alignBottom="@+id/avatar"
android:layout_alignTop="@+id/avatar"
android:gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:textSize="@dimen/text_size_tiny"
tools:text="John Smith"/>
<org.briarproject.android.util.TrustIndicatorView
android:id="@+id/trustIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/avatar"
android:layout_alignTop="@+id/avatar"
android:scaleType="center"
android:layout_marginLeft="@dimen/margin_small"
android:layout_marginStart="@dimen/margin_small"
android:layout_toRightOf="@+id/author"
tools:src="@drawable/trust_indicator_verified"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/avatar"
android:layout_alignTop="@+id/avatar"
android:gravity="center"
android:layout_toRightOf="@+id/trustIndicator"
android:layout_marginLeft="@dimen/margin_small"
android:layout_marginStart="@dimen/margin_small"
android:ellipsize="end"
android:maxLines="1"
android:textSize="@dimen/text_size_tiny"
tools:text="09:09"/>
android:layout_alignLeft="@id/text"
android:layout_below="@id/text"
app:persona="commenter"/>
<ImageView
android:id="@+id/chevron"
@@ -6,7 +6,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/msgBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -9,7 +9,7 @@
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/listitem_horizontal_margin">
<org.briarproject.android.util.TextAvatarView
<org.briarproject.android.view.TextAvatarView
android:id="@+id/avatarView"
android:layout_width="@dimen/listitem_picture_frame_size"
android:layout_height="@dimen/listitem_picture_frame_size"
@@ -10,7 +10,7 @@
android:background="@drawable/msg_in"
android:orientation="vertical">
<TextView
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/msgBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -6,7 +6,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/msgBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -15,7 +15,7 @@
android:layout_marginRight="@dimen/message_bubble_margin_tail"
android:background="@drawable/msg_out">
<TextView
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/msgBody"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -6,7 +6,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/msgBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/text_input_container"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/button_bar_background"
android:elevation="@dimen/margin_tiny"
android:gravity="bottom"
android:orientation="horizontal"
android:paddingLeft="@dimen/margin_large"
android:paddingStart="@dimen/margin_large">
<EditText
android:id="@+id/input_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:layout_weight="1"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="5"/>
<ImageView
android:id="@+id/btn_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_medium"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:contentDescription="@string/send"
android:onClick="sendMessage"
android:src="@drawable/social_send_now_white"
android:tint="@color/briar_primary"
/>
</LinearLayout>
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
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"
tools:showIn="@layout/activity_conversation">
<View
style="@style/Divider.Horizontal"
android:layout_alignParentTop="true"/>
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
android:id="@+id/emoji_toggle"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_above="@+id/emoji_drawer"
android:layout_alignBottom="@+id/input_text"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/margin_small"
android:scaleType="center"/>
<org.thoughtcrime.securesms.components.emoji.EmojiEditText
android:id="@+id/input_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/btn_send"
android:layout_toRightOf="@+id/emoji_toggle"
android:inputType="textMultiLine|textCapSentences"
android:maxLines="5"
android:minHeight="42dp"/>
<ImageButton
android:id="@+id/btn_send"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_above="@+id/emoji_drawer"
android:layout_alignBottom="@+id/input_text"
android:layout_alignParentRight="true"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:contentDescription="@string/send"
android:enabled="false"
android:padding="@dimen/margin_small"
android:src="@drawable/social_send_now_white"
android:tint="@color/briar_primary"/>
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
android:id="@+id/emoji_drawer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/input_text"
android:visibility="gone"/>
</merge>