Compare commits

..

4 Commits

18 changed files with 80 additions and 37 deletions

View File

@ -10,12 +10,12 @@
<deviceKey> <deviceKey>
<Key> <Key>
<type value="VIRTUAL_DEVICE_PATH" /> <type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_2_API_34.avd" /> <value value="$USER_HOME$/.android/avd/Pixel_4_XL_API_34.avd" />
</Key> </Key>
</deviceKey> </deviceKey>
</Target> </Target>
</targetSelectedWithDropDown> </targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-04-21T10:28:14.063607866Z" /> <timeTargetWasSelectedWithDropDown value="2024-04-29T19:01:52.695697079Z" />
</State> </State>
</entry> </entry>
</value> </value>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="Git" />
</component> </component>
</project> </project>

View File

@ -11,8 +11,8 @@ android {
applicationId "com.cringe_studios.code_guard" applicationId "com.cringe_studios.code_guard"
minSdk 21 minSdk 21
targetSdk 34 targetSdk 34
versionCode 9 versionCode 11
versionName "1.0.0" versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -68,23 +68,23 @@ dependencies {
} }
} }
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.11.0' implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata:2.7.0' implementation 'androidx.lifecycle:lifecycle-livedata:2.8.5'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.7.0' implementation 'androidx.lifecycle:lifecycle-viewmodel:2.8.5'
implementation 'androidx.navigation:navigation-fragment:2.7.7' implementation 'androidx.navigation:navigation-fragment:2.8.0'
implementation 'androidx.navigation:navigation-ui:2.7.7' implementation 'androidx.navigation:navigation-ui:2.8.0'
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation "androidx.biometric:biometric:1.1.0" implementation "androidx.biometric:biometric:1.1.0"
implementation 'com.cringe_studios:CringeAuthenticatorLibrary:1.6' implementation 'com.cringe_studios:CringeAuthenticatorLibrary:1.7'
implementation 'com.google.mlkit:barcode-scanning:17.2.0' implementation 'com.google.mlkit:barcode-scanning:17.3.0'
implementation 'com.google.code.gson:gson:2.10.1' 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.3" def camerax_version = "1.3.4"
implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}" implementation "androidx.camera:camera-lifecycle:${camerax_version}"

View File

