make chat/comments more condenced

This commit is contained in:
Yuriy Liskov
2023-01-14 14:36:32 +02:00
parent 4e3c6965a3
commit 8b35fa37d0
7 changed files with 39 additions and 13 deletions

View File

@ -813,7 +813,8 @@ public class MessageHolders {
//wrapper.requestFocus();
//wrapper.setBackgroundResource(R.drawable.bgchange);
wrapper.setOnFocusChangeListener((v, hasFocus) -> {
text.setBackgroundResource(hasFocus ? R.color.tg_selected_bg : R.color.transparent);
//text.setBackgroundResource(hasFocus ? R.color.tg_selected_bg : R.color.transparent);
bubble.setBackgroundResource(hasFocus ? R.drawable.shape_incoming_message_focused : R.drawable.shape_incoming_message);
});
}
}

View File

@ -70,7 +70,7 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
private MessagesListStyle messagesListStyle;
private DateFormatter.Formatter dateHeadersFormatter;
private SparseArray<OnMessageViewClickListener> viewClickListenersArray = new SparseArray<>();
private boolean isTopDateEnabled;
private boolean isDateHeaderEnabled;
private int currentPosition = -1;
private MESSAGE focusedMessage;
@ -166,7 +166,7 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
removeLoadingMessageIfNeeded();
boolean isNewMessageToday = isTopDateEnabled && !isPreviousSameDate(0, message.getCreatedAt());
boolean isNewMessageToday = isDateHeaderEnabled && !isPreviousSameDate(0, message.getCreatedAt());
if (isNewMessageToday) {
items.add(0, new Wrapper<>(message.getCreatedAt()));
}
@ -413,8 +413,8 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
unselectAllItems();
}
public void enableTopDate(boolean enable) {
isTopDateEnabled = enable;
public void enableDateHeader(boolean enable) {
isDateHeaderEnabled = enable;
}
public void enableStackFromEnd(boolean enable) {
@ -615,6 +615,11 @@ public class MessagesListAdapter<MESSAGE extends IMessage>
for (int i = 0; i < messages.size(); i++) {
MESSAGE message = messages.get(i);
this.items.add(new Wrapper<>(message));
if (!isDateHeaderEnabled) {
continue;
}
if (messages.size() > i + 1) {
MESSAGE nextMessage = messages.get(i + 1);
if (!DateFormatter.isSameDay(message.getCreatedAt(), nextMessage.getCreatedAt())) {

View File

@ -0,0 +1,14 @@
<!-- MODIFIED -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- Bubble corner: android:bottomLeftRadius="0dp"->"@dimen/message_bubble_corners_radius" -->
<corners
android:bottomLeftRadius="@dimen/message_bubble_corners_radius"
android:bottomRightRadius="@dimen/message_bubble_corners_radius"
android:topLeftRadius="@dimen/message_bubble_corners_radius"
android:topRightRadius="@dimen/message_bubble_corners_radius" />
<solid android:color="@color/tg_selected_bg" />
</shape>

View File

@ -1,9 +1,7 @@
<!-- MODIFIED -->
<!-- Android 9 message focused bug fix: RelativeLayout focusable="false" -->
<!-- Decrease space between messages: RelativeLayout android:layout_marginBottom="8dp"->"3dp" android:layout_marginTop="8dp"->"3dp" -->
<!-- Decrease space between messages: RelativeLayout android:layout_marginBottom="8dp"->"3dp" android:layout_marginTop="8dp"->"0dp" -->
<!-- Margins: android:layout_marginRight="16dp"->"3dp" -->
<!-- Text: android:fontFamily="sans-serif-condensed" -->
<!-- Text: android:lineSpacingMultiplier="0.8" -->
<com.stfalcon.chatkit.commons.widgets.FocusFixRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
@ -12,7 +10,7 @@
android:layout_marginBottom="3dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:layout_marginTop="0dp"
android:focusable="false">
<!-- Move author icon to the top android:layout_alignParentBottom="true"->android:layout_alignParentTop="true", add new android:layout_marginTop="2dp" -->
@ -43,10 +41,14 @@
<!-- Tweaks from video info dialog: leanback_list_preference_fragment.xml:26 -->
<!-- More info: com.liskovsoft.smartyoutubetv2.tv.ui.mod.leanback.misc.LeanbackListPreferenceDialogFragment -->
<!-- Text: add android:fontFamily="sans-serif-condensed" -->
<!-- Text: add android:lineSpacingMultiplier="0.9" -->
<TextView
android:id="@id/messageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:lineSpacingMultiplier="0.9" />
<TextView
android:id="@id/messageTime"

View File

@ -27,7 +27,9 @@
<dimen name="message_padding_right">16dp</dimen>
<dimen name="message_padding_top">16dp</dimen>
<dimen name="message_padding_bottom">16dp</dimen>
<dimen name="message_text_size">17sp</dimen>
<!-- Incoming/Outcoming text message size -->
<!-- MODIFIED: message_text_size: "17sp"->"14sp" -->
<dimen name="message_text_size">14sp</dimen>
<dimen name="message_time_text_size">14sp</dimen>
<dimen name="message_date_header_text_size">16sp</dimen>
<dimen name="message_date_header_padding">16dp</dimen>