From 84467b60b568e430120f2a5840297b527b5a8580 Mon Sep 17 00:00:00 2001 From: Ammar Githam Date: Sat, 14 Nov 2020 18:32:11 +0900 Subject: [PATCH] Add preference tp disable post open animation, extract some strings to xml, fix one locale string. --- .../PostsLayoutPreferencesDialogFragment.java | 6 + .../fragments/HashTagFragment.java | 49 +- .../fragments/LocationFragment.java | 51 +- .../fragments/SavedViewerFragment.java | 18 +- .../fragments/TopicPostsFragment.java | 18 +- .../fragments/main/FeedFragment.java | 18 +- .../fragments/main/ProfileFragment.java | 18 +- .../models/PostsLayoutPreferences.java | 29 +- .../layout/dialog_post_layout_preferences.xml | 461 +++++++++--------- app/src/main/res/values-zh-rTW/strings.xml | 2 +- app/src/main/res/values/strings.xml | 10 + build.gradle | 2 +- 12 files changed, 372 insertions(+), 310 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/dialogs/PostsLayoutPreferencesDialogFragment.java b/app/src/main/java/awais/instagrabber/dialogs/PostsLayoutPreferencesDialogFragment.java index 9e35ae54..9fc1fa6c 100644 --- a/app/src/main/java/awais/instagrabber/dialogs/PostsLayoutPreferencesDialogFragment.java +++ b/app/src/main/java/awais/instagrabber/dialogs/PostsLayoutPreferencesDialogFragment.java @@ -80,6 +80,7 @@ public class PostsLayoutPreferencesDialogFragment extends DialogFragment { initAvatarsToggle(); initCornersToggle(); initGapToggle(); + initAnimationDisableToggle(); } private void initLayoutToggle() { @@ -169,6 +170,11 @@ public class PostsLayoutPreferencesDialogFragment extends DialogFragment { binding.showGapToggle.setOnCheckedChangeListener((buttonView, isChecked) -> preferencesBuilder.setHasGap(isChecked)); } + private void initAnimationDisableToggle() { + binding.disableAnimationToggle.setChecked(preferencesBuilder.isAnimationDisabled()); + binding.disableAnimationToggle.setOnCheckedChangeListener((buttonView, isChecked) -> preferencesBuilder.setAnimationDisabled(isChecked)); + } + private int getSelectedLayoutId() { switch (preferencesBuilder.getType()) { case STAGGERED_GRID: diff --git a/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java b/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java index bd32ab5c..14cec315 100644 --- a/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java @@ -94,6 +94,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe private Set selectedFeedModels; private FeedModel downloadFeedModel; private int downloadChildPosition = -1; + private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_HASHTAG_POSTS_LAYOUT)); private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { @Override @@ -202,36 +203,23 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe final View mainPostImage, final int position) { if (opening) return; - else if (TextUtils.isEmpty(feedModel.getProfileModel().getUsername())) { + if (TextUtils.isEmpty(feedModel.getProfileModel().getUsername())) { opening = true; - new PostFetcher(feedModel.getShortCode(), newFeedModel -> { - final PostViewV2Fragment.Builder builder = PostViewV2Fragment - .builder(newFeedModel); - if (position >= 0) { - builder.setPosition(position); - } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); - opening = false; - }).execute(); + new PostFetcher(feedModel.getShortCode(), newFeedModel -> openPostDialog(newFeedModel, profilePicView, mainPostImage, position)) + .execute(); + return; } - else { - opening = true; - final PostViewV2Fragment.Builder builder = PostViewV2Fragment - .builder(feedModel); - if (position >= 0) { - builder.setPosition(position); - } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); - opening = false; + opening = true; + final PostViewV2Fragment.Builder builder = PostViewV2Fragment.builder(feedModel); + if (position >= 0) { + builder.setPosition(position); } + if (!layoutPreferences.isAnimationDisabled()) { + builder.setSharedProfilePicElement(profilePicView) + .setSharedMainPostElement(mainPostImage); + } + builder.build().show(getChildFragmentManager(), "post_view"); + opening = false; } }; private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() { @@ -376,7 +364,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe binding.posts.setViewModelStoreOwner(this) .setLifeCycleOwner(this) .setPostFetchService(new HashtagPostFetchService(hashtagModel, isLoggedIn)) - .setLayoutPreferences(PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_HASHTAG_POSTS_LAYOUT))) + .setLayoutPreferences(layoutPreferences) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .setFeedItemCallback(feedItemCallback) .setSelectionModeCallback(selectionModeCallback) @@ -565,7 +553,10 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe private void showPostsLayoutPreferences() { final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( Constants.PREF_HASHTAG_POSTS_LAYOUT, - preferences -> new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200)); + preferences -> { + layoutPreferences = preferences; + new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200); + }); fragment.show(getChildFragmentManager(), "posts_layout_preferences"); } } diff --git a/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java b/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java index 3fb1c6e3..1171b095 100644 --- a/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/LocationFragment.java @@ -93,6 +93,8 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR private Set selectedFeedModels; private FeedModel downloadFeedModel; private int downloadChildPosition = -1; + private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences + .fromJson(settingsHelper.getString(Constants.PREF_LOCATION_POSTS_LAYOUT)); private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { @Override @@ -200,36 +202,24 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR final View mainPostImage, final int position) { if (opening) return; - else if (TextUtils.isEmpty(feedModel.getProfileModel().getUsername())) { + if (TextUtils.isEmpty(feedModel.getProfileModel().getUsername())) { opening = true; - new PostFetcher(feedModel.getShortCode(), newFeedModel -> { - final PostViewV2Fragment.Builder builder = PostViewV2Fragment - .builder(newFeedModel); - if (position >= 0) { - builder.setPosition(position); - } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); - opening = false; - }).execute(); + new PostFetcher(feedModel.getShortCode(), newFeedModel -> openPostDialog(newFeedModel, profilePicView, mainPostImage, position)) + .execute(); + return; } - else { - opening = true; - final PostViewV2Fragment.Builder builder = PostViewV2Fragment - .builder(feedModel); - if (position >= 0) { - builder.setPosition(position); - } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); - opening = false; + opening = true; + final PostViewV2Fragment.Builder builder = PostViewV2Fragment + .builder(feedModel); + if (position >= 0) { + builder.setPosition(position); } + if (!layoutPreferences.isAnimationDisabled()) { + builder.setSharedProfilePicElement(profilePicView) + .setSharedMainPostElement(mainPostImage); + } + builder.build().show(getChildFragmentManager(), "post_view"); + opening = false; } }; private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() { @@ -359,7 +349,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR binding.posts.setViewModelStoreOwner(this) .setLifeCycleOwner(this) .setPostFetchService(new LocationPostFetchService(locationModel, isLoggedIn)) - .setLayoutPreferences(PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_LOCATION_POSTS_LAYOUT))) + .setLayoutPreferences(layoutPreferences) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .setFeedItemCallback(feedItemCallback) .setSelectionModeCallback(selectionModeCallback) @@ -542,7 +532,10 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR private void showPostsLayoutPreferences() { final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( Constants.PREF_LOCATION_POSTS_LAYOUT, - preferences -> new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200)); + preferences -> { + layoutPreferences = preferences; + new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200); + }); fragment.show(getChildFragmentManager(), "posts_layout_preferences"); } } diff --git a/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java index 5b964e0e..2a2439aa 100644 --- a/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/SavedViewerFragment.java @@ -62,6 +62,7 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL private Set selectedFeedModels; private FeedModel downloadFeedModel; private int downloadChildPosition = -1; + private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences.fromJson(settingsHelper.getString(getPostsLayoutPreferenceKey())); private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { @Override @@ -173,11 +174,11 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL if (position >= 0) { builder.setPosition(position); } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); + if (!layoutPreferences.isAnimationDisabled()) { + builder.setSharedProfilePicElement(profilePicView) + .setSharedMainPostElement(mainPostImage); + } + builder.build().show(getChildFragmentManager(), "post_view"); } }; private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() { @@ -320,7 +321,7 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL binding.posts.setViewModelStoreOwner(this) .setLifeCycleOwner(this) .setPostFetchService(new SavedPostFetchService(profileId, type)) - .setLayoutPreferences(PostsLayoutPreferences.fromJson(settingsHelper.getString(getPostsLayoutPreferenceKey()))) + .setLayoutPreferences(layoutPreferences) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .setFeedItemCallback(feedItemCallback) .setSelectionModeCallback(selectionModeCallback) @@ -394,7 +395,10 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL private void showPostsLayoutPreferences() { final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( getPostsLayoutPreferenceKey(), - preferences -> new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200)); + preferences -> { + layoutPreferences = preferences; + new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200); + }); fragment.show(getChildFragmentManager(), "posts_layout_preferences"); } } \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java b/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java index 3f261a6b..87beef53 100644 --- a/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/TopicPostsFragment.java @@ -75,6 +75,7 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O private Set selectedFeedModels; private FeedModel downloadFeedModel; private int downloadChildPosition = -1; + private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_TOPIC_POSTS_LAYOUT)); private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { @Override @@ -186,11 +187,11 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O if (position >= 0) { builder.setPosition(position); } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); + if (!layoutPreferences.isAnimationDisabled()) { + builder.setSharedProfilePicElement(profilePicView) + .setSharedMainPostElement(mainPostImage); + } + builder.build().show(getChildFragmentManager(), "post_view"); } }; private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() { @@ -400,7 +401,7 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O binding.posts.setViewModelStoreOwner(this) .setLifeCycleOwner(this) .setPostFetchService(new DiscoverPostFetchService(topicalExploreRequest)) - .setLayoutPreferences(PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_TOPIC_POSTS_LAYOUT))) + .setLayoutPreferences(layoutPreferences) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .setFeedItemCallback(feedItemCallback) .setSelectionModeCallback(selectionModeCallback) @@ -422,7 +423,10 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O private void showPostsLayoutPreferences() { final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( Constants.PREF_TOPIC_POSTS_LAYOUT, - preferences -> new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200)); + preferences -> { + layoutPreferences = preferences; + new Handler().postDelayed(() -> binding.posts.setLayoutPreferences(preferences), 200); + }); fragment.show(getChildFragmentManager(), "posts_layout_preferences"); } } diff --git a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java index 5c31797d..c75512e2 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java @@ -72,6 +72,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre private Set selectedFeedModels; private FeedModel downloadFeedModel; private int downloadChildPosition = -1; + private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_POSTS_LAYOUT)); private final FeedAdapterV2.FeedItemCallback feedItemCallback = new FeedAdapterV2.FeedItemCallback() { @Override @@ -153,11 +154,11 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre if (position >= 0) { builder.setPosition(position); } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); + if (!layoutPreferences.isAnimationDisabled()) { + builder.setSharedProfilePicElement(profilePicView) + .setSharedMainPostElement(mainPostImage); + } + builder.build().show(getChildFragmentManager(), "post_view"); } }; private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(false) { @@ -324,7 +325,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre binding.feedRecyclerView.setViewModelStoreOwner(this) .setLifeCycleOwner(this) .setPostFetchService(new FeedPostFetchService()) - .setLayoutPreferences(PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_POSTS_LAYOUT))) + .setLayoutPreferences(layoutPreferences) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .setFeedItemCallback(feedItemCallback) .setSelectionModeCallback(selectionModeCallback) @@ -377,7 +378,10 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre private void showPostsLayoutPreferences() { final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( Constants.PREF_POSTS_LAYOUT, - preferences -> new Handler().postDelayed(() -> binding.feedRecyclerView.setLayoutPreferences(preferences), 200)); + preferences -> { + layoutPreferences = preferences; + new Handler().postDelayed(() -> binding.feedRecyclerView.setLayoutPreferences(preferences), 200); + }); fragment.show(getChildFragmentManager(), "posts_layout_preferences"); } diff --git a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java index 1711d0ee..41bca0cc 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java @@ -117,6 +117,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe private Set selectedFeedModels; private FeedModel downloadFeedModel; private int downloadChildPosition = -1; + private PostsLayoutPreferences layoutPreferences = PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_PROFILE_POSTS_LAYOUT)); private final Runnable usernameSettingRunnable = () -> { final ActionBar actionBar = fragmentActivity.getSupportActionBar(); @@ -238,11 +239,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe if (position >= 0) { builder.setPosition(position); } - final PostViewV2Fragment fragment = builder - .setSharedProfilePicElement(profilePicView) - .setSharedMainPostElement(mainPostImage) - .build(); - fragment.show(getChildFragmentManager(), "post_view"); + if (!layoutPreferences.isAnimationDisabled()) { + builder.setSharedProfilePicElement(profilePicView) + .setSharedMainPostElement(mainPostImage); + } + builder.build().show(getChildFragmentManager(), "post_view"); } }; private final FeedAdapterV2.SelectionModeCallback selectionModeCallback = new FeedAdapterV2.SelectionModeCallback() { @@ -876,7 +877,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe binding.postsRecyclerView.setViewModelStoreOwner(this) .setLifeCycleOwner(this) .setPostFetchService(new ProfilePostFetchService(profileModel)) - .setLayoutPreferences(PostsLayoutPreferences.fromJson(settingsHelper.getString(Constants.PREF_PROFILE_POSTS_LAYOUT))) + .setLayoutPreferences(layoutPreferences) .addFetchStatusChangeListener(fetching -> updateSwipeRefreshState()) .setFeedItemCallback(feedItemCallback) .setSelectionModeCallback(selectionModeCallback) @@ -922,7 +923,10 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe private void showPostsLayoutPreferences() { final PostsLayoutPreferencesDialogFragment fragment = new PostsLayoutPreferencesDialogFragment( Constants.PREF_PROFILE_POSTS_LAYOUT, - preferences -> new Handler().postDelayed(() -> binding.postsRecyclerView.setLayoutPreferences(preferences), 200)); + preferences -> { + layoutPreferences = preferences; + new Handler().postDelayed(() -> binding.postsRecyclerView.setLayoutPreferences(preferences), 200); + }); fragment.show(getChildFragmentManager(), "posts_layout_preferences"); } } diff --git a/app/src/main/java/awais/instagrabber/models/PostsLayoutPreferences.java b/app/src/main/java/awais/instagrabber/models/PostsLayoutPreferences.java index aae54fc3..e24b1371 100644 --- a/app/src/main/java/awais/instagrabber/models/PostsLayoutPreferences.java +++ b/app/src/main/java/awais/instagrabber/models/PostsLayoutPreferences.java @@ -12,6 +12,7 @@ public final class PostsLayoutPreferences { private final ProfilePicSize profilePicSize; private final boolean hasRoundedCorners; private final boolean hasGap; + private final boolean animationDisabled; public static class Builder { private PostsLayoutType type = PostsLayoutType.GRID; @@ -21,6 +22,7 @@ public final class PostsLayoutPreferences { private ProfilePicSize profilePicSize = ProfilePicSize.SMALL; private boolean hasRoundedCorners = true; private boolean hasGap = true; + private boolean animationDisabled = false; public Builder setType(final PostsLayoutType type) { this.type = type; @@ -57,6 +59,11 @@ public final class PostsLayoutPreferences { return this; } + public Builder setAnimationDisabled(final boolean animationDisabled) { + this.animationDisabled = animationDisabled; + return this; + } + // Breaking builder pattern and adding getters to avoid too many object creations in PostsLayoutPreferencesDialogFragment public PostsLayoutType getType() { return type; @@ -86,6 +93,10 @@ public final class PostsLayoutPreferences { return hasGap; } + public boolean isAnimationDisabled() { + return animationDisabled; + } + public Builder mergeFrom(final PostsLayoutPreferences preferences) { if (preferences == null) { return this; @@ -97,11 +108,13 @@ public final class PostsLayoutPreferences { setProfilePicSize(preferences.getProfilePicSize()); setHasRoundedCorners(preferences.getHasRoundedCorners()); setHasGap(preferences.getHasGap()); + setAnimationDisabled(preferences.isAnimationDisabled()); return this; } public PostsLayoutPreferences build() { - return new PostsLayoutPreferences(type, colCount, isAvatarVisible, isNameVisible, profilePicSize, hasRoundedCorners, hasGap); + return new PostsLayoutPreferences(type, colCount, isAvatarVisible, isNameVisible, profilePicSize, hasRoundedCorners, hasGap, + animationDisabled); } } @@ -115,7 +128,8 @@ public final class PostsLayoutPreferences { final boolean isNameVisible, final ProfilePicSize profilePicSize, final boolean hasRoundedCorners, - final boolean hasGap) { + final boolean hasGap, + final boolean animationDisabled) { this.type = type; this.colCount = colCount; @@ -124,6 +138,7 @@ public final class PostsLayoutPreferences { this.profilePicSize = profilePicSize; this.hasRoundedCorners = hasRoundedCorners; this.hasGap = hasGap; + this.animationDisabled = animationDisabled; } public PostsLayoutType getType() { @@ -163,6 +178,10 @@ public final class PostsLayoutPreferences { return new Gson().fromJson(json, PostsLayoutPreferences.class); } + public boolean isAnimationDisabled() { + return animationDisabled; + } + @Override public boolean equals(final Object o) { if (this == o) return true; @@ -172,12 +191,13 @@ public final class PostsLayoutPreferences { isAvatarVisible == that.isAvatarVisible && isNameVisible == that.isNameVisible && type == that.type && - profilePicSize == that.profilePicSize; + profilePicSize == that.profilePicSize && + animationDisabled == that.animationDisabled; } @Override public int hashCode() { - return Objects.hash(type, colCount, isAvatarVisible, isNameVisible, profilePicSize); + return Objects.hash(type, colCount, isAvatarVisible, isNameVisible, profilePicSize, animationDisabled); } @Override @@ -190,6 +210,7 @@ public final class PostsLayoutPreferences { ", profilePicSize=" + profilePicSize + ", hasRoundedCorners=" + hasRoundedCorners + ", hasGap=" + hasGap + + ", animationDisabled=" + animationDisabled + '}'; } diff --git a/app/src/main/res/layout/dialog_post_layout_preferences.xml b/app/src/main/res/layout/dialog_post_layout_preferences.xml index 4679e632..7bf0eefc 100644 --- a/app/src/main/res/layout/dialog_post_layout_preferences.xml +++ b/app/src/main/res/layout/dialog_post_layout_preferences.xml @@ -1,252 +1,277 @@ - + android:layout_height="match_parent"> - + android:animateLayoutChanges="true" + android:paddingTop="16dp"> - - - - - -