Add option to show next code, Bump version to 1.1 (11)
This commit is contained in:
parent
2ed7dc3968
commit
4a8dfc6694
@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.cringe_studios.code_guard"
|
||||
minSdk 21
|
||||
targetSdk 34
|
||||
versionCode 10
|
||||
versionName "1.0.1"
|
||||
versionCode 11
|
||||
versionName "1.1"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
@ -71,18 +71,18 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata:2.8.3'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.8.3'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.7.7'
|
||||
implementation 'androidx.navigation:navigation-ui:2.7.7'
|
||||
implementation 'androidx.lifecycle:lifecycle-livedata:2.8.5'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.8.5'
|
||||
implementation 'androidx.navigation:navigation-fragment:2.8.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.8.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||
implementation "androidx.biometric:biometric:1.1.0"
|
||||
implementation 'com.cringe_studios:CringeAuthenticatorLibrary:1.6'
|
||||
implementation 'com.google.mlkit:barcode-scanning:17.2.0'
|
||||
implementation 'com.cringe_studios:CringeAuthenticatorLibrary:1.7'
|
||||
implementation 'com.google.mlkit:barcode-scanning:17.3.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
implementation 'androidx.activity:activity:1.9.0'
|
||||
implementation 'androidx.activity:activity:1.9.2'
|
||||
|
||||
def camerax_version = "1.3.4"
|
||||
implementation "androidx.camera:camera-core:${camerax_version}"
|
||||
|
@ -262,6 +262,9 @@ public class SettingsFragment extends NamedFragment {
|
||||
binding.settingsGroupSize.setValue(SettingsUtil.getDigitGroupSize(requireContext()));
|
||||
binding.settingsGroupSize.addOnChangeListener((view, value, fromUser) -> SettingsUtil.setDigitGroupSize(requireContext(), (int) value));
|
||||
|
||||
binding.settingsShowNextCode.setChecked(SettingsUtil.isShowNextCode(requireContext()));
|
||||
binding.settingsShowNextCode.setOnCheckedChangeListener((view, checked) -> SettingsUtil.setShowNextCode(requireContext(), checked));
|
||||
|
||||
binding.settingsCreateBackup.setOnClickListener(view -> {
|
||||
new StyledDialogBuilder(requireContext())
|
||||
.setTitle(R.string.create_backup)
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.cringe_studios.code_guard.model;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.cringe_studios.cringe_authenticator_library.OTP;
|
||||
import com.cringe_studios.cringe_authenticator_library.OTPAlgorithm;
|
||||
import com.cringe_studios.cringe_authenticator_library.OTPException;
|
||||
@ -104,6 +102,10 @@ public class OTPData implements Serializable {
|
||||
return getOTP().getPin();
|
||||
}
|
||||
|
||||
public String getNextPin() throws OTPException {
|
||||
return getOTP().getNextPin();
|
||||
}
|
||||
|
||||
public void incrementCounter() {
|
||||
getOTP().incrementCounter();
|
||||
this.counter = getOTP().getCounter();
|
||||
|
@ -80,6 +80,7 @@ public class OTPListAdapter extends RecyclerView.Adapter<OTPListItem> {
|
||||
}
|
||||
|
||||
holder.getBinding().otpCodeIcon.setVisibility(SettingsUtil.isShowImages(context) ? View.VISIBLE : View.GONE);
|
||||
holder.getBinding().nextOtpCode.setVisibility(SettingsUtil.isShowNextCode(context) ? 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);
|
||||
|
@ -53,6 +53,7 @@ public class OTPListItem extends RecyclerView.ViewHolder {
|
||||
|
||||
public void refresh() throws OTPException {
|
||||
binding.otpCode.setText(formatCode(otpData.getPin()));
|
||||
binding.nextOtpCode.setText(formatCode(otpData.getNextPin()));
|
||||
|
||||
if(otpData.getType() == OTPType.TOTP) {
|
||||
long timeDiff = otpData.getNextDueTime() - System.currentTimeMillis() / 1000;
|
||||
|
@ -268,6 +268,14 @@ public class SettingsUtil {
|
||||
return ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).getBoolean("searchEverywhere", true);
|
||||
}
|
||||
|
||||
public static void setShowNextCode(Context ctx, boolean enable) {
|
||||
ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).edit().putBoolean("showNextCode", enable).apply();
|
||||
}
|
||||
|
||||
public static boolean isShowNextCode(Context ctx) {
|
||||
return ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).getBoolean("showNextCode", false);
|
||||
}
|
||||
|
||||
public static void setHiddenStyle(Context ctx, HiddenStyle style) {
|
||||
ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).edit().putString("hiddenStyle", style.name()).apply();
|
||||
}
|
||||
|
@ -193,6 +193,12 @@
|
||||
android:valueTo="6"
|
||||
android:stepSize="1" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/settings_show_next_code"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/settings_show_next_code" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
|
@ -52,21 +52,36 @@
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/otpCode"
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/otpCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="monospace"
|
||||
android:gravity="top|center"
|
||||
android:textSize="24sp"
|
||||
tools:text="000000" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nextOtpCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
tools:text="111111" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
app:srcCompat="@drawable/progress_circle" />
|
||||
app:srcCompat="@drawable/progress_circle"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageButton
|
||||
android:id="@+id/refresh"
|
||||
|
@ -176,4 +176,5 @@
|
||||
<string name="style_stars">Sterne</string>
|
||||
<string name="style_dots">Punkte</string>
|
||||
<string name="settings_group_size">Gruppengröße für Ziffern</string>
|
||||
<string name="settings_show_next_code">Nächsten Code anzeigen</string>
|
||||
</resources>
|
@ -176,4 +176,5 @@
|
||||
<string name="style_dots">Points</string>
|
||||
<string name="settings_group_size">Taille du groupe de chiffres</string>
|
||||
<string name="backup_create_new_password">Créer avec un nouveau mot de passe</string>
|
||||
<string name="settings_show_next_code">Afficher le code suivant</string>
|
||||
</resources>
|
@ -176,4 +176,5 @@
|
||||
<string name="style_dots">Kropki</string>
|
||||
<string name="settings_group_size">Wielkość grupy cyfr</string>
|
||||
<string name="backup_create_new_password">Utwórz z nowym hasłem</string>
|
||||
<string name="settings_show_next_code">Pokaż następny kod</string>
|
||||
</resources>
|
@ -176,4 +176,5 @@
|
||||
<string name="style_dots">Крапки</string>
|
||||
<string name="settings_group_size">Розмір групи цифр</string>
|
||||
<string name="backup_create_new_password">Створити з новим паролем</string>
|
||||
<string name="settings_show_next_code">Показати наступний код</string>
|
||||
</resources>
|
@ -197,4 +197,5 @@
|
||||
<string name="style_stars">Stars</string>
|
||||
<string name="style_dots">Dots</string>
|
||||
<string name="settings_group_size">Digit group size</string>
|
||||
<string name="settings_show_next_code">Show next code</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user