mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
fixed #678
This commit is contained in:
parent
829bbcb469
commit
7ccf5df99c
@ -86,7 +86,6 @@ public interface SharedPreferenceConstants {
|
||||
|
||||
String DEFAULT_QUOTE_FORMAT = "RT @" + FORMAT_PATTERN_NAME + ": " + FORMAT_PATTERN_TEXT;
|
||||
String DEFAULT_SHARE_FORMAT = FORMAT_PATTERN_TITLE + " - " + FORMAT_PATTERN_TEXT;
|
||||
String DEFAULT_IMAGE_UPLOAD_FORMAT = FORMAT_PATTERN_TEXT + " " + FORMAT_PATTERN_LINK;
|
||||
|
||||
String DEFAULT_REFRESH_INTERVAL = "15";
|
||||
boolean DEFAULT_AUTO_REFRESH = true;
|
||||
|
@ -765,13 +765,13 @@ public final class Utils implements Constants {
|
||||
|
||||
public static String getShareStatus(final Context context, final CharSequence title, final CharSequence text) {
|
||||
if (context == null) return null;
|
||||
String share_format = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).getString(
|
||||
String shareFormat = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE).getString(
|
||||
KEY_SHARE_FORMAT, DEFAULT_SHARE_FORMAT);
|
||||
if (TextUtils.isEmpty(share_format)) {
|
||||
share_format = DEFAULT_SHARE_FORMAT;
|
||||
if (TextUtils.isEmpty(shareFormat)) {
|
||||
shareFormat = DEFAULT_SHARE_FORMAT;
|
||||
}
|
||||
if (TextUtils.isEmpty(title)) return ParseUtils.parseString(text);
|
||||
return share_format.replace(FORMAT_PATTERN_TITLE, title).replace(FORMAT_PATTERN_TEXT, text != null ? text : "");
|
||||
return shareFormat.replace(FORMAT_PATTERN_TITLE, title).replace(FORMAT_PATTERN_TEXT, text != null ? text : "");
|
||||
}
|
||||
|
||||
public static String getTabDisplayOption(final Context context) {
|
||||
|
@ -254,7 +254,17 @@ class WebLinkHandlerActivity : Activity(), Constants {
|
||||
handledIntent.action = Intent.ACTION_SEND
|
||||
val text = uri.getQueryParameter("text")
|
||||
val url = uri.getQueryParameter("url")
|
||||
handledIntent.putExtra(Intent.EXTRA_TEXT, Utils.getShareStatus(this, text, url))
|
||||
val sb = StringBuilder()
|
||||
if (!text.isNullOrEmpty()) {
|
||||
sb.append(text)
|
||||
}
|
||||
if (!url.isNullOrEmpty()) {
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append(" ")
|
||||
}
|
||||
sb.append(url)
|
||||
}
|
||||
handledIntent.putExtra(Intent.EXTRA_TEXT, sb.toString())
|
||||
return Pair.create(handledIntent, true)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user