Small improvement

This commit is contained in:
M66B 2019-01-17 19:22:16 +00:00
parent 94c5c3aa23
commit 1f1332a169
1 changed files with 20 additions and 6 deletions

View File

@ -136,12 +136,20 @@ public class FragmentAnswer extends FragmentBase {
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Helper.setViewsEnabled(view, false);
Bundle args = new Bundle();
args.putLong("id", id);
new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
Helper.setViewsEnabled(view, false);
}
@Override
protected void onPostExecute(Bundle args) {
Helper.setViewsEnabled(view, true);
}
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
@ -156,7 +164,6 @@ public class FragmentAnswer extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.setViewsEnabled(view, true);
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
}
}.execute(FragmentAnswer.this, args, "answer:delete");
@ -167,14 +174,22 @@ public class FragmentAnswer extends FragmentBase {
}
private void onActionSave() {
Helper.setViewsEnabled(view, false);
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("name", etName.getText().toString());
args.putString("text", Html.toHtml(etText.getText()));
new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
Helper.setViewsEnabled(view, false);
}
@Override
protected void onPostExecute(Bundle args) {
Helper.setViewsEnabled(view, true);
}
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
@ -204,7 +219,6 @@ public class FragmentAnswer extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
Helper.setViewsEnabled(view, true);
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
}
}.execute(this, args, "answer:save");