Group mentions at the top

This commit is contained in:
Thomas 2023-02-05 11:00:34 +01:00
parent f75d8258f4
commit 4111d00025
4 changed files with 44 additions and 3 deletions

View file

@ -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;

View file

@ -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>

View file

@ -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"

View file

@ -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