Fixes issue #303

This commit is contained in:
stom79 2018-05-12 11:11:17 +02:00
parent a7c1d68195
commit 4240f504cf
6 changed files with 48 additions and 13 deletions

View File

@ -1438,19 +1438,25 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
else
url = status.getUrl();
}
String extra_text = (status.getReblog() != null)?status.getReblog().getAccount().getAcct():status.getAccount().getAcct();
if( extra_text.split("@").length == 1)
extra_text = "@" + extra_text + "@" + Helper.getLiveInstance(context);
else
extra_text = "@" + extra_text;
extra_text += " " + Helper.shortnameToUnicode(":link:",true) + " " + url + "\r\n-\n";
final String contentToot;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
contentToot = Html.fromHtml((status.getReblog() != null)?status.getReblog().getContent():status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
contentToot = Html.fromHtml((status.getReblog() != null)?status.getReblog().getContent():status.getContent()).toString();
extra_text += contentToot;
String extra_text;
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
if( share_details) {
extra_text = (status.getReblog() != null) ? status.getReblog().getAccount().getAcct() : status.getAccount().getAcct();
if (extra_text.split("@").length == 1)
extra_text = "@" + extra_text + "@" + Helper.getLiveInstance(context);
else
extra_text = "@" + extra_text;
extra_text += " " + Helper.shortnameToUnicode(":link:", true) + " " + url + "\r\n-\n";
final String contentToot;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
contentToot = Html.fromHtml((status.getReblog() != null) ? status.getReblog().getContent() : status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
else
//noinspection deprecation
contentToot = Html.fromHtml((status.getReblog() != null) ? status.getReblog().getContent() : status.getContent()).toString();
extra_text += contentToot;
}else {
extra_text = url;
}
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
sendIntent.setType("text/plain");
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));

View File

@ -239,6 +239,19 @@ public class SettingsFragment extends Fragment {
});
boolean share_details = sharedpreferences.getBoolean(Helper.SET_SHARE_DETAILS, true);
final CheckBox set_share_details = rootView.findViewById(R.id.set_share_details);
set_share_details.setChecked(share_details);
set_share_details.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_SHARE_DETAILS, set_share_details.isChecked());
editor.apply();
}
});
boolean multiaccount_actions = sharedpreferences.getBoolean(Helper.SET_ALLOW_CROSS_ACTIONS, true);
final CheckBox set_multiaccount_actions = rootView.findViewById(R.id.set_multiaccount_actions);
set_multiaccount_actions.setChecked(multiaccount_actions);

View File

@ -243,6 +243,7 @@ public class Helper {
public static final String SET_SHOW_BOOKMARK = "set_show_bookmark";
public static final String SET_FULL_PREVIEW = "set_full_preview";
public static final String SET_COMPACT_MODE = "set_compact_mode";
public static final String SET_SHARE_DETAILS = "set_share_details";
public static final int S_512KO = 1;
public static final int S_1MO = 2;
public static final int S_2MO = 3;

View File

@ -171,6 +171,12 @@
android:text="@string/set_compact_mode"
android:layout_height="wrap_content" />
<!-- PUT THE WHOLE CONTENT WHEN SHARING -->
<CheckBox
android:id="@+id/set_share_details"
android:layout_width="wrap_content"
android:text="@string/set_share_details"
android:layout_height="wrap_content" />
<!-- Resize pictures -->
<LinearLayout

View File

@ -169,6 +169,14 @@
android:text="@string/set_compact_mode"
android:layout_height="wrap_content" />
<!-- PUT THE WHOLE CONTENT WHEN SHARING -->
<CheckBox
android:id="@+id/set_share_details"
android:layout_width="wrap_content"
android:text="@string/set_share_details"
android:layout_height="wrap_content" />
<!-- Resize pictures -->
<LinearLayout
android:layout_marginTop="10dp"

View File

@ -534,6 +534,7 @@
<string name="poxy_password">Password</string>
<string name="set_theme">Theme:</string>
<string name="set_compact_mode">Compact mode</string>
<string name="set_share_details">Add toot details when sharing</string>
<string-array translatable="false" name="proxy_type_choice">
<item>HTTP</item>
<item>SOCKS</item>