mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Layout improvements and emoji handling
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
4be4c0aa02
commit
9a6775a3e8
@ -29,6 +29,7 @@ import android.view.View;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.amulyakhare.textdrawable.TextDrawable;
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
|
import com.google.android.flexbox.FlexboxLayout;
|
||||||
import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView;
|
import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
@ -61,6 +62,9 @@ public class MagicIncomingTextMessageViewHolder
|
|||||||
@BindView(R.id.messageUserAvatar)
|
@BindView(R.id.messageUserAvatar)
|
||||||
ShapeImageView messageUserAvatarView;
|
ShapeImageView messageUserAvatarView;
|
||||||
|
|
||||||
|
@BindView(R.id.messageTime)
|
||||||
|
TextView messageTimeView;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
UserUtils userUtils;
|
UserUtils userUtils;
|
||||||
|
|
||||||
@ -98,6 +102,7 @@ public class MagicIncomingTextMessageViewHolder
|
|||||||
HashMap<String, HashMap<String, String>> messageParameters = message.getMessageParameters();
|
HashMap<String, HashMap<String, String>> messageParameters = message.getMessageParameters();
|
||||||
|
|
||||||
Context context = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
Context context = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
||||||
|
itemView.setSelected(false);
|
||||||
|
|
||||||
Spannable messageString = new SpannableString(message.getText());
|
Spannable messageString = new SpannableString(message.getText());
|
||||||
|
|
||||||
@ -123,6 +128,9 @@ public class MagicIncomingTextMessageViewHolder
|
|||||||
} else if (EmoticonUtils.isMessageWithSingleEmoticonOnly(context, message.getText())) {
|
} else if (EmoticonUtils.isMessageWithSingleEmoticonOnly(context, message.getText())) {
|
||||||
messageString.setSpan(new RelativeSizeSpan(2.5f), 0, messageString.length(),
|
messageString.setSpan(new RelativeSizeSpan(2.5f), 0, messageString.length(),
|
||||||
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
FlexboxLayout.LayoutParams layoutParams = (FlexboxLayout.LayoutParams) messageTimeView.getLayoutParams();
|
||||||
|
layoutParams.setWrapBefore(true);
|
||||||
|
messageTimeView.setLayoutParams(layoutParams);
|
||||||
itemView.setSelected(true);
|
itemView.setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,9 @@ import android.text.Spannable;
|
|||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.style.RelativeSizeSpan;
|
import android.text.style.RelativeSizeSpan;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.flexbox.FlexboxLayout;
|
||||||
import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView;
|
import com.kevalpatel2106.emoticongifkeyboard.widget.EmoticonTextView;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
@ -49,6 +51,9 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin
|
|||||||
@BindView(R.id.messageText)
|
@BindView(R.id.messageText)
|
||||||
EmoticonTextView messageText;
|
EmoticonTextView messageText;
|
||||||
|
|
||||||
|
@BindView(R.id.messageTime)
|
||||||
|
TextView messageTimeView;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
UserUtils userUtils;
|
UserUtils userUtils;
|
||||||
|
|
||||||
@ -93,6 +98,10 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin
|
|||||||
} else if (EmoticonUtils.isMessageWithSingleEmoticonOnly(context, message.getText())) {
|
} else if (EmoticonUtils.isMessageWithSingleEmoticonOnly(context, message.getText())) {
|
||||||
messageString.setSpan(new RelativeSizeSpan(2.5f), 0, messageString.length(),
|
messageString.setSpan(new RelativeSizeSpan(2.5f), 0, messageString.length(),
|
||||||
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
FlexboxLayout.LayoutParams layoutParams = (FlexboxLayout.LayoutParams) messageTimeView.getLayoutParams();
|
||||||
|
layoutParams.setWrapBefore(true);
|
||||||
|
messageTimeView.setLayoutParams(layoutParams);
|
||||||
|
messageTimeView.setTextColor(context.getResources().getColor(R.color.warm_grey_four));
|
||||||
itemView.setSelected(true);
|
itemView.setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
app/src/main/res/drawable/shape_incoming_message.xml
Normal file
33
app/src/main/res/drawable/shape_incoming_message.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Nextcloud Talk application
|
||||||
|
~
|
||||||
|
~ @author Mario Danic
|
||||||
|
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||||
|
~
|
||||||
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This program is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners
|
||||||
|
android:topLeftRadius="0dp"
|
||||||
|
android:bottomRightRadius="@dimen/message_bubble_corners_radius"
|
||||||
|
android:bottomLeftRadius="@dimen/message_bubble_corners_radius"
|
||||||
|
android:topRightRadius="@dimen/message_bubble_corners_radius" />
|
||||||
|
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
|
||||||
|
</shape>
|
33
app/src/main/res/drawable/shape_outcoming_message.xml
Normal file
33
app/src/main/res/drawable/shape_outcoming_message.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Nextcloud Talk application
|
||||||
|
~
|
||||||
|
~ @author Mario Danic
|
||||||
|
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||||
|
~
|
||||||
|
~ This program is free software: you can redistribute it and/or modify
|
||||||
|
~ it under the terms of the GNU General Public License as published by
|
||||||
|
~ the Free Software Foundation, either version 3 of the License, or
|
||||||
|
~ at your option) any later version.
|
||||||
|
~
|
||||||
|
~ This program is distributed in the hope that it will be useful,
|
||||||
|
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
~ GNU General Public License for more details.
|
||||||
|
~
|
||||||
|
~ You should have received a copy of the GNU General Public License
|
||||||
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="@dimen/message_bubble_corners_radius"
|
||||||
|
android:topRightRadius="0dp"
|
||||||
|
android:topLeftRadius="@dimen/message_bubble_corners_radius"
|
||||||
|
android:bottomRightRadius="@dimen/message_bubble_corners_radius" />
|
||||||
|
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
|
||||||
|
</shape>
|
@ -51,7 +51,6 @@
|
|||||||
app:outcomingTextColor="@color/nc_outcoming_text_default"
|
app:outcomingTextColor="@color/nc_outcoming_text_default"
|
||||||
app:outcomingTextLinkColor="@color/nc_outcoming_text_default"
|
app:outcomingTextLinkColor="@color/nc_outcoming_text_default"
|
||||||
app:outcomingTextSize="@dimen/chat_text_size"
|
app:outcomingTextSize="@dimen/chat_text_size"
|
||||||
app:outcomingTimeTextColor="@color/warm_grey_four"
|
|
||||||
app:outcomingTimeTextSize="12sp"
|
app:outcomingTimeTextSize="12sp"
|
||||||
app:dateHeaderTextSize="13sp"
|
app:dateHeaderTextSize="13sp"
|
||||||
app:textAutoLink="all"/>
|
app:textAutoLink="all"/>
|
||||||
@ -62,8 +61,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/separator"
|
android:layout_above="@+id/separator"
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:paddingEnd="8dp"
|
android:paddingEnd="8dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
app:pb_backgroundColor="@color/colorPrimary"
|
app:pb_backgroundColor="@color/colorPrimary"
|
||||||
app:pb_icon="@drawable/ic_baseline_arrow_downward_24px"
|
app:pb_icon="@drawable/ic_baseline_arrow_downward_24px"
|
||||||
app:pb_text="@string/nc_new_messages"
|
app:pb_text="@string/nc_new_messages"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
android:id="@id/messageUserAvatar"
|
android:id="@id/messageUserAvatar"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginEnd="8dp"/>
|
android:layout_marginEnd="8dp"/>
|
||||||
|
|
||||||
<com.google.android.flexbox.FlexboxLayout
|
<com.google.android.flexbox.FlexboxLayout
|
||||||
@ -64,14 +64,13 @@
|
|||||||
app:layout_wrapBefore="true"/>
|
app:layout_wrapBefore="true"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@id/messageTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/messageText"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:layout_alignSelf="center"/>
|
||||||
|
|
||||||
</com.google.android.flexbox.FlexboxLayout>
|
</com.google.android.flexbox.FlexboxLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@id/messageTime"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignEnd="@id/bubble"
|
|
||||||
android:layout_below="@id/bubble"
|
|
||||||
android:layout_marginStart="16dp"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -47,14 +47,14 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignWithParentIfMissing="true"/>
|
android:layout_alignWithParentIfMissing="true"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@id/messageTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/messageText"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
app:layout_alignSelf="center"/>
|
||||||
|
|
||||||
</com.google.android.flexbox.FlexboxLayout>
|
</com.google.android.flexbox.FlexboxLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@id/messageTime"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignEnd="@id/bubble"
|
|
||||||
android:layout_below="@id/bubble"
|
|
||||||
android:layout_marginStart="16dp"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user