Update project, Tap to copy if code is visible, Update version

This commit is contained in:
MrLetsplay 2024-01-26 21:06:47 +01:00
parent 278d9da6a4
commit 34c3f57b19
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
8 changed files with 33 additions and 15 deletions

View File

@ -11,8 +11,8 @@ android {
applicationId "com.cringe_studios.code_guard"
minSdk 21
targetSdk 34
versionCode 7
versionName "1.0.0_beta2"
versionCode 8
versionName "1.0.0_beta3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -71,8 +71,8 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
implementation 'androidx.lifecycle:lifecycle-livedata:2.7.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.7.0'
implementation 'androidx.navigation:navigation-fragment:2.7.6'
implementation 'androidx.navigation:navigation-ui:2.7.6'
testImplementation 'junit:junit:4.13.2'

View File

@ -1,5 +1,7 @@
package com.cringe_studios.code_guard.otplist;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
@ -73,7 +75,7 @@ public class OTPListAdapter extends RecyclerView.Adapter<OTPListItem> {
try {
holder.refresh();
} catch (OTPException e) {
DialogUtil.showErrorDialog(context, context.getString(R.string.otp_add_error, e.getMessage() != null ? e.getMessage() : e.toString()));
DialogUtil.showErrorDialog(context, context.getString(R.string.otp_add_error), e);
}
holder.getBinding().otpCodeIcon.setVisibility(SettingsUtil.isShowImages(context) ? View.VISIBLE : View.GONE);
@ -103,18 +105,24 @@ public class OTPListAdapter extends RecyclerView.Adapter<OTPListItem> {
holder.getBinding().getRoot().setOnClickListener(view -> {
if(!editing) {
if(!SettingsUtil.isHideCodes(context)) return;
if(!holder.isCodeShown()) {
showCode(holder);
}else {
holder.setCodeShown(false);
if(!SettingsUtil.isHideCodes(context) || holder.isCodeShown()) {
try {
ClipboardManager manager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(null, holder.getOTPData().getPin());
manager.setPrimaryClip(clip);
Toast.makeText(context, R.string.otp_copied, Toast.LENGTH_SHORT).show();
} catch (OTPException e) {
DialogUtil.showErrorDialog(context, context.getString(R.string.otp_copy_error), e);
}
return;
}
showCode(holder);
try {
holder.refresh();
} catch (OTPException e) {
DialogUtil.showErrorDialog(context, context.getString(R.string.otp_add_error, e.getMessage() != null ? e.getMessage() : e.toString()));
DialogUtil.showErrorDialog(context, context.getString(R.string.otp_add_error), e);
}
}else {
holder.setSelected(!holder.isSelected());

View File

@ -174,4 +174,6 @@
<string name="settings_super_secret_settings">Supergeheime Einstellungen</string>
<string name="settings_hamburger_mode">Ich mag Hamburger 🍔</string>
<string name="settings_cringe_icon">Extra-Cringe-Symbol verwenden</string>
<string name="otp_copy_error">Kopieren des OTP-Codes fehlgeschlagen</string>
<string name="otp_copied">OTP-Code in die Zwischenablage kopiert</string>
</resources>

View File

@ -160,4 +160,6 @@
<string name="settings_super_secret_settings">Paramètres super secrets</string>
<string name="settings_hamburger_mode">J\'aime les hamburgers 🍔</string>
<string name="settings_cringe_icon">Utiliser l\'icône de l\'humour supplémentaire</string>
<string name="otp_copy_error">Échec de la copie de l\'OTP dans le presse-papiers</string>
<string name="otp_copied">OTP copié dans le presse-papiers</string>
</resources>

View File

@ -160,4 +160,6 @@
<string name="settings_super_secret_settings">Super tajne ustawienia</string>
<string name="settings_hamburger_mode">Lubię hamburgery 🍔</string>
<string name="settings_cringe_icon">Użyj dodatkowej ikony cringe</string>
<string name="otp_copy_error">Nie udało się skopiować OTP do schowka</string>
<string name="otp_copied">OTP skopiowany do schowka</string>
</resources>

View File

@ -160,4 +160,6 @@
<string name="settings_super_secret_settings">Суперсекретні налаштування</string>
<string name="settings_hamburger_mode">Я люблю гамбургери 🍔</string>
<string name="settings_cringe_icon">Використовуйте додаткову піктограму обтиснення</string>
<string name="otp_copy_error">Не вдалося скопіювати OTP до буфера обміну</string>
<string name="otp_copied">OTP скопійовано в буфер обміну</string>
</resources>

View File

@ -42,7 +42,8 @@
<string name="otp_add_secret">Secret</string>
<string name="otp_add_name">Name</string>
<string name="otp_add_period">Period</string>
<string name="otp_add_error">Failed to update OTP: %s</string>
<string name="otp_add_error">Failed to update OTP</string>
<string name="otp_copy_error">Failed to copy OTP to clipboard</string>
<string name="otp_add_issuer">Issuer (optional)</string>
<string name="otp_add_missing_name">Missing name</string>
<string name="qr_scanner_migration_title">OTP Migration</string>
@ -191,4 +192,5 @@
<string name="settings_super_secret_settings">Super Secret Settings</string>
<string name="settings_hamburger_mode">I like hamburgers 🍔</string>
<string name="settings_cringe_icon">Use extra cringe icon</string>
<string name="otp_copied">OTP copied to clipboard</string>
</resources>

View File

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