Check send at result code

This commit is contained in:
M66B 2019-09-11 19:32:17 +02:00
parent 7e250f2de0
commit 4c57d7f744
2 changed files with 32 additions and 25 deletions

View File

@ -3685,36 +3685,34 @@ public class FragmentCompose extends FragmentBase {
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
Context context = getContext();
if (context == null)
return;
if (resultCode == RESULT_OK && intent != null) {
Bundle data = intent.getBundleExtra("args");
long id = data.getLong("id");
long duration = data.getLong("duration");
long time = data.getLong("time");
Bundle data = intent.getBundleExtra("args");
long id = data.getLong("id");
long duration = data.getLong("duration");
long time = data.getLong("time");
Bundle args = new Bundle();
args.putLong("id", id);
args.putLong("wakeup", duration == 0 ? -1 : time);
Bundle args = new Bundle();
args.putLong("id", id);
args.putLong("wakeup", duration == 0 ? -1 : time);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
Long wakeup = args.getLong("wakeup");
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
Long wakeup = args.getLong("wakeup");
DB db = DB.getInstance(context);
db.message().setMessageSnoozed(id, wakeup < 0 ? null : wakeup);
DB db = DB.getInstance(context);
db.message().setMessageSnoozed(id, wakeup < 0 ? null : wakeup);
return null;
}
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "compose:snooze");
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(getFragmentManager(), ex);
}
}.execute(this, args, "compose:snooze");
}
}
}

View File

@ -76,6 +76,15 @@ public class FragmentDialogEx extends DialogFragment {
Log.i("Stop " + this);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
Log.i("Result class=" + this.getClass().getSimpleName() +
" request=" + requestCode + " result=" + resultCode);
Log.logExtras(data);
super.onActivityResult(requestCode, resultCode, data);
}
@NonNull
@Override
public LifecycleOwner getViewLifecycleOwner() {