aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-05-02 14:26:45 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-05-02 14:26:45 +0000
commit93af286d553084a8b85ae8b8baa5fc7463729f5f (patch)
tree89753dbfae54f44aa4592815b95b4ab31d22a3b9 /app/src/main/java/ml/docilealligator/infinityforreddit
parentae98fd8a08d2f65415403b3159f3303bdd350978 (diff)
downloadinfinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.tar
infinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.tar.gz
infinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.tar.bz2
infinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.tar.lz
infinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.tar.xz
infinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.tar.zst
infinity-for-reddit-93af286d553084a8b85ae8b8baa5fc7463729f5f.zip
Sharing user and subreddit is now available.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java18
2 files changed, 22 insertions, 6 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index b0148cdd..d83ba1ee 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -706,6 +706,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
sidebarIntent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, subredditName);
startActivity(sidebarIntent);
return true;
+ case R.id.action_share_view_subreddit_detail_activity:
+ Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ shareIntent.setType("text/plain");
+ shareIntent.putExtra(Intent.EXTRA_TEXT, "https://www.reddit.com/r/" + subredditName);
+ if (shareIntent.resolveActivity(getPackageManager()) != null) {
+ startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
+ } else {
+ Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
+ }
+ return true;
}
return false;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
index 8af8944c..82acead4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
@@ -280,9 +280,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
userViewModel.getUserLiveData().observe(this, userData -> {
if (userData != null) {
if (userData.getBanner().equals("")) {
- bannerImageView.setOnClickListener(view -> {
- //Do nothing since the user has no banner image
- });
+ bannerImageView.setOnClickListener(null);
} else {
glide.load(userData.getBanner()).into(bannerImageView);
bannerImageView.setOnClickListener(view -> {
@@ -297,9 +295,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
glide.load(getDrawable(R.drawable.subreddit_default_icon))
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
.into(iconGifImageView);
- iconGifImageView.setOnClickListener(view -> {
- //Do nothing since the user has no icon image
- });
+ iconGifImageView.setOnClickListener(null);
} else {
glide.load(userData.getIconUrl())
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
@@ -621,6 +617,16 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
case R.id.action_change_post_layout_view_user_detail_activity:
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
return true;
+ case R.id.action_share_view_user_detail_activity:
+ Intent shareIntent = new Intent(Intent.ACTION_SEND);
+ shareIntent.setType("text/plain");
+ shareIntent.putExtra(Intent.EXTRA_TEXT, "https://www.reddit.com/user/" + username);
+ if (shareIntent.resolveActivity(getPackageManager()) != null) {
+ startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
+ } else {
+ Toast.makeText(this, R.string.no_app, Toast.LENGTH_SHORT).show();
+ }
+ return true;
}
return false;
}