Make Placing vote buttons on the right an option.

This commit is contained in:
Alex Ning 2019-10-29 11:20:16 +08:00
parent 3a81ca17e8
commit 168456f57c
42 changed files with 341 additions and 203 deletions

View File

@ -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));
}

View File

@ -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<Recy
private boolean mIsSingleCommentThreadMode;
private boolean mNeedBlurNSFW;
private boolean mNeedBlurSpoiler;
private boolean mVoteButtonsOnTheRight;
private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback;
private boolean isInitiallyLoading;
private boolean isInitiallyLoadingFailed;
@ -113,7 +116,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide,
String accessToken, String accountName, Post post, Locale locale,
String singleCommentId, boolean isSingleCommentThreadMode,
boolean needBlurNSFW, boolean needBlurSpoiler,
boolean needBlurNSFW, boolean needBlurSpoiler, boolean voteButtonsOnTheRight,
CommentRecyclerViewAdapterCallback commentRecyclerViewAdapterCallback) {
mActivity = activity;
mRetrofit = retrofit;
@ -149,6 +152,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
mIsSingleCommentThreadMode = isSingleCommentThreadMode;
mNeedBlurNSFW = needBlurNSFW;
mNeedBlurSpoiler = needBlurSpoiler;
mVoteButtonsOnTheRight = voteButtonsOnTheRight;
mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback;
isInitiallyLoading = true;
isInitiallyLoadingFailed = false;
@ -492,7 +496,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
break;
}
((PostDetailViewHolder) holder).commentButton.setOnClickListener(view -> {
((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<Recy
((PostDetailViewHolder) holder).commentsCountTextView.setText(Integer.toString(mPost.getnComments()));
if (mPost.isSaved()) {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
} else {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
((PostDetailViewHolder) holder).saveButton.setOnClickListener(view -> {
@ -521,13 +525,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
if (mPost.isSaved()) {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
mPost.setSaved(false);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost);
}
@ -535,19 +539,19 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void failed() {
mPost.setSaved(true);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost);
}
});
} else {
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, mPost.getFullName(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
mPost.setSaved(true);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost);
}
@ -555,7 +559,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void failed() {
mPost.setSaved(false);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((PostDetailViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
mCommentRecyclerViewAdapterCallback.updatePost(mPost);
}
@ -655,9 +659,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if (comment.hasReply()) {
if (comment.isExpanded()) {
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_black_22dp);
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
} else {
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
((CommentViewHolder) holder).expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
}
((CommentViewHolder) holder).expandButton.setVisibility(View.VISIBLE);
}
@ -839,9 +843,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
});
if (comment.isSaved()) {
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_20dp);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
} else {
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_20dp);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
((CommentViewHolder) holder).saveButton.setOnClickListener(view -> {
@ -851,14 +855,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void success() {
comment.setSaved(false);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_20dp);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mActivity, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show();
}
@Override
public void failed() {
comment.setSaved(true);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_20dp);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mActivity, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show();
}
});
@ -868,14 +872,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
@Override
public void success() {
comment.setSaved(true);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_20dp);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mActivity, R.string.comment_saved_success, Toast.LENGTH_SHORT).show();
}
@Override
public void failed() {
comment.setSaved(false);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_20dp);
((CommentViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mActivity, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show();
}
});
@ -1469,14 +1473,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
AspectRatioImageView mImageView;
@BindView(R.id.image_view_no_preview_link_item_post_detail)
ImageView mNoPreviewLinkImageView;
@BindView(R.id.bottom_constraint_layout_item_post_detail)
ConstraintLayout mBottomConstraintLayout;
@BindView(R.id.plus_button_item_post_detail)
ImageView mUpvoteButton;
@BindView(R.id.score_text_view_item_post_detail)
TextView mScoreTextView;
@BindView(R.id.minus_button_item_post_detail)
ImageView mDownvoteButton;
@BindView(R.id.comment_button_item_post_detail)
ImageView commentButton;
@BindView(R.id.comments_count_item_post_detail)
TextView commentsCountTextView;
@BindView(R.id.save_button_item_post_detail)
@ -1662,6 +1666,25 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
}
}, mPost.getFullName(), newVoteType);
});
if (mVoteButtonsOnTheRight) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(mBottomConstraintLayout);
constraintSet.clear(mUpvoteButton.getId(), ConstraintSet.START);
constraintSet.clear(mScoreTextView.getId(), ConstraintSet.START);
constraintSet.clear(mDownvoteButton.getId(), ConstraintSet.START);
constraintSet.clear(saveButton.getId(), ConstraintSet.END);
constraintSet.clear(mShareButton.getId(), ConstraintSet.END);
constraintSet.connect(mUpvoteButton.getId(), ConstraintSet.END, mScoreTextView.getId(), ConstraintSet.START);
constraintSet.connect(mScoreTextView.getId(), ConstraintSet.END, mDownvoteButton.getId(), ConstraintSet.START);
constraintSet.connect(mDownvoteButton.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END);
constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.START, saveButton.getId(), ConstraintSet.END);
constraintSet.connect(commentsCountTextView.getId(), ConstraintSet.END, mUpvoteButton.getId(), ConstraintSet.START);
constraintSet.connect(saveButton.getId(), ConstraintSet.START, mShareButton.getId(), ConstraintSet.END);
constraintSet.connect(mShareButton.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START);
constraintSet.setHorizontalBias(commentsCountTextView.getId(), 0);
constraintSet.applyTo(mBottomConstraintLayout);
}
}
}
@ -1726,11 +1749,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
if(commentPosition < mVisibleComments.size()) {
if (mVisibleComments.get(commentPosition).isExpanded()) {
collapseChildren(commentPosition);
expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
expandButton.setImageResource(R.drawable.ic_expand_more_grey_24dp);
} else {
expandChildren(commentPosition);
mVisibleComments.get(commentPosition).setExpanded(true);
expandButton.setImageResource(R.drawable.ic_expand_less_black_22dp);
expandButton.setImageResource(R.drawable.ic_expand_less_grey_24dp);
}
}
}

