From 64e82bdeed5cce6243abc7987017f67913afd067 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 18 Feb 2024 14:19:05 -0300 Subject: [PATCH] chore(merge-upstream): still 21 things to do --- .../api/session/AccountLocalPreferences.java | 10 +++++ .../fragments/BaseStatusListFragment.java | 38 ++++++++++--------- .../ui/photoviewer/PhotoViewerInfoSheet.java | 2 +- .../ComposeLanguageAlertViewController.java | 4 +- 4 files changed, 34 insertions(+), 20 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 24439acbeb..d5cb4c13ac 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 @@ -50,6 +50,7 @@ public class AccountLocalPreferences{ public ShowEmojiReactions showEmojiReactions; public ColorPreference color; public ArrayList recentCustomEmoji; + public boolean preReplySheet; private final static Type recentLanguagesType=new TypeToken>() {}.getType(); private final static Type timelinesType=new TypeToken>() {}.getType(); @@ -68,6 +69,7 @@ public AccountLocalPreferences(SharedPreferences prefs, AccountSession session){ revealCWs=prefs.getBoolean("revealCWs", false); hideSensitiveMedia=prefs.getBoolean("hideSensitive", true); serverSideFiltersSupported=prefs.getBoolean("serverSideFilters", false); +// preReplySheet=prefs.getBoolean("preReplySheet", false); // MEGALODON showReplies=prefs.getBoolean("showReplies", true); @@ -112,6 +114,9 @@ public void save(){ .putBoolean("hideSensitive", hideSensitiveMedia) .putBoolean("serverSideFilters", serverSideFiltersSupported) + //TODO figure this stuff out +// .putBoolean("preReplySheet", preReplySheet) + // MEGALODON .putBoolean("showReplies", showReplies) .putBoolean("showBoosts", showBoosts) @@ -169,4 +174,9 @@ public enum ShowEmojiReactions{ ONLY_OPENED, ALWAYS } + +// public enum PreReplySheetType{ +// OLD_POST, +// NON_MUTUAL +// } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index 38b44a36ba..9cfb5c5183 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -1079,23 +1079,27 @@ public void rebuildAllDisplayItems(){ } public void maybeShowPreReplySheet(Status status, Runnable proceed){ - Relationship rel=getRelationship(status.account.id); - if(!GlobalUserPreferences.isOptedOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.NON_MUTUAL, status.account, accountID) && - !status.account.id.equals(AccountSessionManager.get(accountID).self.id) && rel!=null && !rel.followedBy && status.account.followingCount>=1){ - new NonMutualPreReplySheet(getActivity(), notAgain->{ - GlobalUserPreferences.optOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.NON_MUTUAL, notAgain ? null : status.account, accountID); - proceed.run(); - }, status.account, accountID).show(); - }else if(!GlobalUserPreferences.isOptedOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.OLD_POST, null, null) && - status.createdAt.isBefore(Instant.now().minus(90, ChronoUnit.DAYS))){ - new OldPostPreReplySheet(getActivity(), notAgain->{ - if(notAgain) - GlobalUserPreferences.optOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.OLD_POST, null, null); - proceed.run(); - }, status).show(); - }else{ - proceed.run(); - } + // TODO: figure this stuff out +// Relationship rel=getRelationship(status.account.id); +// if(!GlobalUserPreferences.isOptedOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.NON_MUTUAL, status.account, accountID) && +// !status.account.id.equals(AccountSessionManager.get(accountID).self.id) && rel!=null && !rel.followedBy && status.account.followingCount>=1){ +// new NonMutualPreReplySheet(getActivity(), notAgain->{ +// GlobalUserPreferences.optOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.NON_MUTUAL, notAgain ? null : status.account, accountID); +// proceed.run(); +// }, status.account, accountID).show(); +// }else if(!GlobalUserPreferences.isOptedOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.OLD_POST, null, null) && +// status.createdAt.isBefore(Instant.now().minus(90, ChronoUnit.DAYS))){ +// new OldPostPreReplySheet(getActivity(), notAgain->{ +// if(notAgain) +// GlobalUserPreferences.optOutOfPreReplySheet(GlobalUserPreferences.PreReplySheetType.OLD_POST, null, null); +// proceed.run(); +// }, status).show(); +// }else{ +// proceed.run(); +// } + + + proceed.run(); } protected void onModifyItemViewHolder(BindableViewHolder holder){} diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewerInfoSheet.java b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewerInfoSheet.java index 6f26b61f34..565d198ca1 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewerInfoSheet.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/photoviewer/PhotoViewerInfoSheet.java @@ -147,7 +147,7 @@ public void setStatus(Status status){ statusID=status.id; boostBtn.setCompoundDrawablesWithIntrinsicBounds(0, switch(status.visibility){ case DIRECT -> R.drawable.ic_boost_disabled_24px; - case PUBLIC, UNLISTED -> R.drawable.ic_boost; + case PUBLIC, UNLISTED, LOCAL -> R.drawable.ic_boost; case PRIVATE -> R.drawable.ic_boost_private; }, 0, 0); boostBtn.setEnabled(status.visibility!=StatusPrivacy.DIRECT); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeLanguageAlertViewController.java b/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeLanguageAlertViewController.java index 644c7a7ec3..bd70738851 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeLanguageAlertViewController.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/viewcontrollers/ComposeLanguageAlertViewController.java @@ -115,8 +115,8 @@ public ComposeLanguageAlertViewController(Context context, String preferred, Sel int i=0; boolean found=false; for(SpecialLocaleInfo li:specialLocales){ - if(null!=li.locale&&li.locale.equals(previouslySelected.locale)){ - selectedLocale=li.locale; + if(null!=li.language&&li.language.equals(previouslySelected.language)){ + selectedLocale=li.language; selectedIndex=i; found=true; break;