diff options
author | TacoTheDank <SkytkRSfan3895@gmail.com> | 2021-09-25 01:28:33 +0000 |
---|---|---|
committer | TacoTheDank <SkytkRSfan3895@gmail.com> | 2021-09-25 01:28:33 +0000 |
commit | d1740f77d1692f5c0772833f4683ad4aa464f8aa (patch) | |
tree | 978d2fcbd2652c95383e78d00772b1a6099e0822 /app/src/main/java/ml/docilealligator | |
parent | a5ca6ac2bcc82c339706a84d4949c0f4b4e33540 (diff) | |
download | infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.tar infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.tar.gz infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.tar.bz2 infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.tar.lz infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.tar.xz infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.tar.zst infinity-for-reddit-d1740f77d1692f5c0772833f4683ad4aa464f8aa.zip |
Fix some deprecations
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
15 files changed, 60 insertions, 60 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java index c6f7ee56..9d9b0843 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java @@ -35,7 +35,7 @@ public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<Ack @Override public void onBindViewHolder(@NonNull AcknowledgementViewHolder holder, int position) { - Acknowledgement acknowledgement = acknowledgements.get(holder.getAdapterPosition()); + Acknowledgement acknowledgement = acknowledgements.get(holder.getBindingAdapterPosition()); if (acknowledgement != null) { holder.nameTextView.setText(acknowledgement.getName()); holder.introductionTextView.setText(acknowledgement.getIntroduction()); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java index 5f233a53..cfe0d799 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java @@ -91,7 +91,7 @@ public class AwardRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView. coinTextView.setTextColor(primaryTextColor); itemView.setOnClickListener(view -> { - itemOnClickListener.onClick(awards.get(getAdapterPosition())); + itemOnClickListener.onClick(awards.get(getBindingAdapterPosition())); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java index 4d738aa3..399726d0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java @@ -44,7 +44,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl @Override public void onBindViewHolder(@NonNull FlairViewHolder holder, int position) { - if (flairs.get(holder.getAdapterPosition()).isEditable()) { + if (flairs.get(holder.getBindingAdapterPosition()).isEditable()) { holder.editFlairImageView.setVisibility(View.VISIBLE); holder.editFlairImageView.setOnClickListener(view -> { View dialogView = ((Activity) context).getLayoutInflater().inflate(R.layout.dialog_edit_flair, null); @@ -59,7 +59,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl .setView(dialogView) .setPositiveButton(R.string.ok, (dialogInterface, i) -> { - Flair flair = flairs.get(holder.getAdapterPosition()); + Flair flair = flairs.get(holder.getBindingAdapterPosition()); flair.setText(flairEditText.getText().toString()); itemClickListener.onClick(flair); }) @@ -68,13 +68,13 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl }); } - if (flairs.get(holder.getAdapterPosition()).isEditable() && flairs.get(holder.getAdapterPosition()).getText().equals("")) { + if (flairs.get(holder.getBindingAdapterPosition()).isEditable() && flairs.get(holder.getBindingAdapterPosition()).getText().equals("")) { holder.itemView.setOnClickListener(view -> holder.editFlairImageView.performClick()); } else { - holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getAdapterPosition()))); + holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getBindingAdapterPosition()))); } - holder.flairTextView.setText(flairs.get(holder.getAdapterPosition()).getText()); + holder.flairTextView.setText(flairs.get(holder.getBindingAdapterPosition()).getText()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java index a077569e..89bae0c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java @@ -106,8 +106,8 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - if (!mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl().equals("")) { - glide.load(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl()) + if (!mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl().equals("")) { + glide.load(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(glide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) @@ -117,16 +117,16 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .into(((UserViewHolder) viewHolder).iconGifImageView); } - ((UserViewHolder) viewHolder).userNameTextView.setText(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getName()); + ((UserViewHolder) viewHolder).userNameTextView.setText(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getName()); - if(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).isFavorite()) { + if(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) { ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); } else { ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); } } else if (viewHolder instanceof FavoriteUserViewHolder) { - if (!mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl().equals("")) { - glide.load(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl()) + if (!mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getIconUrl().equals("")) { + glide.load(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(glide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) @@ -136,9 +136,9 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .into(((FavoriteUserViewHolder) viewHolder).iconGifImageView); } - ((FavoriteUserViewHolder) viewHolder).userNameTextView.setText(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getName()); + ((FavoriteUserViewHolder) viewHolder).userNameTextView.setText(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getName()); - if(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).isFavorite()) { + if(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).isFavorite()) { ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); } else { ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); @@ -205,7 +205,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc userNameTextView.setTextColor(mPrimaryTextColor); itemView.setOnClickListener(view -> { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { Intent intent = new Intent(mContext, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mFavoriteSubscribedUserData.get(position).getName()); @@ -214,7 +214,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc }); favoriteImageView.setOnClickListener(view -> { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { if(mFavoriteSubscribedUserData.get(position).isFavorite()) { favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); @@ -225,7 +225,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(false); } @@ -235,7 +235,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(true); } @@ -251,7 +251,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(true); } @@ -261,7 +261,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(false); } @@ -290,7 +290,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc itemView.setOnClickListener(view -> { int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { Intent intent = new Intent(mContext, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mSubscribedUserData.get(position).getName()); @@ -301,7 +301,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc favoriteImageView.setOnClickListener(view -> { int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { if(mSubscribedUserData.get(position).isFavorite()) { @@ -313,7 +313,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(false); } @@ -323,7 +323,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(true); } @@ -339,7 +339,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(true); } @@ -349,7 +349,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(false); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java index 2c283669..3925d59c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java @@ -201,7 +201,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof DataViewHolder) { - Message message = getItem(holder.getAdapterPosition()); + Message message = getItem(holder.getBindingAdapterPosition()); if (message != null) { ArrayList<Message> replies = message.getReplies(); Message displayedMessage; @@ -240,7 +240,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl } else if (mMessageType == FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE) { Intent intent = new Intent(mContext, ViewPrivateMessagesActivity.class); intent.putExtra(ViewPrivateMessagesActivity.EXTRA_PRIVATE_MESSAGE, message); - intent.putExtra(ViewPrivateMessagesActivity.EXTRA_MESSAGE_POSITION, holder.getAdapterPosition()); + intent.putExtra(ViewPrivateMessagesActivity.EXTRA_MESSAGE_POSITION, holder.getBindingAdapterPosition()); mContext.startActivity(intent); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java index 580e7fec..038f1744 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java @@ -116,7 +116,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< int offset = (mFavoriteMultiReddits != null && mFavoriteMultiReddits.size() > 0) ? mFavoriteMultiReddits.size() + 2 : 0; - MultiReddit multiReddit = mMultiReddits.get(holder.getAdapterPosition() - offset); + MultiReddit multiReddit = mMultiReddits.get(holder.getBindingAdapterPosition() - offset); name = multiReddit.getDisplayName(); iconUrl = multiReddit.getIconUrl(); if(multiReddit.isFavorite()) { @@ -134,7 +134,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(false); } @@ -144,7 +144,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(true); } @@ -160,7 +160,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(true); } @@ -170,7 +170,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(false); } @@ -202,7 +202,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< } ((MultiRedditViewHolder) holder).multiRedditNameTextView.setText(name); } else if (holder instanceof FavoriteMultiRedditViewHolder) { - MultiReddit multiReddit = mFavoriteMultiReddits.get(holder.getAdapterPosition() - 1); + MultiReddit multiReddit = mFavoriteMultiReddits.get(holder.getBindingAdapterPosition() - 1); String name = multiReddit.getDisplayName(); String iconUrl = multiReddit.getIconUrl(); if(multiReddit.isFavorite()) { @@ -220,7 +220,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(false); } @@ -230,7 +230,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(true); } @@ -246,7 +246,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(true); } @@ -256,7 +256,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(false); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java index d6d4c938..e8c92df3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java @@ -86,7 +86,7 @@ public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<Rec usageTextView = (TextView) itemView; usageTextView.setOnClickListener(view -> { - onItemClickListener.onClick(postFilterUsages.get(getAdapterPosition())); + onItemClickListener.onClick(postFilterUsages.get(getBindingAdapterPosition())); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java index 190b8ad5..8fe78d79 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java @@ -117,10 +117,10 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { Message message; - if (holder.getAdapterPosition() == 0) { + if (holder.getBindingAdapterPosition() == 0) { message = mMessage; } else { - message = mMessage.getReplies().get(holder.getAdapterPosition() - 1); + message = mMessage.getReplies().get(holder.getBindingAdapterPosition() - 1); } if (message != null) { if (holder instanceof MessageViewHolder) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java index 5e5572ff..80e57a5a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java @@ -42,9 +42,9 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl if (holder instanceof ReasonViewHolder) { ReportReason reportReason; if (position >= generalReasons.size()) { - reportReason = rules.get(holder.getAdapterPosition() - generalReasons.size()); + reportReason = rules.get(holder.getBindingAdapterPosition() - generalReasons.size()); } else { - reportReason = generalReasons.get(holder.getAdapterPosition()); + reportReason = generalReasons.get(holder.getBindingAdapterPosition()); } ((ReasonViewHolder) holder).reasonTextView.setText(reportReason.getReportReason()); ((ReasonViewHolder) holder).checkBox.setChecked(reportReason.isSelected()); @@ -119,10 +119,10 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl } } - if (getAdapterPosition() >= generalReasons.size()) { - rules.get(getAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked()); + if (getBindingAdapterPosition() >= generalReasons.size()) { + rules.get(getBindingAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked()); } else { - generalReasons.get(getAdapterPosition()).setSelected(checkBox.isChecked()); + generalReasons.get(getBindingAdapterPosition()).setSelected(checkBox.isChecked()); } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java index 51d55400..454ecdd4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java @@ -82,11 +82,11 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler @Override public void onBindViewHolder(@NonNull RuleViewHolder holder, int position) { - holder.shortNameTextView.setText(rules.get(holder.getAdapterPosition()).getShortName()); - if (rules.get(holder.getAdapterPosition()).getDescriptionHtml() == null) { + holder.shortNameTextView.setText(rules.get(holder.getBindingAdapterPosition()).getShortName()); + if (rules.get(holder.getBindingAdapterPosition()).getDescriptionHtml() == null) { holder.descriptionMarkwonView.setVisibility(View.GONE); } else { - markwon.setMarkdown(holder.descriptionMarkwonView, rules.get(holder.getAdapterPosition()).getDescriptionHtml()); + markwon.setMarkdown(holder.descriptionMarkwonView, rules.get(holder.getBindingAdapterPosition()).getDescriptionHtml()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java index f4da7bd7..35cf33e7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java @@ -82,12 +82,12 @@ public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<Recy itemView.setOnClickListener(view -> { if (recentSearchQueries != null && !recentSearchQueries.isEmpty()) { - itemOnClickListener.onClick(recentSearchQueries.get(getAdapterPosition()).getSearchQuery()); + itemOnClickListener.onClick(recentSearchQueries.get(getBindingAdapterPosition()).getSearchQuery()); } }); deleteImageView.setOnClickListener(view -> { - itemOnClickListener.onDelete(recentSearchQueries.get(getAdapterPosition())); + itemOnClickListener.onDelete(recentSearchQueries.get(getBindingAdapterPosition())); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java index e6bbe441..ad57d3ba 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java @@ -39,10 +39,10 @@ public class SelectedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof SubredditViewHolder) { - ((SubredditViewHolder) holder).subredditNameTextView.setText(subreddits.get(holder.getAdapterPosition())); + ((SubredditViewHolder) holder).subredditNameTextView.setText(subreddits.get(holder.getBindingAdapterPosition())); ((SubredditViewHolder) holder).deleteButton.setOnClickListener(view -> { - subreddits.remove(holder.getAdapterPosition()); - notifyItemRemoved(holder.getAdapterPosition()); + subreddits.remove(holder.getBindingAdapterPosition()); + notifyItemRemoved(holder.getBindingAdapterPosition()); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java index 1f05380b..d260bb0d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java @@ -43,7 +43,7 @@ public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerV @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof UserFlairViewHolder) { - UserFlair userFlair = userFlairs.get(holder.getAdapterPosition()); + UserFlair userFlair = userFlairs.get(holder.getBindingAdapterPosition()); if (userFlair.getHtmlText() == null || userFlair.getHtmlText().equals("")) { ((UserFlairViewHolder) holder).userFlairHtmlTextView.setText(userFlair.getText()); } else { @@ -77,11 +77,11 @@ public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerV editUserFlairImageView.setColorFilter(customThemeWrapper.getPrimaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); itemView.setOnClickListener(view -> { - itemClickListener.onClick(userFlairs.get(getAdapterPosition()), false); + itemClickListener.onClick(userFlairs.get(getBindingAdapterPosition()), false); }); editUserFlairImageView.setOnClickListener(view -> { - itemClickListener.onClick(userFlairs.get(getAdapterPosition()), true); + itemClickListener.onClick(userFlairs.get(getBindingAdapterPosition()), true); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java index 465a31eb..5078692d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java @@ -120,6 +120,6 @@ public class APIUtils { } public static RequestBody getRequestBody(String s) { - return RequestBody.create(MediaType.parse("text/plain"), s); + return RequestBody.create(s, MediaType.parse("text/plain")); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java index c7b5f728..e0bf7c25 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java @@ -50,7 +50,7 @@ public class UploadImageUtils { image.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] byteArray = stream.toByteArray(); - RequestBody fileBody = RequestBody.create(MediaType.parse("application/octet-stream"), byteArray); + RequestBody fileBody = RequestBody.create(byteArray, MediaType.parse("application/octet-stream")); MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", "post_image.jpg", fileBody); RedditAPI uploadMediaToAWSApi = uploadMediaRetrofit.create(RedditAPI.class); |