Delete & redraft
This commit is contained in:
parent
5c1eab2299
commit
938c83f106
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1833,14 +1833,22 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
|
||||||
//Sensitive content
|
//Sensitive content
|
||||||
toot_sensitive.setChecked(status.isSensitive());
|
toot_sensitive.setChecked(status.isSensitive());
|
||||||
if( status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0 ){
|
if( status.getSpoiler_text() != null && status.getSpoiler_text().length() > 0 ){
|
||||||
toot_cw_content.setText(status.getSpoiler_text());
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
toot_cw_content.setText(Html.fromHtml(status.getSpoiler_text(), Html.FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
//noinspection deprecation
|
||||||
|
toot_cw_content.setText(Html.fromHtml(status.getSpoiler_text()));
|
||||||
toot_cw_content.setVisibility(View.VISIBLE);
|
toot_cw_content.setVisibility(View.VISIBLE);
|
||||||
}else {
|
}else {
|
||||||
toot_cw_content.setText("");
|
toot_cw_content.setText("");
|
||||||
toot_cw_content.setVisibility(View.GONE);
|
toot_cw_content.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
String content = status.getContent();
|
String content = status.getContent();
|
||||||
toot_content.setText(content);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
toot_content.setText(Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
//noinspection deprecation
|
||||||
|
toot_content.setText(Html.fromHtml(content));
|
||||||
toot_space_left.setText(String.valueOf(toot_content.length()));
|
toot_space_left.setText(String.valueOf(toot_content.length()));
|
||||||
toot_content.setSelection(toot_content.getText().length());
|
toot_content.setSelection(toot_content.getText().length());
|
||||||
switch (status.getVisibility()){
|
switch (status.getVisibility()){
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class PostActionAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||||
private WeakReference<Context> contextReference;
|
private WeakReference<Context> contextReference;
|
||||||
private boolean muteNotifications;
|
private boolean muteNotifications;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface){
|
public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface){
|
||||||
this.contextReference = new WeakReference<>(context);
|
this.contextReference = new WeakReference<>(context);
|
||||||
this.listener = onPostActionInterface;
|
this.listener = onPostActionInterface;
|
||||||
|
|
|
@ -115,6 +115,7 @@ import fr.gouv.etalab.mastodon.interfaces.OnRetrieveRepliesInterface;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
|
import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
|
||||||
|
import fr.gouv.etalab.mastodon.sqlite.StatusStoredDAO;
|
||||||
import fr.gouv.etalab.mastodon.sqlite.TempMuteDAO;
|
import fr.gouv.etalab.mastodon.sqlite.TempMuteDAO;
|
||||||
|
|
||||||
import static fr.gouv.etalab.mastodon.activities.MainActivity.currentLocale;
|
import static fr.gouv.etalab.mastodon.activities.MainActivity.currentLocale;
|
||||||
|
@ -144,7 +145,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
private final int COMPACT_STATUS = 3;
|
private final int COMPACT_STATUS = 3;
|
||||||
private int conversationPosition;
|
private int conversationPosition;
|
||||||
private List<String> timedMute;
|
private List<String> timedMute;
|
||||||
|
private boolean redraft;
|
||||||
|
|
||||||
|
|
||||||
public StatusListAdapter(Context context, List<String> timedMute, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
public StatusListAdapter(Context context, List<String> timedMute, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
||||||
|
@ -159,6 +160,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
this.targetedId = targetedId;
|
this.targetedId = targetedId;
|
||||||
this.translator = translator;
|
this.translator = translator;
|
||||||
this.timedMute = timedMute;
|
this.timedMute = timedMute;
|
||||||
|
redraft = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
public StatusListAdapter(Context context, RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
||||||
|
@ -172,6 +174,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.targetedId = targetedId;
|
this.targetedId = targetedId;
|
||||||
this.translator = translator;
|
this.translator = translator;
|
||||||
|
redraft = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
public StatusListAdapter(Context context, int position, String targetedId, boolean isOnWifi, int behaviorWithAttachments, int translator, List<Status> statuses){
|
||||||
|
@ -185,6 +188,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
this.conversationPosition = position;
|
this.conversationPosition = position;
|
||||||
this.targetedId = targetedId;
|
this.targetedId = targetedId;
|
||||||
this.translator = translator;
|
this.translator = translator;
|
||||||
|
redraft = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMuted(List<String> timedMute){
|
public void updateMuted(List<String> timedMute){
|
||||||
|
@ -1259,6 +1263,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
popup.getMenu().findItem(R.id.action_timed_mute).setVisible(false);
|
popup.getMenu().findItem(R.id.action_timed_mute).setVisible(false);
|
||||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
||||||
}else {
|
}else {
|
||||||
|
popup.getMenu().findItem(R.id.action_redraft).setVisible(false);
|
||||||
popup.getMenu().findItem(R.id.action_remove).setVisible(false);
|
popup.getMenu().findItem(R.id.action_remove).setVisible(false);
|
||||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_confirm);
|
stringArrayConf = context.getResources().getStringArray(R.array.more_action_confirm);
|
||||||
if( type != RetrieveFeedsAsyncTask.Type.HOME){
|
if( type != RetrieveFeedsAsyncTask.Type.HOME){
|
||||||
|
@ -1270,6 +1275,17 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
AlertDialog.Builder builderInner;
|
AlertDialog.Builder builderInner;
|
||||||
final API.StatusAction doAction;
|
final API.StatusAction doAction;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
|
case R.id.action_redraft:
|
||||||
|
builderInner = new AlertDialog.Builder(context);
|
||||||
|
builderInner.setTitle(stringArrayConf[1]);
|
||||||
|
redraft = true;
|
||||||
|
doAction = API.StatusAction.UNSTATUS;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||||
|
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||||
|
else
|
||||||
|
//noinspection deprecation
|
||||||
|
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||||
|
break;
|
||||||
case R.id.action_remove:
|
case R.id.action_remove:
|
||||||
builderInner = new AlertDialog.Builder(context);
|
builderInner = new AlertDialog.Builder(context);
|
||||||
builderInner.setTitle(stringArrayConf[0]);
|
builderInner.setTitle(stringArrayConf[0]);
|
||||||
|
@ -1523,6 +1539,14 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
if(doAction == API.StatusAction.UNSTATUS ){
|
if(doAction == API.StatusAction.UNSTATUS ){
|
||||||
String targetedId = status.getId();
|
String targetedId = status.getId();
|
||||||
new PostActionAsyncTask(context, doAction, targetedId, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new PostActionAsyncTask(context, doAction, targetedId, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
if( redraft ){
|
||||||
|
long id = new StatusStoredDAO(context, db).insertStatus(status, null);
|
||||||
|
Intent intentToot = new Intent(context, TootActivity.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putLong("restored", id);
|
||||||
|
intentToot.putExtras(b);
|
||||||
|
context.startActivity(intentToot);
|
||||||
|
}
|
||||||
}else if(doAction == API.StatusAction.REPORT ){
|
}else if(doAction == API.StatusAction.REPORT ){
|
||||||
String comment = null;
|
String comment = null;
|
||||||
if( finalInput.getText() != null)
|
if( finalInput.getText() != null)
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
android:id="@+id/action_report"
|
android:id="@+id/action_report"
|
||||||
android:title="@string/more_action_3"
|
android:title="@string/more_action_3"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_redraft"
|
||||||
|
android:title="@string/more_action_9"
|
||||||
|
app:showAsAction="never" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_remove"
|
android:id="@+id/action_remove"
|
||||||
android:title="@string/more_action_4"
|
android:title="@string/more_action_4"
|
||||||
|
|
|
@ -124,6 +124,7 @@
|
||||||
<string name="more_action_6">Share</string>
|
<string name="more_action_6">Share</string>
|
||||||
<string name="more_action_7">Mention</string>
|
<string name="more_action_7">Mention</string>
|
||||||
<string name="more_action_8">Timed mute</string>
|
<string name="more_action_8">Timed mute</string>
|
||||||
|
<string name="more_action_9">Delete & re-draft</string>
|
||||||
<string-array name="more_action_confirm">
|
<string-array name="more_action_confirm">
|
||||||
<item>Mute this account?</item>
|
<item>Mute this account?</item>
|
||||||
<item>Block this account?</item>
|
<item>Block this account?</item>
|
||||||
|
@ -132,6 +133,7 @@
|
||||||
|
|
||||||
<string-array name="more_action_owner_confirm">
|
<string-array name="more_action_owner_confirm">
|
||||||
<item>Remove this toot?</item>
|
<item>Remove this toot?</item>
|
||||||
|
<item>Delete & re-draft this toot?</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<plurals name="preview_replies">
|
<plurals name="preview_replies">
|
||||||
|
|
Loading…
Reference in New Issue