mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-26 02:48:23 +01:00
Fixed user's icon cannot be shown if the post is sent to user space. Start ViewUserDetailActivity when clicking user name or user icon if the post is sent to user space.
This commit is contained in:
parent
fcc34b45d4
commit
6f4367c459
@ -39,6 +39,7 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import CustomView.AspectRatioGifImageView;
|
import CustomView.AspectRatioGifImageView;
|
||||||
import SubredditDatabase.SubredditRoomDatabase;
|
import SubredditDatabase.SubredditRoomDatabase;
|
||||||
|
import User.UserRoomDatabase;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import jp.wasabeef.glide.transformations.BlurTransformation;
|
import jp.wasabeef.glide.transformations.BlurTransformation;
|
||||||
@ -161,6 +162,39 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||||||
if(holder.getItemViewType() == VIEW_TYPE_POST_DETAIL) {
|
if(holder.getItemViewType() == VIEW_TYPE_POST_DETAIL) {
|
||||||
((PostDetailViewHolder) holder).mTitleTextView.setText(mPost.getTitle());
|
((PostDetailViewHolder) holder).mTitleTextView.setText(mPost.getTitle());
|
||||||
|
|
||||||
|
if(mPost.getSubredditNamePrefixed().equals("u/" + mPost.getAuthor())) {
|
||||||
|
if(mPost.getAuthorIconUrl() == null) {
|
||||||
|
new LoadUserDataAsyncTask(UserRoomDatabase.getDatabase(mActivity).userDao(), mPost.getAuthor(), mOauthRetrofit, iconImageUrl -> {
|
||||||
|
if(mActivity != null && getItemCount() > 0) {
|
||||||
|
if(!iconImageUrl.equals("")) {
|
||||||
|
mGlide.load(iconImageUrl)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.error(mGlide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||||
|
.into(((PostDetailViewHolder) holder).mSubredditIconGifImageView);
|
||||||
|
} else {
|
||||||
|
mGlide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.into(((PostDetailViewHolder) holder).mSubredditIconGifImageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(holder.getAdapterPosition() >= 0) {
|
||||||
|
mPost.setAuthorIconUrl(iconImageUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).execute();
|
||||||
|
} else if(!mPost.getAuthorIconUrl().equals("")) {
|
||||||
|
mGlide.load(mPost.getAuthorIconUrl())
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.error(mGlide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||||
|
.into(((PostDetailViewHolder) holder).mSubredditIconGifImageView);
|
||||||
|
} else {
|
||||||
|
mGlide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.into(((PostDetailViewHolder) holder).mSubredditIconGifImageView);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if(mPost.getSubredditIconUrl() == null) {
|
if(mPost.getSubredditIconUrl() == null) {
|
||||||
if(mLoadSubredditIconAsyncTask != null) {
|
if(mLoadSubredditIconAsyncTask != null) {
|
||||||
mLoadSubredditIconAsyncTask.cancel(true);
|
mLoadSubredditIconAsyncTask.cancel(true);
|
||||||
@ -195,6 +229,7 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.into(((PostDetailViewHolder) holder).mSubredditIconGifImageView);
|
.into(((PostDetailViewHolder) holder).mSubredditIconGifImageView);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (mPost.getVoteType()) {
|
switch (mPost.getVoteType()) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -659,9 +694,15 @@ class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||||||
ButterKnife.bind(this, itemView);
|
ButterKnife.bind(this, itemView);
|
||||||
|
|
||||||
mSubredditIconNameLinearLayout.setOnClickListener(view -> {
|
mSubredditIconNameLinearLayout.setOnClickListener(view -> {
|
||||||
Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
Intent intent;
|
||||||
|
if(mPost.getSubredditNamePrefixed().equals("u/" + mPost.getAuthor())) {
|
||||||
|
intent = new Intent(mActivity, ViewUserDetailActivity.class);
|
||||||
|
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mPost.getAuthor());
|
||||||
|
} else {
|
||||||
|
intent = new Intent(mActivity, ViewSubredditDetailActivity.class);
|
||||||
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
|
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
|
||||||
mPost.getSubredditNamePrefixed().substring(2));
|
mPost.getSubredditNamePrefixed().substring(2));
|
||||||
|
}
|
||||||
mActivity.startActivity(intent);
|
mActivity.startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -152,6 +152,39 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(postType != PostDataSource.TYPE_SUBREDDIT) {
|
if(postType != PostDataSource.TYPE_SUBREDDIT) {
|
||||||
|
if(author.equals(subredditNamePrefixed)) {
|
||||||
|
if(post.getAuthorIconUrl() == null) {
|
||||||
|
new LoadUserDataAsyncTask(userDao, post.getAuthor(), mOauthRetrofit, iconImageUrl -> {
|
||||||
|
if(mContext != null && getItemCount() > 0) {
|
||||||
|
if(!iconImageUrl.equals("")) {
|
||||||
|
glide.load(iconImageUrl)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.error(glide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||||
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
|
} else {
|
||||||
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(holder.getAdapterPosition() >= 0) {
|
||||||
|
post.setAuthorIconUrl(iconImageUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).execute();
|
||||||
|
} else if(!post.getAuthorIconUrl().equals("")) {
|
||||||
|
glide.load(post.getAuthorIconUrl())
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.error(glide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))))
|
||||||
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
|
} else {
|
||||||
|
glide.load(R.drawable.subreddit_default_icon)
|
||||||
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if(post.getSubredditIconUrl() == null) {
|
if(post.getSubredditIconUrl() == null) {
|
||||||
new LoadSubredditIconAsyncTask(subredditDao, subredditName,
|
new LoadSubredditIconAsyncTask(subredditDao, subredditName,
|
||||||
iconImageUrl -> {
|
iconImageUrl -> {
|
||||||
@ -184,6 +217,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))
|
||||||
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
.into(((DataViewHolder) holder).subredditIconGifImageView);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
((DataViewHolder) holder).subredditNameTextView.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
|
((DataViewHolder) holder).subredditNameTextView.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
|
||||||
((DataViewHolder) holder).subredditNameTextView.setText(subredditNamePrefixed);
|
((DataViewHolder) holder).subredditNameTextView.setText(subredditNamePrefixed);
|
||||||
|
Loading…
Reference in New Issue
Block a user