diff --git a/app/build.gradle b/app/build.gradle index 7f0181db..4e93a793 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { defaultConfig { minSdk 21 targetSdk 33 - versionCode 480 - versionName "3.18.2" + versionCode 481 + versionName "3.19.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } flavorDimensions "default" diff --git a/app/src/main/assets/release_notes/notes.json b/app/src/main/assets/release_notes/notes.json index 7aaf714c..97b8611d 100644 --- a/app/src/main/assets/release_notes/notes.json +++ b/app/src/main/assets/release_notes/notes.json @@ -1,4 +1,9 @@ [ + { + "version": "3.19.0", + "code": "481", + "note": "Added:\n- Settings compose: don't send media if there are no description (default: disabled)\n- Settings Timelines: Enable/Disable truncate links\n- Allow to set max link length (20 - 150 chars)\n\nChanged:\n- Align media with text (left margin enabled)\n\nFixed:\n- Media previews remain the same when sharing\n- Edit media description not working\n- Accessibility (larger fonts): profiles/DM\n- Cross replies: Wrong visibility with the selected account\n- Several crashes" + }, { "version": "3.18.2", "code": "480", diff --git a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java index 426323e4..f9947510 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/mastodon/helper/SpannableHelper.java @@ -303,10 +303,15 @@ public class SpannableHelper { end = start + newUrl.length(); url = newUrl; } - if (url.length() > 30 && (validUrl || url.startsWith("gimini://"))) { - newUrl = url.substring(0, 30); - newUrl += "…"; - content.replace(start, end, newUrl); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); + boolean truncate = sharedpreferences.getBoolean(context.getString(R.string.SET_TRUNCATE_LINKS), true); + if (truncate) { + int truncateValue = sharedpreferences.getInt(context.getString(R.string.SET_TRUNCATE_LINKS_MAX), 30); + if (url.length() > truncateValue && (validUrl || url.startsWith("gimini://"))) { + newUrl = url.substring(0, truncateValue); + newUrl += "…"; + content.replace(start, end, newUrl); + } } int matchEnd = validUrl ? start + newUrl.length() : end; diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java index 059494ab..bc6c01f3 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/fragment/settings/FragmentTimelinesSettings.java @@ -61,6 +61,7 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen preferenceScreen.removePreferenceRecursively("SET_TRANSLATOR_DOMAIN"); } } + SwitchPreferenceCompat SET_DISPLAY_BOOKMARK = findPreference(getString(R.string.SET_DISPLAY_BOOKMARK)); if (SET_DISPLAY_BOOKMARK != null) { boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_BOOKMARK) + MainActivity.currentUserID + MainActivity.currentInstance, true); @@ -77,6 +78,7 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen boolean checked = sharedpreferences.getBoolean(getString(R.string.SET_PIXELFED_PRESENTATION) + MainActivity.currentUserID + MainActivity.currentInstance, false); SET_PIXELFED_PRESENTATION.setChecked(checked); } + } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 00879430..3bc0e5ce 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1125,6 +1125,9 @@ SET_EXPAND_MEDIA SET_GROUP_REBLOGS SET_BOOST_ORIGINAL_DATE + SET_TRUNCATE_LINKS + SET_TRUNCATE_LINKS_MAX + SET_HIDE_SINGLE_MEDIA_WITH_CARD SET_LIVE_TRANSLATE_MULTIPLE SET_TRUNCATE_TOOTS_SIZE @@ -1910,4 +1913,7 @@ The message will not be sent if a description is missing with a media There are missing media descriptions + + Truncate links + Max chars in links \ No newline at end of file diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml index d17b85ec..80800942 100644 --- a/app/src/main/res/xml/pref_timelines.xml +++ b/app/src/main/res/xml/pref_timelines.xml @@ -44,6 +44,23 @@ app:singleLineTitle="false" app:title="@string/boost_original_date" /> + + +