|
|
@ -201,7 +201,11 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
floatingBtn.setOnLongClickListener(new View.OnLongClickListener() { |
|
|
|
floatingBtn.setOnLongClickListener(new View.OnLongClickListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean onLongClick(View v) { |
|
|
|
public boolean onLongClick(View v) { |
|
|
|
boolean b = saveTheToot(textEditor.getText().toString()); |
|
|
|
String contentWarning = null; |
|
|
|
|
|
|
|
if (statusHideText) { |
|
|
|
|
|
|
|
contentWarning = contentWarningEditor.getText().toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean b = saveTheToot(textEditor.getText().toString(), contentWarning); |
|
|
|
if (b) { |
|
|
|
if (b) { |
|
|
|
Toast.makeText(ComposeActivity.this, R.string.action_save_one_toot, Toast.LENGTH_SHORT).show(); |
|
|
|
Toast.makeText(ComposeActivity.this, R.string.action_save_one_toot, Toast.LENGTH_SHORT).show(); |
|
|
|
} |
|
|
|
} |
|
|
@ -269,6 +273,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
Intent intent = getIntent(); |
|
|
|
Intent intent = getIntent(); |
|
|
|
|
|
|
|
|
|
|
|
String[] mentionedUsernames = null; |
|
|
|
String[] mentionedUsernames = null; |
|
|
|
|
|
|
|
ArrayList<String> loadedDraftMediaUris = null; |
|
|
|
inReplyToId = null; |
|
|
|
inReplyToId = null; |
|
|
|
if (intent != null) { |
|
|
|
if (intent != null) { |
|
|
|
inReplyToId = intent.getStringExtra("in_reply_to_id"); |
|
|
|
inReplyToId = intent.getStringExtra("in_reply_to_id"); |
|
|
@ -294,10 +299,15 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
if (startingHideText) { |
|
|
|
if (startingHideText) { |
|
|
|
startingContentWarning = intent.getStringExtra("content_warning"); |
|
|
|
startingContentWarning = intent.getStringExtra("content_warning"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String contentWarning = intent.getStringExtra("saved_toot_content_warning"); |
|
|
|
|
|
|
|
startingHideText = !TextUtils.isEmpty(contentWarning); |
|
|
|
|
|
|
|
if (startingHideText) { |
|
|
|
|
|
|
|
startingContentWarning = contentWarning; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* If come from SavedTootActivity |
|
|
|
// If come from SavedTootActivity
|
|
|
|
* */ |
|
|
|
|
|
|
|
String savedTootText = intent.getStringExtra("saved_toot_text"); |
|
|
|
String savedTootText = intent.getStringExtra("saved_toot_text"); |
|
|
|
if (!TextUtils.isEmpty(savedTootText)) { |
|
|
|
if (!TextUtils.isEmpty(savedTootText)) { |
|
|
|
textEditor.append(savedTootText); |
|
|
|
textEditor.append(savedTootText); |
|
|
@ -306,7 +316,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
String savedJsonUrls = intent.getStringExtra("saved_json_urls"); |
|
|
|
String savedJsonUrls = intent.getStringExtra("saved_json_urls"); |
|
|
|
if (!TextUtils.isEmpty(savedJsonUrls)) { |
|
|
|
if (!TextUtils.isEmpty(savedJsonUrls)) { |
|
|
|
// try to redo a list of media
|
|
|
|
// try to redo a list of media
|
|
|
|
ArrayList<String> playersList = new Gson().fromJson(savedJsonUrls, |
|
|
|
loadedDraftMediaUris = new Gson().fromJson(savedJsonUrls, |
|
|
|
new TypeToken<ArrayList<String>>() { |
|
|
|
new TypeToken<ArrayList<String>>() { |
|
|
|
}.getType()); |
|
|
|
}.getType()); |
|
|
|
} |
|
|
|
} |
|
|
@ -398,6 +408,13 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
statusAlreadyInFlight = false; |
|
|
|
statusAlreadyInFlight = false; |
|
|
|
|
|
|
|
|
|
|
|
// These can only be added after everything affected by the media queue is initialized.
|
|
|
|
// These can only be added after everything affected by the media queue is initialized.
|
|
|
|
|
|
|
|
/* if (loadedDraftMediaUris != null && !loadedDraftMediaUris.isEmpty()) { |
|
|
|
|
|
|
|
for (String uriString : loadedDraftMediaUris) { |
|
|
|
|
|
|
|
Uri uri = Uri.parse(uriString); |
|
|
|
|
|
|
|
long mediaSize = MediaUtils.getMediaSize(getContentResolver(), uri); |
|
|
|
|
|
|
|
pickMedia(uri, mediaSize); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else */ |
|
|
|
if (savedMediaQueued != null) { |
|
|
|
if (savedMediaQueued != null) { |
|
|
|
for (SavedQueuedMedia item : savedMediaQueued) { |
|
|
|
for (SavedQueuedMedia item : savedMediaQueued) { |
|
|
|
addMediaToQueue(item.type, item.preview, item.uri, item.mediaSize); |
|
|
|
addMediaToQueue(item.type, item.preview, item.uri, item.mediaSize); |
|
|
@ -530,16 +547,16 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean saveTheToot(String s) { |
|
|
|
public boolean saveTheToot(String s, @Nullable String contentWarning) { |
|
|
|
if (TextUtils.isEmpty(s)) { |
|
|
|
if (TextUtils.isEmpty(s)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
final TootEntity toot = new TootEntity(); |
|
|
|
final TootEntity toot = new TootEntity(); |
|
|
|
toot.setText(s); |
|
|
|
toot.setText(s); |
|
|
|
|
|
|
|
toot.setContentWarning(contentWarning); |
|
|
|
if (mediaQueued != null && mediaQueued.size() > 0) { |
|
|
|
if (mediaQueued != null && mediaQueued.size() > 0) { |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
for (QueuedMedia q : |
|
|
|
for (QueuedMedia q : mediaQueued) { |
|
|
|
mediaQueued) { |
|
|
|
|
|
|
|
list.add(q.uri.toString()); |
|
|
|
list.add(q.uri.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
String json = new Gson().toJson(list); |
|
|
|
String json = new Gson().toJson(list); |
|
|
@ -679,7 +696,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, |
|
|
|
private boolean onCommitContent(InputContentInfoCompat inputContentInfo, int flags, |
|
|
|
String[] mimeTypes) { |
|
|
|
String[] mimeTypes) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (currentInputContentInfo != null) { |
|
|
|
if (currentInputContentInfo != null) { |
|
|
|
currentInputContentInfo.releasePermission(); |
|
|
|
currentInputContentInfo.releasePermission(); |
|
|
@ -741,7 +758,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void sendStatus(String content, String visibility, boolean sensitive, |
|
|
|
private void sendStatus(String content, String visibility, boolean sensitive, |
|
|
|
String spoilerText) { |
|
|
|
String spoilerText) { |
|
|
|
ArrayList<String> mediaIds = new ArrayList<>(); |
|
|
|
ArrayList<String> mediaIds = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (QueuedMedia item : mediaQueued) { |
|
|
|
for (QueuedMedia item : mediaQueued) { |
|
|
@ -1240,7 +1257,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void showMarkSensitive(boolean show) { |
|
|
|
private void showMarkSensitive(boolean show) { |
|
|
|
showMarkSensitive = show; |
|
|
|
showMarkSensitive = show; |
|
|
|
|
|
|
|
|
|
|
|
if (!showMarkSensitive) { |
|
|
|
if (!showMarkSensitive) { |
|
|
@ -1256,7 +1273,7 @@ public class ComposeActivity extends BaseActivity implements ComposeOptionsFragm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void showContentWarning(boolean show) { |
|
|
|
private void showContentWarning(boolean show) { |
|
|
|
statusHideText = show; |
|
|
|
statusHideText = show; |
|
|
|
if (show) { |
|
|
|
if (show) { |
|
|
|
contentWarningBar.setVisibility(View.VISIBLE); |
|
|
|
contentWarningBar.setVisibility(View.VISIBLE); |
|
|
|