Fix issue #276 - Problem when sharing text with URL

This commit is contained in:
Thomas 2022-11-04 15:49:47 +01:00
parent 3883af2f78
commit 60a1b2bfa4
2 changed files with 102 additions and 94 deletions

View file

@ -852,6 +852,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
boolean fetchSharedMedia = sharedpreferences.getBoolean(getString(R.string.SET_RETRIEVE_METADATA_IF_URL_FROM_EXTERAL), true);
boolean fetchShareContent = sharedpreferences.getBoolean(getString(R.string.SET_SHARE_DETAILS), true);
if (url[0] != null && count == 1 && (fetchShareContent || fetchSharedMedia)) {
if (!url[0].trim().equalsIgnoreCase(sharedText.trim())) {
Bundle b = new Bundle();
b.putString(Helper.ARG_SHARE_TITLE, sharedSubject);
b.putString(Helper.ARG_SHARE_DESCRIPTION, sharedText);
CrossActionHelper.doCrossShare(BaseMainActivity.this, b);
} else {
new Thread(() -> {
if (url[0].startsWith("www."))
url[0] = "http://" + url[0];
@ -949,6 +955,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
}
}).start();
}
} else {
Bundle b = new Bundle();
b.putString(Helper.ARG_SHARE_TITLE, sharedSubject);

View file

@ -434,7 +434,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
}
if (description != null && description.trim().length() > 0) {
statusList.get(position).text += description + "\n\n";
if (!description.contains(url)) {
if (url != null && !description.contains(url)) {
statusList.get(position).text += url;
}
} else if (content != null && content.trim().length() > 0) {