diff options
author | Docile-Alligator <chineseperson5@gmail.com> | 2022-02-28 10:01:30 +0000 |
---|---|---|
committer | Docile-Alligator <chineseperson5@gmail.com> | 2022-02-28 10:01:30 +0000 |
commit | 2e67298813483a949b52510893541e8cb6b81683 (patch) | |
tree | c6254b6f20f07e28e9394f6301ebb281fe5ea87c /app/src/main/java/ml | |
parent | 405317b4cb51fb389d86e63dbc9f1c028ca9b1c1 (diff) | |
download | infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.tar infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.tar.gz infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.tar.bz2 infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.tar.lz infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.tar.xz infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.tar.zst infinity-for-reddit-2e67298813483a949b52510893541e8cb6b81683.zip |
Show and open r/u_ style subreddits in posts.
Diffstat (limited to 'app/src/main/java/ml')
2 files changed, 19 insertions, 44 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index d64a9d1b..529bed8d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -588,7 +588,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } if (!mHideSubredditAndUserPrefix) { - ((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditNamePrefixed()); + ((PostDetailBaseViewHolder) holder).mSubredditTextView.setText("r/" + mPost.getSubredditName()); ((PostDetailBaseViewHolder) holder).mUserTextView.setText(mPost.getAuthorNamePrefixed()); } else { ((PostDetailBaseViewHolder) holder).mSubredditTextView.setText(mPost.getSubredditName()); @@ -1191,14 +1191,9 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mSubredditTextView.setOnClickListener(view -> { 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, - mPost.getSubredditNamePrefixed().substring(2)); - } + intent = new Intent(mActivity, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, + mPost.getSubredditName()); mActivity.startActivity(intent); }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 2bc5c5df..773e78f6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -483,7 +483,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditName()); ((PostBaseViewHolder) holder).userTextView.setText(post.getAuthor()); } else { - ((PostBaseViewHolder) holder).subredditTextView.setText(post.getSubredditNamePrefixed()); + ((PostBaseViewHolder) holder).subredditTextView.setText("r/" + post.getSubredditName()); ((PostBaseViewHolder) holder).userTextView.setText(authorPrefixed); } @@ -1081,9 +1081,9 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ((PostCompactBaseViewHolder) holder).nameTextView.setTextColor(mSubredditColor); if (mHideSubredditAndUserPrefix) { - ((PostCompactBaseViewHolder) holder).nameTextView.setText(subredditName); + ((PostCompactBaseViewHolder) holder).nameTextView.setText(post.getSubredditName()); } else { - ((PostCompactBaseViewHolder) holder).nameTextView.setText(subredditNamePrefixed); + ((PostCompactBaseViewHolder) holder).nameTextView.setText("r/" + post.getSubredditName()); } } else { if (post.getAuthorIconUrl() == null) { @@ -2201,17 +2201,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie if (post != null) { if (canStartActivity) { canStartActivity = false; - if (post.getSubredditNamePrefixed().startsWith("u/")) { - Intent intent = new Intent(mActivity, ViewUserDetailActivity.class); - intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, - post.getSubredditNamePrefixed().substring(2)); - mActivity.startActivity(intent); - } else { - Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, - post.getSubredditName()); - mActivity.startActivity(intent); - } + Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, + post.getSubredditName()); + mActivity.startActivity(intent); } } }); @@ -2227,16 +2220,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie if (post != null) { if (canStartActivity) { canStartActivity = false; - if (post.getSubredditNamePrefixed().startsWith("u/")) { - Intent intent = new Intent(mActivity, ViewUserDetailActivity.class); - intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, post.getAuthor()); - mActivity.startActivity(intent); - } else { - Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, - post.getSubredditName()); - mActivity.startActivity(intent); - } + Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, + post.getSubredditName()); + mActivity.startActivity(intent); } } }); @@ -3278,17 +3265,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie if (post != null && canStartActivity) { canStartActivity = false; if (mDisplaySubredditName) { - if (post.getSubredditNamePrefixed().startsWith("u/")) { - Intent intent = new Intent(mActivity, ViewUserDetailActivity.class); - intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, - post.getSubredditNamePrefixed().substring(2)); - mActivity.startActivity(intent); - } else { - Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, - post.getSubredditNamePrefixed().substring(2)); - mActivity.startActivity(intent); - } + Intent intent = new Intent(mActivity, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, + post.getSubredditName()); + mActivity.startActivity(intent); } else { Intent intent = new Intent(mActivity, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, post.getAuthor()); |