From 168456f57ccd80a52c7d95761b1df6827d0b90c8 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 29 Oct 2019 11:20:16 +0800 Subject: [PATCH] Make Placing vote buttons on the right an option. --- .../Activity/ViewPostDetailActivity.java | 38 +++--- .../CommentAndPostRecyclerViewAdapter.java | 67 ++++++---- .../CommentsListingRecyclerViewAdapter.java | 12 +- .../Adapter/PostRecyclerViewAdapter.java | 47 +++++-- .../Event/ChangeVoteButtonsPositionEvent.java | 9 ++ .../Fragment/PostFragment.java | 16 ++- .../Settings/MainPreferenceFragment.java | 13 +- .../SharedPreferencesUtils.java | 1 + .../ic_arrow_downward_black_24dp.png | Bin 185 -> 0 bytes .../ic_arrow_upward_black_24dp.png | Bin 197 -> 0 bytes .../ic_arrow_downward_black_24dp.png | Bin 142 -> 0 bytes .../ic_arrow_upward_black_24dp.png | Bin 147 -> 0 bytes .../ic_arrow_downward_black_24dp.png | Bin 221 -> 0 bytes .../ic_arrow_upward_black_24dp.png | Bin 204 -> 0 bytes .../ic_arrow_downward_black_24dp.png | Bin 283 -> 0 bytes .../ic_arrow_upward_black_24dp.png | Bin 302 -> 0 bytes .../ic_arrow_downward_black_24dp.png | Bin 376 -> 0 bytes .../ic_arrow_upward_black_24dp.png | Bin 341 -> 0 bytes .../drawable/ic_arrow_downward_black_22dp.xml | 4 - .../drawable/ic_arrow_downward_black_24dp.xml | 9 ++ .../drawable/ic_arrow_downward_grey_24dp.xml | 9 ++ .../drawable/ic_arrow_upward_black_22dp.xml | 4 - .../drawable/ic_arrow_upward_black_24dp.xml | 9 ++ .../drawable/ic_arrow_upward_grey_24dp.xml | 9 ++ .../main/res/drawable/ic_bookmark_20dp.xml | 4 - ...rk_24px.xml => ic_bookmark_black_24dp.xml} | 0 .../res/drawable/ic_bookmark_border_20dp.xml | 4 - ....xml => ic_bookmark_border_black_24dp.xml} | 0 .../drawable/ic_bookmark_border_grey_24dp.xml | 9 ++ .../res/drawable/ic_bookmark_grey_24dp.xml | 9 ++ .../res/drawable/ic_comment_grey_24dp.xml | 9 ++ ..._22dp.xml => ic_expand_less_grey_24dp.xml} | 2 +- ..._20dp.xml => ic_expand_more_grey_24dp.xml} | 2 +- ...rt_24px.xml => ic_more_vert_grey_24dp.xml} | 2 +- .../res/drawable/ic_outline_share_20px.xml | 4 - ..._black_20dp.xml => ic_reply_grey_24dp.xml} | 2 +- ..._share_24px.xml => ic_share_grey_24dp.xml} | 2 +- app/src/main/res/layout/item_comment.xml | 16 +-- app/src/main/res/layout/item_post.xml | 124 ++++++++++++++---- app/src/main/res/layout/item_post_detail.xml | 91 ++----------- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/main_preferences.xml | 16 ++- 42 files changed, 341 insertions(+), 203 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeVoteButtonsPositionEvent.java delete mode 100644 app/src/main/res/drawable-hdpi/ic_arrow_downward_black_24dp.png delete mode 100644 app/src/main/res/drawable-hdpi/ic_arrow_upward_black_24dp.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_arrow_downward_black_24dp.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_arrow_upward_black_24dp.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_arrow_downward_black_24dp.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_arrow_upward_black_24dp.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_arrow_downward_black_24dp.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_arrow_upward_black_24dp.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/ic_arrow_downward_black_24dp.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/ic_arrow_upward_black_24dp.png delete mode 100644 app/src/main/res/drawable/ic_arrow_downward_black_22dp.xml create mode 100644 app/src/main/res/drawable/ic_arrow_downward_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_arrow_downward_grey_24dp.xml delete mode 100644 app/src/main/res/drawable/ic_arrow_upward_black_22dp.xml create mode 100644 app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_arrow_upward_grey_24dp.xml delete mode 100644 app/src/main/res/drawable/ic_bookmark_20dp.xml rename app/src/main/res/drawable/{ic_baseline_bookmark_24px.xml => ic_bookmark_black_24dp.xml} (100%) delete mode 100644 app/src/main/res/drawable/ic_bookmark_border_20dp.xml rename app/src/main/res/drawable/{ic_baseline_bookmark_border_24px.xml => ic_bookmark_border_black_24dp.xml} (100%) create mode 100644 app/src/main/res/drawable/ic_bookmark_border_grey_24dp.xml create mode 100644 app/src/main/res/drawable/ic_bookmark_grey_24dp.xml create mode 100644 app/src/main/res/drawable/ic_comment_grey_24dp.xml rename app/src/main/res/drawable/{ic_expand_less_black_22dp.xml => ic_expand_less_grey_24dp.xml} (78%) rename app/src/main/res/drawable/{ic_expand_more_black_20dp.xml => ic_expand_more_grey_24dp.xml} (78%) rename app/src/main/res/drawable/{ic_outline_more_vert_24px.xml => ic_more_vert_grey_24dp.xml} (91%) delete mode 100644 app/src/main/res/drawable/ic_outline_share_20px.xml rename app/src/main/res/drawable/{ic_reply_black_20dp.xml => ic_reply_grey_24dp.xml} (79%) rename app/src/main/res/drawable/{ic_outline_share_24px.xml => ic_share_grey_24dp.xml} (95%) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 4bb8711e..6bafbebe 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -159,6 +159,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS private String mSingleCommentId; private boolean mNeedBlurNsfw; private boolean mNeedBlurSpoiler; + private boolean mVoteButtonsOnTheRight; private boolean showToast = false; private boolean isSortingComments = false; private LinearLayoutManager mLinearLayoutManager; @@ -232,6 +233,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mNeedBlurNsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_NSFW_KEY, true); mNeedBlurSpoiler = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_SPOILER_KEY, false); + mVoteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false); mGlide = Glide.with(this); mLocale = getResources().getConfiguration().locale; @@ -239,7 +241,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mLinearLayoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(mLinearLayoutManager); - mSingleCommentId = getIntent().hasExtra(EXTRA_SINGLE_COMMENT_ID) ? getIntent().getExtras().getString(EXTRA_SINGLE_COMMENT_ID) : null; + mSingleCommentId = getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID); if (savedInstanceState == null) { if (mSingleCommentId != null) { isSingleCommentThreadMode = true; @@ -336,10 +338,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (mPost.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_24px); + saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); } if (mPost.isHidden()) { @@ -385,6 +387,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this, mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId, isSingleCommentThreadMode, mNeedBlurNsfw, mNeedBlurSpoiler, + mVoteButtonsOnTheRight, new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() { @Override public void updatePost(Post post) { @@ -473,10 +476,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (post.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_24px); + saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); } if (post.isHidden()) { @@ -505,6 +508,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide, mAccessToken, mAccountName, mPost, mLocale, mSingleCommentId, isSingleCommentThreadMode, mNeedBlurNsfw, mNeedBlurSpoiler, + mVoteButtonsOnTheRight, new CommentAndPostRecyclerViewAdapter.CommentRecyclerViewAdapterCallback() { @Override public void updatePost(Post post) { @@ -727,10 +731,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (post.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_24px); + saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); } if (post.isHidden()) { @@ -962,10 +966,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mMenu != null) { if (event.post.isSaved()) { mMenu.findItem(R.id.action_save_view_post_detail_activity).setIcon(getResources() - .getDrawable(R.drawable.ic_baseline_bookmark_24px)); + .getDrawable(R.drawable.ic_bookmark_black_24dp)); } else { mMenu.findItem(R.id.action_save_view_post_detail_activity).setIcon(getResources() - .getDrawable(R.drawable.ic_baseline_bookmark_border_24px)); + .getDrawable(R.drawable.ic_bookmark_border_black_24dp)); } } mAdapter.updatePost(mPost); @@ -1022,10 +1026,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mAccessToken != null) { if (mPost.isSaved()) { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_24px); + saveItem.setIcon(R.drawable.ic_bookmark_black_24dp); } else { saveItem.setVisible(true); - saveItem.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + saveItem.setIcon(R.drawable.ic_bookmark_border_black_24dp); } if (mPost.isHidden()) { @@ -1104,13 +1108,13 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS case R.id.action_save_view_post_detail_activity: if (mPost != null && mAccessToken != null) { if (mPost.isSaved()) { - item.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + item.setIcon(R.drawable.ic_bookmark_border_black_24dp); SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { mPost.setSaved(false); - item.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + item.setIcon(R.drawable.ic_bookmark_border_black_24dp); showMessage(R.string.post_unsaved_success); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } @@ -1118,19 +1122,19 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS @Override public void failed() { mPost.setSaved(true); - item.setIcon(R.drawable.ic_baseline_bookmark_24px); + item.setIcon(R.drawable.ic_bookmark_black_24dp); showMessage(R.string.post_unsaved_failed); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } }); } else { - item.setIcon(R.drawable.ic_baseline_bookmark_24px); + item.setIcon(R.drawable.ic_bookmark_black_24dp); SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { mPost.setSaved(true); - item.setIcon(R.drawable.ic_baseline_bookmark_24px); + item.setIcon(R.drawable.ic_bookmark_black_24dp); showMessage(R.string.post_saved_success); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } @@ -1138,7 +1142,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS @Override public void failed() { mPost.setSaved(false); - item.setIcon(R.drawable.ic_baseline_bookmark_border_24px); + item.setIcon(R.drawable.ic_bookmark_border_black_24dp); showMessage(R.string.post_saved_failed); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 84585046..169a5cee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -23,6 +23,8 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.constraintlayout.widget.ConstraintSet; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; @@ -102,6 +104,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { + ((PostDetailViewHolder) holder).commentsCountTextView.setOnClickListener(view -> { if (mAccessToken == null) { Toast.makeText(mActivity, R.string.login_first, Toast.LENGTH_SHORT).show(); return; @@ -509,9 +513,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { @@ -521,13 +525,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { @@ -851,14 +855,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter { @@ -307,14 +307,14 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter { @@ -627,13 +631,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter { //Do nothing in order to prevent clicking this to start ViewPostDetailActivity }); + + if (mVoteButtonsOnTheRight) { + ConstraintSet constraintSet = new ConstraintSet(); + constraintSet.clone(bottomConstraintLayout); + constraintSet.clear(upvoteButton.getId(), ConstraintSet.START); + constraintSet.clear(scoreTextView.getId(), ConstraintSet.START); + constraintSet.clear(downvoteButton.getId(), ConstraintSet.START); + constraintSet.clear(saveButton.getId(), ConstraintSet.END); + constraintSet.clear(shareButton.getId(), ConstraintSet.END); + constraintSet.connect(upvoteButton.getId(), ConstraintSet.END, scoreTextView.getId(), ConstraintSet.START); + constraintSet.connect(scoreTextView.getId(), ConstraintSet.END, downvoteButton.getId(), ConstraintSet.START); + constraintSet.connect(downvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); + constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END); + constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.END, upvoteButton.getId(), ConstraintSet.START); + constraintSet.connect(saveButton.getId(), ConstraintSet.START, shareButton.getId(), ConstraintSet.END); + constraintSet.connect(shareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); + constraintSet.setHorizontalBias(commentsCountTextView.getId(), 0); + constraintSet.applyTo(bottomConstraintLayout); + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeVoteButtonsPositionEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeVoteButtonsPositionEvent.java new file mode 100644 index 00000000..00f506ab --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeVoteButtonsPositionEvent.java @@ -0,0 +1,9 @@ +package ml.docilealligator.infinityforreddit.Event; + +public class ChangeVoteButtonsPositionEvent { + public boolean voteButtonsOnTheRight; + + public ChangeVoteButtonsPositionEvent(boolean voteButtonsOnTheRight) { + this.voteButtonsOnTheRight = voteButtonsOnTheRight; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java index e5f8c2f3..921763c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java @@ -51,6 +51,7 @@ import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity import ml.docilealligator.infinityforreddit.Adapter.PostRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent; import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; @@ -275,6 +276,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false); boolean needBlurNsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_NSFW_KEY, true); boolean needBlurSpoiler = mSharedPreferences.getBoolean(SharedPreferencesUtils.BLUR_SPOILER_KEY, false); + boolean voteButtonsOnTheRight = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY, false); PostViewModel.Factory factory; @@ -288,7 +290,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase, accessToken, postType, true, needBlurNsfw, needBlurSpoiler, - new PostRecyclerViewAdapter.Callback() { + voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -348,7 +350,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase, accessToken, postType, displaySubredditName, needBlurNsfw, needBlurSpoiler, - new PostRecyclerViewAdapter.Callback() { + voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -393,7 +395,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase, accessToken, postType, true, needBlurNsfw, needBlurSpoiler, - new PostRecyclerViewAdapter.Callback() { + voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -431,7 +433,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase, accessToken, postType, true, needBlurNsfw, needBlurSpoiler, - new PostRecyclerViewAdapter.Callback() { + voteButtonsOnTheRight, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -625,6 +627,12 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } } + @Subscribe + public void onChangeVoteButtonsPositionEvent(ChangeVoteButtonsPositionEvent event) { + mAdapter.setVoteButtonsPosition(event.voteButtonsOnTheRight); + refreshAdapter(); + } + @Subscribe public void onChangeNSFWBlurEvent(ChangeNSFWBlurEvent event) { mAdapter.setBlurNSFW(event.needBlurNSFW); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java index 9e366424..dcc1c201 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/MainPreferenceFragment.java @@ -19,6 +19,7 @@ import javax.inject.Inject; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; @@ -47,12 +48,13 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY); SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); + SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY); SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY); SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY); SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY); ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY); - if(amoledDarkSwitch != null) { + if (amoledDarkSwitch != null) { amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> { if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) { EventBus.getDefault().post(new RecreateActivityEvent()); @@ -62,7 +64,7 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { }); } - if(immersiveInterfaceSwitch != null) { + if (immersiveInterfaceSwitch != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { immersiveInterfaceSwitch.setVisible(true); immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> { @@ -74,6 +76,13 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { } } + if (voteButtonsOnTheRightSwitch != null) { + voteButtonsOnTheRightSwitch.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeVoteButtonsPositionEvent((Boolean) newValue)); + return true; + }); + } + if (nsfwSwitch != null) { nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java index 334aff47..b11f4c32 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java @@ -29,6 +29,7 @@ public class SharedPreferencesUtils { public static final String CONTENT_FONT_SIZE_KEY = "content_font_size"; public static final String AMOLED_DARK_KEY = "amoled_dark"; public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface"; + public static final String VOTE_BUTTONS_ON_THE_RIGHT_KEY = "vote_buttons_on_the_right"; public static final String SORT_TYPE_BEST_POST = "sort_type_best_post"; public static final String SORT_TIME_BEST_POST = "sort_time_best_post"; public static final String SORT_TYPE_ALL_POST = "sort_type_all_post"; diff --git a/app/src/main/res/drawable-hdpi/ic_arrow_downward_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_arrow_downward_black_24dp.png deleted file mode 100644 index b848197a5e664e57f8c501be7ed8e3f18b275181..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 185 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8gQtsQNCo5DE3Qn<0Rqeyu2jE? z{P+1v|1qxX36f@CAAH-#_~W^Dvd4r2am;@g+HWa!l#cz!?9TbNu|k0wldT1B8K8kEe@cNCo5D%e%Rl40u`}GJC!D z?wvF0hs4*34?w v?@Z%ydDUlXrCS$u>*@V%_KMR2%%b!2mQMA!WnH2RbQgoCtDnm{r-UW|C3r`J diff --git a/app/src/main/res/drawable-mdpi/ic_arrow_downward_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_arrow_downward_black_24dp.png deleted file mode 100644 index 3cc4b130c57977187c3ca2a924502a6347896ca5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_+iP)`@fkP61Prw=kZIEXM`+`@c{ z@$R2pj0^_f_)eD2i`x_SmcQVl?gvft&{KjcTB$6zI&%`v-sUx!$?)7^ljxFF3ha~m q8j97FAIv#fa&D$YvD&ih>zIFeIHkVZ{*4!C0fVQjpUXO@geCw9oibqn diff --git a/app/src/main/res/drawable-mdpi/ic_arrow_upward_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_arrow_upward_black_24dp.png deleted file mode 100644 index 368eb65f6e5e93d71ed2a38fdcb7bc090dcf843a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_+iC{Gv1kP61Prvtef40u>BTJ}G` zSS5XOZ}bX*2`x%`e?#uvpL@JL{YK2amp4M@b)K93+;`%M?&esb^V+O33p$?X6f`Pm v@qcjWImIQZQdF>+l}(`k7Q>H&ugjU%v^WK|m>kOl+QQ)J>gTe~DWM4f1MxPL diff --git a/app/src/main/res/drawable-xhdpi/ic_arrow_downward_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_arrow_downward_black_24dp.png deleted file mode 100644 index 3c147bc50c6d482fddb5582a0f119c821cd84a1f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 221 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0DC7v#hAr*{o&$==l3J_qqxKC)^ zbEmT6#G3xEL+yDRo diff --git a/app/src/main/res/drawable-xxhdpi/ic_arrow_downward_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_arrow_downward_black_24dp.png deleted file mode 100644 index ace750c4d31cab6c54b58e3b00704ac25b183b87..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhaw9(lSrhEy=VJ$IGy5Q6~A#cYP( z#};1H7Fo`JN2$H#;LV%!E9Pk~of33vTIXKdMiwCt1t_t~RwTr1#_c=5_?b;}68bD= z&sXu_+43-FUg5EuIcc_RUIk{w2RtWmteE*A=NZqInU7tA>9Ah@#HnxmLOldbTa z?-I`@kp>3#30CIKv&^2%x$SA#QNXZLwpoFF!m(?8j&qtl8CS4cG?;7(<9Hh cyS>&ja3qE{`K2*00Q#1})78&qol`;+0L@QubpQYW diff --git a/app/src/main/res/drawable-xxhdpi/ic_arrow_upward_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_arrow_upward_black_24dp.png deleted file mode 100644 index 99622e7cf0778b50bac047f1b056598dd4ac17eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhawzIwVihEy=Vy=3Xf>>$8;(Tagl zG48;O;!S6CBYA(QsO2?Yo#d??`6&FGyYQX`j2@axrwBC{#?4`7KNeXilF4*@vRZ)+ zh_X38Ijz{{WU&qB`HxF}%J_ehDNC)jn)JM;Aog3YY9-%OR)3>8rhk|Yx=mntKG*aQ zXA^IHlZs`?1O?4=Tzw6G3X$iewKE(GPMgnjIUni7ETnQW(_!9~f;b?1lFIp)4jXKp zF3n;6vY>JaS5+dTdUL|*eSfN%9JS`iU70L*SJbwcl`F)Pzr*dRhQOVT&*g5iS_HhD qB*`hj$SM-x042Wc_Xc{Pj=@I;Y-qAcQ(cbd;oZ@qq&+j}bJu8{ez{n}N`s`8l4Ef9Gn=bm5G=UdK<%g={CD^NSz(!<^X7@XRXz9%s_O zg7dfh7(AYtv#?xv>3Q3eu{d^xH-kiCF#Ctkr(2j39M7NU?B`TuWcbYJ#I)e~bx!`M z>5Sa5MW0`{upBtQUih7~6Vrib%uvpjUj_*awX5ppPGETOlR=SLr~c5NIR&djnG%3X zq;-Q21YJK-(@?4vRU()h3y0LX2mHO@JZF;OXk;vd$@?2>>VYoNNF9 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_arrow_upward_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_arrow_upward_black_24dp.png deleted file mode 100644 index fca5022c7415c7e6fd08636abf3285eb4dfa2869..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 341 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%&M7z$oMC;uuoF`1bs1&O-?Tt`9X8 zzOAVJ@uT|l#jqo5I}5}(i(8AQGc!M5J@?t1;&YbI=M*nKR{#9GDYH|Nor219Fty}) zu~S{072}iT!VVzHT{xmnr|}sxP*8>usHCorf$_=xgG>7vJ}p0*yULx1@yYc^QI;$d z_Op2?HvB1d;9`8Tp1Fxb;lKHUR~OtFellEe0TK)xj6jwXl*REu(S~uMqC5iwh>+q? zkY|+QP?^sRCU$W!KQCrbzmwI>JAt2};lr$~+rZ#r@O1Ta JS?83{1OVokc%c9Q diff --git a/app/src/main/res/drawable/ic_arrow_downward_black_22dp.xml b/app/src/main/res/drawable/ic_arrow_downward_black_22dp.xml deleted file mode 100644 index c6c587c6..00000000 --- a/app/src/main/res/drawable/ic_arrow_downward_black_22dp.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_arrow_downward_black_24dp.xml b/app/src/main/res/drawable/ic_arrow_downward_black_24dp.xml new file mode 100644 index 00000000..dd7522fd --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_downward_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_arrow_downward_grey_24dp.xml b/app/src/main/res/drawable/ic_arrow_downward_grey_24dp.xml new file mode 100644 index 00000000..bc5c4cf5 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_downward_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_arrow_upward_black_22dp.xml b/app/src/main/res/drawable/ic_arrow_upward_black_22dp.xml deleted file mode 100644 index 150d5218..00000000 --- a/app/src/main/res/drawable/ic_arrow_upward_black_22dp.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml b/app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml new file mode 100644 index 00000000..fb30b2cb --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_arrow_upward_grey_24dp.xml b/app/src/main/res/drawable/ic_arrow_upward_grey_24dp.xml new file mode 100644 index 00000000..e370580a --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_upward_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_bookmark_20dp.xml b/app/src/main/res/drawable/ic_bookmark_20dp.xml deleted file mode 100644 index 6908d298..00000000 --- a/app/src/main/res/drawable/ic_bookmark_20dp.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_baseline_bookmark_24px.xml b/app/src/main/res/drawable/ic_bookmark_black_24dp.xml similarity index 100% rename from app/src/main/res/drawable/ic_baseline_bookmark_24px.xml rename to app/src/main/res/drawable/ic_bookmark_black_24dp.xml diff --git a/app/src/main/res/drawable/ic_bookmark_border_20dp.xml b/app/src/main/res/drawable/ic_bookmark_border_20dp.xml deleted file mode 100644 index d77b4ce5..00000000 --- a/app/src/main/res/drawable/ic_bookmark_border_20dp.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_baseline_bookmark_border_24px.xml b/app/src/main/res/drawable/ic_bookmark_border_black_24dp.xml similarity index 100% rename from app/src/main/res/drawable/ic_baseline_bookmark_border_24px.xml rename to app/src/main/res/drawable/ic_bookmark_border_black_24dp.xml diff --git a/app/src/main/res/drawable/ic_bookmark_border_grey_24dp.xml b/app/src/main/res/drawable/ic_bookmark_border_grey_24dp.xml new file mode 100644 index 00000000..377a705f --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark_border_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_bookmark_grey_24dp.xml b/app/src/main/res/drawable/ic_bookmark_grey_24dp.xml new file mode 100644 index 00000000..3f4a6dd4 --- /dev/null +++ b/app/src/main/res/drawable/ic_bookmark_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_comment_grey_24dp.xml b/app/src/main/res/drawable/ic_comment_grey_24dp.xml new file mode 100644 index 00000000..93d143c8 --- /dev/null +++ b/app/src/main/res/drawable/ic_comment_grey_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_expand_less_black_22dp.xml b/app/src/main/res/drawable/ic_expand_less_grey_24dp.xml similarity index 78% rename from app/src/main/res/drawable/ic_expand_less_black_22dp.xml rename to app/src/main/res/drawable/ic_expand_less_grey_24dp.xml index f7a3985f..6e5840db 100644 --- a/app/src/main/res/drawable/ic_expand_less_black_22dp.xml +++ b/app/src/main/res/drawable/ic_expand_less_grey_24dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/ic_expand_more_black_20dp.xml b/app/src/main/res/drawable/ic_expand_more_grey_24dp.xml similarity index 78% rename from app/src/main/res/drawable/ic_expand_more_black_20dp.xml rename to app/src/main/res/drawable/ic_expand_more_grey_24dp.xml index 2e1e234a..71b8f17a 100644 --- a/app/src/main/res/drawable/ic_expand_more_black_20dp.xml +++ b/app/src/main/res/drawable/ic_expand_more_grey_24dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/ic_outline_more_vert_24px.xml b/app/src/main/res/drawable/ic_more_vert_grey_24dp.xml similarity index 91% rename from app/src/main/res/drawable/ic_outline_more_vert_24px.xml rename to app/src/main/res/drawable/ic_more_vert_grey_24dp.xml index 568cbb4d..69c1029e 100644 --- a/app/src/main/res/drawable/ic_outline_more_vert_24px.xml +++ b/app/src/main/res/drawable/ic_more_vert_grey_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/drawable/ic_outline_share_20px.xml b/app/src/main/res/drawable/ic_outline_share_20px.xml deleted file mode 100644 index 52eda61c..00000000 --- a/app/src/main/res/drawable/ic_outline_share_20px.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_reply_black_20dp.xml b/app/src/main/res/drawable/ic_reply_grey_24dp.xml similarity index 79% rename from app/src/main/res/drawable/ic_reply_black_20dp.xml rename to app/src/main/res/drawable/ic_reply_grey_24dp.xml index 1dd3dfed..979f0eb2 100644 --- a/app/src/main/res/drawable/ic_reply_black_20dp.xml +++ b/app/src/main/res/drawable/ic_reply_grey_24dp.xml @@ -1,4 +1,4 @@ - + diff --git a/app/src/main/res/drawable/ic_outline_share_24px.xml b/app/src/main/res/drawable/ic_share_grey_24dp.xml similarity index 95% rename from app/src/main/res/drawable/ic_outline_share_24px.xml rename to app/src/main/res/drawable/ic_share_grey_24dp.xml index 82ddcec3..86f0e234 100644 --- a/app/src/main/res/drawable/ic_outline_share_24px.xml +++ b/app/src/main/res/drawable/ic_share_grey_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24" android:viewportHeight="24"> diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index 3c1a3330..1e594578 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -83,7 +83,7 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:src="@drawable/ic_arrow_upward_black_22dp" + android:src="@drawable/ic_arrow_upward_grey_24dp" android:tint="@android:color/tab_indicator_text" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -110,7 +110,7 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:src="@drawable/ic_arrow_downward_black_22dp" + android:src="@drawable/ic_arrow_downward_grey_24dp" android:tint="@android:color/tab_indicator_text" app:layout_constraintStart_toEndOf="@+id/score_text_view_item_post_comment" app:layout_constraintEnd_toStartOf="@id/more_button_item_post_comment" @@ -126,8 +126,7 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:src="@drawable/ic_outline_more_vert_24px" - android:tint="@android:color/tab_indicator_text" + android:src="@drawable/ic_more_vert_grey_24dp" android:visibility="gone" app:layout_constraintEnd_toStartOf="@+id/expand_button_item_post_comment" app:layout_constraintTop_toTopOf="parent" @@ -141,7 +140,7 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:src="@drawable/ic_expand_less_black_22dp" + android:src="@drawable/ic_expand_less_grey_24dp" android:tint="@android:color/tab_indicator_text" android:visibility="gone" app:layout_constraintEnd_toStartOf="@+id/save_button_item_post_comment" @@ -156,7 +155,6 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:tint="@android:color/tab_indicator_text" app:layout_constraintEnd_toStartOf="@+id/share_button_item_post_comment" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> @@ -169,8 +167,7 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:src="@drawable/ic_outline_share_20px" - android:tint="@android:color/tab_indicator_text" + android:src="@drawable/ic_share_grey_24dp" app:layout_constraintEnd_toStartOf="@+id/reply_button_item_post_comment" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> @@ -183,8 +180,7 @@ android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" - android:src="@drawable/ic_reply_black_20dp" - android:tint="@android:color/tab_indicator_text" + android:src="@drawable/ic_reply_grey_24dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/app/src/main/res/layout/item_post.xml b/app/src/main/res/layout/item_post.xml index c702e529..5733f9c5 100644 --- a/app/src/main/res/layout/item_post.xml +++ b/app/src/main/res/layout/item_post.xml @@ -256,7 +256,7 @@ android:background="@color/grey" android:visibility="gone"/> - @@ -265,19 +265,108 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="12dp" - android:src="@drawable/ic_arrow_upward_black_24dp" + android:src="@drawable/ic_arrow_upward_grey_24dp" android:tint="@android:color/tab_indicator_text" android:background="?actionBarItemBackground" android:clickable="true" android:focusable="true" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/score_text_view_item_post" /> + + + + + + + + + + + + --> + + + + - - + app:layout_constraintStart_toEndOf="@id/minus_button_item_post" /> + app:layout_constraintEnd_toEndOf="parent" /> diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml index 9d7b574b..338975e4 100644 --- a/app/src/main/res/layout/item_post_detail.xml +++ b/app/src/main/res/layout/item_post_detail.xml @@ -248,70 +248,17 @@ android:tint="@android:color/tab_indicator_text" android:visibility="gone" /> - - + android:layout_height="wrap_content" + android:id="@+id/bottom_constraint_layout_item_post_detail"> - - + app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail" /> + app:layout_constraintEnd_toEndOf="parent" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c0071a81..d8dc8b01 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -287,6 +287,7 @@ Device default Amoled Dark Immersive Interface + Vote Buttons on the Right Lazy Mode Interval Font Size Title Font Size diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index 5f3925f4..575dfd38 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -26,6 +26,17 @@ app:title="@string/settings_immersive_interface_title" app:isPreferenceVisible="false" /> + + + + - -