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 0bf1ff0..3f979f7 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 @@ -142,7 +142,8 @@ public class GroupFragment extends NamedFragment { if(vh.getOTPData().getType() == OTPType.TOTP) { long timeDiff = vh.getOTPData().getNextDueTime() - System.currentTimeMillis() / 1000; - vh.getBinding().progress.setProgress((int) ((1 - ((double) timeDiff / vh.getOTPData().getPeriod())) * 100)); + double progress = 1 - ((double) timeDiff / vh.getOTPData().getPeriod()); + vh.getBinding().progress.setImageLevel((int) (progress * 10_000)); } } } 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 8ea36c5..7978a27 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 @@ -55,7 +55,7 @@ public class OTPListAdapter extends RecyclerView.Adapter { holder.setOTPData(data); 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().progress.setVisibility(data.getType() == OTPType.TOTP ? View.VISIBLE : View.INVISIBLE); holder.getBinding().getRoot().setOnClickListener(view -> { if(data.getType() != OTPType.HOTP) return; 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 e07c4ce..912b8b1 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 @@ -127,6 +127,7 @@ public class DialogUtil { binding.inputDigits.setEnabled(!view); binding.inputName.setEnabled(!view); + binding.inputIssuer.setEnabled(!view); binding.inputSecret.setEnabled(!view); binding.inputCounter.setEnabled(!view); binding.inputChecksum.setEnabled(!view); @@ -180,6 +181,7 @@ public class DialogUtil { } public static void showViewCodeDialog(LayoutInflater inflater, @NonNull OTPData initialData, Runnable back) { + // TODO: use better dialogs switch(initialData.getType()) { case HOTP: showHOTPDialog(inflater, initialData, d -> {}, back, true); break; case TOTP: showTOTPDialog(inflater, initialData, d -> {}, back, true); break; diff --git a/app/src/main/res/drawable/progress_circle.xml b/app/src/main/res/drawable/progress_circle.xml new file mode 100644 index 0000000..518d43c --- /dev/null +++ b/app/src/main/res/drawable/progress_circle.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/app/src/main/res/layout/otp_code.xml b/app/src/main/res/layout/otp_code.xml index 51ff1c2..3afba64 100644 --- a/app/src/main/res/layout/otp_code.xml +++ b/app/src/main/res/layout/otp_code.xml @@ -1,5 +1,6 @@ - + android:gravity="center" + android:layout_marginEnd="10dp" + android:layout_marginStart="10dp"> - + + + + + + + \ No newline at end of file