feat: initial steps for only show media preview setting
It contains settings, flags and settings. But no implementation just yet
This commit is contained in:
@@ -76,6 +76,7 @@ public class GlobalUserPreferences{
|
|||||||
public static boolean loadRemoteAccountFollowers;
|
public static boolean loadRemoteAccountFollowers;
|
||||||
public static boolean mentionRebloggerAutomatically;
|
public static boolean mentionRebloggerAutomatically;
|
||||||
public static boolean showPostsWithoutAlt;
|
public static boolean showPostsWithoutAlt;
|
||||||
|
public static boolean showMediaPreview;
|
||||||
|
|
||||||
public static SharedPreferences getPrefs(){
|
public static SharedPreferences getPrefs(){
|
||||||
return MastodonApp.context.getSharedPreferences("global", Context.MODE_PRIVATE);
|
return MastodonApp.context.getSharedPreferences("global", Context.MODE_PRIVATE);
|
||||||
@@ -151,7 +152,8 @@ public class GlobalUserPreferences{
|
|||||||
swapBookmarkWithBoostAction=prefs.getBoolean("swapBookmarkWithBoostAction", false);
|
swapBookmarkWithBoostAction=prefs.getBoolean("swapBookmarkWithBoostAction", false);
|
||||||
loadRemoteAccountFollowers=prefs.getBoolean("loadRemoteAccountFollowers", true);
|
loadRemoteAccountFollowers=prefs.getBoolean("loadRemoteAccountFollowers", true);
|
||||||
mentionRebloggerAutomatically=prefs.getBoolean("mentionRebloggerAutomatically", false);
|
mentionRebloggerAutomatically=prefs.getBoolean("mentionRebloggerAutomatically", false);
|
||||||
showPostsWithoutAlt =prefs.getBoolean("showPostsWithoutAlt", true);
|
showPostsWithoutAlt=prefs.getBoolean("showPostsWithoutAlt", true);
|
||||||
|
showMediaPreview=prefs.getBoolean("showMediaPreview", true);
|
||||||
|
|
||||||
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
|
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
|
||||||
|
|
||||||
@@ -234,6 +236,7 @@ public class GlobalUserPreferences{
|
|||||||
.putBoolean("relocatePublishButton", relocatePublishButton)
|
.putBoolean("relocatePublishButton", relocatePublishButton)
|
||||||
.putBoolean("enableDeleteNotifications", enableDeleteNotifications)
|
.putBoolean("enableDeleteNotifications", enableDeleteNotifications)
|
||||||
.putBoolean("showPostsWithoutAlt", showPostsWithoutAlt)
|
.putBoolean("showPostsWithoutAlt", showPostsWithoutAlt)
|
||||||
|
.putBoolean("showMediaPreview", showMediaPreview)
|
||||||
|
|
||||||
.putInt("theme", theme.ordinal())
|
.putInt("theme", theme.ordinal())
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public abstract class StatusListFragment extends BaseStatusListFragment<Status>
|
|||||||
flags |= StatusDisplayItem.FLAG_NO_FOOTER;
|
flags |= StatusDisplayItem.FLAG_NO_FOOTER;
|
||||||
if (!lp.emojiReactionsEnabled || lp.showEmojiReactions==ONLY_OPENED)
|
if (!lp.emojiReactionsEnabled || lp.showEmojiReactions==ONLY_OPENED)
|
||||||
flags |= StatusDisplayItem.FLAG_NO_EMOJI_REACTIONS;
|
flags |= StatusDisplayItem.FLAG_NO_EMOJI_REACTIONS;
|
||||||
|
if(GlobalUserPreferences.showMediaPreview)
|
||||||
|
flags |= StatusDisplayItem.FLAG_NO_MEDIA_PREVIEW;
|
||||||
return StatusDisplayItem.buildItems(this, s, accountID, s, knownAccounts, getFilterContext(), isMainThreadStatus ? 0 : flags);
|
return StatusDisplayItem.buildItems(this, s, accountID, s, knownAccounts, getFilterContext(), isMainThreadStatus ? 0 : flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
|
|||||||
private CheckableListItem<Void> pronounsInUserListingsItem, pronounsInTimelinesItem, pronounsInThreadsItem;
|
private CheckableListItem<Void> pronounsInUserListingsItem, pronounsInTimelinesItem, pronounsInThreadsItem;
|
||||||
|
|
||||||
// MOSHIDON
|
// MOSHIDON
|
||||||
private CheckableListItem<Void> enableDoubleTapToSwipeItem, relocatePublishButtonItem, showPostDividersItem, enableDoubleTapToSearchItem;
|
private CheckableListItem<Void> enableDoubleTapToSwipeItem, relocatePublishButtonItem, showPostDividersItem, enableDoubleTapToSearchItem, showMediaPreviewItem;
|
||||||
|
|
||||||
private AccountLocalPreferences lp;
|
private AccountLocalPreferences lp;
|
||||||
|
|
||||||
@@ -131,6 +131,7 @@ public class SettingsDisplayFragment extends BaseSettingsFragment<Void>{
|
|||||||
GlobalUserPreferences.displayPronounsInTimelines=pronounsInTimelinesItem.checked;
|
GlobalUserPreferences.displayPronounsInTimelines=pronounsInTimelinesItem.checked;
|
||||||
GlobalUserPreferences.displayPronounsInThreads=pronounsInThreadsItem.checked;
|
GlobalUserPreferences.displayPronounsInThreads=pronounsInThreadsItem.checked;
|
||||||
GlobalUserPreferences.displayPronounsInUserListings=pronounsInUserListingsItem.checked;
|
GlobalUserPreferences.displayPronounsInUserListings=pronounsInUserListingsItem.checked;
|
||||||
|
GlobalUserPreferences.showMediaPreview=showMediaPreviewItem.checked;
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
if(restartPlease) restartActivityToApplyNewTheme();
|
if(restartPlease) restartActivityToApplyNewTheme();
|
||||||
else E.post(new StatusDisplaySettingsChangedEvent(accountID));
|
else E.post(new StatusDisplaySettingsChangedEvent(accountID));
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public abstract class StatusDisplayItem{
|
|||||||
public static final int FLAG_NO_HEADER=1 << 4;
|
public static final int FLAG_NO_HEADER=1 << 4;
|
||||||
public static final int FLAG_NO_TRANSLATE=1 << 5;
|
public static final int FLAG_NO_TRANSLATE=1 << 5;
|
||||||
public static final int FLAG_NO_EMOJI_REACTIONS=1 << 6;
|
public static final int FLAG_NO_EMOJI_REACTIONS=1 << 6;
|
||||||
|
public static final int FLAG_NO_MEDIA_PREVIEW=1 << 7;
|
||||||
|
|
||||||
public void setAncestryInfo(
|
public void setAncestryInfo(
|
||||||
boolean hasDescendantNeighbor,
|
boolean hasDescendantNeighbor,
|
||||||
@@ -252,7 +253,7 @@ public abstract class StatusDisplayItem{
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Attachment> imageAttachments=statusForContent.mediaAttachments.stream().filter(att->att.type.isImage()).collect(Collectors.toList());
|
List<Attachment> imageAttachments=statusForContent.mediaAttachments.stream().filter(att->att.type.isImage()).collect(Collectors.toList());
|
||||||
if(!imageAttachments.isEmpty()){
|
if(!imageAttachments.isEmpty() && ((flags & FLAG_NO_MEDIA_PREVIEW)!=0)){
|
||||||
int color = UiUtils.getThemeColor(fragment.getContext(), R.attr.colorM3SurfaceVariant);
|
int color = UiUtils.getThemeColor(fragment.getContext(), R.attr.colorM3SurfaceVariant);
|
||||||
for (Attachment att : imageAttachments) {
|
for (Attachment att : imageAttachments) {
|
||||||
if (att.blurhashPlaceholder == null) {
|
if (att.blurhashPlaceholder == null) {
|
||||||
@@ -267,6 +268,11 @@ public abstract class StatusDisplayItem{
|
|||||||
statusForContent.sensitiveRevealed=true;
|
statusForContent.sensitiveRevealed=true;
|
||||||
contentItems.add(mediaGrid);
|
contentItems.add(mediaGrid);
|
||||||
}
|
}
|
||||||
|
if((flags & FLAG_NO_MEDIA_PREVIEW)==0){
|
||||||
|
for(Attachment att:imageAttachments){
|
||||||
|
contentItems.add(new FileStatusDisplayItem(parentID, fragment, att, statusForContent));
|
||||||
|
}
|
||||||
|
}
|
||||||
for(Attachment att:statusForContent.mediaAttachments){
|
for(Attachment att:statusForContent.mediaAttachments){
|
||||||
if(att.type==Attachment.Type.AUDIO){
|
if(att.type==Attachment.Type.AUDIO){
|
||||||
contentItems.add(new AudioStatusDisplayItem(parentID, fragment, statusForContent, att));
|
contentItems.add(new AudioStatusDisplayItem(parentID, fragment, statusForContent, att));
|
||||||
|
|||||||
@@ -97,4 +97,5 @@
|
|||||||
<string name="mo_confirm_unfollow_title">Unfollow Account</string>
|
<string name="mo_confirm_unfollow_title">Unfollow Account</string>
|
||||||
<string name="mo_confirm_unfollow">Confirm to unfollow %s</string>
|
<string name="mo_confirm_unfollow">Confirm to unfollow %s</string>
|
||||||
<string name="mo_recent_emoji_cleared">Recent emoji cleared</string>
|
<string name="mo_recent_emoji_cleared">Recent emoji cleared</string>
|
||||||
|
<string name="mo_show_media_preview">Show media preview in timelines</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user