diff options
author | Thomas <tschneider.ac@gmail.com> | 2023-02-05 11:00:34 +0100 |
---|---|---|
committer | Thomas <tschneider.ac@gmail.com> | 2023-02-05 11:00:34 +0100 |
commit | 4111d0002552dc218c63b407455e4da68faae5a0 (patch) | |
tree | 405d697760e381f18b04e05838dd899eef62a41f | |
parent | f75d8258f4c31133a184b5ad09e2d71f4f7e3671 (diff) |
Group mentions at the top
4 files changed, 44 insertions, 3 deletions
diff --git a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java index dc1265a7c..a500e1af6 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/mastodon/ui/drawer/ComposeAdapter.java @@ -314,8 +314,10 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder } //Put other accounts mentioned at the bottom boolean capitalize = sharedpreferences.getBoolean(context.getString(R.string.SET_CAPITALIZE), true); + boolean mentionsAtTop = sharedpreferences.getBoolean(context.getString(R.string.SET_MENTIONS_AT_TOP), false); + if (inReplyToUser != null) { - if (capitalize) { + if (capitalize && !mentionsAtTop) { statusDraft.text = inReplyToUser.acct.startsWith("@") ? inReplyToUser.acct + "\n" : "@" + inReplyToUser.acct + "\n"; } else { statusDraft.text = inReplyToUser.acct.startsWith("@") ? inReplyToUser.acct + " " : "@" + inReplyToUser.acct + " "; @@ -324,7 +326,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder holder.binding.content.setText(statusDraft.text); statusDraft.cursorPosition = statusDraft.text.length(); if (statusDraft.mentions.size() > 1) { - statusDraft.text += "\n"; + if (!mentionsAtTop) { + statusDraft.text += "\n"; + } for (int i = 1; i < statusDraft.mentions.size(); i++) { String tootTemp = String.format("@%s ", statusDraft.mentions.get(i).acct); statusDraft.text = String.format("%s ", (statusDraft.text + tootTemp.trim())); @@ -1575,8 +1579,18 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder currentCursorPosition = holder.getLayoutPosition(); } }); + boolean capitalize = sharedpreferences.getBoolean(context.getString(R.string.SET_CAPITALIZE), true); + boolean mentionsAtTop = sharedpreferences.getBoolean(context.getString(R.string.SET_MENTIONS_AT_TOP), false); if (statusDraft.cursorPosition <= holder.binding.content.length()) { - holder.binding.content.setSelection(statusDraft.cursorPosition); + if (!mentionsAtTop) { + holder.binding.content.setSelection(statusDraft.cursorPosition); + } else { + if (capitalize && !statusDraft.text.endsWith("\n")) { + statusDraft.text += "\n"; + holder.binding.content.setText(statusDraft.text); + } + holder.binding.content.setSelection(holder.binding.content.getText().length()); + } } if (statusDraft.setCursorToEnd) { statusDraft.setCursorToEnd = false; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4b1bbfe4d..2ef289cdb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1390,6 +1390,8 @@ <string name="SET_DISABLE_ANIMATED_EMOJI" translatable="false">SET_DISABLE_ANIMATED_EMOJI</string> <string name="SET_CAPITALIZE" translatable="false">SET_CAPITALIZE</string> + <string name="SET_MENTIONS_AT_TOP" translatable="false">SET_MENTIONS_AT_TOP</string> + <string name="SET_THEME_BASE" translatable="false">SET_THEME_BASE</string> <string name="SET_DYNAMICCOLOR" translatable="false">SET_DYNAMICCOLOR</string> <string name="SET_CARDVIEW" translatable="false">SET_CARDVIEW</string> @@ -2244,4 +2246,7 @@ <string name="home_cache">Home cache</string> <string name="fetch_home_messages">Fetch home messages</string> <string name="auto_fetch_missing">Automatically fetch missing messages</string> + + <string name="set_mention_at_top">Mentions at the top</string> + <string name="set_mention_at_top_indication">When replying mentions will all be added to the beginning of the message</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/xml/pref_compose.xml b/app/src/main/res/xml/pref_compose.xml index 3bb9a7e6f..52fc8276d 100644 --- a/app/src/main/res/xml/pref_compose.xml +++ b/app/src/main/res/xml/pref_compose.xml @@ -13,6 +13,14 @@ app:singleLineTitle="false" app:summary="@string/set_capitalize_indication" app:title="@string/set_capitalize" /> + + <SwitchPreferenceCompat + app:defaultValue="false" + app:iconSpaceReserved="false" + app:key="@string/SET_MENTIONS_AT_TOP" + app:singleLineTitle="false" + app:summary="@string/set_mention_at_top_indication" + app:title="@string/set_mention_at_top" /> <!-- <SwitchPreferenceCompat app:defaultValue="false" diff --git a/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt b/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt new file mode 100644 index 000000000..e86d194e4 --- /dev/null +++ b/src/fdroid/fastlane/metadata/android/en/changelogs/477.txt @@ -0,0 +1,14 @@ +Added: +- Peertube 2FA support +- Cache home in background (default disabled -> New settings category and per account) / change frequency +- Auto-fetch missing messages for the Home (default disabled -> in Settings - Timelines) +- Automatically switch between tabs when searching +- More deep links detection +- Allow to group mentions at the top (default: disabled) + + +Fixed: +- Dynamic color for Android 12+ +- Fix a crash when replying +- Fix button size not changed +- Some crashes |