From d829c659bd7363e8a0d167a6239f4fe185ee4b8d Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Thu, 12 Oct 2023 15:34:32 -0300 Subject: [PATCH] chore: make app compile again --- .../api/session/AccountLocalPreferences.java | 6 ++- .../android/fragments/ProfileFragment.java | 1 - .../settings/SettingsAboutAppFragment.java | 3 +- .../settings/SettingsDisplayFragment.java | 5 +-- .../EmojiReactionsStatusDisplayItem.java | 2 +- .../displayitems/FooterStatusDisplayItem.java | 40 ++++++++++++++----- .../NotificationHeaderStatusDisplayItem.java | 1 - .../ui/displayitems/StatusDisplayItem.java | 6 +-- .../android/ui/utils/ColorPalette.java | 2 +- mastodon/src/main/res/values/palettes.xml | 2 +- 10 files changed, 45 insertions(+), 23 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountLocalPreferences.java b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountLocalPreferences.java index eb2ffdebf4..9f419f2284 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountLocalPreferences.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/session/AccountLocalPreferences.java @@ -142,7 +142,9 @@ public enum ColorPreference{ BLUE, BROWN, RED, - YELLOW; + YELLOW, + NORD, + WHITE; public @StringRes int getName() { return switch(this){ @@ -154,6 +156,8 @@ public enum ColorPreference{ case BROWN -> R.string.sk_color_palette_brown; case RED -> R.string.sk_color_palette_red; case YELLOW -> R.string.sk_color_palette_yellow; + case NORD -> R.string.mo_color_palette_nord; + case WHITE -> R.string.mo_color_palette_black_and_white; }; } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index b3917c769a..eb8536a33f 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -138,7 +138,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList private ImageView avatar; private CoverImageView cover; private View avatarBorder; - private View usernameWrap; private TextView name, username, bio, followersCount, followersLabel, followingCount, followingLabel; private ImageView lockIcon, botIcon; private ProgressBarButton actionButton, notifyButton; diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsAboutAppFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsAboutAppFragment.java index 0bfd2b582a..80c84ed4b3 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsAboutAppFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsAboutAppFragment.java @@ -16,6 +16,7 @@ import org.joinmastodon.android.model.viewmodel.ListItem; import org.joinmastodon.android.ui.utils.UiUtils; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Objects; @@ -79,7 +80,7 @@ private void onClearMediaCacheClick(){ } private void onClearRecentEmojisClick(){ - getLocalPrefs().recentEmojis=new HashMap<>(); + getLocalPrefs().recentCustomEmoji=new ArrayList<>(); getLocalPrefs().save(); Toast.makeText(getContext(), R.string.mo_recent_emoji_cleared, Toast.LENGTH_SHORT).show(); } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsDisplayFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsDisplayFragment.java index 4fd7b30984..9ab227b734 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsDisplayFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/settings/SettingsDisplayFragment.java @@ -109,10 +109,9 @@ protected void onHidden(){ boolean restartPlease= GlobalUserPreferences.disableM3PillActiveIndicator!=disablePillItem.checked || GlobalUserPreferences.showNavigationLabels!=showNavigationLabelsItem.checked || - lp.likeIcon!=likeIconItem.checked; - GlobalUserPreferences.showNavigationLabels!=showNavigationLabelsItem.checked || GlobalUserPreferences.showMediaPreview !=showMediaPreviewItem.checked || - GlobalUserPreferences.showDividers!=showPostDividersItem.checked; + GlobalUserPreferences.showDividers!=showPostDividersItem.checked || + lp.likeIcon!=likeIconItem.checked; lp.revealCWs=revealCWsItem.checked; lp.hideSensitiveMedia=hideSensitiveMediaItem.checked; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java index e360d803b6..d874df595d 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java @@ -179,7 +179,7 @@ public void onBind(EmojiReactionsStatusDisplayItem item) { (Activity) item.parentFragment.getContext(), item.accountID, AccountSessionManager.getInstance().getCustomEmojis(session.domain), - session.domain, true, item.accountID); + session.domain, true); emojiKeyboard.setListener(this); space.setVisibility(View.GONE); root.addView(emojiKeyboard.getView()); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java index ecb1741e91..621447f5a6 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java @@ -65,7 +65,6 @@ public static class Holder extends StatusDisplayItem.Holder { - v.startAnimation(opacityIn); + UiUtils.opacityIn(v); Bundle args=new Bundle(); args.putString("account", item.accountID); args.putParcelable("replyTo", Parcels.wrap(status)); @@ -365,10 +385,10 @@ private void onFavoriteClick(View v){ favorite.setSelected(!status.favourited); vibrateForAction(favorite, !status.favourited); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(status, !status.favourited, r->{ - if (status.favourited) { - v.startAnimation(GlobalUserPreferences.reduceMotion ? opacityIn : animSet); + if (status.favourited && !GlobalUserPreferences.reduceMotion) { + v.startAnimation(animSet); } else { - v.startAnimation(opacityIn); + UiUtils.opacityIn(v); } bindText(favorites, r.favouritesCount); }); @@ -379,10 +399,10 @@ private void onFavoriteClick(View v){ favorite.setSelected(!item.status.favourited); vibrateForAction(favorite, !item.status.favourited); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setFavorited(item.status, !item.status.favourited, r->{ - if (item.status.favourited) { - v.startAnimation(GlobalUserPreferences.reduceMotion ? opacityIn : animSet); + if (item.status.favourited && !GlobalUserPreferences.reduceMotion) { + v.startAnimation(animSet); } else { - v.startAnimation(opacityIn); + UiUtils.opacityIn(v); } bindText(favorites, r.favouritesCount); }); @@ -413,7 +433,7 @@ private void onBookmarkClick(View v){ bookmark.setSelected(!status.bookmarked); vibrateForAction(bookmark, !status.bookmarked); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setBookmarked(status, !status.bookmarked, r->{ - v.startAnimation(opacityIn); + UiUtils.opacityIn(v); }); } ); @@ -430,7 +450,7 @@ private boolean onBookmarkLongClick(View v) { if (AccountSessionManager.getInstance().getLoggedInAccounts().size() < 2) return false; UiUtils.pickInteractAs(v.getContext(), item.accountID, item.status, - s -> s.bookmarked,w + s -> s.bookmarked, (ic, status, consumer) -> ic.setBookmarked(status, true, consumer), R.string.sk_bookmark_as, R.string.sk_bookmarked_as, diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/NotificationHeaderStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/NotificationHeaderStatusDisplayItem.java index 6586ea103d..dff55373fb 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/NotificationHeaderStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/NotificationHeaderStatusDisplayItem.java @@ -117,7 +117,6 @@ public ImageLoaderRequest getImageRequest(int index){ public static class Holder extends StatusDisplayItem.Holder implements ImageLoaderViewHolder{ private final ImageView icon, avatar, deleteNotification; private final TextView text, timestamp; - private final int selectableItemBackground; public Holder(Activity activity, ViewGroup parent){ super(activity, R.layout.display_item_notification_header, parent); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java index 9c7188c3e0..0ddf6a9b9c 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java @@ -278,14 +278,14 @@ else if(statusForContent.sensitive && AccountSessionManager.get(accountID).getLo contentItems.add(new AudioStatusDisplayItem(parentID, fragment, statusForContent, att)); } if(att.type==Attachment.Type.UNKNOWN){ - contentItems.add(new FileStatusDisplayItem(parentID, fragment, att)); + contentItems.add(new FileStatusDisplayItem(parentID, fragment, att, statusForContent)); } } if(statusForContent.poll!=null){ - buildPollItems(parentID, fragment, statusForContent.poll, contentItems); + buildPollItems(parentID, fragment, statusForContent.poll, contentItems, statusForContent); } if(statusForContent.card!=null && statusForContent.mediaAttachments.isEmpty()){ - contentItems.add(new LinkCardStatusDisplayItem(parentID, fragment, statusForContent)); + contentItems.add(new LinkCardStatusDisplayItem(parentID, fragment, statusForContent, (flags & FLAG_NO_MEDIA_PREVIEW)==0)); } if(contentItems!=items && statusForContent.spoilerRevealed){ items.addAll(contentItems); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/ColorPalette.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/ColorPalette.java index 3b5562f016..dca5ad8ed6 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/ColorPalette.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/ColorPalette.java @@ -25,7 +25,7 @@ GREEN, new ColorPalette(R.style.ColorPalette_Green), BLUE, new ColorPalette(R.style.ColorPalette_Blue), BROWN, new ColorPalette(R.style.ColorPalette_Brown), RED, new ColorPalette(R.style.ColorPalette_Red), - YELLOW, new ColorPalette(R.style.ColorPalette_Yellow) + YELLOW, new ColorPalette(R.style.ColorPalette_Yellow), NORD, new ColorPalette(R.style.ColorPalette_Nord), WHITE, new ColorPalette(R.style.ColorPalette_White) diff --git a/mastodon/src/main/res/values/palettes.xml b/mastodon/src/main/res/values/palettes.xml index 7c1cbbbe1d..ae249ba3fe 100644 --- a/mastodon/src/main/res/values/palettes.xml +++ b/mastodon/src/main/res/values/palettes.xml @@ -68,7 +68,7 @@ ?colorGray100 ?colorPrimary200 - @color/favorite_selected + @color/warning_500 @color/like_selected ?colorM3Primary @color/bookmark_selected