Added account/identity copy

This commit is contained in:
M66B
2019-08-13 12:07:30 +02:00
parent 3012584eae
commit efba726dc8
5 changed files with 67 additions and 28 deletions

View File

@@ -167,6 +167,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
popupMenu.getMenu().add(Menu.NONE, R.string.title_synchronize_enabled, 1, R.string.title_synchronize_enabled)
.setCheckable(true).setChecked(identity.synchronize);
popupMenu.getMenu().add(Menu.NONE, R.string.title_copy, 2, R.string.title_copy);
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
@@ -174,6 +176,11 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
case R.string.title_synchronize_enabled:
onActionSync(!item.isChecked());
return true;
case R.string.title_copy:
onActionCopy();
return true;
default:
return false;
}
@@ -204,6 +211,14 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
}
}.execute(context, owner, args, "identitty:enable");
}
private void onActionCopy() {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivitySetup.ACTION_EDIT_IDENTITY)
.putExtra("id", identity.id)
.putExtra("copy", true));
}
});
popupMenu.show();