diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/GroupFragment.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/GroupFragment.java index 268998a..0bf1ff0 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/GroupFragment.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/fragment/GroupFragment.java @@ -77,7 +77,7 @@ public class GroupFragment extends NamedFragment { private void showOTPDialog(OTPData data) { new StyledDialogBuilder(requireContext()) .setTitle(R.string.edit_otp_title) - .setItems(R.array.view_edit_delete, (dialog, which) -> { + .setItems(R.array.view_edit_move_delete, (dialog, which) -> { switch(which) { case 0: DialogUtil.showViewCodeDialog(getLayoutInflater(), data, () -> showOTPDialog(data)); @@ -89,6 +89,13 @@ public class GroupFragment extends NamedFragment { }, () -> showOTPDialog(data)); break; case 2: + DialogUtil.showChooseGroupDialog(requireContext(), group -> { + SettingsUtil.addOTP(requireContext(), group, data); + otpListAdapter.remove(data); + saveOTPs(); + }, null); + break; + case 3: new StyledDialogBuilder(requireContext()) .setTitle(R.string.otp_delete_title) .setMessage(R.string.otp_delete_message) diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/otplist/OTPListAdapter.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/otplist/OTPListAdapter.java index d3ece26..8ea36c5 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/otplist/OTPListAdapter.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/otplist/OTPListAdapter.java @@ -54,8 +54,8 @@ public class OTPListAdapter extends RecyclerView.Adapter { OTPData data = items.get(position); holder.setOTPData(data); - holder.getBinding().label.setText(holder.getOTPData().getName()); - holder.getBinding().progress.setVisibility(holder.getOTPData().getType() == OTPType.TOTP ? View.VISIBLE : View.GONE); + holder.getBinding().label.setText(String.format("%s%s", data.getIssuer() == null || data.getIssuer().isEmpty() ? "" : data.getIssuer() + ": ", data.getName())); + holder.getBinding().progress.setVisibility(data.getType() == OTPType.TOTP ? View.VISIBLE : View.GONE); holder.getBinding().getRoot().setOnClickListener(view -> { if(data.getType() != OTPType.HOTP) return; diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/urihandler/URIHandlerActivity.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/urihandler/URIHandlerActivity.java index 2f1a84e..3ef4b6b 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/urihandler/URIHandlerActivity.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/urihandler/URIHandlerActivity.java @@ -54,7 +54,7 @@ public class URIHandlerActivity extends AppCompatActivity { } private void importCodes(OTPData... data) { - DialogUtil.showImportCodeDialog(this, group -> { + DialogUtil.showChooseGroupDialog(this, group -> { for(OTPData d : data) SettingsUtil.addOTP(this, group, d); Toast.makeText(this, R.string.uri_handler_code_added, Toast.LENGTH_SHORT).show(); }, this::finishAndRemoveTask); diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/DialogUtil.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/DialogUtil.java index d0dd8aa..e07c4ce 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/util/DialogUtil.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/util/DialogUtil.java @@ -224,7 +224,7 @@ public class DialogUtil { dialog.show(); } - public static void showImportCodeDialog(Context context, Consumer callback, Runnable onDismiss) { + public static void showChooseGroupDialog(Context context, Consumer callback, Runnable onDismiss) { List groups = SettingsUtil.getGroups(context); String[] groupNames = new String[groups.size() + 1]; diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index cafe112..b96172b 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -50,9 +50,10 @@ Name fehlt OTP-Migration Du scheinst zu versuchen, Codes aus einer anderen App zu importieren. Willst du alle Codes in diese Gruppe importieren? - + Anzeigen Bearbeiten + In andere Gruppe verschieben Löschen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index faa29d7..b49c34e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -90,9 +90,10 @@ Missing name OTP Migration It seems like you\'re trying to import OTP codes from another app. Do you want to import all codes into this group? - + View Edit + Move to other group Delete