diff --git a/src/main/java/eu/siacs/conversations/AppSettings.java b/src/main/java/eu/siacs/conversations/AppSettings.java index b223e90e1..dde4ff8db 100644 --- a/src/main/java/eu/siacs/conversations/AppSettings.java +++ b/src/main/java/eu/siacs/conversations/AppSettings.java @@ -42,6 +42,7 @@ public class AppSettings { public static final String CHANNEL_DISCOVERY_METHOD = "channel_discovery_method"; public static final String SEND_CRASH_REPORTS = "send_crash_reports"; public static final String COLORFUL_CHAT_BUBBLES = "use_green_background"; + public static final String LARGE_FONT = "large_font"; private final Context context; @@ -98,6 +99,10 @@ public class AppSettings { return getBooleanPreference(COLORFUL_CHAT_BUBBLES, R.bool.use_green_background); } + public boolean isLargeFont() { + return getBooleanPreference(LARGE_FONT, R.bool.large_font); + } + public boolean isUseTor() { return getBooleanPreference(USE_TOR, R.bool.use_tor); } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index df45657c7..f3cba4f3d 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -98,7 +98,7 @@ public class MessageAdapter extends ArrayAdapter { private final DisplayMetrics metrics; private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; - private boolean colorfulChatBubbles = false; + private BubbleDesign bubbleDesign = new BubbleDesign(false, false); private final boolean mForceNames; public MessageAdapter( @@ -459,15 +459,13 @@ public class MessageAdapter extends ArrayAdapter { } private void displayTextMessage( - final ViewHolder viewHolder, - final Message message, - final BubbleColor bubbleColor, - int type) { + final ViewHolder viewHolder, final Message message, final BubbleColor bubbleColor) { viewHolder.download_button.setVisibility(View.GONE); viewHolder.image.setVisibility(View.GONE); viewHolder.audioPlayer.setVisibility(View.GONE); viewHolder.messageBody.setVisibility(View.VISIBLE); setTextColor(viewHolder.messageBody, bubbleColor); + setTextSize(viewHolder.messageBody, this.bubbleDesign.largeFont); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); if (message.getBody() != null) { @@ -804,7 +802,7 @@ public class MessageAdapter extends ArrayAdapter { } } - final boolean colorfulBackground = this.colorfulChatBubbles; + final boolean colorfulBackground = this.bubbleDesign.colorfulChatBubbles; final BubbleColor bubbleColor; if (type == RECEIVED) { if (isInValidSession) { @@ -1039,7 +1037,7 @@ public class MessageAdapter extends ArrayAdapter { bubbleColor); } } else { - displayTextMessage(viewHolder, message, bubbleColor, type); + displayTextMessage(viewHolder, message, bubbleColor); } } @@ -1119,7 +1117,8 @@ public class MessageAdapter extends ArrayAdapter { public void updatePreferences() { final AppSettings appSettings = new AppSettings(activity); - this.colorfulChatBubbles = appSettings.isColorfulChatBubbles(); + this.bubbleDesign = + new BubbleDesign(appSettings.isColorfulChatBubbles(), appSettings.isLargeFont()); } public void setHighlightedTerm(List terms) { @@ -1173,6 +1172,16 @@ public class MessageAdapter extends ArrayAdapter { textView.setTextColor(bubbleToOnSurfaceColor(textView, bubbleColor)); } + private static void setTextSize(final TextView textView, final boolean largeFont) { + if (largeFont) { + textView.setTextAppearance( + com.google.android.material.R.style.TextAppearance_Material3_BodyLarge); + } else { + textView.setTextAppearance( + com.google.android.material.R.style.TextAppearance_Material3_BodyMedium); + } + } + private static @ColorInt int bubbleToOnSurfaceVariant( final View view, final BubbleColor bubbleColor) { final @AttrRes int colorAttributeResId; @@ -1213,6 +1222,16 @@ public class MessageAdapter extends ArrayAdapter { WARNING } + private static class BubbleDesign { + public final boolean colorfulChatBubbles; + public final boolean largeFont; + + private BubbleDesign(final boolean colorfulChatBubbles, final boolean largeFont) { + this.colorfulChatBubbles = colorfulChatBubbles; + this.largeFont = largeFont; + } + } + private static class ViewHolder { public MaterialButton load_more_messages; diff --git a/src/main/res/drawable/ic_format_size_24dp.xml b/src/main/res/drawable/ic_format_size_24dp.xml new file mode 100644 index 000000000..bd642c391 --- /dev/null +++ b/src/main/res/drawable/ic_format_size_24dp.xml @@ -0,0 +1,10 @@ + + + diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml index 40179e6e3..03bc16b6f 100644 --- a/src/main/res/values/defaults.xml +++ b/src/main/res/values/defaults.xml @@ -18,6 +18,7 @@ 524288 auto true + false recent false true diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index ac73d20b0..5eb496f3d 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -1055,5 +1055,7 @@ Interaction On device 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. + Large font + Increase font size in message bubbles diff --git a/src/main/res/xml/preferences_interface.xml b/src/main/res/xml/preferences_interface.xml index a71dcaf08..333edb03a 100644 --- a/src/main/res/xml/preferences_interface.xml +++ b/src/main/res/xml/preferences_interface.xml @@ -21,6 +21,12 @@ android:key="use_green_background" android:summary="@string/pref_use_colorful_bubbles_summary" android:title="@string/pref_use_colorful_bubbles" /> +