View File

@ -295,9 +295,9 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
});
if (comment.isSaved()) {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_20dp);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
} else {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_20dp);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
((DataViewHolder) holder).saveButton.setOnClickListener(view -> {
@ -307,14 +307,14 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
@Override
public void success() {
comment.setSaved(false);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_20dp);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mContext, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show();
}
@Override
public void failed() {
comment.setSaved(true);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_20dp);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mContext, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show();
}
});
@ -324,14 +324,14 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
@Override
public void success() {
comment.setSaved(true);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_20dp);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mContext, R.string.comment_saved_success, Toast.LENGTH_SHORT).show();
}
@Override
public void failed() {
comment.setSaved(false);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_20dp);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mContext, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show();
}
});

View File

@ -20,6 +20,8 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.content.ContextCompat;
import androidx.paging.PagedListAdapter;
import androidx.recyclerview.widget.DiffUtil;
@ -96,6 +98,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
private boolean canStartActivity = true;
private int mPostType;
private boolean mDisplaySubredditName;
private boolean mVoteButtonsOnTheRight;
private boolean mNeedBlurNSFW;
private boolean mNeedBlurSpoiler;
private NetworkState networkState;
@ -104,7 +107,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
public PostRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, Retrofit retrofit,
RedditDataRoomDatabase redditDataRoomDatabase, String accessToken,
int postType, boolean displaySubredditName, boolean needBlurNSFW,
boolean needBlurSpoiler, Callback callback) {
boolean needBlurSpoiler, boolean voteButtonsOnTheRight, Callback callback) {
super(DIFF_CALLBACK);
if (context != null) {
mContext = context;
@ -115,6 +118,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
mDisplaySubredditName = displaySubredditName;
mNeedBlurNSFW = needBlurNSFW;
mNeedBlurSpoiler = needBlurSpoiler;
mVoteButtonsOnTheRight = voteButtonsOnTheRight;
mGlide = Glide.with(mContext.getApplicationContext());
mRedditDataRoomDatabase = redditDataRoomDatabase;
mUserDao = redditDataRoomDatabase.userDao();
@ -615,9 +619,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((DataViewHolder) holder).commentsCountTextView.setText(Integer.toString(post.getnComments()));
if (post.isSaved()) {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
} else {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
}
((DataViewHolder) holder).saveButton.setOnClickListener(view -> {
@ -627,13 +631,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
if (post.isSaved()) {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
post.setSaved(false);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mContext, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
@ -641,19 +645,19 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public void failed() {
post.setSaved(true);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mContext, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
});
} else {
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
SaveThing.saveThing(mOauthRetrofit, mAccessToken, post.getFullName(),
new SaveThing.SaveThingListener() {
@Override
public void success() {
post.setSaved(true);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp);
Toast.makeText(mContext, R.string.post_saved_success, Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
@ -661,7 +665,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
@Override
public void failed() {
post.setSaved(false);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_baseline_bookmark_border_24px);
((DataViewHolder) holder).saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp);
Toast.makeText(mContext, R.string.post_saved_failed, Toast.LENGTH_SHORT).show();
EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post));
}
@ -736,6 +740,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
return super.getItemCount();
}
public void setVoteButtonsPosition(boolean voteButtonsOnTheRight) {
mVoteButtonsOnTheRight = voteButtonsOnTheRight;
}
public void setBlurNSFW(boolean needBlurNSFW) {
mNeedBlurNSFW = needBlurNSFW;
}
@ -841,6 +849,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
ImageView noPreviewLinkImageView;
@BindView(R.id.content_text_view_item_post)
TextView contentTextView;
@BindView(R.id.bottom_constraint_layout_item_post)
ConstraintLayout bottomConstraintLayout;
@BindView(R.id.plus_button_item_post)
ImageView upvoteButton;
@BindView(R.id.score_text_view_item_post)
@ -860,6 +870,25 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
scoreTextView.setOnClickListener(view -> {
//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);
}
}
}

View File

@ -0,0 +1,9 @@
package ml.docilealligator.infinityforreddit.Event;
public class ChangeVoteButtonsPositionEvent {
public boolean voteButtonsOnTheRight;
public ChangeVoteButtonsPositionEvent(boolean voteButtonsOnTheRight) {
this.voteButtonsOnTheRight = voteButtonsOnTheRight;
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

View File

@ -1,4 +0,0 @@
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#010101" android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"
android:fillColor="#010101"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M20,12l-1.41,-1.41L13,16.17V4h-2v12.17l-5.58,-5.59L4,12l8,8 8,-8z"
android:fillColor="#FF808080"/>
</vector>

View File

@ -1,4 +0,0 @@
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M4,12l1.41,1.41L11,7.83V20h2V7.83l5.58,5.59L20,12l-8,-8 -8,8z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M4,12l1.41,1.41L11,7.83V20h2V7.83l5.58,5.59L20,12l-8,-8 -8,8z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF808080"
android:pathData="M4,12l1.41,1.41L11,7.83V20h2V7.83l5.58,5.59L20,12l-8,-8 -8,8z"/>
</vector>

View File

@ -1,4 +0,0 @@
<vector android:height="20dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M17,3H7c-1.1,0 -2,0.9 -2,2v16l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -1,4 +0,0 @@
<vector android:height="20dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M17,3L7,3c-1.1,0 -2,0.9 -2,2v16l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF808080"
android:pathData="M17,3L7,3c-1.1,0 -2,0.9 -2,2v16l7,-3 7,3L19,5c0,-1.1 -0.9,-2 -2,-2zM17,18l-5,-2.18L7,18L7,5h10v13z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF808080"
android:pathData="M17,3H7c-1.1,0 -2,0.9 -2,2v16l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF808080"
android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2L4,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM20,4v13.17L18.83,16L4,16L4,4h16zM6,12h12v2L6,14zM6,9h12v2L6,11zM6,6h12v2L6,8z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
<path android:fillColor="#FF808080" android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="20dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="20dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
<path android:fillColor="#FF808080" android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
</vector>

View File

@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:fillColor="#FF808080"
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -1,4 +0,0 @@
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z"/>
</vector>

View File

@ -1,4 +1,4 @@
<vector android:height="24dp" android:viewportHeight="24.0"
android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/>
<path android:fillColor="#FF808080" android:pathData="M10,9V5l-7,7 7,7v-4.1c5,0 8.5,1.6 11,5.1 -1,-5 -4,-10 -11,-11z"/>
</vector>

View File

@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:fillColor="#FF808080"
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92s2.92,-1.31 2.92,-2.92c0,-1.61 -1.31,-2.92 -2.92,-2.92zM18,4c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM6,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM18,20.02c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1z"/>
</vector>

View File

@ -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"/>

View File

@ -256,7 +256,7 @@
android:background="@color/grey"
android:visibility="gone"/>
<androidx.constraintlayout.widget.ConstraintLayout
<!--<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -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" />
<TextView
android:id="@+id/score_text_view_item_post"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/minus_button_item_post" />
<ImageView
android:id="@+id/minus_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_arrow_downward_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_toEndOf="parent" />
<TextView
android:id="@+id/comments_count_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:gravity="center_vertical"
android:textSize="?attr/font_12"
android:textStyle="bold"
android:drawableStart="@drawable/ic_comment_grey_24dp"
android:drawablePadding="12dp"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/save_button_item_post"
app:layout_constraintEnd_toStartOf="@id/plus_button_item_post" />
<ImageView
android:id="@+id/save_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/share_button_item_post" />
<ImageView
android:id="@+id/share_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_share_grey_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="1" />
</androidx.constraintlayout.widget.ConstraintLayout>-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottom_constraint_layout_item_post"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/plus_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_arrow_upward_grey_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/score_text_view_item_post"
android:layout_width="64dp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
@ -290,8 +379,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_arrow_downward_black_24dp"
android:tint="@android:color/tab_indicator_text"
android:src="@drawable/ic_arrow_downward_grey_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
@ -299,35 +387,25 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post" />
<ImageView
android:id="@+id/comment_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_comment_white_24dp"
android:tint="@android:color/tab_indicator_text"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post" />
<TextView
android:id="@+id/comments_count_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:gravity="center_vertical"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0"
android:drawableStart="@drawable/ic_comment_grey_24dp"
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/comment_button_item_post" />
app:layout_constraintStart_toEndOf="@id/minus_button_item_post" />
<ImageView
android:id="@+id/save_button_item_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
@ -342,15 +420,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_outline_share_24px"
android:tint="@android:color/tab_indicator_text"
android:src="@drawable/ic_share_grey_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1" />
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -248,70 +248,17 @@
android:tint="@android:color/tab_indicator_text"
android:visibility="gone" />
<!--<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/plus_button_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="16dp"
android:src="@drawable/ic_arrow_upward_black_24dp"
android:tint="@android:color/tab_indicator_text" />
<TextView
android:id="@+id/score_text_view_item_post_detail"
android:layout_width="64dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/plus_button_item_post_detail"
android:gravity="center"
android:textSize="?attr/font_default" />
<ImageView
android:id="@+id/minus_button_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/score_text_view_item_post_detail"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="16dp"
android:src="@drawable/ic_arrow_downward_black_24dp"
android:tint="@android:color/tab_indicator_text" />
<ImageView
android:id="@+id/share_button_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="16dp"
android:src="@drawable/ic_outline_share_24px"
android:tint="@android:color/tab_indicator_text" />
</RelativeLayout>-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:id="@+id/bottom_constraint_layout_item_post_detail">
<ImageView
android:id="@+id/plus_button_item_post_detail"
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"
@ -323,7 +270,7 @@
<TextView
android:id="@+id/score_text_view_item_post_detail"
android:layout_width="64dp"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="?attr/font_12"
android:textStyle="bold"
@ -336,7 +283,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_arrow_downward_black_24dp"
android:src="@drawable/ic_arrow_downward_grey_24dp"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
@ -345,31 +292,19 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_detail" />
<ImageView
android:id="@+id/comment_button_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_comment_white_24dp"
android:tint="@android:color/tab_indicator_text"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail" />
<TextView
android:id="@+id/comments_count_item_post_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:gravity="center_vertical"
android:textSize="?attr/font_12"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0"
android:drawableStart="@drawable/ic_comment_grey_24dp"
android:drawablePadding="12dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/comment_button_item_post_detail" />
app:layout_constraintStart_toEndOf="@id/minus_button_item_post_detail" />
<ImageView
android:id="@+id/save_button_item_post_detail"
@ -391,15 +326,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:src="@drawable/ic_outline_share_24px"
android:tint="@android:color/tab_indicator_text"
android:src="@drawable/ic_share_grey_24dp"
android:background="?actionBarItemBackground"
android:clickable="true"
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1" />
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -287,6 +287,7 @@
<string name="settings_theme_system_default_summary">Device default</string>
<string name="settings_amoled_dark_title">Amoled Dark</string>
<string name="settings_immersive_interface_title">Immersive Interface</string>
<string name="settings_vote_buttons_on_the_right_title">Vote Buttons on the Right</string>
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
<string name="settings_font_size_title">Font Size</string>
<string name="settings_title_font_size_title">Title Font Size</string>

View File

@ -26,6 +26,17 @@
app:title="@string/settings_immersive_interface_title"
app:isPreferenceVisible="false" />
<SwitchPreference
app:defaultValue="false"
app:key="vote_buttons_on_the_right"
app:title="@string/settings_vote_buttons_on_the_right_title"
app:isPreferenceVisible="true" />
<Preference
app:title="@string/settings_font_size_title"
app:icon="@drawable/ic_font_size_24dp"
app:fragment="ml.docilealligator.infinityforreddit.Settings.FontSizePreferenceFragment" />
<ListPreference
app:defaultValue="2.5"
android:entries="@array/settings_lazy_mode_interval"
@ -35,11 +46,6 @@
app:title="@string/settings_lazy_mode_interval_title"
app:useSimpleSummaryProvider="true" />
<Preference
app:title="@string/settings_font_size_title"
app:icon="@drawable/ic_font_size_24dp"
app:fragment="ml.docilealligator.infinityforreddit.Settings.FontSizePreferenceFragment" />
<SwitchPreference
app:defaultValue="false"
app:key="nsfw"