Allow clearing notes

pull/199/head
M66B 4 years ago
parent 786e0420d2
commit dd2274d1fb

@ -6676,17 +6676,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
}); });
return new AlertDialog.Builder(context) final SimpleTask<Void> task = new SimpleTask<Void>() {
.setView(view)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("notes", etNotes.getText().toString());
args.putInt("color", btnColor.getColor());
new SimpleTask<Void>() {
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id"); long id = args.getLong("id");
@ -6731,11 +6721,37 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) { protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex); Log.unexpectedError(getParentFragmentManager(), ex);
} }
}.execute(getContext(), getActivity(), args, "message:note"); };
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setView(view)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("notes", etNotes.getText().toString());
args.putInt("color", btnColor.getColor());
task.execute(getContext(), getActivity(), args, "message:note");
} }
}) })
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null);
.create();
if (!TextUtils.isEmpty(notes))
builder.setNeutralButton(R.string.title_reset, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("notes", "");
args.putInt("color", Color.TRANSPARENT);
task.execute(getContext(), getActivity(), args, "message:note");
}
});
return builder.create();
} }
@Override @Override

Loading…
Cancel
Save