Added copy answer

pull/161/head
M66B 5 years ago
parent 4f68d86316
commit d149a1f790

@ -113,6 +113,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
popupMenu.getMenu().add(Menu.NONE, R.string.title_compose, 1, R.string.title_compose);
popupMenu.getMenu().add(Menu.NONE, R.string.title_answer_hide, 2, R.string.title_answer_hide)
.setCheckable(true).setChecked(answer.hide);
popupMenu.getMenu().add(Menu.NONE, R.string.title_copy, 3, R.string.title_copy);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
@ -121,9 +122,15 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
case R.string.title_compose:
onActionCompose();
return true;
case R.string.title_answer_hide:
onActionHide(!item.isChecked());
return true;
case R.string.title_copy:
onActionCopy();
return true;
default:
return false;
}
@ -158,6 +165,14 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
}
}.execute(context, owner, args, "rule:enable");
}
private void onActionCopy() {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_EDIT_ANSWER)
.putExtra("id", answer.id)
.putExtra("copy", true));
}
});
popupMenu.show();

@ -53,6 +53,7 @@ public class FragmentAnswer extends FragmentBase {
private Group grpReady;
private long id = -1;
private long copy = -1;
private final static int REQUEST_DELETE = 1;
@ -62,7 +63,10 @@ public class FragmentAnswer extends FragmentBase {
// Get arguments
Bundle args = getArguments();
id = (args == null ? -1 : args.getLong("id", -1));
if (args.getBoolean("copy"))
copy = args.getLong("id", -1);
else
id = args.getLong("id", -1);
}
@Override
@ -118,7 +122,7 @@ public class FragmentAnswer extends FragmentBase {
super.onActivityCreated(savedInstanceState);
Bundle args = new Bundle();
args.putLong("id", id);
args.putLong("id", copy < 0 ? id : copy);
new SimpleTask<EntityAnswer>() {
@Override

Loading…
Cancel
Save