mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-07-15 08:00:29 +03:00
Disable by default the mention to the booster when replying. Can be enabled in Settings > Compose (per account)
This commit is contained in:
parent
bbd9c909b7
commit
d044d1d36f
5 changed files with 67 additions and 37 deletions
|
@ -502,6 +502,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
|
|
||||||
private void initializeAfterBundle(Bundle b) {
|
private void initializeAfterBundle(Bundle b) {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
|
statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY);
|
||||||
|
@ -514,6 +515,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
account = Helper.getCurrentAccount(ComposeActivity.this);
|
account = Helper.getCurrentAccount(ComposeActivity.this);
|
||||||
}
|
}
|
||||||
|
boolean setMentionBooster = sharedpreferences.getBoolean(getString(R.string.SET_MENTION_BOOSTER) + account.user_id + account.instance, false);
|
||||||
|
|
||||||
editMessageId = b.getString(Helper.ARG_EDIT_STATUS_ID, null);
|
editMessageId = b.getString(Helper.ARG_EDIT_STATUS_ID, null);
|
||||||
instance = b.getString(Helper.ARG_INSTANCE, null);
|
instance = b.getString(Helper.ARG_INSTANCE, null);
|
||||||
token = b.getString(Helper.ARG_TOKEN, null);
|
token = b.getString(Helper.ARG_TOKEN, null);
|
||||||
|
@ -523,7 +526,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
|
||||||
} else if (visibility == null && Helper.getCurrentAccount(ComposeActivity.this) != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source != null) {
|
} else if (visibility == null && Helper.getCurrentAccount(ComposeActivity.this) != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source != null) {
|
||||||
visibility = Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source.privacy;
|
visibility = Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source.privacy;
|
||||||
}
|
}
|
||||||
|
if(setMentionBooster) {
|
||||||
mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
|
||||||
|
} else {
|
||||||
|
mentionBooster = null;
|
||||||
|
}
|
||||||
accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
|
accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
|
||||||
//Shared elements
|
//Shared elements
|
||||||
sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS);
|
sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS);
|
||||||
|
|
|
@ -315,7 +315,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
*/
|
*/
|
||||||
private void manageMentions(Context context, Status statusDraft, ComposeViewHolder holder) {
|
private void manageMentions(Context context, Status statusDraft, ComposeViewHolder holder) {
|
||||||
|
|
||||||
if (statusDraft.mentions != null && (statusDraft.text == null || statusDraft.text.length() == 0) && statusDraft.mentions.size() > 0) {
|
if (statusDraft.mentions != null && (statusDraft.text == null || statusDraft.text.isEmpty()) && !statusDraft.mentions.isEmpty()) {
|
||||||
//Retrieves mentioned accounts + OP and adds them at the beginin of the toot
|
//Retrieves mentioned accounts + OP and adds them at the beginin of the toot
|
||||||
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
Mention inReplyToUser;
|
Mention inReplyToUser;
|
||||||
|
@ -426,25 +426,25 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||||
String[] mimetypes = new String[0];
|
String[] mimetypes = new String[0];
|
||||||
if (type == ComposeActivity.mediaType.PHOTO) {
|
if (type == ComposeActivity.mediaType.PHOTO) {
|
||||||
if (instanceInfo != null && instanceInfo.getMimeTypeImage() != null && instanceInfo.getMimeTypeImage().size() > 0) {
|
if (instanceInfo != null && instanceInfo.getMimeTypeImage() != null && !instanceInfo.getMimeTypeImage().isEmpty()) {
|
||||||
mimetypes = instanceInfo.getMimeTypeImage().toArray(new String[0]);
|
mimetypes = instanceInfo.getMimeTypeImage().toArray(new String[0]);
|
||||||
} else {
|
} else {
|
||||||
mimetypes = new String[]{"image/*"};
|
mimetypes = new String[]{"image/*"};
|
||||||
}
|
}
|
||||||
} else if (type == ComposeActivity.mediaType.VIDEO) {
|
} else if (type == ComposeActivity.mediaType.VIDEO) {
|
||||||
if (instanceInfo != null && instanceInfo.getMimeTypeVideo() != null && instanceInfo.getMimeTypeVideo().size() > 0) {
|
if (instanceInfo != null && instanceInfo.getMimeTypeVideo() != null && !instanceInfo.getMimeTypeVideo().isEmpty()) {
|
||||||
mimetypes = instanceInfo.getMimeTypeVideo().toArray(new String[0]);
|
mimetypes = instanceInfo.getMimeTypeVideo().toArray(new String[0]);
|
||||||
} else {
|
} else {
|
||||||
mimetypes = new String[]{"video/*"};
|
mimetypes = new String[]{"video/*"};
|
||||||
}
|
}
|
||||||
} else if (type == ComposeActivity.mediaType.AUDIO) {
|
} else if (type == ComposeActivity.mediaType.AUDIO) {
|
||||||
if (instanceInfo != null && instanceInfo.getMimeTypeAudio() != null && instanceInfo.getMimeTypeAudio().size() > 0) {
|
if (instanceInfo != null && instanceInfo.getMimeTypeAudio() != null && !instanceInfo.getMimeTypeAudio().isEmpty()) {
|
||||||
mimetypes = instanceInfo.getMimeTypeAudio().toArray(new String[0]);
|
mimetypes = instanceInfo.getMimeTypeAudio().toArray(new String[0]);
|
||||||
} else {
|
} else {
|
||||||
mimetypes = new String[]{"audio/*"};
|
mimetypes = new String[]{"audio/*"};
|
||||||
}
|
}
|
||||||
} else if (type == ComposeActivity.mediaType.ALL) {
|
} else if (type == ComposeActivity.mediaType.ALL) {
|
||||||
if (instanceInfo != null && instanceInfo.getMimeTypeOther() != null && instanceInfo.getMimeTypeOther().size() > 0) {
|
if (instanceInfo != null && instanceInfo.getMimeTypeOther() != null && !instanceInfo.getMimeTypeOther().isEmpty()) {
|
||||||
mimetypes = instanceInfo.getMimeTypeOther().toArray(new String[0]);
|
mimetypes = instanceInfo.getMimeTypeOther().toArray(new String[0]);
|
||||||
} else {
|
} else {
|
||||||
mimetypes = new String[]{"*/*"};
|
mimetypes = new String[]{"*/*"};
|
||||||
|
@ -509,9 +509,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
*/
|
*/
|
||||||
private boolean canBeRemoved(Status draft) {
|
private boolean canBeRemoved(Status draft) {
|
||||||
return draft.poll == null
|
return draft.poll == null
|
||||||
&& (draft.media_attachments == null || draft.media_attachments.size() == 0)
|
&& (draft.media_attachments == null || draft.media_attachments.isEmpty())
|
||||||
&& (draft.text == null || draft.text.trim().length() == 0)
|
&& (draft.text == null || draft.text.trim().isEmpty())
|
||||||
&& (draft.spoiler_text == null || draft.spoiler_text.trim().length() == 0);
|
&& (draft.spoiler_text == null || draft.spoiler_text.trim().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -717,7 +717,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
|
|
||||||
InputStream is;
|
InputStream is;
|
||||||
newContent[0] = "";
|
newContent[0] = "";
|
||||||
if (mentions.size() > 0) {
|
if (!mentions.isEmpty()) {
|
||||||
for (String mention : mentions) {
|
for (String mention : mentions) {
|
||||||
newContent[0] += mention + " ";
|
newContent[0] += mention + " ";
|
||||||
}
|
}
|
||||||
|
@ -734,7 +734,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
List<Quotes.Quote> quotes = gson.fromJson(json, new TypeToken<List<Quotes.Quote>>() {
|
List<Quotes.Quote> quotes = gson.fromJson(json, new TypeToken<List<Quotes.Quote>>() {
|
||||||
}.getType());
|
}.getType());
|
||||||
if (quotes != null && quotes.size() > 0) {
|
if (quotes != null && !quotes.isEmpty()) {
|
||||||
final int random = new Random().nextInt(quotes.size());
|
final int random = new Random().nextInt(quotes.size());
|
||||||
Quotes.Quote quote = quotes.get(random);
|
Quotes.Quote quote = quotes.get(random);
|
||||||
newContent[0] += quote.content + "\n- " + quote.author;
|
newContent[0] += quote.content + "\n- " + quote.author;
|
||||||
|
@ -762,7 +762,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
|
|
||||||
if (holder.binding.content.getSelectionStart() != 0)
|
if (holder.binding.content.getSelectionStart() != 0)
|
||||||
currentCursorPosition[0] = holder.binding.content.getSelectionStart();
|
currentCursorPosition[0] = holder.binding.content.getSelectionStart();
|
||||||
if (contentString.length() == 0)
|
if (contentString.isEmpty())
|
||||||
currentCursorPosition[0] = 0;
|
currentCursorPosition[0] = 0;
|
||||||
//Only check last 15 characters before cursor position to avoid lags
|
//Only check last 15 characters before cursor position to avoid lags
|
||||||
//Less than 15 characters are written before the cursor position
|
//Less than 15 characters are written before the cursor position
|
||||||
|
@ -858,7 +858,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
if (currentCursorPosition >= oldContent.length())
|
if (currentCursorPosition >= oldContent.length())
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
||||||
}
|
}
|
||||||
if (!search.equals(""))
|
if (!search.isEmpty())
|
||||||
deltaSearch = deltaSearch.replace("@" + search, "");
|
deltaSearch = deltaSearch.replace("@" + search, "");
|
||||||
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
newContent += deltaSearch;
|
newContent += deltaSearch;
|
||||||
|
@ -886,10 +886,10 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
"hashtags", false, true, false, 0,
|
"hashtags", false, true, false, 0,
|
||||||
null, null, 10).observe((LifecycleOwner) context,
|
null, null, 10).observe((LifecycleOwner) context,
|
||||||
results -> {
|
results -> {
|
||||||
if (results == null || results.hashtags == null || results.hashtags.size() == 0) {
|
if (results == null || results.hashtags == null || results.hashtags.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (camelTags != null && camelTags.size() > 0) {
|
if (camelTags != null && !camelTags.isEmpty()) {
|
||||||
for (String camelTag : camelTags) {
|
for (String camelTag : camelTags) {
|
||||||
Tag tag = new Tag();
|
Tag tag = new Tag();
|
||||||
tag.name = camelTag;
|
tag.name = camelTag;
|
||||||
|
@ -931,7 +931,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!search.equals(""))
|
if (!search.isEmpty())
|
||||||
deltaSearch = deltaSearch.replace("#" + search, "");
|
deltaSearch = deltaSearch.replace("#" + search, "");
|
||||||
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
newContent += deltaSearch;
|
newContent += deltaSearch;
|
||||||
|
@ -954,7 +954,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
List<Emoji> emojisToDisplay = new ArrayList<>();
|
List<Emoji> emojisToDisplay = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
if (emojisList == null || emojisList.size() == 0) {
|
if (emojisList == null || emojisList.isEmpty()) {
|
||||||
emojisList = new EmojiInstance(context).getEmojiList(BaseMainActivity.currentInstance);
|
emojisList = new EmojiInstance(context).getEmojiList(BaseMainActivity.currentInstance);
|
||||||
}
|
}
|
||||||
if (emojis == null) {
|
if (emojis == null) {
|
||||||
|
@ -997,7 +997,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
deltaSearch = oldContent.substring(currentCursorPosition - searchLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!search.equals(""))
|
if (!search.isEmpty())
|
||||||
deltaSearch = deltaSearch.replace(":" + search, "");
|
deltaSearch = deltaSearch.replace(":" + search, "");
|
||||||
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
String newContent = oldContent.substring(0, currentCursorPosition - searchLength);
|
||||||
newContent += deltaSearch;
|
newContent += deltaSearch;
|
||||||
|
@ -1049,9 +1049,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
|
|
||||||
StringBuilder contentBuilder = new StringBuilder();
|
StringBuilder contentBuilder = new StringBuilder();
|
||||||
|
|
||||||
if (title != null && title.trim().length() > 0) {
|
if (title != null && !title.trim().isEmpty()) {
|
||||||
contentBuilder.append(title);
|
contentBuilder.append(title);
|
||||||
} else if (subject != null && subject.trim().length() > 0) {
|
} else if (subject != null && !subject.trim().isEmpty()) {
|
||||||
contentBuilder.append(subject);
|
contentBuilder.append(subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,12 +1059,12 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
contentBuilder.append("\n\n");
|
contentBuilder.append("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (description != null && description.trim().length() > 0) {
|
if (description != null && !description.trim().isEmpty()) {
|
||||||
if (url != null && !description.contains(url)) {
|
if (url != null && !description.contains(url)) {
|
||||||
contentBuilder.append(url).append("\n\n");
|
contentBuilder.append(url).append("\n\n");
|
||||||
}
|
}
|
||||||
contentBuilder.append("> ").append(description);
|
contentBuilder.append("> ").append(description);
|
||||||
} else if (content != null && content.trim().length() > 0) {
|
} else if (content != null && !content.trim().isEmpty()) {
|
||||||
if (!content.contains(url)) {
|
if (!content.contains(url)) {
|
||||||
contentBuilder.append(url).append("\n\n");
|
contentBuilder.append(url).append("\n\n");
|
||||||
}
|
}
|
||||||
|
@ -1311,7 +1311,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
}
|
}
|
||||||
for (Status status : statusList) {
|
for (Status status : statusList) {
|
||||||
if (getItemViewType(position) == TYPE_COMPOSE) {
|
if (getItemViewType(position) == TYPE_COMPOSE) {
|
||||||
if (status != null && status.media_attachments != null && status.media_attachments.size() > 0) {
|
if (status != null && status.media_attachments != null && !status.media_attachments.isEmpty()) {
|
||||||
int mediaPosition = 0;
|
int mediaPosition = 0;
|
||||||
for (Attachment attachment : status.media_attachments) {
|
for (Attachment attachment : status.media_attachments) {
|
||||||
if (attachment.description == null || attachment.description.trim().isEmpty()) {
|
if (attachment.description == null || attachment.description.trim().isEmpty()) {
|
||||||
|
@ -1355,7 +1355,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
holder.binding.buttonAttachManual.setEnabled(false);
|
holder.binding.buttonAttachManual.setEnabled(false);
|
||||||
holder.binding.buttonPoll.setEnabled(true);
|
holder.binding.buttonPoll.setEnabled(true);
|
||||||
}
|
}
|
||||||
holder.binding.buttonPoll.setEnabled(statusDraft.media_attachments == null || statusDraft.media_attachments.size() == 0);
|
holder.binding.buttonPoll.setEnabled(statusDraft.media_attachments == null || statusDraft.media_attachments.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1380,7 +1380,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
Status status = statusList.get(position);
|
Status status = statusList.get(position);
|
||||||
StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
|
StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
|
||||||
|
|
||||||
if (status.media_attachments != null && status.media_attachments.size() > 0) {
|
if (status.media_attachments != null && !status.media_attachments.isEmpty()) {
|
||||||
holder.binding.simpleMedia.removeAllViews();
|
holder.binding.simpleMedia.removeAllViews();
|
||||||
List<Attachment> attachmentList = statusList.get(position).media_attachments;
|
List<Attachment> attachmentList = statusList.get(position).media_attachments;
|
||||||
for (Attachment attachment : attachmentList) {
|
for (Attachment attachment : attachmentList) {
|
||||||
|
@ -1449,7 +1449,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
statusFromUser.pronouns = null;
|
statusFromUser.pronouns = null;
|
||||||
boolean pronounsSupport = sharedpreferences.getBoolean(context.getString(R.string.SET_PRONOUNS_SUPPORT), true);
|
boolean pronounsSupport = sharedpreferences.getBoolean(context.getString(R.string.SET_PRONOUNS_SUPPORT), true);
|
||||||
if(pronounsSupport) {
|
if(pronounsSupport) {
|
||||||
if (accountFromUser.fields != null && accountFromUser.fields.size() > 0) {
|
if (accountFromUser.fields != null && !accountFromUser.fields.isEmpty()) {
|
||||||
for (Field field : accountFromUser.fields) {
|
for (Field field : accountFromUser.fields) {
|
||||||
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
if (PronounsHelper.pronouns.contains(field.name.toLowerCase().trim())) {
|
||||||
statusList.get(position).pronouns = Helper.parseHtml(field.value);
|
statusList.get(position).pronouns = Helper.parseHtml(field.value);
|
||||||
|
@ -1572,16 +1572,16 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
holder.binding.buttonAttach.setOnClickListener(v -> {
|
holder.binding.buttonAttach.setOnClickListener(v -> {
|
||||||
|
|
||||||
if (instanceInfo.configuration.media_attachments.supported_mime_types != null) {
|
if (instanceInfo.configuration.media_attachments.supported_mime_types != null) {
|
||||||
if (instanceInfo.getMimeTypeAudio().size() == 0) {
|
if (instanceInfo.getMimeTypeAudio().isEmpty()) {
|
||||||
holder.binding.buttonAttachAudio.setEnabled(false);
|
holder.binding.buttonAttachAudio.setEnabled(false);
|
||||||
}
|
}
|
||||||
if (instanceInfo.getMimeTypeImage().size() == 0) {
|
if (instanceInfo.getMimeTypeImage().isEmpty()) {
|
||||||
holder.binding.buttonAttachImage.setEnabled(false);
|
holder.binding.buttonAttachImage.setEnabled(false);
|
||||||
}
|
}
|
||||||
if (instanceInfo.getMimeTypeVideo().size() == 0) {
|
if (instanceInfo.getMimeTypeVideo().isEmpty()) {
|
||||||
holder.binding.buttonAttachVideo.setEnabled(false);
|
holder.binding.buttonAttachVideo.setEnabled(false);
|
||||||
}
|
}
|
||||||
if (instanceInfo.getMimeTypeOther().size() == 0) {
|
if (instanceInfo.getMimeTypeOther().isEmpty()) {
|
||||||
holder.binding.buttonAttachManual.setEnabled(false);
|
holder.binding.buttonAttachManual.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1689,7 +1689,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
unlisted_changed = true;
|
unlisted_changed = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (statusDraft.spoilerChecked || statusDraft.spoiler_text != null && statusDraft.spoiler_text.trim().length() > 0) {
|
if (statusDraft.spoilerChecked || statusDraft.spoiler_text != null && !statusDraft.spoiler_text.trim().isEmpty()) {
|
||||||
holder.binding.contentSpoiler.setVisibility(View.VISIBLE);
|
holder.binding.contentSpoiler.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.binding.contentSpoiler.setVisibility(View.GONE);
|
holder.binding.contentSpoiler.setVisibility(View.GONE);
|
||||||
|
@ -1709,7 +1709,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
//Last compose drawer
|
//Last compose drawer
|
||||||
buttonVisibility(holder);
|
buttonVisibility(holder);
|
||||||
|
|
||||||
if (emojis != null && emojis.size() > 0) {
|
if (emojis != null && !emojis.isEmpty()) {
|
||||||
holder.binding.buttonEmoji.setVisibility(View.VISIBLE);
|
holder.binding.buttonEmoji.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.binding.buttonEmoji.setVisibility(View.GONE);
|
holder.binding.buttonEmoji.setVisibility(View.GONE);
|
||||||
|
@ -1785,7 +1785,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
camelCaseTags.add(tag);
|
camelCaseTags.add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (camelCaseTags.size() > 0) {
|
if (!camelCaseTags.isEmpty()) {
|
||||||
statusDraft.text += "\n\n";
|
statusDraft.text += "\n\n";
|
||||||
int lenght = 0;
|
int lenght = 0;
|
||||||
for (String tag : camelCaseTags) {
|
for (String tag : camelCaseTags) {
|
||||||
|
@ -1819,7 +1819,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
camelCaseTags.add(tag);
|
camelCaseTags.add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (camelCaseTags.size() > 0) {
|
if (!camelCaseTags.isEmpty()) {
|
||||||
statusList.get(position).tagAdded = true;
|
statusList.get(position).tagAdded = true;
|
||||||
int lenght = 0;
|
int lenght = 0;
|
||||||
for (String tag : camelCaseTags) {
|
for (String tag : camelCaseTags) {
|
||||||
|
@ -1902,7 +1902,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
String[] languagesArr = new String[0];
|
String[] languagesArr = new String[0];
|
||||||
|
|
||||||
int selection = 0;
|
int selection = 0;
|
||||||
if (storedLanguages != null && storedLanguages.size() > 0) {
|
if (storedLanguages != null && !storedLanguages.isEmpty()) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
codesArr = new String[storedLanguages.size()];
|
codesArr = new String[storedLanguages.size()];
|
||||||
languagesArr = new String[storedLanguages.size()];
|
languagesArr = new String[storedLanguages.size()];
|
||||||
|
|
|
@ -23,6 +23,7 @@ import androidx.preference.ListPreference;
|
||||||
import androidx.preference.MultiSelectListPreference;
|
import androidx.preference.MultiSelectListPreference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -59,6 +60,12 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
|
||||||
SET_WATERMARK_TEXT.setText(val);
|
SET_WATERMARK_TEXT.setText(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SwitchPreferenceCompat SET_MENTION_BOOSTER = findPreference(getString(R.string.SET_MENTION_BOOSTER));
|
||||||
|
if (SET_MENTION_BOOSTER != null) {
|
||||||
|
boolean val = sharedPreferences.getBoolean(getString(R.string.SET_MENTION_BOOSTER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getBoolean(getString(R.string.SET_MENTION_BOOSTER), false));
|
||||||
|
SET_MENTION_BOOSTER.setChecked(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE));
|
MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE));
|
||||||
if (SET_SELECTED_LANGUAGE != null) {
|
if (SET_SELECTED_LANGUAGE != null) {
|
||||||
|
@ -66,7 +73,7 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
|
||||||
Set<String> storedLanguages = sharedPreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
|
Set<String> storedLanguages = sharedPreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null);
|
||||||
|
|
||||||
String[] selectedValue = new String[0];
|
String[] selectedValue = new String[0];
|
||||||
if (storedLanguages != null && storedLanguages.size() > 0) {
|
if (storedLanguages != null && !storedLanguages.isEmpty()) {
|
||||||
if (storedLanguages.size() == 1 && storedLanguages.toArray()[0] == null) {
|
if (storedLanguages.size() == 1 && storedLanguages.toArray()[0] == null) {
|
||||||
sharedPreferences.edit().remove(getString(R.string.SET_SELECTED_LANGUAGE)).commit();
|
sharedPreferences.edit().remove(getString(R.string.SET_SELECTED_LANGUAGE)).commit();
|
||||||
} else {
|
} else {
|
||||||
|
@ -102,6 +109,11 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
|
||||||
editor.putString(getString(R.string.SET_WATERMARK_TEXT) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT), null));
|
editor.putString(getString(R.string.SET_WATERMARK_TEXT) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getString(getString(R.string.SET_WATERMARK_TEXT), null));
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
if (Objects.requireNonNull(key).equalsIgnoreCase(getString(R.string.SET_MENTION_BOOSTER))) {
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putBoolean(getString(R.string.SET_MENTION_BOOSTER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, sharedPreferences.getBoolean(getString(R.string.SET_MENTION_BOOSTER), false));
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1148,7 +1148,7 @@
|
||||||
<string name="SET_DISABLE_ANIMATED_EMOJI" translatable="false">SET_DISABLE_ANIMATED_EMOJI</string>
|
<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_CAPITALIZE" translatable="false">SET_CAPITALIZE</string>
|
||||||
<string name="SET_MENTIONS_AT_TOP" translatable="false">SET_MENTIONS_AT_TOP</string>
|
<string name="SET_MENTIONS_AT_TOP" translatable="false">SET_MENTIONS_AT_TOP</string>
|
||||||
|
<string name="SET_MENTION_BOOSTER" translatable="false">SET_MENTION_BOOSTER</string>
|
||||||
<string name="SET_THREAD_MESSAGE" translatable="false">SET_THREAD_MESSAGE</string>
|
<string name="SET_THREAD_MESSAGE" translatable="false">SET_THREAD_MESSAGE</string>
|
||||||
<string name="SET_THEME_BASE" translatable="false">SET_THEME_BASE</string>
|
<string name="SET_THEME_BASE" translatable="false">SET_THEME_BASE</string>
|
||||||
<string name="SET_DYNAMICCOLOR" translatable="false">SET_DYNAMICCOLOR</string>
|
<string name="SET_DYNAMICCOLOR" translatable="false">SET_DYNAMICCOLOR</string>
|
||||||
|
@ -2060,6 +2060,8 @@
|
||||||
<string name="set_mention_at_top">Mentions at the top</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>
|
<string name="set_mention_at_top_indication">When replying mentions will all be added to the beginning of the message</string>
|
||||||
|
|
||||||
|
<string name="set_mention_booster">Mention the booster</string>
|
||||||
|
<string name="set_mention_booster_indication">When replying to a boost, the person who boosted will be mentioned in the reply</string>
|
||||||
|
|
||||||
<string name="number_of_media">Number of media</string>
|
<string name="number_of_media">Number of media</string>
|
||||||
<string name="number_of_replies">Number of replies</string>
|
<string name="number_of_replies">Number of replies</string>
|
||||||
|
|
|
@ -32,6 +32,15 @@
|
||||||
app:singleLineTitle="false"
|
app:singleLineTitle="false"
|
||||||
app:summary="@string/set_mention_at_top_indication"
|
app:summary="@string/set_mention_at_top_indication"
|
||||||
app:title="@string/set_mention_at_top" />
|
app:title="@string/set_mention_at_top" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
app:defaultValue="false"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:key="@string/SET_MENTION_BOOSTER"
|
||||||
|
app:singleLineTitle="false"
|
||||||
|
app:summary="@string/set_mention_booster_indication"
|
||||||
|
app:title="@string/set_mention_booster" />
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
app:defaultValue="false"
|
app:defaultValue="false"
|
||||||
|
|
Loading…
Reference in a new issue