mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Emoji Support for all user input
All text that can be generated by users will show emoji from the shipped sprites. For all messages and posts, the custom emoji keyboard is now available. This also disables menu actions rather than hiding them and thus closes #677 Included is a fix for a regression that was not showing the keyboard automatically in forums and thus closes #676
This commit is contained in:
@@ -93,7 +93,7 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/BriarThemeNoActionBar.Default"
|
android:theme="@style/BriarThemeNoActionBar.Default"
|
||||||
android:parentActivityName=".android.NavDrawerActivity"
|
android:parentActivityName=".android.NavDrawerActivity"
|
||||||
android:windowSoftInputMode="stateHidden">
|
android:windowSoftInputMode="stateHidden|adjustResize">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".android.NavDrawerActivity"
|
android:value=".android.NavDrawerActivity"
|
||||||
@@ -145,7 +145,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".android.sharing.ShareForumActivity"
|
android:name=".android.sharing.ShareForumActivity"
|
||||||
android:label="@string/activity_share_toolbar_header"
|
android:label="@string/activity_share_toolbar_header"
|
||||||
android:parentActivityName=".android.forum.ForumActivity">
|
android:parentActivityName=".android.forum.ForumActivity"
|
||||||
|
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".android.forum.ForumActivity"
|
android:value=".android.forum.ForumActivity"
|
||||||
@@ -155,7 +156,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".android.sharing.ShareBlogActivity"
|
android:name=".android.sharing.ShareBlogActivity"
|
||||||
android:label="@string/activity_share_toolbar_header"
|
android:label="@string/activity_share_toolbar_header"
|
||||||
android:parentActivityName=".android.blogs.BlogActivity">
|
android:parentActivityName=".android.blogs.BlogActivity"
|
||||||
|
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.PARENT_ACTIVITY"
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
android:value=".android.blogs.BlogActivity"
|
android:value=".android.blogs.BlogActivity"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<include layout="@layout/contact_avatar_status"/>
|
<include layout="@layout/contact_avatar_status"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/contactName"
|
android:id="@+id/contactName"
|
||||||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse"
|
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/button_bar_background"
|
android:background="@color/button_bar_background"
|
||||||
android:elevation="@dimen/margin_tiny"/>
|
android:elevation="@dimen/margin_tiny"
|
||||||
|
app:hint="@string/message_hint"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/button_bar_background"
|
android:background="@color/button_bar_background"
|
||||||
android:elevation="@dimen/margin_tiny"/>
|
android:elevation="@dimen/margin_tiny"
|
||||||
|
app:hint="@string/forum_new_message_hint"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -1,56 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="@dimen/margin_small"
|
|
||||||
tools:context=".android.blogs.WriteBlogPostActivity">
|
tools:context=".android.blogs.WriteBlogPostActivity">
|
||||||
|
|
||||||
<android.support.design.widget.TextInputLayout
|
<org.briarproject.android.view.LargeTextInputView
|
||||||
android:id="@+id/titleLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:counterEnabled="true"
|
|
||||||
app:counterOverflowTextAppearance="@style/BriarTextCounter.Overflow">
|
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
|
||||||
android:id="@+id/titleInput"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="@string/blogs_write_blog_post_title_hint"
|
|
||||||
android:inputType="textCapWords|textCapSentences|textAutoCorrect"/>
|
|
||||||
|
|
||||||
</android.support.design.widget.TextInputLayout>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/bodyInput"
|
android:id="@+id/bodyInput"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:hint="@string/blogs_write_blog_post_body_hint"
|
app:buttonText="@string/blogs_publish_blog_post"
|
||||||
android:inputType="textMultiLine|textLongMessage|textCapSentences|textAutoCorrect">
|
app:hint="@string/blogs_write_blog_post_body_hint"
|
||||||
|
app:fillHeight="true"/>
|
||||||
<requestFocus/>
|
|
||||||
|
|
||||||
</EditText>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/publishButton"
|
|
||||||
style="@style/BriarButton"
|
|
||||||
android:enabled="false"
|
|
||||||
android:text="@string/blogs_publish_blog_post"/>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
style="?android:attr/progressBarStyle"
|
style="?android:attr/progressBarStyleLarge"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:visibility="gone"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</FrameLayout>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
tools:ignore="ContentDescription"/>
|
tools:ignore="ContentDescription"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/authorName"
|
android:id="@+id/authorName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -1,46 +1,47 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView
|
<LinearLayout
|
||||||
android:id="@+id/scrollView"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/window_background">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
<ScrollView
|
||||||
|
android:id="@+id/scrollView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@color/window_background">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/postLayout"
|
||||||
|
layout="@layout/list_item_blog_post"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="@dimen/margin_small"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
style="?android:attr/progressBarStyleLarge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<org.briarproject.android.view.LargeTextInputView
|
||||||
|
android:id="@+id/inputText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/margin_small">
|
android:gravity="bottom"
|
||||||
|
app:buttonText="@string/blogs_reblog_button"
|
||||||
|
app:maxLines="5"
|
||||||
|
app:hint="@string/blogs_reblog_comment_hint"/>
|
||||||
|
|
||||||
<include
|
</LinearLayout>
|
||||||
android:id="@+id/postLayout"
|
|
||||||
layout="@layout/list_item_blog_post"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progressBar"
|
|
||||||
style="?android:attr/progressBarStyleLarge"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/inputText"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/postLayout"
|
|
||||||
android:layout_margin="@dimen/listitem_vertical_margin"
|
|
||||||
android:gravity="bottom"
|
|
||||||
android:hint="@string/blogs_reblog_comment_hint"
|
|
||||||
android:inputType="textShortMessage|textMultiLine|textCapSentences|textAutoCorrect"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/publishButton"
|
|
||||||
style="@style/BriarButton"
|
|
||||||
android:layout_below="@+id/inputText"
|
|
||||||
android:enabled="false"
|
|
||||||
android:text="@string/blogs_reblog_button"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|||||||
@@ -1,41 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.NestedScrollView
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
|
android:id="@+id/introductionText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:padding="@dimen/margin_activity_horizontal"
|
android:padding="@dimen/margin_activity_horizontal"
|
||||||
android:orientation="vertical">
|
android:text="@string/forum_share_message"
|
||||||
|
android:textColor="@color/briar_text_primary"
|
||||||
|
android:textSize="@dimen/text_size_medium"/>
|
||||||
|
|
||||||
<TextView
|
<org.briarproject.android.view.LargeTextInputView
|
||||||
android:id="@+id/introductionText"
|
android:id="@+id/invitationMessageView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="@dimen/margin_medium"
|
android:layout_weight="1"
|
||||||
android:layout_weight="1"
|
android:gravity="bottom"
|
||||||
android:gravity="top"
|
app:buttonText="@string/forum_share_button"
|
||||||
android:textSize="@dimen/text_size_medium"
|
app:fillHeight="true"
|
||||||
android:textColor="@color/briar_text_primary"
|
app:hint="@string/introduction_message_hint"/>
|
||||||
android:text="@string/forum_share_message"/>
|
|
||||||
|
|
||||||
<EditText
|
</LinearLayout>
|
||||||
android:id="@+id/invitationMessageView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/margin_medium"
|
|
||||||
android:gravity="bottom"
|
|
||||||
android:hint="@string/introduction_message_hint"
|
|
||||||
android:inputType="text|textMultiLine|textCapSentences"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/shareForumButton"
|
|
||||||
style="@style/BriarButton"
|
|
||||||
android:text="@string/forum_share_button"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</android.support.v4.widget.NestedScrollView>
|
|
||||||
|
|||||||
@@ -1,128 +1,126 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.NestedScrollView
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fillViewport="true">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:orientation="vertical"
|
android:layout_weight="1">
|
||||||
android:padding="@dimen/margin_activity_horizontal">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_toLeftOf="@+id/introductionIcon"
|
|
||||||
android:gravity="top|center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
|
||||||
android:id="@+id/avatarContact1"
|
|
||||||
style="@style/BriarAvatar"
|
|
||||||
android:layout_width="@dimen/listitem_picture_size"
|
|
||||||
android:layout_height="@dimen/listitem_picture_size"
|
|
||||||
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
|
||||||
tools:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameContact1"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/margin_small"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/briar_text_primary"
|
|
||||||
android:textSize="@dimen/text_size_tiny"
|
|
||||||
tools:text="Contact 1"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/introductionIcon"
|
|
||||||
android:layout_width="@dimen/listitem_picture_size"
|
|
||||||
android:layout_height="@dimen/listitem_picture_size"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:src="@drawable/ic_contact_introduction"
|
|
||||||
tools:ignore="ContentDescription"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_toEndOf="@+id/introductionIcon"
|
|
||||||
android:layout_toRightOf="@+id/introductionIcon"
|
|
||||||
android:gravity="top|center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<de.hdodenhof.circleimageview.CircleImageView
|
|
||||||
android:id="@+id/avatarContact2"
|
|
||||||
style="@style/BriarAvatar"
|
|
||||||
android:layout_width="@dimen/listitem_picture_size"
|
|
||||||
android:layout_height="@dimen/listitem_picture_size"
|
|
||||||
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
|
||||||
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
|
||||||
android:transitionName="avatar"
|
|
||||||
tools:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameContact2"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/margin_small"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/briar_text_primary"
|
|
||||||
android:textSize="@dimen/text_size_tiny"
|
|
||||||
tools:text="Contact 2"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progressBar"
|
|
||||||
style="?android:attr/progressBarStyleLarge"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
tools:visibility="gone"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/introductionText"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginTop="@dimen/margin_medium"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="top"
|
|
||||||
android:textColor="@color/briar_text_secondary"
|
|
||||||
android:textSize="@dimen/text_size_medium"
|
|
||||||
tools:text="@string/introduction_message_text"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/introductionMessageView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/margin_medium"
|
android:layout_margin="@dimen/margin_activity_horizontal"
|
||||||
android:gravity="bottom"
|
android:orientation="vertical">
|
||||||
android:hint="@string/introduction_message_hint"
|
|
||||||
android:inputType="text|textMultiLine|textCapSentences"
|
|
||||||
android:textColor="@color/briar_text_primary"
|
|
||||||
android:textColorHint="@color/briar_text_tertiary"/>
|
|
||||||
|
|
||||||
<Button
|
<RelativeLayout
|
||||||
android:id="@+id/makeIntroductionButton"
|
android:layout_width="match_parent"
|
||||||
style="@style/BriarButton"
|
android:layout_height="wrap_content">
|
||||||
android:text="@string/introduction_button"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toLeftOf="@+id/introductionIcon"
|
||||||
|
android:gravity="top|center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
</android.support.v4.widget.NestedScrollView>
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
|
android:id="@+id/avatarContact1"
|
||||||
|
style="@style/BriarAvatar"
|
||||||
|
android:layout_width="@dimen/listitem_picture_size"
|
||||||
|
android:layout_height="@dimen/listitem_picture_size"
|
||||||
|
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
||||||
|
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
||||||
|
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||||
|
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
||||||
|
tools:src="@drawable/ic_launcher"/>
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
|
android:id="@+id/nameContact1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/briar_text_primary"
|
||||||
|
android:textSize="@dimen/text_size_tiny"
|
||||||
|
tools:text="Contact 1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/introductionIcon"
|
||||||
|
android:layout_width="@dimen/listitem_picture_size"
|
||||||
|
android:layout_height="@dimen/listitem_picture_size"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:src="@drawable/ic_contact_introduction"
|
||||||
|
tools:ignore="ContentDescription"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_toEndOf="@+id/introductionIcon"
|
||||||
|
android:layout_toRightOf="@+id/introductionIcon"
|
||||||
|
android:gravity="top|center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<de.hdodenhof.circleimageview.CircleImageView
|
||||||
|
android:id="@+id/avatarContact2"
|
||||||
|
style="@style/BriarAvatar"
|
||||||
|
android:layout_width="@dimen/listitem_picture_size"
|
||||||
|
android:layout_height="@dimen/listitem_picture_size"
|
||||||
|
android:layout_marginEnd="@dimen/listitem_horizontal_margin"
|
||||||
|
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
|
||||||
|
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||||
|
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
||||||
|
android:transitionName="avatar"
|
||||||
|
tools:src="@drawable/ic_launcher"/>
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
|
android:id="@+id/nameContact2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_small"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/briar_text_primary"
|
||||||
|
android:textSize="@dimen/text_size_tiny"
|
||||||
|
tools:text="Contact 2"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBar"
|
||||||
|
style="?android:attr/progressBarStyleLarge"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:visibility="gone"/>
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
|
android:id="@+id/introductionText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/margin_activity_horizontal"
|
||||||
|
android:textColor="@color/briar_text_secondary"
|
||||||
|
android:textSize="@dimen/text_size_medium"
|
||||||
|
tools:text="@string/introduction_message_text"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<org.briarproject.android.view.LargeTextInputView
|
||||||
|
android:id="@+id/introductionMessageView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:buttonText="@string/introduction_button"
|
||||||
|
app:hint="@string/introduction_message_hint"
|
||||||
|
app:maxLines="5"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||||
android:layout_marginTop="@dimen/margin_medium"/>
|
android:layout_marginTop="@dimen/margin_medium"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/nameView"
|
android:id="@+id/nameView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
android:padding="@dimen/listitem_vertical_margin"
|
android:padding="@dimen/listitem_vertical_margin"
|
||||||
app:persona="commenter"/>
|
app:persona="commenter"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/bodyView"
|
android:id="@+id/bodyView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
android:padding="@dimen/margin_small"
|
android:padding="@dimen/margin_small"
|
||||||
android:src="@drawable/ic_repeat"/>
|
android:src="@drawable/ic_repeat"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/bodyView"
|
android:id="@+id/bodyView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
android:layout_toRightOf="@+id/avatarFrameView"
|
android:layout_toRightOf="@+id/avatarFrameView"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/nameView"
|
android:id="@+id/nameView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
android:layout_marginStart="@dimen/listitem_horizontal_margin"
|
||||||
tools:src="@drawable/ic_launcher"/>
|
tools:src="@drawable/ic_launcher"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/nameView"
|
android:id="@+id/nameView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"/>
|
android:layout_marginRight="@dimen/listitem_horizontal_margin"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/forumNameView"
|
android:id="@+id/forumNameView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -63,7 +63,6 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
android:layout_marginRight="@dimen/message_bubble_margin_non_tail"
|
android:layout_marginRight="@dimen/message_bubble_margin_non_tail"
|
||||||
android:background="@drawable/notice_in_bottom">
|
android:background="@drawable/notice_in_bottom">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/introductionText"
|
android:id="@+id/introductionText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
android:layout_marginRight="@dimen/listitem_horizontal_margin"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/forumNameView"
|
android:id="@+id/forumNameView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
android:textSize="@dimen/text_size_medium"
|
android:textSize="@dimen/text_size_medium"
|
||||||
tools:text="This is a name of a forum that is available"/>
|
tools:text="This is a name of a forum that is available"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/sharedByView"
|
android:id="@+id/sharedByView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
android:layout_marginRight="@dimen/message_bubble_margin_tail"
|
android:layout_marginRight="@dimen/message_bubble_margin_tail"
|
||||||
android:background="@drawable/notice_out_bottom">
|
android:background="@drawable/notice_out_bottom">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/introductionText"
|
android:id="@+id/introductionText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
android:layout_marginLeft="@dimen/message_bubble_margin_tail"
|
android:layout_marginLeft="@dimen/message_bubble_margin_tail"
|
||||||
android:layout_marginRight="@dimen/message_bubble_margin_non_tail">
|
android:layout_marginRight="@dimen/message_bubble_margin_non_tail">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/noticeText"
|
android:id="@+id/noticeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
android:layout_marginLeft="@dimen/message_bubble_margin_non_tail"
|
android:layout_marginLeft="@dimen/message_bubble_margin_non_tail"
|
||||||
android:layout_marginRight="@dimen/message_bubble_margin_tail">
|
android:layout_marginRight="@dimen/message_bubble_margin_tail">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/noticeText"
|
android:id="@+id/noticeText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
android:layout_marginTop="@dimen/listitem_horizontal_margin"
|
android:layout_marginTop="@dimen/listitem_horizontal_margin"
|
||||||
android:background="?attr/selectableItemBackground">
|
android:background="?attr/selectableItemBackground">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/titleView"
|
android:id="@+id/titleView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
android:textColor="@color/briar_text_secondary"
|
android:textColor="@color/briar_text_secondary"
|
||||||
android:textSize="@dimen/text_size_small"/>
|
android:textSize="@dimen/text_size_small"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/authorView"
|
android:id="@+id/authorView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
android:textSize="@dimen/text_size_small"
|
android:textSize="@dimen/text_size_small"
|
||||||
tools:text="5 min. ago"/>
|
tools:text="5 min. ago"/>
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/descriptionView"
|
android:id="@+id/descriptionView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
android:layout_toRightOf="@+id/avatarView"
|
android:layout_toRightOf="@+id/avatarView"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/nameView"
|
android:id="@+id/nameView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
android:layout_marginRight="@dimen/message_bubble_margin_non_tail"
|
android:layout_marginRight="@dimen/message_bubble_margin_non_tail"
|
||||||
android:background="@drawable/notice_in_bottom">
|
android:background="@drawable/notice_in_bottom">
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||||
android:id="@+id/introductionText"
|
android:id="@+id/introductionText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -10,41 +10,43 @@
|
|||||||
style="@style/Divider.Horizontal"
|
style="@style/Divider.Horizontal"
|
||||||
android:layout_alignParentTop="true"/>
|
android:layout_alignParentTop="true"/>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
|
<LinearLayout
|
||||||
android:id="@+id/emoji_toggle"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="42dp"
|
android:layout_height="wrap_content">
|
||||||
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
|
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
|
||||||
android:id="@+id/input_text"
|
android:id="@+id/emoji_toggle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="@dimen/text_input_height"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/text_input_height"
|
||||||
android:layout_toLeftOf="@+id/btn_send"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:layout_toRightOf="@+id/emoji_toggle"
|
android:padding="@dimen/margin_small"
|
||||||
android:inputType="textMultiLine|textCapSentences"
|
android:scaleType="center"/>
|
||||||
android:maxLines="5"
|
|
||||||
android:minHeight="42dp"/>
|
|
||||||
|
|
||||||
<ImageButton
|
<org.thoughtcrime.securesms.components.emoji.EmojiEditText
|
||||||
android:id="@+id/btn_send"
|
android:id="@+id/input_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="42dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_above="@+id/emoji_drawer"
|
android:layout_weight="1"
|
||||||
android:layout_alignBottom="@+id/input_text"
|
android:background="@android:color/transparent"
|
||||||
android:layout_alignParentRight="true"
|
android:inputType="textMultiLine|textCapSentences"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:maxLines="5"
|
||||||
android:clickable="true"
|
android:minHeight="@dimen/text_input_height"
|
||||||
android:contentDescription="@string/send"
|
android:textColor="@color/briar_text_primary"
|
||||||
android:enabled="false"
|
android:textColorHint="@color/briar_text_tertiary"/>
|
||||||
android:padding="@dimen/margin_small"
|
|
||||||
android:src="@drawable/social_send_now_white"
|
<ImageButton
|
||||||
android:tint="@color/briar_primary"/>
|
android:id="@+id/btn_send"
|
||||||
|
android:layout_width="@dimen/text_input_height"
|
||||||
|
android:layout_height="@dimen/text_input_height"
|
||||||
|
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"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
|
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
|
||||||
android:id="@+id/emoji_drawer"
|
android:id="@+id/emoji_drawer"
|
||||||
|
|||||||
64
briar-android/res/layout/text_input_view_large.xml
Normal file
64
briar-android/res/layout/text_input_view_large.xml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?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/fragment_reblog">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/input_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/margin_medium"
|
||||||
|
android:layout_marginLeft="@dimen/margin_medium"
|
||||||
|
android:layout_marginRight="@dimen/margin_medium"
|
||||||
|
android:layout_marginStart="@dimen/margin_medium"
|
||||||
|
android:layout_marginTop="@dimen/margin_medium"
|
||||||
|
android:background="@android:color/white"
|
||||||
|
android:elevation="@dimen/cardview_default_elevation"
|
||||||
|
android:minHeight="@dimen/text_input_height"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiToggle
|
||||||
|
android:id="@+id/emoji_toggle"
|
||||||
|
android:layout_width="@dimen/text_input_height"
|
||||||
|
android:layout_height="@dimen/text_input_height"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
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="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:inputType="textMultiLine|textLongMessage|textCapSentences|textAutoCorrect"
|
||||||
|
android:minHeight="@dimen/text_input_height"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingEnd="@dimen/margin_small"
|
||||||
|
android:paddingRight="@dimen/margin_small"
|
||||||
|
android:paddingTop="@dimen/margin_small"
|
||||||
|
android:textColor="@color/briar_text_primary"
|
||||||
|
android:textColorHint="@color/briar_text_tertiary"
|
||||||
|
tools:ignore="RtlSymmetry"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_send"
|
||||||
|
style="@style/BriarButton"
|
||||||
|
android:layout_marginEnd="@dimen/margin_small"
|
||||||
|
android:layout_marginLeft="@dimen/margin_small"
|
||||||
|
android:layout_marginRight="@dimen/margin_small"
|
||||||
|
android:layout_marginStart="@dimen/margin_small"/>
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.components.emoji.EmojiDrawer
|
||||||
|
android:id="@+id/emoji_drawer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</merge>
|
||||||
@@ -27,8 +27,7 @@
|
|||||||
android:id="@+id/action_blog_delete"
|
android:id="@+id/action_blog_delete"
|
||||||
android:icon="@drawable/action_delete_white"
|
android:icon="@drawable/action_delete_white"
|
||||||
android:title="@string/blogs_remove_blog"
|
android:title="@string/blogs_remove_blog"
|
||||||
android:visible="false"
|
android:enabled="false"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"/>
|
||||||
tools:visible="true"/>
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu
|
<menu
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_introduction"
|
android:id="@+id/action_introduction"
|
||||||
android:icon="@drawable/introduction_white"
|
android:icon="@drawable/introduction_white"
|
||||||
android:title="@string/introduction_button"
|
android:title="@string/introduction_button"
|
||||||
android:visible="false"
|
android:enabled="false"
|
||||||
app:showAsAction="never"
|
app:showAsAction="never"/>
|
||||||
tools:visible="true"/>
|
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_social_remove_person"
|
android:id="@+id/action_social_remove_person"
|
||||||
|
|||||||
@@ -14,4 +14,14 @@
|
|||||||
</attr>
|
</attr>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="TextInputView">
|
||||||
|
<attr name="hint" format="string"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="LargeTextInputView">
|
||||||
|
<attr name="buttonText" format="string"/>
|
||||||
|
<attr name="maxLines" format="integer"/>
|
||||||
|
<attr name="fillHeight" format="boolean"/>
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
<dimen name="blogs_avatar_comment_size">20dp</dimen>
|
<dimen name="blogs_avatar_comment_size">20dp</dimen>
|
||||||
|
|
||||||
<!-- Emoji -->
|
<!-- Emoji -->
|
||||||
|
<dimen name="text_input_height">42dp</dimen>
|
||||||
<dimen name="conversation_item_body_text_size">16sp</dimen>
|
<dimen name="conversation_item_body_text_size">16sp</dimen>
|
||||||
<dimen name="emoji_drawer_size">32sp</dimen>
|
<dimen name="emoji_drawer_size">32sp</dimen>
|
||||||
<dimen name="emoji_drawer_indicator_height">2dp</dimen>
|
<dimen name="emoji_drawer_indicator_height">2dp</dimen>
|
||||||
|
|||||||
@@ -79,6 +79,7 @@
|
|||||||
<string name="no_contacts">It seems that you are new here and have no contacts yet.\n\nTap the + icon at the top and follow the instructions to add some friends to your list.\n\nPlease remember: You can only add new contacts face-to-face to prevent anyone from impersonating you or reading your messages in the future.</string>
|
<string name="no_contacts">It seems that you are new here and have no contacts yet.\n\nTap the + icon at the top and follow the instructions to add some friends to your list.\n\nPlease remember: You can only add new contacts face-to-face to prevent anyone from impersonating you or reading your messages in the future.</string>
|
||||||
<string name="date_no_private_messages">No messages.</string>
|
<string name="date_no_private_messages">No messages.</string>
|
||||||
<string name="no_private_messages">This is the conversation view.\n\nThere seems to be a lack of conversation.\n\nJust tap the input field at the bottom to start a conversation.</string>
|
<string name="no_private_messages">This is the conversation view.\n\nThere seems to be a lack of conversation.\n\nJust tap the input field at the bottom to start a conversation.</string>
|
||||||
|
<string name="message_hint">Type message</string>
|
||||||
<string name="delete_contact">Delete contact</string>
|
<string name="delete_contact">Delete contact</string>
|
||||||
<string name="dialog_title_delete_contact">Confirm Contact Deletion</string>
|
<string name="dialog_title_delete_contact">Confirm Contact Deletion</string>
|
||||||
<string name="dialog_message_delete_contact">Are you sure that you want to remove this contact and all messages exchanged with this contact?</string>
|
<string name="dialog_message_delete_contact">Are you sure that you want to remove this contact and all messages exchanged with this contact?</string>
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public class BlogFragment extends BaseFragment implements
|
|||||||
writeButton = menu.findItem(R.id.action_write_blog_post);
|
writeButton = menu.findItem(R.id.action_write_blog_post);
|
||||||
if (isMyBlog) writeButton.setVisible(true);
|
if (isMyBlog) writeButton.setVisible(true);
|
||||||
deleteButton = menu.findItem(R.id.action_blog_delete);
|
deleteButton = menu.findItem(R.id.action_blog_delete);
|
||||||
if (canDeleteBlog) deleteButton.setVisible(true);
|
if (canDeleteBlog) deleteButton.setEnabled(true);
|
||||||
|
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ public class BlogFragment extends BaseFragment implements
|
|||||||
displaySnackbar(R.string.blogs_blog_post_created, true);
|
displaySnackbar(R.string.blogs_blog_post_created, true);
|
||||||
loadBlogPosts(true);
|
loadBlogPosts(true);
|
||||||
} else if (request == REQUEST_SHARE && result == RESULT_OK) {
|
} else if (request == REQUEST_SHARE && result == RESULT_OK) {
|
||||||
displaySnackbar(R.string.blogs_sharing_snackbar, true);
|
displaySnackbar(R.string.blogs_sharing_snackbar, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ public class BlogFragment extends BaseFragment implements
|
|||||||
if (blog.isOurs())
|
if (blog.isOurs())
|
||||||
showWriteButton();
|
showWriteButton();
|
||||||
if (blog.canBeRemoved())
|
if (blog.canBeRemoved())
|
||||||
showDeleteButton();
|
enableDeleteButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -287,10 +287,10 @@ public class BlogFragment extends BaseFragment implements
|
|||||||
writeButton.setVisible(true);
|
writeButton.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDeleteButton() {
|
private void enableDeleteButton() {
|
||||||
canDeleteBlog = true;
|
canDeleteBlog = true;
|
||||||
if (deleteButton != null)
|
if (deleteButton != null)
|
||||||
deleteButton.setVisible(true);
|
deleteButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displaySnackbar(int stringId, boolean scroll) {
|
private void displaySnackbar(int stringId, boolean scroll) {
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ import android.os.Bundle;
|
|||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
|
||||||
@@ -16,6 +13,8 @@ import org.briarproject.R;
|
|||||||
import org.briarproject.android.ActivityComponent;
|
import org.briarproject.android.ActivityComponent;
|
||||||
import org.briarproject.android.controller.handler.UiResultExceptionHandler;
|
import org.briarproject.android.controller.handler.UiResultExceptionHandler;
|
||||||
import org.briarproject.android.fragment.BaseFragment;
|
import org.briarproject.android.fragment.BaseFragment;
|
||||||
|
import org.briarproject.android.view.TextInputView;
|
||||||
|
import org.briarproject.android.view.TextInputView.TextInputListener;
|
||||||
import org.briarproject.api.db.DbException;
|
import org.briarproject.api.db.DbException;
|
||||||
import org.briarproject.api.sync.GroupId;
|
import org.briarproject.api.sync.GroupId;
|
||||||
import org.briarproject.api.sync.MessageId;
|
import org.briarproject.api.sync.MessageId;
|
||||||
@@ -29,7 +28,7 @@ import static android.view.View.VISIBLE;
|
|||||||
import static org.briarproject.android.BriarActivity.GROUP_ID;
|
import static org.briarproject.android.BriarActivity.GROUP_ID;
|
||||||
import static org.briarproject.android.blogs.BasePostPagerFragment.POST_ID;
|
import static org.briarproject.android.blogs.BasePostPagerFragment.POST_ID;
|
||||||
|
|
||||||
public class ReblogFragment extends BaseFragment {
|
public class ReblogFragment extends BaseFragment implements TextInputListener {
|
||||||
|
|
||||||
public static final String TAG = ReblogFragment.class.getName();
|
public static final String TAG = ReblogFragment.class.getName();
|
||||||
|
|
||||||
@@ -88,6 +87,7 @@ public class ReblogFragment extends BaseFragment {
|
|||||||
false);
|
false);
|
||||||
ui = new ViewHolder(v);
|
ui = new ViewHolder(v);
|
||||||
ui.post.setTransitionName(postId);
|
ui.post.setTransitionName(postId);
|
||||||
|
ui.input.setSendButtonEnabled(false);
|
||||||
showProgressBar();
|
showProgressBar();
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
@@ -129,14 +129,8 @@ public class ReblogFragment extends BaseFragment {
|
|||||||
ui.post.bindItem(item);
|
ui.post.bindItem(item);
|
||||||
ui.post.hideReblogButton();
|
ui.post.hideReblogButton();
|
||||||
|
|
||||||
ui.publish.setOnClickListener(new OnClickListener() {
|
ui.input.setListener(this);
|
||||||
@Override
|
ui.input.setSendButtonEnabled(true);
|
||||||
public void onClick(View v) {
|
|
||||||
send();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ui.publish.setEnabled(true);
|
|
||||||
ui.scrollView.post(new Runnable() {
|
ui.scrollView.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -145,7 +139,8 @@ public class ReblogFragment extends BaseFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void send() {
|
@Override
|
||||||
|
public void onSendClick(String text) {
|
||||||
String comment = getComment();
|
String comment = getComment();
|
||||||
feedController.repeatPost(item, comment,
|
feedController.repeatPost(item, comment,
|
||||||
new UiResultExceptionHandler<Void, DbException>(listener) {
|
new UiResultExceptionHandler<Void, DbException>(listener) {
|
||||||
@@ -159,6 +154,7 @@ public class ReblogFragment extends BaseFragment {
|
|||||||
// do nothing, this fragment is gone already
|
// do nothing, this fragment is gone already
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -170,13 +166,11 @@ public class ReblogFragment extends BaseFragment {
|
|||||||
private void showProgressBar() {
|
private void showProgressBar() {
|
||||||
ui.progressBar.setVisibility(VISIBLE);
|
ui.progressBar.setVisibility(VISIBLE);
|
||||||
ui.input.setVisibility(GONE);
|
ui.input.setVisibility(GONE);
|
||||||
ui.publish.setVisibility(GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideProgressBar() {
|
private void hideProgressBar() {
|
||||||
ui.progressBar.setVisibility(INVISIBLE);
|
ui.progressBar.setVisibility(INVISIBLE);
|
||||||
ui.input.setVisibility(VISIBLE);
|
ui.input.setVisibility(VISIBLE);
|
||||||
ui.publish.setVisibility(VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ViewHolder {
|
private static class ViewHolder {
|
||||||
@@ -184,15 +178,13 @@ public class ReblogFragment extends BaseFragment {
|
|||||||
private final ScrollView scrollView;
|
private final ScrollView scrollView;
|
||||||
private final ProgressBar progressBar;
|
private final ProgressBar progressBar;
|
||||||
private final BlogPostViewHolder post;
|
private final BlogPostViewHolder post;
|
||||||
private final EditText input;
|
private final TextInputView input;
|
||||||
private final Button publish;
|
|
||||||
|
|
||||||
private ViewHolder(View v) {
|
private ViewHolder(View v) {
|
||||||
scrollView = (ScrollView) v.findViewById(R.id.scrollView);
|
scrollView = (ScrollView) v.findViewById(R.id.scrollView);
|
||||||
progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
|
||||||
post = new BlogPostViewHolder(v.findViewById(R.id.postLayout));
|
post = new BlogPostViewHolder(v.findViewById(R.id.postLayout));
|
||||||
input = (EditText) v.findViewById(R.id.inputText);
|
input = (TextInputView) v.findViewById(R.id.inputText);
|
||||||
publish = (Button) v.findViewById(R.id.publishButton);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import android.text.Editable;
|
|||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TextView.OnEditorActionListener;
|
import android.widget.TextView.OnEditorActionListener;
|
||||||
@@ -17,6 +14,8 @@ import org.briarproject.R;
|
|||||||
import org.briarproject.android.ActivityComponent;
|
import org.briarproject.android.ActivityComponent;
|
||||||
import org.briarproject.android.BriarActivity;
|
import org.briarproject.android.BriarActivity;
|
||||||
import org.briarproject.android.api.AndroidNotificationManager;
|
import org.briarproject.android.api.AndroidNotificationManager;
|
||||||
|
import org.briarproject.android.view.TextInputView;
|
||||||
|
import org.briarproject.android.view.TextInputView.TextInputListener;
|
||||||
import org.briarproject.api.FormatException;
|
import org.briarproject.api.FormatException;
|
||||||
import org.briarproject.api.blogs.BlogManager;
|
import org.briarproject.api.blogs.BlogManager;
|
||||||
import org.briarproject.api.blogs.BlogPost;
|
import org.briarproject.api.blogs.BlogPost;
|
||||||
@@ -39,7 +38,7 @@ import static java.util.logging.Level.WARNING;
|
|||||||
import static org.briarproject.api.blogs.BlogConstants.MAX_BLOG_POST_BODY_LENGTH;
|
import static org.briarproject.api.blogs.BlogConstants.MAX_BLOG_POST_BODY_LENGTH;
|
||||||
|
|
||||||
public class WriteBlogPostActivity extends BriarActivity
|
public class WriteBlogPostActivity extends BriarActivity
|
||||||
implements OnEditorActionListener {
|
implements OnEditorActionListener, TextInputListener {
|
||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
Logger.getLogger(WriteBlogPostActivity.class.getName());
|
Logger.getLogger(WriteBlogPostActivity.class.getName());
|
||||||
@@ -47,8 +46,7 @@ public class WriteBlogPostActivity extends BriarActivity
|
|||||||
@Inject
|
@Inject
|
||||||
protected AndroidNotificationManager notificationManager;
|
protected AndroidNotificationManager notificationManager;
|
||||||
|
|
||||||
private EditText bodyInput;
|
private TextInputView input;
|
||||||
private Button publishButton;
|
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@@ -60,6 +58,7 @@ public class WriteBlogPostActivity extends BriarActivity
|
|||||||
@Inject
|
@Inject
|
||||||
volatile BlogManager blogManager;
|
volatile BlogManager blogManager;
|
||||||
|
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle state) {
|
public void onCreate(Bundle state) {
|
||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
@@ -71,8 +70,9 @@ public class WriteBlogPostActivity extends BriarActivity
|
|||||||
|
|
||||||
setContentView(R.layout.activity_write_blog_post);
|
setContentView(R.layout.activity_write_blog_post);
|
||||||
|
|
||||||
bodyInput = (EditText) findViewById(R.id.bodyInput);
|
input = (TextInputView) findViewById(R.id.bodyInput);
|
||||||
bodyInput.addTextChangedListener(new TextWatcher() {
|
input.setSendButtonEnabled(false);
|
||||||
|
input.addTextChangedListener(new TextWatcher() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||||
int after) {
|
int after) {
|
||||||
@@ -88,14 +88,7 @@ public class WriteBlogPostActivity extends BriarActivity
|
|||||||
enableOrDisablePublishButton();
|
enableOrDisablePublishButton();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
input.setListener(this);
|
||||||
publishButton = (Button) findViewById(R.id.publishButton);
|
|
||||||
publishButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
publish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
progressBar = (ProgressBar) findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) findViewById(R.id.progressBar);
|
||||||
}
|
}
|
||||||
@@ -130,25 +123,23 @@ public class WriteBlogPostActivity extends BriarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView textView, int actionId, KeyEvent e) {
|
public boolean onEditorAction(TextView textView, int actionId, KeyEvent e) {
|
||||||
bodyInput.requestFocus();
|
input.requestFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableOrDisablePublishButton() {
|
private void enableOrDisablePublishButton() {
|
||||||
int bodyLength =
|
int bodyLength =
|
||||||
StringUtils.toUtf8(bodyInput.getText().toString()).length;
|
StringUtils.toUtf8(input.getText().toString()).length;
|
||||||
if (bodyLength > 0 && bodyLength <= MAX_BLOG_POST_BODY_LENGTH)
|
if (bodyLength > 0 && bodyLength <= MAX_BLOG_POST_BODY_LENGTH)
|
||||||
publishButton.setEnabled(true);
|
input.setSendButtonEnabled(true);
|
||||||
else
|
else
|
||||||
publishButton.setEnabled(false);
|
input.setSendButtonEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish() {
|
@Override
|
||||||
// body
|
public void onSendClick(String body) {
|
||||||
String body = bodyInput.getText().toString();
|
|
||||||
|
|
||||||
// hide publish button, show progress bar
|
// hide publish button, show progress bar
|
||||||
publishButton.setVisibility(GONE);
|
input.setVisibility(GONE);
|
||||||
progressBar.setVisibility(VISIBLE);
|
progressBar.setVisibility(VISIBLE);
|
||||||
|
|
||||||
storePost(body);
|
storePost(body);
|
||||||
@@ -192,10 +183,9 @@ public class WriteBlogPostActivity extends BriarActivity
|
|||||||
public void run() {
|
public void run() {
|
||||||
// hide progress bar, show publish button
|
// hide progress bar, show publish button
|
||||||
progressBar.setVisibility(GONE);
|
progressBar.setVisibility(GONE);
|
||||||
publishButton.setVisibility(VISIBLE);
|
input.setVisibility(VISIBLE);
|
||||||
// TODO show error
|
// TODO show error
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ public class ConversationActivity extends BriarActivity
|
|||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.conversation_actions, menu);
|
inflater.inflate(R.menu.conversation_actions, menu);
|
||||||
|
|
||||||
showIntroductionActionIfAvailable(
|
enableIntroductionActionIfAvailable(
|
||||||
menu.findItem(R.id.action_introduction));
|
menu.findItem(R.id.action_introduction));
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
@@ -269,10 +269,6 @@ public class ConversationActivity extends BriarActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (textInputView.isEmojiDrawerOpen()) {
|
|
||||||
textInputView.hideEmojiDrawer();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// FIXME disabled exit transition, because it doesn't work for some reason #318
|
// FIXME disabled exit transition, because it doesn't work for some reason #318
|
||||||
//supportFinishAfterTransition();
|
//supportFinishAfterTransition();
|
||||||
finish();
|
finish();
|
||||||
@@ -755,13 +751,13 @@ public class ConversationActivity extends BriarActivity
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showIntroductionActionIfAvailable(final MenuItem item) {
|
private void enableIntroductionActionIfAvailable(final MenuItem item) {
|
||||||
runOnDbThread(new Runnable() {
|
runOnDbThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (contactManager.getActiveContacts().size() > 1) {
|
if (contactManager.getActiveContacts().size() > 1) {
|
||||||
showIntroductionAction(item);
|
enableIntroductionAction(item);
|
||||||
Settings settings =
|
Settings settings =
|
||||||
settingsManager.getSettings(SETTINGS_NAMESPACE);
|
settingsManager.getSettings(SETTINGS_NAMESPACE);
|
||||||
if (settings.getBoolean(SHOW_ONBOARDING_INTRODUCTION,
|
if (settings.getBoolean(SHOW_ONBOARDING_INTRODUCTION,
|
||||||
@@ -777,11 +773,11 @@ public class ConversationActivity extends BriarActivity
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showIntroductionAction(final MenuItem item) {
|
private void enableIntroductionAction(final MenuItem item) {
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
item.setVisible(true);
|
item.setEnabled(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,9 +174,7 @@ public class ForumActivity extends BriarActivity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (textInput.isEmojiDrawerOpen()) {
|
if (textInput.getVisibility() == VISIBLE) {
|
||||||
textInput.hideEmojiDrawer();
|
|
||||||
} else if (textInput.getVisibility() == VISIBLE) {
|
|
||||||
textInput.setVisibility(GONE);
|
textInput.setVisibility(GONE);
|
||||||
forumAdapter.setReplyEntry(null);
|
forumAdapter.setReplyEntry(null);
|
||||||
} else {
|
} else {
|
||||||
@@ -193,9 +191,9 @@ public class ForumActivity extends BriarActivity implements
|
|||||||
textInput.setText("");
|
textInput.setText("");
|
||||||
}
|
}
|
||||||
textInput.requestFocus();
|
textInput.requestFocus();
|
||||||
|
textInput.showSoftKeyboard();
|
||||||
textInput.setHint(replyEntry == null ? R.string.forum_new_message_hint :
|
textInput.setHint(replyEntry == null ? R.string.forum_new_message_hint :
|
||||||
R.string.forum_message_reply_hint);
|
R.string.forum_message_reply_hint);
|
||||||
showSoftKeyboardForced(textInput);
|
|
||||||
forumAdapter.setReplyEntry(replyEntry);
|
forumAdapter.setReplyEntry(replyEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +271,7 @@ public class ForumActivity extends BriarActivity implements
|
|||||||
.createPost(StringUtils.toUtf8(text), replyEntry.getId(),
|
.createPost(StringUtils.toUtf8(text), replyEntry.getId(),
|
||||||
resultHandler);
|
resultHandler);
|
||||||
}
|
}
|
||||||
hideSoftKeyboard(textInput);
|
textInput.hideSoftKeyboard();
|
||||||
textInput.setVisibility(GONE);
|
textInput.setVisibility(GONE);
|
||||||
forumAdapter.setReplyEntry(null);
|
forumAdapter.setReplyEntry(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import android.support.v7.app.ActionBar;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -15,6 +13,7 @@ import android.widget.Toast;
|
|||||||
import org.briarproject.R;
|
import org.briarproject.R;
|
||||||
import org.briarproject.android.ActivityComponent;
|
import org.briarproject.android.ActivityComponent;
|
||||||
import org.briarproject.android.fragment.BaseFragment;
|
import org.briarproject.android.fragment.BaseFragment;
|
||||||
|
import org.briarproject.android.view.TextInputView;
|
||||||
import org.briarproject.api.FormatException;
|
import org.briarproject.api.FormatException;
|
||||||
import org.briarproject.api.contact.Contact;
|
import org.briarproject.api.contact.Contact;
|
||||||
import org.briarproject.api.contact.ContactId;
|
import org.briarproject.api.contact.ContactId;
|
||||||
@@ -35,7 +34,8 @@ import static android.view.View.VISIBLE;
|
|||||||
import static android.widget.Toast.LENGTH_SHORT;
|
import static android.widget.Toast.LENGTH_SHORT;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
|
|
||||||
public class IntroductionMessageFragment extends BaseFragment {
|
public class IntroductionMessageFragment extends BaseFragment
|
||||||
|
implements TextInputView.TextInputListener {
|
||||||
|
|
||||||
public final static String TAG = "IntroductionMessageFragment";
|
public final static String TAG = "IntroductionMessageFragment";
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ public class IntroductionMessageFragment extends BaseFragment {
|
|||||||
|
|
||||||
private IntroductionActivity introductionActivity;
|
private IntroductionActivity introductionActivity;
|
||||||
private ViewHolder ui;
|
private ViewHolder ui;
|
||||||
|
private Contact contact1, contact2;
|
||||||
|
|
||||||
// Fields that are accessed from background threads must be volatile
|
// Fields that are accessed from background threads must be volatile
|
||||||
@Inject
|
@Inject
|
||||||
@@ -96,7 +97,7 @@ public class IntroductionMessageFragment extends BaseFragment {
|
|||||||
// show progress bar until contacts have been loaded
|
// show progress bar until contacts have been loaded
|
||||||
ui = new ViewHolder(v);
|
ui = new ViewHolder(v);
|
||||||
ui.text.setVisibility(GONE);
|
ui.text.setVisibility(GONE);
|
||||||
ui.button.setEnabled(false);
|
ui.message.setSendButtonEnabled(false);
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
@@ -144,6 +145,9 @@ public class IntroductionMessageFragment extends BaseFragment {
|
|||||||
introductionActivity.runOnUiThread(new Runnable() {
|
introductionActivity.runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
contact1 = c1;
|
||||||
|
contact2 = c2;
|
||||||
|
|
||||||
// set avatars
|
// set avatars
|
||||||
ui.avatar1.setImageDrawable(new IdenticonDrawable(
|
ui.avatar1.setImageDrawable(new IdenticonDrawable(
|
||||||
c1.getAuthor().getId().getBytes()));
|
c1.getAuthor().getId().getBytes()));
|
||||||
@@ -160,27 +164,24 @@ public class IntroductionMessageFragment extends BaseFragment {
|
|||||||
c1.getAuthor().getName(), c2.getAuthor().getName()));
|
c1.getAuthor().getName(), c2.getAuthor().getName()));
|
||||||
|
|
||||||
// set button action
|
// set button action
|
||||||
ui.button.setOnClickListener(new View.OnClickListener() {
|
ui.message.setListener(IntroductionMessageFragment.this);
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
onButtonClick(c1, c2);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// hide progress bar and show views
|
// hide progress bar and show views
|
||||||
ui.progressBar.setVisibility(GONE);
|
ui.progressBar.setVisibility(GONE);
|
||||||
ui.text.setVisibility(VISIBLE);
|
ui.text.setVisibility(VISIBLE);
|
||||||
ui.button.setEnabled(true);
|
ui.message.setSendButtonEnabled(true);
|
||||||
|
ui.message.showSoftKeyboard();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onButtonClick(final Contact c1, final Contact c2) {
|
@Override
|
||||||
|
public void onSendClick(String text) {
|
||||||
// disable button to prevent accidental double invitations
|
// disable button to prevent accidental double invitations
|
||||||
ui.button.setEnabled(false);
|
ui.message.setSendButtonEnabled(false);
|
||||||
|
|
||||||
String msg = ui.message.getText().toString();
|
String msg = ui.message.getText().toString();
|
||||||
makeIntroduction(c1, c2, msg);
|
makeIntroduction(contact1, contact2, msg);
|
||||||
|
|
||||||
// don't wait for the introduction to be made before finishing activity
|
// don't wait for the introduction to be made before finishing activity
|
||||||
introductionActivity.hideSoftKeyboard(ui.message);
|
introductionActivity.hideSoftKeyboard(ui.message);
|
||||||
@@ -223,18 +224,17 @@ public class IntroductionMessageFragment extends BaseFragment {
|
|||||||
private final CircleImageView avatar1, avatar2;
|
private final CircleImageView avatar1, avatar2;
|
||||||
private final TextView contactName1, contactName2;
|
private final TextView contactName1, contactName2;
|
||||||
private final TextView text;
|
private final TextView text;
|
||||||
private final EditText message;
|
private final TextInputView message;
|
||||||
private final Button button;
|
|
||||||
|
|
||||||
ViewHolder(View v) {
|
private ViewHolder(View v) {
|
||||||
progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) v.findViewById(R.id.progressBar);
|
||||||
avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1);
|
avatar1 = (CircleImageView) v.findViewById(R.id.avatarContact1);
|
||||||
avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2);
|
avatar2 = (CircleImageView) v.findViewById(R.id.avatarContact2);
|
||||||
contactName1 = (TextView) v.findViewById(R.id.nameContact1);
|
contactName1 = (TextView) v.findViewById(R.id.nameContact1);
|
||||||
contactName2 = (TextView) v.findViewById(R.id.nameContact2);
|
contactName2 = (TextView) v.findViewById(R.id.nameContact2);
|
||||||
text = (TextView) v.findViewById(R.id.introductionText);
|
text = (TextView) v.findViewById(R.id.introductionText);
|
||||||
message = (EditText) v.findViewById(R.id.introductionMessageView);
|
message = (TextInputView) v
|
||||||
button = (Button) v.findViewById(R.id.makeIntroductionButton);
|
.findViewById(R.id.introductionMessageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ShareBlogMessageFragment extends ShareMessageFragment {
|
|||||||
setTitle(R.string.blogs_sharing_share);
|
setTitle(R.string.blogs_sharing_share);
|
||||||
|
|
||||||
View v = super.onCreateView(inflater, container, savedInstanceState);
|
View v = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
ui.button.setText(getString(R.string.blogs_sharing_button));
|
ui.message.setButtonText(getString(R.string.blogs_sharing_button));
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
|
|
||||||
import org.briarproject.R;
|
import org.briarproject.R;
|
||||||
import org.briarproject.android.fragment.BaseFragment;
|
import org.briarproject.android.fragment.BaseFragment;
|
||||||
|
import org.briarproject.android.view.LargeTextInputView;
|
||||||
|
import org.briarproject.android.view.TextInputView.TextInputListener;
|
||||||
import org.briarproject.api.blogs.BlogSharingManager;
|
import org.briarproject.api.blogs.BlogSharingManager;
|
||||||
import org.briarproject.api.contact.ContactId;
|
import org.briarproject.api.contact.ContactId;
|
||||||
import org.briarproject.api.forum.ForumSharingManager;
|
import org.briarproject.api.forum.ForumSharingManager;
|
||||||
@@ -26,7 +26,8 @@ import static org.briarproject.android.sharing.ShareActivity.CONTACTS;
|
|||||||
import static org.briarproject.android.sharing.ShareActivity.getContactsFromIds;
|
import static org.briarproject.android.sharing.ShareActivity.getContactsFromIds;
|
||||||
import static org.briarproject.api.sharing.SharingConstants.GROUP_ID;
|
import static org.briarproject.api.sharing.SharingConstants.GROUP_ID;
|
||||||
|
|
||||||
abstract class ShareMessageFragment extends BaseFragment {
|
abstract class ShareMessageFragment extends BaseFragment
|
||||||
|
implements TextInputListener {
|
||||||
|
|
||||||
public final static String TAG = ShareMessageFragment.class.getName();
|
public final static String TAG = ShareMessageFragment.class.getName();
|
||||||
|
|
||||||
@@ -81,16 +82,17 @@ abstract class ShareMessageFragment extends BaseFragment {
|
|||||||
View v = inflater.inflate(R.layout.fragment_share_message, container,
|
View v = inflater.inflate(R.layout.fragment_share_message, container,
|
||||||
false);
|
false);
|
||||||
ui = new ViewHolder(v);
|
ui = new ViewHolder(v);
|
||||||
ui.button.setOnClickListener(new View.OnClickListener() {
|
ui.message.setListener(this);
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
onButtonClick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
ui.message.showSoftKeyboard();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
@@ -111,11 +113,11 @@ abstract class ShareMessageFragment extends BaseFragment {
|
|||||||
shareActivity.setTitle(res);
|
shareActivity.setTitle(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onButtonClick() {
|
@Override
|
||||||
|
public void onSendClick(String msg) {
|
||||||
// disable button to prevent accidental double invitations
|
// disable button to prevent accidental double invitations
|
||||||
ui.button.setEnabled(false);
|
ui.message.setSendButtonEnabled(false);
|
||||||
|
|
||||||
String msg = ui.message.getText().toString();
|
|
||||||
share(msg);
|
share(msg);
|
||||||
|
|
||||||
// don't wait for the invitation to be made before finishing activity
|
// don't wait for the invitation to be made before finishing activity
|
||||||
@@ -139,12 +141,11 @@ abstract class ShareMessageFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static class ViewHolder {
|
protected static class ViewHolder {
|
||||||
protected final EditText message;
|
protected final LargeTextInputView message;
|
||||||
protected final Button button;
|
|
||||||
|
|
||||||
ViewHolder(View v) {
|
private ViewHolder(View v) {
|
||||||
message = (EditText) v.findViewById(R.id.invitationMessageView);
|
message = (LargeTextInputView) v
|
||||||
button = (Button) v.findViewById(R.id.shareForumButton);
|
.findViewById(R.id.invitationMessageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package org.briarproject.android.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.annotation.UiThread;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import org.briarproject.R;
|
||||||
|
|
||||||
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
|
||||||
|
@UiThread
|
||||||
|
public class LargeTextInputView extends TextInputView {
|
||||||
|
|
||||||
|
public LargeTextInputView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LargeTextInputView(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
this(context, attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LargeTextInputView(Context context, @Nullable AttributeSet attrs,
|
||||||
|
int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void inflateLayout(Context context) {
|
||||||
|
LayoutInflater inflater = (LayoutInflater) context
|
||||||
|
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
inflater.inflate(R.layout.text_input_view_large, this, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUpViews(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super.setUpViews(context, attrs);
|
||||||
|
|
||||||
|
// get attributes
|
||||||
|
TypedArray attributes = context.obtainStyledAttributes(attrs,
|
||||||
|
R.styleable.LargeTextInputView);
|
||||||
|
String buttonText =
|
||||||
|
attributes.getString(R.styleable.LargeTextInputView_buttonText);
|
||||||
|
int maxLines =
|
||||||
|
attributes
|
||||||
|
.getInteger(R.styleable.LargeTextInputView_maxLines, 0);
|
||||||
|
boolean fillHeight = attributes
|
||||||
|
.getBoolean(R.styleable.LargeTextInputView_fillHeight,
|
||||||
|
false);
|
||||||
|
attributes.recycle();
|
||||||
|
|
||||||
|
if (buttonText != null) setButtonText(buttonText);
|
||||||
|
if (maxLines > 0) ui.editText.setMaxLines(maxLines);
|
||||||
|
if (fillHeight) {
|
||||||
|
LinearLayout layout =
|
||||||
|
(LinearLayout) findViewById(R.id.input_layout);
|
||||||
|
LayoutParams params = (LayoutParams) layout.getLayoutParams();
|
||||||
|
params.height = 0;
|
||||||
|
params.weight = 1;
|
||||||
|
layout.setLayoutParams(params);
|
||||||
|
ViewGroup.LayoutParams editParams = ui.editText.getLayoutParams();
|
||||||
|
editParams.height = MATCH_PARENT;
|
||||||
|
ui.editText.setLayoutParams(editParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButtonText(String text) {
|
||||||
|
((Button) ui.sendButton).setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,18 +1,29 @@
|
|||||||
package org.briarproject.android.view;
|
package org.briarproject.android.view;
|
||||||
|
|
||||||
|
import android.animation.LayoutTransition;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.support.annotation.CallSuper;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
import android.support.annotation.UiThread;
|
import android.support.annotation.UiThread;
|
||||||
|
import android.support.v7.widget.AppCompatImageButton;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import org.briarproject.R;
|
import org.briarproject.R;
|
||||||
import org.thoughtcrime.securesms.components.KeyboardAwareRelativeLayout;
|
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout;
|
||||||
import org.thoughtcrime.securesms.components.emoji.EmojiDrawer;
|
import org.thoughtcrime.securesms.components.emoji.EmojiDrawer;
|
||||||
import org.thoughtcrime.securesms.components.emoji.EmojiDrawer.EmojiEventListener;
|
import org.thoughtcrime.securesms.components.emoji.EmojiDrawer.EmojiEventListener;
|
||||||
import org.thoughtcrime.securesms.components.emoji.EmojiEditText;
|
import org.thoughtcrime.securesms.components.emoji.EmojiEditText;
|
||||||
@@ -21,19 +32,17 @@ import org.thoughtcrime.securesms.components.emoji.EmojiToggle;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||||
|
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
public class TextInputView extends KeyboardAwareRelativeLayout
|
public class TextInputView extends KeyboardAwareLinearLayout
|
||||||
implements EmojiEventListener {
|
implements EmojiEventListener {
|
||||||
|
|
||||||
private static final String TAG = TextInputView.class.getName();
|
private static final String TAG = TextInputView.class.getName();
|
||||||
private static final Logger LOG = Logger.getLogger(TAG);
|
private static final Logger LOG = Logger.getLogger(TAG);
|
||||||
|
|
||||||
private EmojiEditText editText;
|
protected final ViewHolder ui;
|
||||||
private View sendButton;
|
protected TextInputListener listener;
|
||||||
private EmojiDrawer emojiDrawer;
|
|
||||||
|
|
||||||
private TextInputListener listener;
|
|
||||||
|
|
||||||
public TextInputView(Context context) {
|
public TextInputView(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -46,50 +55,80 @@ public class TextInputView extends KeyboardAwareRelativeLayout
|
|||||||
public TextInputView(Context context, @Nullable AttributeSet attrs,
|
public TextInputView(Context context, @Nullable AttributeSet attrs,
|
||||||
int defStyleAttr) {
|
int defStyleAttr) {
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
|
setOrientation(VERTICAL);
|
||||||
|
setLayoutTransition(new LayoutTransition());
|
||||||
|
|
||||||
|
inflateLayout(context);
|
||||||
|
ui = new ViewHolder();
|
||||||
|
setUpViews(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void inflateLayout(Context context) {
|
||||||
LayoutInflater inflater = (LayoutInflater) context
|
LayoutInflater inflater = (LayoutInflater) context
|
||||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
inflater.inflate(R.layout.text_input_view, this, true);
|
inflater.inflate(R.layout.text_input_view, this, true);
|
||||||
|
}
|
||||||
|
|
||||||
// find views
|
@CallSuper
|
||||||
EmojiToggle emojiToggle = (EmojiToggle) findViewById(R.id.emoji_toggle);
|
protected void setUpViews(Context context, @Nullable AttributeSet attrs) {
|
||||||
editText = (EmojiEditText) findViewById(R.id.input_text);
|
// get attributes
|
||||||
emojiDrawer = (EmojiDrawer) findViewById(R.id.emoji_drawer);
|
TypedArray attributes = context.obtainStyledAttributes(attrs,
|
||||||
sendButton = findViewById(R.id.btn_send);
|
R.styleable.TextInputView);
|
||||||
|
String hint = attributes.getString(R.styleable.TextInputView_hint);
|
||||||
|
attributes.recycle();
|
||||||
|
|
||||||
emojiToggle.attach(emojiDrawer);
|
if (hint != null) {
|
||||||
emojiToggle.setOnClickListener(new OnClickListener() {
|
ui.editText.setHint(hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.emojiToggle.attach(ui.emojiDrawer);
|
||||||
|
ui.emojiToggle.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
onEmojiToggleClicked();
|
onEmojiToggleClicked();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
editText.setOnClickListener(new OnClickListener() {
|
ui.editText.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
showSoftKeyboard();
|
showSoftKeyboard();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sendButton.setOnClickListener(new OnClickListener() {
|
ui.editText.setOnKeyListener(new OnKeyListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK && isEmojiDrawerOpen()) {
|
||||||
|
hideEmojiDrawer();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ui.sendButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onSendClick(editText.getText().toString());
|
listener.onSendClick(ui.editText.getText().toString());
|
||||||
editText.setText("");
|
ui.editText.setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
emojiDrawer.setEmojiEventListener(this);
|
ui.emojiDrawer.setEmojiEventListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onKeyEvent(KeyEvent keyEvent) {
|
public void onKeyEvent(KeyEvent keyEvent) {
|
||||||
editText.dispatchKeyEvent(keyEvent);
|
ui.editText.dispatchKeyEvent(keyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEmojiSelected(String emoji) {
|
public void onEmojiSelected(String emoji) {
|
||||||
editText.insertEmoji(emoji);
|
ui.editText.insertEmoji(emoji);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
|
||||||
|
return ui.editText.requestFocus(direction, previouslyFocusedRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onEmojiToggleClicked() {
|
private void onEmojiToggleClicked() {
|
||||||
@@ -101,29 +140,33 @@ public class TextInputView extends KeyboardAwareRelativeLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
editText.setText(text);
|
ui.editText.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Editable getText() {
|
||||||
|
return ui.editText.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHint(@StringRes int res) {
|
public void setHint(@StringRes int res) {
|
||||||
editText.setHint(res);
|
ui.editText.setHint(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSendButtonEnabled(boolean enabled) {
|
public void setSendButtonEnabled(boolean enabled) {
|
||||||
sendButton.setEnabled(enabled);
|
ui.sendButton.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTextChangedListener(TextWatcher watcher) {
|
||||||
|
ui.editText.addTextChangedListener(watcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListener(TextInputListener listener) {
|
public void setListener(TextInputListener listener) {
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface TextInputListener {
|
|
||||||
void onSendClick(String text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showSoftKeyboard() {
|
public void showSoftKeyboard() {
|
||||||
if (isKeyboardOpen()) return;
|
if (isKeyboardOpen()) return;
|
||||||
|
|
||||||
if (emojiDrawer.isShowing()) {
|
if (ui.emojiDrawer.isShowing()) {
|
||||||
postOnKeyboardOpen(new Runnable() {
|
postOnKeyboardOpen(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -131,18 +174,18 @@ public class TextInputView extends KeyboardAwareRelativeLayout
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
editText.post(new Runnable() {
|
ui.editText.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
editText.requestFocus();
|
ui.editText.requestFocus();
|
||||||
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||||
((InputMethodManager) o).showSoftInput(editText, 0);
|
((InputMethodManager) o).showSoftInput(ui.editText, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideSoftKeyboard() {
|
public void hideSoftKeyboard() {
|
||||||
IBinder token = editText.getWindowToken();
|
IBinder token = ui.editText.getWindowToken();
|
||||||
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
Object o = getContext().getSystemService(INPUT_METHOD_SERVICE);
|
||||||
((InputMethodManager) o).hideSoftInputFromWindow(token, 0);
|
((InputMethodManager) o).hideSoftInputFromWindow(token, 0);
|
||||||
}
|
}
|
||||||
@@ -151,21 +194,40 @@ public class TextInputView extends KeyboardAwareRelativeLayout
|
|||||||
if (isKeyboardOpen()) {
|
if (isKeyboardOpen()) {
|
||||||
postOnKeyboardClose(new Runnable() {
|
postOnKeyboardClose(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
emojiDrawer.show(getKeyboardHeight());
|
ui.emojiDrawer.show(getKeyboardHeight());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
hideSoftKeyboard();
|
hideSoftKeyboard();
|
||||||
} else {
|
} else {
|
||||||
emojiDrawer.show(getKeyboardHeight());
|
ui.emojiDrawer.show(getKeyboardHeight());
|
||||||
|
ui.editText.requestFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideEmojiDrawer() {
|
public void hideEmojiDrawer() {
|
||||||
emojiDrawer.hide();
|
ui.emojiDrawer.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEmojiDrawerOpen() {
|
public boolean isEmojiDrawerOpen() {
|
||||||
return emojiDrawer.isShowing();
|
return ui.emojiDrawer.isShowing();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class ViewHolder {
|
||||||
|
private final EmojiToggle emojiToggle;
|
||||||
|
protected final EmojiEditText editText;
|
||||||
|
protected final View sendButton;
|
||||||
|
protected final EmojiDrawer emojiDrawer;
|
||||||
|
|
||||||
|
private ViewHolder() {
|
||||||
|
emojiToggle = (EmojiToggle) findViewById(R.id.emoji_toggle);
|
||||||
|
editText = (EmojiEditText) findViewById(R.id.input_text);
|
||||||
|
emojiDrawer = (EmojiDrawer) findViewById(R.id.emoji_drawer);
|
||||||
|
sendButton = findViewById(R.id.btn_send);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface TextInputListener {
|
||||||
|
void onSendClick(String text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import android.support.annotation.UiThread;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import org.briarproject.R;
|
import org.briarproject.R;
|
||||||
|
|
||||||
@@ -31,10 +31,10 @@ import static java.util.logging.Level.WARNING;
|
|||||||
* a soft keyboard has been opened and what its height would be.
|
* a soft keyboard has been opened and what its height would be.
|
||||||
*/
|
*/
|
||||||
@UiThread
|
@UiThread
|
||||||
public class KeyboardAwareRelativeLayout extends RelativeLayout {
|
public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
Logger.getLogger(KeyboardAwareRelativeLayout.class.getName());
|
Logger.getLogger(KeyboardAwareLinearLayout.class.getName());
|
||||||
|
|
||||||
private final Rect rect = new Rect();
|
private final Rect rect = new Rect();
|
||||||
private final Set<OnKeyboardHiddenListener> hiddenListeners =
|
private final Set<OnKeyboardHiddenListener> hiddenListeners =
|
||||||
@@ -51,16 +51,16 @@ public class KeyboardAwareRelativeLayout extends RelativeLayout {
|
|||||||
private boolean keyboardOpen = false;
|
private boolean keyboardOpen = false;
|
||||||
private int rotation = -1;
|
private int rotation = -1;
|
||||||
|
|
||||||
public KeyboardAwareRelativeLayout(Context context) {
|
public KeyboardAwareLinearLayout(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardAwareRelativeLayout(Context context,
|
public KeyboardAwareLinearLayout(Context context,
|
||||||
@Nullable AttributeSet attrs) {
|
@Nullable AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
this(context, attrs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyboardAwareRelativeLayout(Context context,
|
public KeyboardAwareLinearLayout(Context context,
|
||||||
@Nullable AttributeSet attrs, int defStyle) {
|
@Nullable AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
final int statusBarRes = getResources()
|
final int statusBarRes = getResources()
|
||||||
@@ -41,6 +41,7 @@ public class EmojiTextView extends TextView {
|
|||||||
@Override
|
@Override
|
||||||
public void setText(@Nullable CharSequence text, BufferType type) {
|
public void setText(@Nullable CharSequence text, BufferType type) {
|
||||||
source = EmojiProvider.getInstance(getContext()).emojify(text, this);
|
source = EmojiProvider.getInstance(getContext()).emojify(text, this);
|
||||||
|
|
||||||
setTextEllipsized(source);
|
setTextEllipsized(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user