Merge remote-tracking branch 'megalodon_main/main'
# Conflicts: # mastodon/src/main/java/org/joinmastodon/android/GlobalUserPreferences.java # mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java # mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsDisplayFragment.java
This commit is contained in:
commit
681ee1c211
|
@ -65,6 +65,7 @@ public class GlobalUserPreferences{
|
|||
public static boolean showSuicideHelp;
|
||||
public static boolean underlinedLinks;
|
||||
public static ColorPreference color;
|
||||
public static boolean likeIcon;
|
||||
|
||||
// MOSHIDON
|
||||
public static boolean showDividers;
|
||||
|
@ -142,6 +143,7 @@ public class GlobalUserPreferences{
|
|||
showSuicideHelp=prefs.getBoolean("showSuicideHelp", true);
|
||||
underlinedLinks=prefs.getBoolean("underlinedLinks", true);
|
||||
color=ColorPreference.valueOf(prefs.getString("color", MATERIAL3.name()));
|
||||
likeIcon=prefs.getBoolean("likeIcon", false);
|
||||
|
||||
// MOSHIDON
|
||||
uniformNotificationIcon=prefs.getBoolean("uniformNotificationIcon", false);
|
||||
|
@ -219,6 +221,7 @@ public class GlobalUserPreferences{
|
|||
.putBoolean("showSuicideHelp", showSuicideHelp)
|
||||
.putBoolean("underlinedLinks", underlinedLinks)
|
||||
.putString("color", color.name())
|
||||
.putBoolean("likeIcon", likeIcon)
|
||||
|
||||
// MOSHIDON
|
||||
.putBoolean("defaultToUnlistedReplies", defaultToUnlistedReplies)
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.opengl.Visibility;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
|
@ -28,7 +27,6 @@ import org.joinmastodon.android.api.requests.statuses.CreateStatus;
|
|||
import org.joinmastodon.android.api.requests.statuses.SetStatusBookmarked;
|
||||
import org.joinmastodon.android.api.requests.statuses.SetStatusFavorited;
|
||||
import org.joinmastodon.android.api.requests.statuses.SetStatusReblogged;
|
||||
import org.joinmastodon.android.api.session.AccountLocalPreferences;
|
||||
import org.joinmastodon.android.api.session.AccountSession;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
import org.joinmastodon.android.model.Account;
|
||||
|
@ -39,7 +37,6 @@ import org.joinmastodon.android.model.PushNotification;
|
|||
import org.joinmastodon.android.model.Status;
|
||||
import org.joinmastodon.android.model.StatusPrivacy;
|
||||
import org.joinmastodon.android.model.StatusPrivacy;
|
||||
import org.joinmastodon.android.ui.text.HtmlParser;
|
||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
import org.parceler.Parcels;
|
||||
|
||||
|
@ -165,7 +162,6 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
private void notify(Context context, PushNotification pn, String accountID, org.joinmastodon.android.model.Notification notification){
|
||||
NotificationManager nm=context.getSystemService(NotificationManager.class);
|
||||
AccountSession session=AccountSessionManager.get(accountID);
|
||||
AccountLocalPreferences lp=session.getLocalPreferences();
|
||||
Account self=session.self;
|
||||
String accountName="@"+self.username+"@"+AccountSessionManager.getInstance().getAccount(accountID).domain;
|
||||
Notification.Builder builder;
|
||||
|
@ -220,7 +216,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
|
||||
if (!GlobalUserPreferences.uniformNotificationIcon) {
|
||||
builder.setSmallIcon(switch (pn.notificationType) {
|
||||
case FAVORITE -> lp.likeIcon ? R.drawable.ic_fluent_heart_24_filled : R.drawable.ic_fluent_star_24_filled;
|
||||
case FAVORITE -> GlobalUserPreferences.likeIcon ? R.drawable.ic_fluent_heart_24_filled : R.drawable.ic_fluent_star_24_filled;
|
||||
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
||||
case FOLLOW -> R.drawable.ic_fluent_person_add_24_filled;
|
||||
case MENTION -> R.drawable.ic_fluent_mention_24_filled;
|
||||
|
|
|
@ -49,7 +49,6 @@ public class AccountLocalPreferences{
|
|||
public boolean emojiReactionsEnabled;
|
||||
public ShowEmojiReactions showEmojiReactions;
|
||||
public ColorPreference color;
|
||||
public boolean likeIcon;
|
||||
public ArrayList<Emoji> recentCustomEmoji;
|
||||
|
||||
private final static Type recentLanguagesType=new TypeToken<ArrayList<String>>() {}.getType();
|
||||
|
@ -86,7 +85,6 @@ public class AccountLocalPreferences{
|
|||
emojiReactionsEnabled=prefs.getBoolean("emojiReactionsEnabled", session.getInstance().isPresent() && session.getInstance().get().isAkkoma());
|
||||
showEmojiReactions=ShowEmojiReactions.valueOf(prefs.getString("showEmojiReactions", ShowEmojiReactions.HIDE_EMPTY.name()));
|
||||
color=prefs.contains("color") ? ColorPreference.valueOf(prefs.getString("color", null)) : null;
|
||||
likeIcon=prefs.getBoolean("likeIcon", false);
|
||||
recentCustomEmoji=fromJson(prefs.getString("recentCustomEmoji", null), recentCustomEmojiType, new ArrayList<>());
|
||||
|
||||
// MOSHIDON
|
||||
|
@ -130,7 +128,6 @@ public class AccountLocalPreferences{
|
|||
.putBoolean("emojiReactionsEnabled", emojiReactionsEnabled)
|
||||
.putString("showEmojiReactions", showEmojiReactions.name())
|
||||
.putString("color", color!=null ? color.name() : null)
|
||||
.putBoolean("likeIcon", likeIcon)
|
||||
.putString("recentCustomEmoji", gson.toJson(recentCustomEmoji))
|
||||
|
||||
// MOSHIDON
|
||||
|
|
|
@ -80,7 +80,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
|
|||
spectatorModeItem=new CheckableListItem<>(R.string.sk_settings_hide_interaction, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.spectatorMode, R.drawable.ic_fluent_star_off_24_regular, ()->toggleCheckableItem(spectatorModeItem)),
|
||||
hideFabItem=new CheckableListItem<>(R.string.sk_settings_hide_fab, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.autoHideFab, R.drawable.ic_fluent_edit_24_regular, ()->toggleCheckableItem(hideFabItem)),
|
||||
translateOpenedItem=new CheckableListItem<>(R.string.sk_settings_translate_only_opened, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.translateButtonOpenedOnly, R.drawable.ic_fluent_translate_24_regular, ()->toggleCheckableItem(translateOpenedItem)),
|
||||
likeIconItem=new CheckableListItem<>(R.string.sk_settings_like_icon, 0, CheckableListItem.Style.SWITCH, lp.likeIcon, R.drawable.ic_fluent_heart_24_regular, ()->toggleCheckableItem(likeIconItem)),
|
||||
likeIconItem=new CheckableListItem<>(R.string.sk_settings_like_icon, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.likeIcon, R.drawable.ic_fluent_heart_24_regular, ()->toggleCheckableItem(likeIconItem)),
|
||||
underlinedLinksItem=new CheckableListItem<>(R.string.sk_settings_underlined_links, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.underlinedLinks, R.drawable.ic_fluent_text_underline_24_regular, ()->toggleCheckableItem(underlinedLinksItem)),
|
||||
showPostDividersItem=new CheckableListItem<>(R.string.mo_enable_dividers, 0, CheckableListItem.Style.SWITCH, GlobalUserPreferences.showDividers, R.drawable.ic_fluent_timeline_24_regular, ()->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, ()->toggleCheckableItem(disablePillItem)),
|
||||
|
@ -109,18 +109,17 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
|
|||
protected void onHidden(){
|
||||
super.onHidden();
|
||||
|
||||
boolean restartPlease=
|
||||
GlobalUserPreferences.disableM3PillActiveIndicator!=disablePillItem.checked ||
|
||||
GlobalUserPreferences.showNavigationLabels!=showNavigationLabelsItem.checked ||
|
||||
GlobalUserPreferences.showMediaPreview !=showMediaPreviewItem.checked ||
|
||||
GlobalUserPreferences.showDividers!=showPostDividersItem.checked ||
|
||||
lp.likeIcon!=likeIconItem.checked;
|
||||
boolean restartPlease=GlobalUserPreferences.disableM3PillActiveIndicator!=disablePillItem.checked
|
||||
|| GlobalUserPreferences.showNavigationLabels!=showNavigationLabelsItem.checked
|
||||
|| GlobalUserPreferences.showMediaPreview!=showMediaPreviewItem.checked
|
||||
|| GlobalUserPreferences.showDividers!=showPostDividersItem.checked
|
||||
|| GlobalUserPreferences.likeIcon!=likeIconItem.checked;
|
||||
;
|
||||
|
||||
lp.revealCWs=revealCWsItem.checked;
|
||||
lp.hideSensitiveMedia=hideSensitiveMediaItem.checked;
|
||||
lp.showInteractionCounts=interactionCountsItem.checked;
|
||||
lp.customEmojiInNames=emojiInNamesItem.checked;
|
||||
lp.likeIcon=likeIconItem.checked;
|
||||
lp.save();
|
||||
GlobalUserPreferences.toolbarMarquee=marqueeItem.checked;
|
||||
GlobalUserPreferences.relocatePublishButton=relocatePublishButtonItem.checked;
|
||||
|
@ -134,6 +133,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
|
|||
GlobalUserPreferences.spectatorMode=spectatorModeItem.checked;
|
||||
GlobalUserPreferences.autoHideFab=hideFabItem.checked;
|
||||
GlobalUserPreferences.translateButtonOpenedOnly=translateOpenedItem.checked;
|
||||
GlobalUserPreferences.likeIcon=likeIconItem.checked;
|
||||
GlobalUserPreferences.underlinedLinks=underlinedLinksItem.checked;
|
||||
GlobalUserPreferences.showDividers=showPostDividersItem.checked;
|
||||
GlobalUserPreferences.disableM3PillActiveIndicator=disablePillItem.checked;
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.widget.Button;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.joinmastodon.android.GlobalUserPreferences;
|
||||
import org.joinmastodon.android.R;
|
||||
import org.joinmastodon.android.api.session.AccountSession;
|
||||
import org.joinmastodon.android.api.session.AccountSessionManager;
|
||||
|
@ -77,9 +78,7 @@ public class ExtendedFooterStatusDisplayItem extends StatusDisplayItem{
|
|||
@Override
|
||||
public void onBind(ExtendedFooterStatusDisplayItem item){
|
||||
Status s=item.status;
|
||||
AccountSession session=AccountSessionManager.get(item.accountID);
|
||||
boolean like=session!=null && session.getLocalPreferences().likeIcon;
|
||||
favorites.setCompoundDrawablesRelativeWithIntrinsicBounds(like ? R.drawable.ic_fluent_heart_20_regular : R.drawable.ic_fluent_star_20_regular, 0, 0, 0);
|
||||
favorites.setCompoundDrawablesRelativeWithIntrinsicBounds(GlobalUserPreferences.likeIcon ? R.drawable.ic_fluent_heart_20_regular : R.drawable.ic_fluent_star_20_regular, 0, 0, 0);
|
||||
favorites.setText(context.getResources().getQuantityString(R.plurals.x_favorites, (int)(s.favouritesCount%1000), s.favouritesCount));
|
||||
reblogs.setText(context.getResources().getQuantityString(R.plurals.x_reblogs, (int) (s.reblogsCount % 1000), s.reblogsCount));
|
||||
reblogs.setVisibility(s.visibility != StatusPrivacy.DIRECT ? View.VISIBLE : View.GONE);
|
||||
|
|
|
@ -150,13 +150,10 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||
boolean condenseBottom = !item.isMainStatus && item.hasDescendantNeighbor &&
|
||||
!nextIsWarning;
|
||||
|
||||
|
||||
AccountSession session=AccountSessionManager.get(item.accountID);
|
||||
boolean like=session!=null && session.getLocalPreferences().likeIcon;
|
||||
ColorStateList color=item.parentFragment.getResources().getColorStateList(
|
||||
like ? R.color.like_icon : R.color.favorite_icon, item.parentFragment.getContext().getTheme()
|
||||
GlobalUserPreferences.likeIcon ? R.color.like_icon : R.color.favorite_icon, item.parentFragment.getContext().getTheme()
|
||||
);
|
||||
favIcon.setImageResource(like ? R.drawable.ic_fluent_heart_24_selector : R.drawable.ic_fluent_star_24_selector);
|
||||
favIcon.setImageResource(GlobalUserPreferences.likeIcon ? R.drawable.ic_fluent_heart_24_selector : R.drawable.ic_fluent_star_24_selector);
|
||||
favIcon.setImageTintList(color);
|
||||
favorites.setTextColor(color);
|
||||
|
||||
|
@ -401,8 +398,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
|||
R.string.sk_favorite_as,
|
||||
R.string.sk_favorited_as,
|
||||
R.string.sk_already_favorited,
|
||||
AccountSessionManager.get(item.accountID).getLocalPreferences().likeIcon ?
|
||||
R.drawable.ic_fluent_heart_28_regular : R.drawable.ic_fluent_star_28_regular
|
||||
GlobalUserPreferences.likeIcon ? R.drawable.ic_fluent_heart_28_regular : R.drawable.ic_fluent_star_28_regular
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,14 +47,12 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
|
|||
private final CustomEmojiHelper emojiHelper=new CustomEmojiHelper();
|
||||
private final CharSequence text;
|
||||
private final CharSequence timestamp;
|
||||
private final AccountLocalPreferences lp;
|
||||
|
||||
public NotificationHeaderStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Notification notification, String accountID){
|
||||
super(parentID, parentFragment);
|
||||
this.notification=notification;
|
||||
this.accountID=accountID;
|
||||
this.timestamp=notification.createdAt==null ? null : UiUtils.formatRelativeTimestamp(context, notification.createdAt);
|
||||
this.lp=AccountSessionManager.get(accountID).getLocalPreferences();
|
||||
|
||||
if(notification.type==Notification.Type.POLL){
|
||||
text=parentFragment.getString(R.string.poll_ended);
|
||||
|
@ -163,7 +161,7 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
|
|||
timestamp.setText(item.timestamp);
|
||||
avatar.setVisibility(item.notification.type==Notification.Type.POLL ? View.GONE : View.VISIBLE);
|
||||
icon.setImageResource(switch(item.notification.type){
|
||||
case FAVORITE -> item.lp.likeIcon ? R.drawable.ic_fluent_heart_24_filled : R.drawable.ic_fluent_star_24_filled;
|
||||
case FAVORITE -> GlobalUserPreferences.likeIcon ? R.drawable.ic_fluent_heart_24_filled : R.drawable.ic_fluent_star_24_filled;
|
||||
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
||||
case FOLLOW, FOLLOW_REQUEST -> R.drawable.ic_fluent_person_add_24_filled;
|
||||
case POLL -> R.drawable.ic_fluent_poll_24_filled;
|
||||
|
@ -174,7 +172,7 @@ public class NotificationHeaderStatusDisplayItem extends StatusDisplayItem{
|
|||
default -> throw new IllegalStateException("Unexpected value: "+item.notification.type);
|
||||
});
|
||||
icon.setImageTintList(ColorStateList.valueOf(UiUtils.getThemeColor(item.parentFragment.getActivity(), switch(item.notification.type){
|
||||
case FAVORITE -> item.lp.likeIcon ? R.attr.colorLike : R.attr.colorFavorite;
|
||||
case FAVORITE -> GlobalUserPreferences.likeIcon ? R.attr.colorLike : R.attr.colorFavorite;
|
||||
case REBLOG -> R.attr.colorBoost;
|
||||
case POLL -> R.attr.colorPoll;
|
||||
default -> android.R.attr.colorAccent;
|
||||
|
|
Loading…
Reference in New Issue