Revert to previous read more read less feature + Remove empty top space

This commit is contained in:
Arne 2024-04-27 21:05:39 +02:00
parent 72b5591012
commit d5d5bf50e9
3 changed files with 23 additions and 37 deletions

View file

@ -173,8 +173,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
private final Map<String, WebxdcUpdate> lastWebxdcUpdate = new HashMap<>();
private String readmarkervalue;
private ConversationFragment mConversationFragment = null;
private boolean expandable;
private boolean expand;
public MessageAdapter(final XmppActivity activity, final List<Message> messages, final boolean forceNames) {
@ -1476,9 +1474,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.quotedImage = view.findViewById(R.id.image_quote_preview);
viewHolder.quotedImageBox = view.findViewById(R.id.image_quote_box);
viewHolder.secondQuoteLine = view.findViewById(R.id.second_quote_line);
viewHolder.seeMore = view.findViewById(R.id.see_more);
viewHolder.richlinkview = view.findViewById(R.id.richLinkView);
viewHolder.messageBody = view.findViewById(R.id.message_body);
if (activity.xmppConnectionService.getBooleanPreference("set_text_collapsable", R.bool.set_text_collapsable)) {
viewHolder.messageBody = view.findViewById(R.id.message_body_collapsable);
} else if (!activity.xmppConnectionService.getBooleanPreference("set_text_collapsable", R.bool.set_text_collapsable)) {
viewHolder.messageBody = view.findViewById(R.id.message_body);
}
viewHolder.user = view.findViewById(R.id.message_user);
viewHolder.time = view.findViewById(R.id.message_time);
viewHolder.subject = view.findViewById(R.id.message_subject);
@ -1515,9 +1516,12 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.quotedImage = view.findViewById(R.id.image_quote_preview);
viewHolder.quotedImageBox = view.findViewById(R.id.image_quote_box);
viewHolder.secondQuoteLine = view.findViewById(R.id.second_quote_line);
viewHolder.seeMore = view.findViewById(R.id.see_more);
viewHolder.richlinkview = view.findViewById(R.id.richLinkView);
viewHolder.messageBody = view.findViewById(R.id.message_body);
if (activity.xmppConnectionService.getBooleanPreference("set_text_collapsable", R.bool.set_text_collapsable)) {
viewHolder.messageBody = view.findViewById(R.id.message_body_collapsable);
} else if (!activity.xmppConnectionService.getBooleanPreference("set_text_collapsable", R.bool.set_text_collapsable)) {
viewHolder.messageBody = view.findViewById(R.id.message_body);
}
viewHolder.user = view.findViewById(R.id.message_user);
viewHolder.time = view.findViewById(R.id.message_time);
viewHolder.subject = view.findViewById(R.id.message_subject);
@ -1552,28 +1556,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
if (viewHolder.messageBody != null) {
viewHolder.messageBody.setCustomSelectionActionModeCallback(new MessageTextActionModeCallback(this, viewHolder.messageBody));
if (!activity.xmppConnectionService.getBooleanPreference("set_text_collapsable", R.bool.set_text_collapsable)) {
viewHolder.messageBody.setMaxLines(Integer.MAX_VALUE);//Message TextView
viewHolder.seeMore.setVisibility(GONE);
} else if (viewHolder.messageBody.getLineCount() > 7 && viewHolder.seeMore.getText().toString().equalsIgnoreCase(activity.getString(R.string.show_more))) {
viewHolder.seeMore.setVisibility(View.VISIBLE);
viewHolder.seeMore.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (viewHolder.seeMore.getText().toString().equalsIgnoreCase(activity.getString(R.string.show_more))) {
viewHolder.messageBody.setMaxLines(Integer.MAX_VALUE);// Message TextView
viewHolder.seeMore.setText(R.string.show_less);
} else {
viewHolder.messageBody.setMaxLines(7);//Message TextView
viewHolder.seeMore.setText(R.string.show_more);
}
}
});
} else if (viewHolder.messageBody.getLineCount() <= 7) {
viewHolder.seeMore.setVisibility(GONE);
}
}
if (viewHolder.thread_identicon != null) {
@ -2145,7 +2127,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
protected ImageView image;
protected ImageView quotedImage;
protected RelativeLayout quotedImageBox;
protected TextView seeMore;
protected View secondQuoteLine;
protected TextView mediaduration;
protected RichLinkView richlinkview;

View file

@ -54,16 +54,21 @@
android:autoLink="web"
android:longClickable="false"
android:textIsSelectable="true"
android:maxLines="7"
android:textAppearance="@style/TextAppearance.Conversations.Body1" />
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:visibility="gone" />
<TextView
android:id="@+id/see_more"
android:text="@string/show_more"
<de.monocles.chat.ReadMoreTextView
app:trimExpandedText="@string/show_less"
app:trimCollapsedText="@string/show_more"
app:trimMode="trimModeLength"
app:colorClickableText="?attr/colorAccent"
android:id="@+id/message_body_collapsable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:clickable="true" />
android:autoLink="web"
android:longClickable="false"
android:textAppearance="@style/TextAppearance.Conversations.Body1"
android:visibility="gone" />
<TextView
android:id="@+id/message_user"

View file

@ -1312,7 +1312,7 @@
<string name="pref_follow_thread_in_channel_summary">Set the thread marker to match the message currently being looked at</string>
<string name="show_less">\n\n... show less</string>
<string name="show_more">\n\n... show more</string>
<string name="collapse_message_signs_summary">Collapse messages with more than 7 lines</string>
<string name="collapse_message_signs_summary">Set the maximum number of signs to collapse a message</string>
<string name="collapse_message_signs_title">Collapse long text messages</string>
<string name="action_complete">Action complete</string>
<string name="moderate_recent">Moderate messages?</string>