Skip to content

Commit

Permalink
feat: add setting to hide reply bar
Browse files Browse the repository at this point in the history
  • Loading branch information
FineFindus committed Mar 16, 2024
1 parent 14a36d2 commit 6db05e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@
import org.joinmastodon.android.R;
import org.joinmastodon.android.model.ContentType;
import org.joinmastodon.android.model.Emoji;
import org.joinmastodon.android.model.Emoji;
import org.joinmastodon.android.model.PushSubscription;
import org.joinmastodon.android.model.TimelineDefinition;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AccountLocalPreferences{
private final SharedPreferences prefs;
Expand Down Expand Up @@ -50,7 +46,6 @@ public class AccountLocalPreferences{
public ShowEmojiReactions showEmojiReactions;
public ColorPreference color;
public ArrayList<Emoji> recentCustomEmoji;
public boolean preReplySheet;

private final static Type recentLanguagesType=new TypeToken<ArrayList<String>>() {}.getType();
private final static Type timelinesType=new TypeToken<ArrayList<TimelineDefinition>>() {}.getType();
Expand All @@ -61,6 +56,7 @@ public class AccountLocalPreferences{
// public Map<String, Integer> recentEmojis;
private final static Type notificationFiltersType = new TypeToken<PushSubscription.Alerts>() {}.getType();
public PushSubscription.Alerts notificationFilters;
public boolean showReplyBar;

public AccountLocalPreferences(SharedPreferences prefs, AccountSession session){
this.prefs=prefs;
Expand Down Expand Up @@ -92,6 +88,7 @@ public AccountLocalPreferences(SharedPreferences prefs, AccountSession session){
// MOSHIDON
// recentEmojis=fromJson(prefs.getString("recentEmojis", "{}"), recentEmojisType, new HashMap<>());
notificationFilters=fromJson(prefs.getString("notificationFilters", gson.toJson(PushSubscription.Alerts.ofAll())), notificationFiltersType, PushSubscription.Alerts.ofAll());
showReplyBar=prefs.getBoolean("showReplyBar", true);
}

public long getNotificationsPauseEndTime(){
Expand Down Expand Up @@ -138,6 +135,7 @@ public void save(){
// MOSHIDON
// .putString("recentEmojis", gson.toJson(recentEmojis))
.putString("notificationFilters", gson.toJson(notificationFilters))
.putBoolean("showReplyBar", showReplyBar)
.apply();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.requests.statuses.GetStatusByID;
import org.joinmastodon.android.api.requests.statuses.GetStatusContext;
import org.joinmastodon.android.api.session.AccountLocalPreferences;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
import org.joinmastodon.android.events.StatusMuteChangedEvent;
Expand Down Expand Up @@ -436,6 +437,7 @@ public void onAnimationFinished(@NonNull RecyclerView.ViewHolder viewHolder) {
maybeApplyMainStatus();
}
});
replyContainer.setVisibility(getLocalPrefs().showReplyBar ? View.VISIBLE : View.GONE);
}

protected void onStatusCreated(Status status){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
private CheckableListItem<Void> pronounsInUserListingsItem, pronounsInTimelinesItem, pronounsInThreadsItem;

// MOSHIDON
private CheckableListItem<Void> enableDoubleTapToSwipeItem, relocatePublishButtonItem, showPostDividersItem, enableDoubleTapToSearchItem, showMediaPreviewItem;
private CheckableListItem<Void> enableDoubleTapToSwipeItem, relocatePublishButtonItem, showPostDividersItem, enableDoubleTapToSearchItem, showMediaPreviewItem, showReplyBar;

private AccountLocalPreferences lp;

Expand Down Expand Up @@ -85,6 +85,7 @@ public void onCreate(Bundle savedInstanceState){
showPostDividersItem=new CheckableListItem<>(R.string.mo_enable_dividers, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.showDividers, R.drawable.ic_fluent_timeline_24_regular, i->toggleCheckableItem(showPostDividersItem)),
disablePillItem=new CheckableListItem<>(R.string.sk_disable_pill_shaped_active_indicator, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.disableM3PillActiveIndicator, R.drawable.ic_fluent_pill_24_regular, i->toggleCheckableItem(disablePillItem)),
showNavigationLabelsItem=new CheckableListItem<>(R.string.sk_settings_show_labels_in_navigation_bar, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.showNavigationLabels, R.drawable.ic_fluent_tag_24_regular, i->toggleCheckableItem(showNavigationLabelsItem), true),
showReplyBar=new CheckableListItem<>(R.string.mo_show_reply_bar, 0, CheckableListItem.Style.SWITCH, lp.showReplyBar, R.drawable.ic_fluent_tag_24_regular, i->toggleCheckableItem(showReplyBar)),
pronounsInTimelinesItem=new CheckableListItem<>(R.string.sk_settings_display_pronouns_in_timelines, 0, CheckableListItem.Style.CHECKBOX, GlobalUserPreferences.displayPronounsInTimelines, 0, i->toggleCheckableItem(pronounsInTimelinesItem)),
pronounsInThreadsItem=new CheckableListItem<>(R.string.sk_settings_display_pronouns_in_threads, 0, CheckableListItem.Style.CHECKBOX, GlobalUserPreferences.displayPronounsInThreads, 0, i->toggleCheckableItem(pronounsInThreadsItem)),
pronounsInUserListingsItem=new CheckableListItem<>(R.string.sk_settings_display_pronouns_in_user_listings, 0, CheckableListItem.Style.CHECKBOX, GlobalUserPreferences.displayPronounsInUserListings, 0, i->toggleCheckableItem(pronounsInUserListingsItem))
Expand Down Expand Up @@ -119,6 +120,7 @@ protected void onHidden(){
lp.hideSensitiveMedia=hideSensitiveMediaItem.checked;
lp.showInteractionCounts=interactionCountsItem.checked;
lp.customEmojiInNames=emojiInNamesItem.checked;
lp.showReplyBar=showReplyBar.checked;
lp.save();
GlobalUserPreferences.toolbarMarquee=marqueeItem.checked;
GlobalUserPreferences.relocatePublishButton=relocatePublishButtonItem.checked;
Expand Down
1 change: 1 addition & 0 deletions mastodon/src/main/res/values/strings_mo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<string name="mo_recent_emoji_cleared">Recent emoji cleared</string>
<string name="mo_show_media_preview">Show media preview in timelines</string>
<string name="mo_notification_filter_reset">Reset to default</string>
<string name="mo_show_reply_bar">Show ReplyBar</string>

<!-- Temporary Strings. They exist in strings_sk.xml, but are not available on Megalodon's weblate-->
<string name="mo_muted_accounts">Muted accounts</string>
Expand Down

0 comments on commit 6db05e8

Please sign in to comment.