mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-10 20:57:25 +01:00
Sharing user and subreddit is now available.
This commit is contained in:
parent
ae98fd8a08
commit
93af286d55
@ -706,6 +706,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
sidebarIntent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
sidebarIntent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
startActivity(sidebarIntent);
|
startActivity(sidebarIntent);
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -280,9 +280,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
userViewModel.getUserLiveData().observe(this, userData -> {
|
userViewModel.getUserLiveData().observe(this, userData -> {
|
||||||
if (userData != null) {
|
if (userData != null) {
|
||||||
if (userData.getBanner().equals("")) {
|
if (userData.getBanner().equals("")) {
|
||||||
bannerImageView.setOnClickListener(view -> {
|
bannerImageView.setOnClickListener(null);
|
||||||
//Do nothing since the user has no banner image
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
glide.load(userData.getBanner()).into(bannerImageView);
|
glide.load(userData.getBanner()).into(bannerImageView);
|
||||||
bannerImageView.setOnClickListener(view -> {
|
bannerImageView.setOnClickListener(view -> {
|
||||||
@ -297,9 +295,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
glide.load(getDrawable(R.drawable.subreddit_default_icon))
|
glide.load(getDrawable(R.drawable.subreddit_default_icon))
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
||||||
.into(iconGifImageView);
|
.into(iconGifImageView);
|
||||||
iconGifImageView.setOnClickListener(view -> {
|
iconGifImageView.setOnClickListener(null);
|
||||||
//Do nothing since the user has no icon image
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
glide.load(userData.getIconUrl())
|
glide.load(userData.getIconUrl())
|
||||||
.apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))
|
.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:
|
case R.id.action_change_post_layout_view_user_detail_activity:
|
||||||
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag());
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -39,4 +39,10 @@
|
|||||||
android:orderInCategory="6"
|
android:orderInCategory="6"
|
||||||
android:title="@string/action_view_side_bar"
|
android:title="@string/action_view_side_bar"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share_view_subreddit_detail_activity"
|
||||||
|
android:orderInCategory="7"
|
||||||
|
android:title="@string/action_share"
|
||||||
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
@ -31,4 +31,10 @@
|
|||||||
android:orderInCategory="5"
|
android:orderInCategory="5"
|
||||||
android:title="@string/action_change_post_layout"
|
android:title="@string/action_change_post_layout"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_share_view_user_detail_activity"
|
||||||
|
android:orderInCategory="6"
|
||||||
|
android:title="@string/action_share"
|
||||||
|
app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
Loading…
Reference in New Issue
Block a user