diff --git a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java index bacf573..9d4ffce 100644 --- a/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java +++ b/app/src/main/java/com/cringe_studios/cringe_authenticator/MainActivity.java @@ -141,13 +141,6 @@ public class MainActivity extends AppCompatActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - - /*if(NavigationUtil.getCurrentFragment(this) instanceof DynamicFragment) { TODO: vs. fabs? - getMenuInflater().inflate(R.menu.menu_dynamic, menu); - return true; - }*/ - if(NavigationUtil.getCurrentFragment(this) instanceof MenuFragment) { getMenuInflater().inflate(R.menu.menu_groups, menu); return true; 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 65c49c4..d3ece26 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 @@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.cringe_studios.cringe_authenticator.R; import com.cringe_studios.cringe_authenticator.databinding.OtpCodeBinding; import com.cringe_studios.cringe_authenticator.model.OTPData; +import com.cringe_studios.cringe_authenticator.util.DialogUtil; import com.cringe_studios.cringe_authenticator_library.OTPException; import com.cringe_studios.cringe_authenticator_library.OTPType; @@ -23,6 +24,8 @@ import java.util.List; public class OTPListAdapter extends RecyclerView.Adapter { + private Context context; + private LayoutInflater inflater; private List items; @@ -32,6 +35,7 @@ public class OTPListAdapter extends RecyclerView.Adapter { private Consumer showMenuCallback; public OTPListAdapter(Context context, Consumer showMenuCallback) { + this.context = context; this.inflater = LayoutInflater.from(context); this.items = new ArrayList<>(); this.handler = new Handler(Looper.getMainLooper()); @@ -58,16 +62,17 @@ public class OTPListAdapter extends RecyclerView.Adapter { // Click delay for HOTP view.setClickable(false); - Toast.makeText(view.getContext(), R.string.hotp_generated_new_code, Toast.LENGTH_SHORT).show(); data.incrementCounter(); try { holder.getBinding().otpCode.setText(data.getPin()); }catch(OTPException e) { - // TODO: show user an error message + DialogUtil.showErrorDialog(context, context.getString(R.string.otp_add_error, e.getMessage() != null ? e.getMessage() : e.toString())); return; } + Toast.makeText(view.getContext(), R.string.hotp_generated_new_code, Toast.LENGTH_SHORT).show(); + handler.postDelayed(() -> view.setClickable(true), 5000); }); diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index dd5fcda..3193ed7 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -44,6 +44,7 @@ Geheimnis Name Intervall + Hinzufügen des OTP-Codes fehlgeschlagen: %s Anzeigen Bearbeiten diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a09d557..6de6646 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -84,6 +84,7 @@ Secret Name Period + Failed to update OTP: %s View Edit