Add deletion confirmation (#865)
This commit is contained in:
parent
bf00cfcc4d
commit
ab601c4566
2 changed files with 13 additions and 4 deletions
|
@ -23,6 +23,7 @@ import android.os.Bundle;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.Spanned;
|
||||
import android.view.Menu;
|
||||
|
@ -32,7 +33,6 @@ import com.keylesspalace.tusky.BottomSheetActivity;
|
|||
import com.keylesspalace.tusky.ComposeActivity;
|
||||
import com.keylesspalace.tusky.R;
|
||||
import com.keylesspalace.tusky.ReportActivity;
|
||||
import com.keylesspalace.tusky.TuskyApplication;
|
||||
import com.keylesspalace.tusky.ViewMediaActivity;
|
||||
import com.keylesspalace.tusky.ViewTagActivity;
|
||||
import com.keylesspalace.tusky.ViewVideoActivity;
|
||||
|
@ -210,8 +210,7 @@ public abstract class SFragment extends BaseFragment {
|
|||
return true;
|
||||
}
|
||||
case R.id.status_delete: {
|
||||
timelineCases().delete(id);
|
||||
removeItem(position);
|
||||
showConfirmDeleteDialog(id, position);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -273,5 +272,14 @@ public abstract class SFragment extends BaseFragment {
|
|||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
protected void showConfirmDeleteDialog(final String id, final int position) {
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setMessage(R.string.dialog_delete_toot_warning)
|
||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
|
||||
timelineCases().delete(id);
|
||||
removeItem(position);
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@
|
|||
<string name="dialog_download_image">Download</string>
|
||||
<string name="dialog_message_cancel_follow_request">Revoke the follow request?</string>
|
||||
<string name="dialog_unfollow_warning">Unfollow this account?</string>
|
||||
<string name="dialog_delete_toot_warning">Delete this toot?</string>
|
||||
|
||||
<string name="visibility_public">Public: Post to public timelines</string>
|
||||
<string name="visibility_unlisted">Unlisted: Do not show in public timelines</string>
|
||||
|
|
Loading…
Reference in a new issue