Minor fix for sharing users/communities

This commit is contained in:
Balazs Toldi 2023-07-29 22:04:16 +02:00
parent 40b6722e66
commit 72ba41c940
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
2 changed files with 4 additions and 2 deletions

View File

@ -1174,7 +1174,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
} else if (itemId == R.id.action_share_view_subreddit_detail_activity) { } else if (itemId == R.id.action_share_view_subreddit_detail_activity) {
Intent shareIntent = new Intent(Intent.ACTION_SEND); Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain"); shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, mRetrofit.getBaseURL() + qualifiedName); String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + "/" + qualifiedName);
if (shareIntent.resolveActivity(getPackageManager()) != null) { if (shareIntent.resolveActivity(getPackageManager()) != null) {
startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
} else { } else {

View File

@ -1154,7 +1154,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
} else if (itemId == R.id.action_share_view_user_detail_activity) { } else if (itemId == R.id.action_share_view_user_detail_activity) {
Intent shareIntent = new Intent(Intent.ACTION_SEND); Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain"); shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, mRetrofit.getBaseURL() + qualifiedName); String baseURL = mRetrofit.getBaseURL().endsWith("/") ? mRetrofit.getBaseURL() : mRetrofit.getBaseURL() + "/";
shareIntent.putExtra(Intent.EXTRA_TEXT, baseURL + qualifiedName);
if (shareIntent.resolveActivity(getPackageManager()) != null) { if (shareIntent.resolveActivity(getPackageManager()) != null) {
startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); startActivity(Intent.createChooser(shareIntent, getString(R.string.share)));
} else { } else {