forked from mirror/monocles_chat_clean
Increase font size in message bubbles, reactions and input field on user preference
Some checks failed
Android CI / build (pull_request) Has been cancelled
Some checks failed
Android CI / build (pull_request) Has been cancelled
This commit is contained in:
parent
7d05e8e451
commit
b04b1a3a05
6 changed files with 53 additions and 12 deletions
|
@ -13,6 +13,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.AppSettings;
|
||||||
|
import eu.siacs.conversations.Conversations;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.entities.Conversation;
|
import eu.siacs.conversations.entities.Conversation;
|
||||||
import eu.siacs.conversations.entities.Reaction;
|
import eu.siacs.conversations.entities.Reaction;
|
||||||
|
@ -25,7 +27,6 @@ import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class BindingAdapters {
|
public class BindingAdapters {
|
||||||
|
|
||||||
public static void setReactionsOnReceived(
|
public static void setReactionsOnReceived(
|
||||||
final ChipGroup chipGroup,
|
final ChipGroup chipGroup,
|
||||||
final Conversation conversation,
|
final Conversation conversation,
|
||||||
|
@ -58,6 +59,7 @@ public class BindingAdapters {
|
||||||
final var corner = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 35, context.getResources().getDisplayMetrics());
|
final var corner = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 35, context.getResources().getDisplayMetrics());
|
||||||
final var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, size);
|
final var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, size);
|
||||||
final List<Map.Entry<EmojiSearch.Emoji, Collection<Reaction>>> reactions = aggregated.reactions;
|
final List<Map.Entry<EmojiSearch.Emoji, Collection<Reaction>>> reactions = aggregated.reactions;
|
||||||
|
final AppSettings appSettings = new AppSettings(context);
|
||||||
if (reactions == null || reactions.isEmpty()) {
|
if (reactions == null || reactions.isEmpty()) {
|
||||||
chipGroup.setVisibility(View.GONE);
|
chipGroup.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,7 +70,15 @@ public class BindingAdapters {
|
||||||
final var count = reaction.getValue().size();
|
final var count = reaction.getValue().size();
|
||||||
final Chip chip = new Chip(chipGroup.getContext());
|
final Chip chip = new Chip(chipGroup.getContext());
|
||||||
//chip.setEnsureMinTouchTargetSize(false);
|
//chip.setEnsureMinTouchTargetSize(false);
|
||||||
chip.setChipMinHeight(size-32.0f);
|
if (appSettings.isLargeFont()) {
|
||||||
|
chip.setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
|
||||||
|
chip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||||
|
} else {
|
||||||
|
chip.setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
|
||||||
|
}
|
||||||
|
chip.setChipMinHeight(size-22.0f);
|
||||||
chip.ensureAccessibleTouchTarget(size);
|
chip.ensureAccessibleTouchTarget(size);
|
||||||
chip.setLayoutParams(layoutParams);
|
chip.setLayoutParams(layoutParams);
|
||||||
chip.setChipCornerRadius(corner);
|
chip.setChipCornerRadius(corner);
|
||||||
|
@ -125,7 +135,15 @@ public class BindingAdapters {
|
||||||
}
|
}
|
||||||
if (addReaction != null) {
|
if (addReaction != null) {
|
||||||
final Chip chip = new Chip(chipGroup.getContext());
|
final Chip chip = new Chip(chipGroup.getContext());
|
||||||
chip.setChipMinHeight(size-32.0f);
|
if (appSettings.isLargeFont()) {
|
||||||
|
chip.setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
|
||||||
|
chip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||||
|
} else {
|
||||||
|
chip.setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
|
||||||
|
}
|
||||||
|
chip.setChipMinHeight(size-22.0f);
|
||||||
chip.ensureAccessibleTouchTarget(size);
|
chip.ensureAccessibleTouchTarget(size);
|
||||||
chip.setLayoutParams(layoutParams);
|
chip.setLayoutParams(layoutParams);
|
||||||
chip.setChipCornerRadius(corner);
|
chip.setChipCornerRadius(corner);
|
||||||
|
|
|
@ -54,6 +54,7 @@ import android.text.TextWatcher;
|
||||||
import android.text.style.ImageSpan;
|
import android.text.style.ImageSpan;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
|
@ -134,6 +135,7 @@ import net.java.otr4j.session.SessionStatus;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import eu.siacs.conversations.AppSettings;
|
||||||
import eu.siacs.conversations.entities.Bookmark;
|
import eu.siacs.conversations.entities.Bookmark;
|
||||||
import eu.siacs.conversations.medialib.activities.EditActivity;
|
import eu.siacs.conversations.medialib.activities.EditActivity;
|
||||||
import eu.siacs.conversations.ui.util.QuoteHelper;
|
import eu.siacs.conversations.ui.util.QuoteHelper;
|
||||||
|
@ -1734,7 +1736,12 @@ public class ConversationFragment extends XmppFragment
|
||||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
if (displayMetrics.heightPixels > 0) binding.textinput.setMaxHeight(displayMetrics.heightPixels / 4);
|
if (displayMetrics.heightPixels > 0) binding.textinput.setMaxHeight(displayMetrics.heightPixels / 4);
|
||||||
|
final var appSettings = new AppSettings(activity);
|
||||||
|
if (appSettings.isLargeFont()) {
|
||||||
|
binding.textinput.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
|
||||||
|
} else {
|
||||||
|
binding.textinput.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
|
||||||
|
}
|
||||||
binding.textSendButton.setOnClickListener(this.mSendButtonListener);
|
binding.textSendButton.setOnClickListener(this.mSendButtonListener);
|
||||||
binding.cancelButton.setOnClickListener(this.mCancelVoiceRecord);
|
binding.cancelButton.setOnClickListener(this.mCancelVoiceRecord);
|
||||||
binding.shareButton.setOnClickListener(this.mShareVoiceRecord);
|
binding.shareButton.setOnClickListener(this.mShareVoiceRecord);
|
||||||
|
@ -2082,6 +2089,15 @@ public class ConversationFragment extends XmppFragment
|
||||||
}
|
}
|
||||||
messageListAdapter.handleTextQuotes(binding.contextPreviewText, body);
|
messageListAdapter.handleTextQuotes(binding.contextPreviewText, body);
|
||||||
binding.contextPreviewText.setText(body);
|
binding.contextPreviewText.setText(body);
|
||||||
|
final var appSettings = new AppSettings(activity);
|
||||||
|
if (appSettings.isLargeFont()) {
|
||||||
|
binding.contextPreviewText.setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
|
||||||
|
binding.contextPreviewText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||||
|
} else {
|
||||||
|
binding.contextPreviewText.setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
|
||||||
|
}
|
||||||
binding.contextPreview.setVisibility(View.VISIBLE);
|
binding.contextPreview.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,7 +606,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
||||||
final ViewGroup.LayoutParams layoutParams = viewHolder.messageBody().getLayoutParams();
|
final ViewGroup.LayoutParams layoutParams = viewHolder.messageBody().getLayoutParams();
|
||||||
layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
viewHolder.messageBody().setLayoutParams(layoutParams);
|
viewHolder.messageBody().setLayoutParams(layoutParams);
|
||||||
|
if (appSettings.isLargeFont()) {
|
||||||
|
viewHolder.inReplyToQuote().setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyLarge);
|
||||||
|
viewHolder.inReplyToQuote().setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
|
||||||
|
} else {
|
||||||
|
viewHolder.inReplyToQuote().setTextAppearance(
|
||||||
|
com.google.android.material.R.style.TextAppearance_Material3_BodyMedium);
|
||||||
|
}
|
||||||
final ViewGroup.LayoutParams qlayoutParams = viewHolder.inReplyToQuote().getLayoutParams();
|
final ViewGroup.LayoutParams qlayoutParams = viewHolder.inReplyToQuote().getLayoutParams();
|
||||||
qlayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
qlayoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
viewHolder.messageBody().setLayoutParams(qlayoutParams);
|
viewHolder.messageBody().setLayoutParams(qlayoutParams);
|
||||||
|
|
|
@ -1066,7 +1066,7 @@
|
||||||
<string name="pref_accept_invites_from_strangers_summary">Accept invites from strangers for MUCs</string>
|
<string name="pref_accept_invites_from_strangers_summary">Accept invites from strangers for MUCs</string>
|
||||||
<string name="pref_up_long_summary">When acting as a UnifiedPush Distributor the persistent, reliable and battery-friendly XMPP connection will be utilized to wake up other UnifiedPush compatible app such as Tusky, Ltt.rs, FluffyChat and more.</string>
|
<string name="pref_up_long_summary">When acting as a UnifiedPush Distributor the persistent, reliable and battery-friendly XMPP connection will be utilized to wake up other UnifiedPush compatible app such as Tusky, Ltt.rs, FluffyChat and more.</string>
|
||||||
<string name="pref_large_font">Large font</string>
|
<string name="pref_large_font">Large font</string>
|
||||||
<string name="pref_large_font_summary">Increase font size in message bubbles</string>
|
<string name="pref_large_font_summary">Increase font size in message bubbles, reactions and input field</string>
|
||||||
<string name="pref_backup_summary">Create one-off, Schedule recurring</string>
|
<string name="pref_backup_summary">Create one-off, Schedule recurring</string>
|
||||||
<string name="pref_create_backup_one_off_summary">Create one-off backup</string>
|
<string name="pref_create_backup_one_off_summary">Create one-off backup</string>
|
||||||
<string name="pref_backup_recurring">Recurring backup</string>
|
<string name="pref_backup_recurring">Recurring backup</string>
|
||||||
|
|
|
@ -134,6 +134,12 @@
|
||||||
app:fragment="eu.siacs.conversations.ui.fragment.settings.InterfaceBubblesSettingsFragment"
|
app:fragment="eu.siacs.conversations.ui.fragment.settings.InterfaceBubblesSettingsFragment"
|
||||||
app:summary="@string/pref_chat_bubbles_summary"
|
app:summary="@string/pref_chat_bubbles_summary"
|
||||||
app:title="@string/pref_chat_bubbles" />
|
app:title="@string/pref_chat_bubbles" />
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="@bool/large_font"
|
||||||
|
android:icon="@drawable/ic_format_size_24dp"
|
||||||
|
android:key="large_font"
|
||||||
|
android:summary="@string/pref_large_font_summary"
|
||||||
|
android:title="@string/pref_large_font" />
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="@bool/show_dynamic_tags"
|
android:defaultValue="@bool/show_dynamic_tags"
|
||||||
android:icon="@drawable/ic_label_24dp"
|
android:icon="@drawable/ic_label_24dp"
|
||||||
|
|
|
@ -12,10 +12,4 @@
|
||||||
android:key="show_avatars"
|
android:key="show_avatars"
|
||||||
android:summary="@string/pref_show_avatars_summary"
|
android:summary="@string/pref_show_avatars_summary"
|
||||||
android:title="@string/pref_show_avatars" />
|
android:title="@string/pref_show_avatars" />
|
||||||
<SwitchPreferenceCompat
|
|
||||||
android:defaultValue="@bool/large_font"
|
|
||||||
android:icon="@drawable/ic_format_size_24dp"
|
|
||||||
android:key="large_font"
|
|
||||||
android:summary="@string/pref_large_font_summary"
|
|
||||||
android:title="@string/pref_large_font" />
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
Add table
Reference in a new issue