Move more strings into strings.xml

This commit is contained in:
MrLetsplay 2023-10-04 15:53:25 +02:00
parent 87d1c21f50
commit 4c7891b1d3
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
22 changed files with 55 additions and 51 deletions

View File

@ -45,8 +45,6 @@ public class MainActivity extends BaseActivity {
private static final long BACK_BUTTON_DELAY = 500;
private ActivityMainBinding binding;
private ActivityResultLauncher<Void> startQRCodeScan;
private ActivityResultLauncher<PickVisualMediaRequest> pickQRCodeImage;
@ -237,7 +235,7 @@ public class MainActivity extends BaseActivity {
fullyLaunched = true;
lockOnStop = true;
binding = ActivityMainBinding.inflate(getLayoutInflater());
ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
ThemeUtil.loadBackground(this);
@ -281,7 +279,8 @@ public class MainActivity extends BaseActivity {
}
if(fragment instanceof EditOTPFragment) {
getMenuInflater().inflate(R.menu.menu_edit_otp, menu);
EditOTPFragment frag = (EditOTPFragment) fragment;
getMenuInflater().inflate(frag.isView() ? R.menu.menu_view_otp : R.menu.menu_edit_otp, menu);
return true;
}

View File

@ -37,7 +37,7 @@ public class Crypto {
private static final String KEY_STORE = "AndroidKeyStore";
public static byte[] generateHash(CryptoParameters parameters, String password) throws CryptoException {
public static byte[] generateHash(CryptoParameters parameters, String password) {
Argon2Parameters params = new Argon2Parameters.Builder()
.withVersion(parameters.getArgon2Version())
.withIterations(parameters.getArgon2Iterations())

View File

@ -15,8 +15,6 @@ import com.cringe_studios.code_guard.databinding.FragmentAboutBinding;
public class AboutFragment extends NamedFragment {
private FragmentAboutBinding binding;
@Override
public String getName() {
return requireActivity().getString(R.string.fragment_about);
@ -25,7 +23,7 @@ public class AboutFragment extends NamedFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentAboutBinding.inflate(inflater);
FragmentAboutBinding binding = FragmentAboutBinding.inflate(inflater);
try {
PackageManager manager = requireContext().getPackageManager();
PackageInfo info = manager.getPackageInfo(requireContext().getPackageName(), 0);

View File

@ -19,8 +19,6 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
public class PickIconDrawerFragment extends BottomSheetDialogFragment {
private FragmentPickIconBinding binding;
private final Consumer<Icon> selected;
public PickIconDrawerFragment(Consumer<Icon> selected) {
@ -30,7 +28,7 @@ public class PickIconDrawerFragment extends BottomSheetDialogFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = FragmentPickIconBinding.inflate(inflater);
FragmentPickIconBinding binding = FragmentPickIconBinding.inflate(inflater);
IconListAdapter adapter = new IconListAdapter(requireContext(), IconUtil.loadAllIcons(requireContext()), icon -> {
selected.accept(icon);

View File

@ -1,8 +1,6 @@
package com.cringe_studios.code_guard.grouplist;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.ViewGroup;
@ -28,8 +26,6 @@ public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
private final List<String> items;
private final Handler handler;
private final Consumer<String> navigateToGroup;
private final Runnable saveGroups;
@ -46,7 +42,6 @@ public class GroupListAdapter extends RecyclerView.Adapter<GroupListItem> {
this.updateToolbarOptions = updateToolbarOptions;
this.inflater = LayoutInflater.from(context);
this.items = new ArrayList<>();
this.handler = new Handler(Looper.getMainLooper());
attachTouchHelper(recyclerView);
}

View File

@ -7,7 +7,7 @@ import com.cringe_studios.code_guard.databinding.DialogManageIconPacksItemBindin
public class IconPackItem extends RecyclerView.ViewHolder {
private DialogManageIconPacksItemBinding binding;
private final DialogManageIconPacksItemBinding binding;
private IconPack pack;

View File

@ -15,11 +15,11 @@ import java.util.List;
public class IconPackListAdapter extends RecyclerView.Adapter<IconPackItem> {
private Context context;
private final Context context;
private LayoutInflater inflater;
private final LayoutInflater inflater;
private List<IconPack> packs;
private final List<IconPack> packs;
public IconPackListAdapter(Context context, List<IconPack> packs) {
this.context = context;

View File

@ -79,7 +79,7 @@ public class OTPDatabase {
((BaseActivity) ctx).promptUnlock(success, failure);
}
public static OTPDatabase loadDatabase(Context context, SecretKey key) throws OTPDatabaseException, CryptoException {
public static void loadDatabase(Context context, SecretKey key) throws OTPDatabaseException, CryptoException {
File file = new File(context.getFilesDir(), DB_FILE_NAME);
if(!file.exists()) {
try {
@ -94,7 +94,6 @@ public class OTPDatabase {
loadedDatabase = loadFromEncryptedBytes(bytes, key, SettingsUtil.getCryptoParameters(context));
loadedKey = key;
return loadedDatabase;
}catch(IOException e) {
throw new OTPDatabaseException(e);
}

View File

@ -15,7 +15,7 @@ import java.util.Locale;
public class SettingsUtil {
public static String
public static final String
GROUPS_PREFS_NAME = "groups",
GENERAL_PREFS_NAME = "general";

View File

@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Details"
android:text="@string/details"
android:textStyle="bold" />
<HorizontalScrollView

View File

@ -11,7 +11,7 @@
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="left|center"
android:gravity="start|center"
tools:text="My Icon Pack"/>
<androidx.appcompat.widget.AppCompatImageButton

View File

@ -210,7 +210,7 @@
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:text="Developed by Cringe Studios and JG-Cody"
android:text="@string/developed_by"
android:textAlignment="center" />
<LinearLayout

View File

@ -12,7 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:hint="Search" />
android:hint="@string/search" />
<ExpandableListView
android:id="@+id/pick_icon_list"

View File

@ -77,7 +77,7 @@
android:id="@+id/settings_enable_themed_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Use themed background" />
android:text="@string/settings_enable_themed_background" />
<TextView
android:layout_width="match_parent"
@ -95,7 +95,7 @@
android:id="@+id/settings_enable_minimalist_theme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Use minimalist theme" />
android:text="@string/settings_enable_minimalist_theme" />
<TextView
android:layout_width="match_parent"
@ -147,7 +147,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Icon Packs" />
android:text="@string/settings_icon_packs" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/settings_load_icon_pack"
@ -155,7 +155,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="?attr/buttonBackground"
android:text="Import icon pack"
android:text="@string/settings_icon_packs_import"
android:textAllCaps="false" />
<androidx.appcompat.widget.AppCompatButton
@ -164,7 +164,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="?attr/buttonBackground"
android:text="Manage icon packs"
android:text="@string/settings_icon_packs_manage"
android:textAllCaps="false" />
<Space

View File

@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingVertical="5dp"
android:paddingStart="?android:attr/expandableListPreferredChildPaddingLeft">
android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft">
<com.caverock.androidsvg.SVGImageView
android:id="@+id/icon_list_icon_image"
android:layout_width="50dp"

View File

@ -22,7 +22,7 @@
android:id="@+id/otp_code_icon"
android:layout_width="60dp"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:scaleType="centerInside"
android:src="@drawable/cringeauth_white" />
@ -36,9 +36,8 @@
android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:gravity="bottom|center"
android:minHeight="25dp"
android:textAlignment="center"
android:textSize="16sp"
tools:text="My OTP" />
@ -59,8 +58,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="monospace"
android:gravity="top"
android:textAlignment="center"
android:gravity="top|center"
android:textSize="24sp"
tools:text="000000" />

View File

@ -4,13 +4,13 @@
<item
android:id="@+id/action_cancel"
android:orderInCategory="100"
android:title="Cancel"
android:title="@string/cancel"
android:onClick="cancelEditingOTP"
app:showAsAction="always" />
<item
android:id="@+id/action_save"
android:orderInCategory="100"
android:title="Save"
android:title="@string/save"
android:onClick="saveOTP"
app:showAsAction="always" />
</menu>

View File

@ -5,7 +5,7 @@
<item
android:id="@+id/action_lock"
android:orderInCategory="100"
android:title="Lock"
android:title="@string/lock"
app:showAsAction="never"
android:onClick="lockApp" />
<item

View File

@ -12,21 +12,21 @@
android:id="@+id/action_otp_input"
android:orderInCategory="100"
android:icon="@drawable/baseline_edit_24"
android:title="Input manually"
android:title="@string/otp_input"
android:onClick="inputCode"
app:showAsAction="never"/>
<item
android:id="@+id/action_otp_scan"
android:orderInCategory="100"
android:icon="@drawable/baseline_qr_code_scanner_24"
android:title="Scan QR code"
android:title="@string/otp_scan"
android:onClick="scanCode"
app:showAsAction="never"/>
<item
android:id="@+id/action_otp_scan_image"
android:orderInCategory="100"
android:icon="@drawable/baseline_compare_24"
android:title="Scan image"
android:title="@string/otp_scan_image"
android:onClick="scanCodeFromImage"
app:showAsAction="never"/>
</menu>
@ -34,7 +34,7 @@
<item
android:id="@+id/action_lock"
android:orderInCategory="100"
android:title="Lock"
android:title="@string/lock"
app:showAsAction="never"
android:onClick="lockApp" />
<item

View File

@ -5,34 +5,34 @@
android:id="@+id/action_view_otp"
android:orderInCategory="100"
android:icon="@drawable/baseline_visibility_24"
android:title="View OTP"
android:title="@string/otp_view"
android:onClick="viewOTP"
app:showAsAction="always" />
<item
android:id="@+id/action_edit_otp"
android:orderInCategory="100"
android:icon="@drawable/baseline_edit_24"
android:title="Edit OTP"
android:title="@string/otp_edit"
android:onClick="editOTP"
app:showAsAction="always" />
<item
android:id="@+id/action_move_otp"
android:orderInCategory="100"
android:icon="@drawable/baseline_drive_file_move_24"
android:title="Move OTP"
android:title="@string/otp_move"
android:onClick="moveOTP"
app:showAsAction="always" />
<item
android:id="@+id/action_delete_otp"
android:orderInCategory="100"
android:icon="@drawable/baseline_delete_24"
android:title="Delete OTP"
android:title="@string/otp_delete"
android:onClick="deleteOTP"
app:showAsAction="always" />
<item
android:id="@+id/action_lock"
android:orderInCategory="100"
android:title="Lock"
android:title="@string/lock"
app:showAsAction="never"
android:onClick="lockApp" />
<item

View File

@ -4,7 +4,7 @@
<item
android:id="@+id/action_cancel"
android:orderInCategory="100"
android:title="Close"
android:title="@string/close"
android:onClick="cancelEditingOTP"
app:showAsAction="always" />
</menu>

View File

@ -150,6 +150,23 @@
<string name="icon_pack_exists_title">Icon pack already exists</string>
<string name="error_import_icon_pack">Failed to import icon pack</string>
<string name="error_no_camera_permission">No camera permission</string>
<string name="details">Details</string>
<string name="search">Search</string>
<string name="settings_enable_themed_background">Use themed background</string>
<string name="settings_enable_minimalist_theme">Use minimalist theme</string>
<string name="settings_icon_packs">Icon Packs</string>
<string name="settings_icon_packs_import">Import icon pack</string>
<string name="settings_icon_packs_manage">Manage icon packs</string>
<string name="save">Save</string>
<string name="lock">Lock</string>
<string name="otp_input">Input manually</string>
<string name="otp_scan">Scan QR code</string>
<string name="otp_scan_image">Scan image</string>
<string name="otp_view">View OTP</string>
<string name="otp_edit">Edit OTP</string>
<string name="otp_move">Move OTP</string>
<string name="otp_delete">Delete OTP</string>
<string name="close">Close</string>
<string-array name="edit_otp_choose_image_options">
<item>Image from icon pack</item>
<item>Image from gallery</item>