@ -262,6 +262,9 @@ public class SettingsFragment extends NamedFragment {
binding.settingsGroupSize.setValue(SettingsUtil.getDigitGroupSize(requireContext())); binding.settingsGroupSize.setValue(SettingsUtil.getDigitGroupSize(requireContext()));
binding.settingsGroupSize.addOnChangeListener((view, value, fromUser) -> SettingsUtil.setDigitGroupSize(requireContext(), (int) value)); 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 -> { binding.settingsCreateBackup.setOnClickListener(view -> {
new StyledDialogBuilder(requireContext()) new StyledDialogBuilder(requireContext())
.setTitle(R.string.create_backup) .setTitle(R.string.create_backup)

View File

@ -19,6 +19,8 @@ public class IconPack {
} }
public Icon findIconForIssuer(String issuer) { public Icon findIconForIssuer(String issuer) {
if(issuer == null) return null;
for(Icon icon : icons) { for(Icon icon : icons) {
for(String i : icon.getMetadata().getIssuer()) { for(String i : icon.getMetadata().getIssuer()) {
if(issuer.equalsIgnoreCase(i)) { if(issuer.equalsIgnoreCase(i)) {

View File

@ -1,7 +1,5 @@
package com.cringe_studios.code_guard.model; 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.OTP;
import com.cringe_studios.cringe_authenticator_library.OTPAlgorithm; import com.cringe_studios.cringe_authenticator_library.OTPAlgorithm;
import com.cringe_studios.cringe_authenticator_library.OTPException; import com.cringe_studios.cringe_authenticator_library.OTPException;
@ -104,6 +102,10 @@ public class OTPData implements Serializable {
return getOTP().getPin(); return getOTP().getPin();
} }
public String getNextPin() throws OTPException {
return getOTP().getNextPin();
}
public void incrementCounter() { public void incrementCounter() {
getOTP().incrementCounter(); getOTP().incrementCounter();
this.counter = getOTP().getCounter(); this.counter = getOTP().getCounter();

View File

@ -80,6 +80,7 @@ public class OTPListAdapter extends RecyclerView.Adapter<OTPListItem> {
} }
holder.getBinding().otpCodeIcon.setVisibility(SettingsUtil.isShowImages(context) ? View.VISIBLE : View.GONE); 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().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.GONE);
@ -245,8 +246,8 @@ public class OTPListAdapter extends RecyclerView.Adapter<OTPListItem> {
List<OTPData> filtered = new ArrayList<>(); List<OTPData> filtered = new ArrayList<>();
for(OTPData d : allOTPs) { for(OTPData d : allOTPs) {
if(d.getName().toLowerCase().contains(query) if((d.getName() != null && d.getName().toLowerCase().contains(query))
|| d.getIssuer().toLowerCase().contains(query)) filtered.add(d); || (d.getIssuer() != null && d.getIssuer().toLowerCase().contains(query))) filtered.add(d);
} }
filteredItems = filtered; filteredItems = filtered;

View File

@ -53,6 +53,7 @@ public class OTPListItem extends RecyclerView.ViewHolder {
public void refresh() throws OTPException { public void refresh() throws OTPException {
binding.otpCode.setText(formatCode(otpData.getPin())); binding.otpCode.setText(formatCode(otpData.getPin()));
binding.nextOtpCode.setText(formatCode(otpData.getNextPin()));
if(otpData.getType() == OTPType.TOTP) { if(otpData.getType() == OTPType.TOTP) {
long timeDiff = otpData.getNextDueTime() - System.currentTimeMillis() / 1000; long timeDiff = otpData.getNextDueTime() - System.currentTimeMillis() / 1000;

View File

@ -268,6 +268,14 @@ public class SettingsUtil {
return ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).getBoolean("searchEverywhere", true); 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) { public static void setHiddenStyle(Context ctx, HiddenStyle style) {
ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).edit().putString("hiddenStyle", style.name()).apply(); ctx.getSharedPreferences(GENERAL_PREFS_NAME, Context.MODE_PRIVATE).edit().putString("hiddenStyle", style.name()).apply();
} }

View File

@ -193,6 +193,12 @@
android:valueTo="6" android:valueTo="6"
android:stepSize="1" /> 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> </LinearLayout>
<View <View
@ -268,18 +274,18 @@
android:text="@string/settings_icon_packs_manage" android:text="@string/settings_icon_packs_manage"
android:textAllCaps="false" /> android:textAllCaps="false" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="10dp"
android:background="@drawable/theme_gradient" />
<LinearLayout <LinearLayout
android:id="@+id/settings_super_secret_settings" android:id="@+id/settings_super_secret_settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="10dp"
android:background="@drawable/theme_gradient" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -52,21 +52,36 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<TextView <LinearLayout
android:id="@+id/otpCode"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:fontFamily="monospace" android:gravity="center"
android:gravity="top|center" android:orientation="vertical">
android:textSize="24sp"
tools:text="000000" /> <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 <ImageView
android:id="@+id/progress" android:id="@+id/progress"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
app:srcCompat="@drawable/progress_circle" /> app:srcCompat="@drawable/progress_circle"
tools:visibility="gone" />
<androidx.appcompat.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/refresh" android:id="@+id/refresh"

View File

@ -176,4 +176,5 @@
<string name="style_stars">Sterne</string> <string name="style_stars">Sterne</string>
<string name="style_dots">Punkte</string> <string name="style_dots">Punkte</string>
<string name="settings_group_size">Gruppengröße für Ziffern</string> <string name="settings_group_size">Gruppengröße für Ziffern</string>
<string name="settings_show_next_code">Nächsten Code anzeigen</string>
</resources> </resources>

View File

@ -176,4 +176,5 @@
<string name="style_dots">Points</string> <string name="style_dots">Points</string>
<string name="settings_group_size">Taille du groupe de chiffres</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="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> </resources>

View File

@ -176,4 +176,5 @@
<string name="style_dots">Kropki</string> <string name="style_dots">Kropki</string>
<string name="settings_group_size">Wielkość grupy cyfr</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="backup_create_new_password">Utwórz z nowym hasłem</string>
<string name="settings_show_next_code">Pokaż następny kod</string>
</resources> </resources>

View File

@ -176,4 +176,5 @@
<string name="style_dots">Крапки</string> <string name="style_dots">Крапки</string>
<string name="settings_group_size">Розмір групи цифр</string> <string name="settings_group_size">Розмір групи цифр</string>
<string name="backup_create_new_password">Створити з новим паролем</string> <string name="backup_create_new_password">Створити з новим паролем</string>
<string name="settings_show_next_code">Показати наступний код</string>
</resources> </resources>

View File

@ -197,4 +197,5 @@
<string name="style_stars">Stars</string> <string name="style_stars">Stars</string>
<string name="style_dots">Dots</string> <string name="style_dots">Dots</string>
<string name="settings_group_size">Digit group size</string> <string name="settings_group_size">Digit group size</string>
<string name="settings_show_next_code">Show next code</string>
</resources> </resources>

View File

@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.3.2' apply false id 'com.android.application' version '8.5.0' apply false
id 'com.android.library' version '8.3.2' apply false id 'com.android.library' version '8.5.0' apply false
id 'com.google.protobuf' version '0.9.3' apply false id 'com.google.protobuf' version '0.9.3' apply false
} }

View File

@ -1,6 +1,6 @@
#Sat Jun 17 16:15:03 CEST 2023 #Sat Jun 17 16:15:03 CEST 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists