mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Fix some deprecations
This commit is contained in:
parent
a5ca6ac2bc
commit
d1740f77d1
@ -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());
|
||||
|
@ -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()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user