Normalize formatting and 'optimize' imports

This commit is contained in:
Alexander Bakker 2019-04-04 14:07:36 +02:00
parent b681d57b4e
commit 36e3dd559c
49 changed files with 202 additions and 257 deletions

View file

@ -10,10 +10,10 @@ import android.os.Build;
import com.beemdevelopment.aegis.db.DatabaseManager; import com.beemdevelopment.aegis.db.DatabaseManager;
import com.beemdevelopment.aegis.ui.MainActivity; import com.beemdevelopment.aegis.ui.MainActivity;
import androidx.annotation.RequiresApi;
import java.util.Collections; import java.util.Collections;
import androidx.annotation.RequiresApi;
public class AegisApplication extends Application { public class AegisApplication extends Application {
private DatabaseManager _manager; private DatabaseManager _manager;
private Preferences _prefs; private Preferences _prefs;

View file

@ -11,10 +11,6 @@ public class Preferences {
_prefs = PreferenceManager.getDefaultSharedPreferences(context); _prefs = PreferenceManager.getDefaultSharedPreferences(context);
} }
public boolean isDarkModeEnabled() {
return _prefs.getBoolean("pref_dark_mode", false);
}
public boolean isTapToRevealEnabled() { public boolean isTapToRevealEnabled() {
return _prefs.getBoolean("pref_tap_to_reveal", false); return _prefs.getBoolean("pref_tap_to_reveal", false);
} }
@ -47,7 +43,6 @@ public class Preferences {
return _prefs.getInt("pref_current_sort_category", 0); return _prefs.getInt("pref_current_sort_category", 0);
} }
public int getTapToRevealTime() { public int getTapToRevealTime() {
return _prefs.getInt("pref_tap_to_reveal_time", 30); return _prefs.getInt("pref_tap_to_reveal_time", 30);
} }
@ -58,7 +53,6 @@ public class Preferences {
public void setCurrentTheme(Theme theme) { public void setCurrentTheme(Theme theme) {
_prefs.edit().putInt("pref_current_theme", theme.ordinal()).apply(); _prefs.edit().putInt("pref_current_theme", theme.ordinal()).apply();
} }
public int getCurrentViewMode() { public int getCurrentViewMode() {
@ -67,11 +61,8 @@ public class Preferences {
public void setCurrentViewMode(ViewMode viewMode) { public void setCurrentViewMode(ViewMode viewMode) {
_prefs.edit().putInt("pref_current_view_mode", viewMode.ordinal()).apply(); _prefs.edit().putInt("pref_current_view_mode", viewMode.ordinal()).apply();
} }
public int getTimeout() { public int getTimeout() {
return _prefs.getInt("pref_timeout", -1); return _prefs.getInt("pref_timeout", -1);
} }

View file

@ -13,7 +13,7 @@ public enum SortCategory {
ISSUERREVERSED; ISSUERREVERSED;
public static SortCategory fromInteger(int x) { public static SortCategory fromInteger(int x) {
switch(x) { switch (x) {
case 0: case 0:
return CUSTOM; return CUSTOM;
case 1: case 1:
@ -29,7 +29,7 @@ public enum SortCategory {
} }
public static Comparator getComparator(SortCategory sortCategory) { public static Comparator getComparator(SortCategory sortCategory) {
switch(sortCategory) { switch (sortCategory) {
case ACCOUNT: case ACCOUNT:
case ACCOUNTREVERSED: case ACCOUNTREVERSED:
return new AccountNameComparator(); return new AccountNameComparator();
@ -43,7 +43,7 @@ public enum SortCategory {
} }
public static boolean isReversed(SortCategory sortCategory) { public static boolean isReversed(SortCategory sortCategory) {
switch(sortCategory) { switch (sortCategory) {
case ACCOUNTREVERSED: case ACCOUNTREVERSED:
case ISSUERREVERSED: case ISSUERREVERSED:
return true; return true;
@ -65,7 +65,6 @@ public enum SortCategory {
return R.id.menu_sort_alphabetically; return R.id.menu_sort_alphabetically;
case ISSUERREVERSED: case ISSUERREVERSED:
return R.id.menu_sort_alphabetically_reverse; return R.id.menu_sort_alphabetically_reverse;
default: default:
return R.id.menu_sort_custom; return R.id.menu_sort_custom;
} }

View file

@ -6,7 +6,7 @@ public enum Theme {
AMOLED; AMOLED;
public static Theme fromInteger(int x) { public static Theme fromInteger(int x) {
switch(x) { switch (x) {
case 0: case 0:
return LIGHT; return LIGHT;
case 1: case 1:
@ -18,7 +18,7 @@ public enum Theme {
} }
public static String getThemeName(int x) { public static String getThemeName(int x) {
switch(x) { switch (x) {
case 0: case 0:
return "Light theme"; return "Light theme";
case 1: case 1:
@ -30,7 +30,7 @@ public enum Theme {
} }
public static String[] getThemeNames() { public static String[] getThemeNames() {
return new String[] { return new String[]{
"Light theme", "Light theme",
"Dark theme", "Dark theme",
"Amoled theme" "Amoled theme"

View file

@ -6,7 +6,7 @@ public enum ViewMode {
SMALL; SMALL;
public static ViewMode fromInteger(int x) { public static ViewMode fromInteger(int x) {
switch(x) { switch (x) {
case 0: case 0:
return NORMAL; return NORMAL;
case 1: case 1:
@ -18,7 +18,7 @@ public enum ViewMode {
} }
public static String getViewModeName(int x) { public static String getViewModeName(int x) {
switch(x) { switch (x) {
case 0: case 0:
return "Normal"; return "Normal";
case 1: case 1:
@ -30,7 +30,7 @@ public enum ViewMode {
} }
public static String[] getViewModeNames() { public static String[] getViewModeNames() {
return new String[] { return new String[]{
"Normal", "Normal",
"Compact", "Compact",
"Small" "Small"

View file

@ -2,6 +2,8 @@ package com.beemdevelopment.aegis.crypto;
import android.os.Build; import android.os.Build;
import org.spongycastle.crypto.generators.SCrypt;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -24,8 +26,6 @@ import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import org.spongycastle.crypto.generators.SCrypt;
public class CryptoUtils { public class CryptoUtils {
public static final String CRYPTO_AEAD = "AES/GCM/NoPadding"; public static final String CRYPTO_AEAD = "AES/GCM/NoPadding";
public static final byte CRYPTO_AEAD_KEY_SIZE = 32; public static final byte CRYPTO_AEAD_KEY_SIZE = 32;

View file

@ -2,8 +2,8 @@ package com.beemdevelopment.aegis.crypto.otp;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.security.NoSuchAlgorithmException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;

View file

@ -1,7 +1,5 @@
package com.beemdevelopment.aegis.db; package com.beemdevelopment.aegis.db;
import androidx.annotation.NonNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -9,6 +7,8 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import androidx.annotation.NonNull;
public class DatabaseEntryList implements Iterable<DatabaseEntry>, Serializable { public class DatabaseEntryList implements Iterable<DatabaseEntry>, Serializable {
private List<DatabaseEntry> _entries = new ArrayList<>(); private List<DatabaseEntry> _entries = new ArrayList<>();

View file

@ -4,11 +4,10 @@ import com.beemdevelopment.aegis.crypto.CryptParameters;
import com.beemdevelopment.aegis.crypto.CryptResult; import com.beemdevelopment.aegis.crypto.CryptResult;
import com.beemdevelopment.aegis.crypto.MasterKey; import com.beemdevelopment.aegis.crypto.MasterKey;
import com.beemdevelopment.aegis.crypto.MasterKeyException; import com.beemdevelopment.aegis.crypto.MasterKeyException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import java.io.Serializable; import java.io.Serializable;
import com.beemdevelopment.aegis.db.slots.SlotList;
public class DatabaseFileCredentials implements Serializable { public class DatabaseFileCredentials implements Serializable {
private MasterKey _key; private MasterKey _key;
private SlotList _slots; private SlotList _slots;

View file

@ -3,6 +3,9 @@ package com.beemdevelopment.aegis.db;
import android.content.Context; import android.content.Context;
import android.os.Environment; import android.os.Environment;
import com.beemdevelopment.aegis.BuildConfig;
import com.beemdevelopment.aegis.R;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.DataInputStream; import java.io.DataInputStream;
@ -15,9 +18,6 @@ import java.util.List;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.UUID; import java.util.UUID;
import com.beemdevelopment.aegis.BuildConfig;
import com.beemdevelopment.aegis.R;
public class DatabaseManager { public class DatabaseManager {
private static final String FILENAME = "aegis.json"; private static final String FILENAME = "aegis.json";
private static final String FILENAME_EXPORT = "aegis_export.json"; private static final String FILENAME_EXPORT = "aegis_export.json";

View file

@ -22,12 +22,12 @@ package com.beemdevelopment.aegis.helpers;
import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintManager;
import android.os.Build; import android.os.Build;
import android.os.CancellationSignal; import android.os.CancellationSignal;
import androidx.annotation.RequiresApi;
import android.widget.TextView; import android.widget.TextView;
import com.beemdevelopment.aegis.R;
import com.mattprecious.swirl.SwirlView; import com.mattprecious.swirl.SwirlView;
import com.beemdevelopment.aegis.R; import androidx.annotation.RequiresApi;
/** /**
* Small helper class to manage text/icon around fingerprint authentication UI. * Small helper class to manage text/icon around fingerprint authentication UI.

View file

@ -3,12 +3,13 @@ package com.beemdevelopment.aegis.helpers;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
public class PermissionHelper { public class PermissionHelper {
private PermissionHelper() { private PermissionHelper() {

View file

@ -1,7 +1,7 @@
package com.beemdevelopment.aegis.helpers; package com.beemdevelopment.aegis.helpers;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback { public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {

View file

@ -1,12 +1,13 @@
package com.beemdevelopment.aegis.helpers; package com.beemdevelopment.aegis.helpers;
import android.content.Context; import android.content.Context;
import androidx.annotation.ArrayRes;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Spinner; import android.widget.Spinner;
import java.util.List; import java.util.List;
import androidx.annotation.ArrayRes;
public class SpinnerHelper { public class SpinnerHelper {
private SpinnerHelper() { private SpinnerHelper() {

View file

@ -1,7 +1,6 @@
package com.beemdevelopment.aegis.helpers.comparators; package com.beemdevelopment.aegis.helpers.comparators;
import com.beemdevelopment.aegis.db.DatabaseEntry; import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.ui.views.EntryHolder;
import java.util.Comparator; import java.util.Comparator;

View file

@ -2,10 +2,6 @@ package com.beemdevelopment.aegis.importers;
import android.content.Context; import android.content.Context;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.beemdevelopment.aegis.db.DatabaseEntry; import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.db.DatabaseFile; import com.beemdevelopment.aegis.db.DatabaseFile;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials; import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
@ -14,6 +10,10 @@ import com.beemdevelopment.aegis.encoding.Base64Exception;
import com.beemdevelopment.aegis.otp.OtpInfoException; import com.beemdevelopment.aegis.otp.OtpInfoException;
import com.beemdevelopment.aegis.util.ByteInputStream; import com.beemdevelopment.aegis.util.ByteInputStream;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class AegisFileImporter extends DatabaseFileImporter { public class AegisFileImporter extends DatabaseFileImporter {
private DatabaseFileCredentials _creds; private DatabaseFileCredentials _creds;
private DatabaseFile _file; private DatabaseFile _file;

View file

@ -2,12 +2,6 @@ package com.beemdevelopment.aegis.importers;
import android.content.Context; import android.content.Context;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.nio.charset.StandardCharsets;
import com.beemdevelopment.aegis.db.DatabaseEntry; import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.encoding.Base32; import com.beemdevelopment.aegis.encoding.Base32;
import com.beemdevelopment.aegis.encoding.Base32Exception; import com.beemdevelopment.aegis.encoding.Base32Exception;
@ -18,6 +12,12 @@ import com.beemdevelopment.aegis.otp.SteamInfo;
import com.beemdevelopment.aegis.otp.TotpInfo; import com.beemdevelopment.aegis.otp.TotpInfo;
import com.beemdevelopment.aegis.util.ByteInputStream; import com.beemdevelopment.aegis.util.ByteInputStream;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.nio.charset.StandardCharsets;
public class AndOtpFileImporter extends DatabaseFileImporter { public class AndOtpFileImporter extends DatabaseFileImporter {
private JSONArray _obj; private JSONArray _obj;

View file

@ -2,12 +2,9 @@ package com.beemdevelopment.aegis.importers;
import android.content.Context; import android.content.Context;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public abstract class DatabaseAppImporter implements DatabaseImporter { public abstract class DatabaseAppImporter implements DatabaseImporter {

View file

@ -2,15 +2,13 @@ package com.beemdevelopment.aegis.importers;
import android.content.Context; import android.content.Context;
import com.beemdevelopment.aegis.util.ByteInputStream;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.util.ByteInputStream;
public abstract class DatabaseFileImporter implements DatabaseImporter { public abstract class DatabaseFileImporter implements DatabaseImporter {
private static Map<String, Class<? extends DatabaseFileImporter>> _importers; private static Map<String, Class<? extends DatabaseFileImporter>> _importers;
static { static {

View file

@ -2,10 +2,6 @@ package com.beemdevelopment.aegis.importers;
import android.content.Context; import android.content.Context;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import java.util.List;
public interface DatabaseImporter { public interface DatabaseImporter {
void parse() throws DatabaseImporterException; void parse() throws DatabaseImporterException;
DatabaseImporterResult convert() throws DatabaseImporterException; DatabaseImporterResult convert() throws DatabaseImporterException;

View file

@ -3,6 +3,13 @@ package com.beemdevelopment.aegis.importers;
import android.content.Context; import android.content.Context;
import android.util.Xml; import android.util.Xml;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.otp.HotpInfo;
import com.beemdevelopment.aegis.otp.OtpInfo;
import com.beemdevelopment.aegis.otp.OtpInfoException;
import com.beemdevelopment.aegis.otp.TotpInfo;
import com.beemdevelopment.aegis.util.ByteInputStream;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -13,13 +20,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.otp.HotpInfo;
import com.beemdevelopment.aegis.otp.OtpInfo;
import com.beemdevelopment.aegis.otp.OtpInfoException;
import com.beemdevelopment.aegis.otp.TotpInfo;
import com.beemdevelopment.aegis.util.ByteInputStream;
public class FreeOtpFileImporter extends DatabaseFileImporter { public class FreeOtpFileImporter extends DatabaseFileImporter {
private List<XmlEntry> _xmlEntries; private List<XmlEntry> _xmlEntries;

View file

@ -1,7 +1,6 @@
package com.beemdevelopment.aegis.ui; package com.beemdevelopment.aegis.ui;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.WindowManager; import android.view.WindowManager;
import com.beemdevelopment.aegis.AegisApplication; import com.beemdevelopment.aegis.AegisApplication;
@ -9,6 +8,8 @@ import com.beemdevelopment.aegis.Preferences;
import com.beemdevelopment.aegis.R; import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.Theme; import com.beemdevelopment.aegis.Theme;
import androidx.appcompat.app.AppCompatActivity;
public abstract class AegisActivity extends AppCompatActivity { public abstract class AegisActivity extends AppCompatActivity {
private AegisApplication _app; private AegisApplication _app;
@ -39,11 +40,9 @@ public abstract class AegisActivity extends AppCompatActivity {
case LIGHT: case LIGHT:
setTheme(R.style.AppTheme); setTheme(R.style.AppTheme);
break; break;
case DARK: case DARK:
setTheme(R.style.AppTheme_Dark); setTheme(R.style.AppTheme_Dark);
break; break;
case AMOLED: case AMOLED:
setTheme(R.style.AppTheme_TrueBlack); setTheme(R.style.AppTheme_TrueBlack);
break; break;

View file

@ -3,7 +3,6 @@ package com.beemdevelopment.aegis.ui;
import android.content.Intent; import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintManager;
import android.os.Build; import android.os.Build;
import androidx.appcompat.app.AlertDialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
@ -14,28 +13,26 @@ import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.crypto.KeyStoreHandle; import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException; import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
import com.beemdevelopment.aegis.crypto.MasterKey; import com.beemdevelopment.aegis.crypto.MasterKey;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials; import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.helpers.EditTextHelper; import com.beemdevelopment.aegis.helpers.EditTextHelper;
import com.beemdevelopment.aegis.helpers.FingerprintHelper; import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.beemdevelopment.aegis.helpers.FingerprintUiHelper; import com.beemdevelopment.aegis.helpers.FingerprintUiHelper;
import com.beemdevelopment.aegis.ui.tasks.SlotListTask; import com.beemdevelopment.aegis.ui.tasks.SlotListTask;
import com.mattprecious.swirl.SwirlView; import com.mattprecious.swirl.SwirlView;
import java.lang.reflect.UndeclaredThrowableException;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import com.beemdevelopment.aegis.R; import androidx.appcompat.app.AlertDialog;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.db.slots.SlotException;
public class AuthActivity extends AegisActivity implements FingerprintUiHelper.Callback, SlotListTask.Callback { public class AuthActivity extends AegisActivity implements FingerprintUiHelper.Callback, SlotListTask.Callback {
private EditText _textPassword; private EditText _textPassword;
@ -95,7 +92,7 @@ public class AuthActivity extends AegisActivity implements FingerprintUiHelper.C
} }
} }
} catch (KeyStoreHandleException | SlotException e) { } catch (KeyStoreHandleException | SlotException e) {
throw new UndeclaredThrowableException(e); throw new RuntimeException(e);
} }
// display a help message if a matching invalidated keystore entry was found // display a help message if a matching invalidated keystore entry was found

View file

@ -14,8 +14,14 @@ import android.widget.EditText;
import android.widget.NumberPicker; import android.widget.NumberPicker;
import android.widget.TextView; import android.widget.TextView;
import com.beemdevelopment.aegis.Preferences;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.crypto.KeyStoreHandle; import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException; import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.helpers.EditTextHelper; import com.beemdevelopment.aegis.helpers.EditTextHelper;
import com.beemdevelopment.aegis.helpers.FingerprintHelper; import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.beemdevelopment.aegis.helpers.FingerprintUiHelper; import com.beemdevelopment.aegis.helpers.FingerprintUiHelper;
@ -30,14 +36,6 @@ import javax.crypto.SecretKey;
import androidx.annotation.StringRes; import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import com.beemdevelopment.aegis.Preferences;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
public class Dialogs { public class Dialogs {
private Dialogs() { private Dialogs() {
@ -130,8 +128,12 @@ public class Dialogs {
boolean equal = EditTextHelper.areEditTextsEqual(textPassword, textPasswordConfirm); boolean equal = EditTextHelper.areEditTextsEqual(textPassword, textPasswordConfirm);
buttonOK.get().setEnabled(equal); buttonOK.get().setEnabled(equal);
} }
public void beforeTextChanged(CharSequence c, int start, int count, int after) { }
public void afterTextChanged(Editable c) { } public void beforeTextChanged(CharSequence c, int start, int count, int after) {
}
public void afterTextChanged(Editable c) {
}
}; };
textPassword.addTextChangedListener(watcher); textPassword.addTextChangedListener(watcher);
textPasswordConfirm.addTextChangedListener(watcher); textPasswordConfirm.addTextChangedListener(watcher);

View file

@ -10,9 +10,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.ArrayRes;
import androidx.appcompat.app.ActionBar;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.Menu; import android.view.Menu;
@ -30,6 +27,8 @@ import android.widget.TableRow;
import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.TextDrawable;
import com.avito.android.krop.KropView; import com.avito.android.krop.KropView;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.encoding.Base32; import com.beemdevelopment.aegis.encoding.Base32;
import com.beemdevelopment.aegis.encoding.Base32Exception; import com.beemdevelopment.aegis.encoding.Base32Exception;
import com.beemdevelopment.aegis.helpers.EditTextHelper; import com.beemdevelopment.aegis.helpers.EditTextHelper;
@ -54,10 +53,10 @@ import java.util.List;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import androidx.annotation.ArrayRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.DatabaseEntry;
public class EditEntryActivity extends AegisActivity { public class EditEntryActivity extends AegisActivity {
private static final int PICK_IMAGE_REQUEST = 0; private static final int PICK_IMAGE_REQUEST = 0;

View file

@ -4,6 +4,9 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.ui.views.GroupAdapter;
import java.text.Collator; import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TreeSet; import java.util.TreeSet;
@ -12,8 +15,6 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.ui.views.GroupAdapter;
public class GroupManagerActivity extends AegisActivity implements GroupAdapter.Listener { public class GroupManagerActivity extends AegisActivity implements GroupAdapter.Listener {
private GroupAdapter _adapter; private GroupAdapter _adapter;

View file

@ -2,35 +2,34 @@ package com.beemdevelopment.aegis.ui;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.WindowManager; import android.view.WindowManager;
import com.github.paolorotolo.appintro.AppIntro2; import com.beemdevelopment.aegis.Preferences;
import com.github.paolorotolo.appintro.AppIntroFragment; import com.beemdevelopment.aegis.R;
import com.github.paolorotolo.appintro.model.SliderPage; import com.beemdevelopment.aegis.db.Database;
import com.beemdevelopment.aegis.db.DatabaseFile;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials; import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
import com.beemdevelopment.aegis.db.DatabaseFileException;
import com.beemdevelopment.aegis.db.DatabaseManager;
import com.beemdevelopment.aegis.db.DatabaseManagerException;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.ui.slides.CustomAuthenticatedSlide; import com.beemdevelopment.aegis.ui.slides.CustomAuthenticatedSlide;
import com.beemdevelopment.aegis.ui.slides.CustomAuthenticationSlide; import com.beemdevelopment.aegis.ui.slides.CustomAuthenticationSlide;
import com.beemdevelopment.aegis.ui.tasks.DerivationTask; import com.beemdevelopment.aegis.ui.tasks.DerivationTask;
import com.github.paolorotolo.appintro.AppIntro2;
import com.github.paolorotolo.appintro.AppIntroFragment;
import com.github.paolorotolo.appintro.model.SliderPage;
import org.json.JSONObject; import org.json.JSONObject;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import com.beemdevelopment.aegis.Preferences; import androidx.fragment.app.Fragment;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.DatabaseFileException;
import com.beemdevelopment.aegis.db.DatabaseManagerException;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.db.Database;
import com.beemdevelopment.aegis.db.DatabaseFile;
import com.beemdevelopment.aegis.db.DatabaseManager;
import com.beemdevelopment.aegis.db.slots.SlotException;
public class IntroActivity extends AppIntro2 implements DerivationTask.Callback { public class IntroActivity extends AppIntro2 implements DerivationTask.Callback {
public static final int RESULT_OK = 0; public static final int RESULT_OK = 0;

View file

@ -8,11 +8,6 @@ import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Rect; import android.graphics.Rect;
import com.beemdevelopment.aegis.SortCategory;
import com.beemdevelopment.aegis.ViewMode;
import com.beemdevelopment.aegis.helpers.comparators.IssuerNameComparator;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -24,23 +19,22 @@ import android.view.animation.DecelerateInterpolator;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
import com.beemdevelopment.aegis.helpers.PermissionHelper;
import com.beemdevelopment.aegis.ui.views.EntryListView;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.TreeSet;
import com.beemdevelopment.aegis.AegisApplication; import com.beemdevelopment.aegis.AegisApplication;
import com.beemdevelopment.aegis.R; import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.SortCategory;
import com.beemdevelopment.aegis.db.DatabaseManagerException; import com.beemdevelopment.aegis.ViewMode;
import com.beemdevelopment.aegis.db.DatabaseEntry; import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
import com.beemdevelopment.aegis.db.DatabaseManager; import com.beemdevelopment.aegis.db.DatabaseManager;
import com.beemdevelopment.aegis.db.DatabaseManagerException;
import com.beemdevelopment.aegis.helpers.PermissionHelper;
import com.beemdevelopment.aegis.ui.views.EntryListView;
import com.getbase.floatingactionbutton.FloatingActionsMenu;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout;
@ -61,12 +55,13 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
private DatabaseManager _db; private DatabaseManager _db;
private boolean _loaded; private boolean _loaded;
private String _checkedGroup; private String _checkedGroup;
private SortCategory _sortCategory;
private Menu _menu; private Menu _menu;
private FloatingActionsMenu _fabMenu; private FloatingActionsMenu _fabMenu;
private EntryListView _entryListView; private EntryListView _entryListView;
private boolean _isAnimating;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -177,13 +172,10 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
boolean showAccountName = getPreferences().isAccountNameVisible(); boolean showAccountName = getPreferences().isAccountNameVisible();
boolean tapToReveal = getPreferences().isTapToRevealEnabled(); boolean tapToReveal = getPreferences().isTapToRevealEnabled();
int tapToRevealTime = getPreferences().getTapToRevealTime(); int tapToRevealTime = getPreferences().getTapToRevealTime();
int viewMode = getPreferences().getCurrentViewMode();
_entryListView.setShowAccountName(showAccountName); _entryListView.setShowAccountName(showAccountName);
_entryListView.setTapToReveal(tapToReveal); _entryListView.setTapToReveal(tapToReveal);
_entryListView.setTapToRevealTime(tapToRevealTime); _entryListView.setTapToRevealTime(tapToRevealTime);
_entryListView.refresh(true); _entryListView.refresh(true);
} }
} }
@ -269,10 +261,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
} }
private void setSortCategory(SortCategory sortCategory) { private void setSortCategory(SortCategory sortCategory) {
_sortCategory = sortCategory; if (sortCategory == SortCategory.CUSTOM) {
if(sortCategory == SortCategory.CUSTOM)
{
_entryListView.clearEntries(); _entryListView.clearEntries();
loadEntries(); loadEntries();
} }
@ -293,7 +282,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
if (resultCode == IntroActivity.RESULT_EXCEPTION) { if (resultCode == IntroActivity.RESULT_EXCEPTION) {
// TODO: user feedback // TODO: user feedback
Exception e = (Exception) data.getSerializableExtra("exception"); Exception e = (Exception) data.getSerializableExtra("exception");
throw new UndeclaredThrowableException(e); throw new RuntimeException(e);
} }
DatabaseFileCredentials creds = (DatabaseFileCredentials) data.getSerializableExtra("creds"); DatabaseFileCredentials creds = (DatabaseFileCredentials) data.getSerializableExtra("creds");
@ -459,19 +448,15 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
case R.id.menu_sort_alphabetically: case R.id.menu_sort_alphabetically:
sortCategory = SortCategory.ISSUER; sortCategory = SortCategory.ISSUER;
break; break;
case R.id.menu_sort_alphabetically_reverse: case R.id.menu_sort_alphabetically_reverse:
sortCategory = SortCategory.ISSUERREVERSED; sortCategory = SortCategory.ISSUERREVERSED;
break; break;
case R.id.menu_sort_alphabetically_name: case R.id.menu_sort_alphabetically_name:
sortCategory = SortCategory.ACCOUNT; sortCategory = SortCategory.ACCOUNT;
break; break;
case R.id.menu_sort_alphabetically_name_reverse: case R.id.menu_sort_alphabetically_name_reverse:
sortCategory = SortCategory.ACCOUNTREVERSED; sortCategory = SortCategory.ACCOUNTREVERSED;
break; break;
case R.id.menu_sort_custom: case R.id.menu_sort_custom:
default: default:
sortCategory = SortCategory.CUSTOM; sortCategory = SortCategory.CUSTOM;
@ -571,12 +556,10 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
saveDatabase(); saveDatabase();
} }
private boolean isAnimating;
@Override @Override
public void onScroll(int dx, int dy) { public void onScroll(int dx, int dy) {
if (dy > 0 && _fabMenu.getVisibility() == View.VISIBLE && !isAnimating) { if (dy > 0 && _fabMenu.getVisibility() == View.VISIBLE && !_isAnimating) {
isAnimating = true; _isAnimating = true;
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) _fabMenu.getLayoutParams(); CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) _fabMenu.getLayoutParams();
int fabBottomMargin = lp.bottomMargin; int fabBottomMargin = lp.bottomMargin;
_fabMenu.animate() _fabMenu.animate()
@ -585,12 +568,12 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
isAnimating = false; _isAnimating = false;
_fabMenu.setVisibility(View.INVISIBLE); _fabMenu.setVisibility(View.INVISIBLE);
super.onAnimationEnd(animation); super.onAnimationEnd(animation);
} }
}).start(); }).start();
} else if (dy < 0 && _fabMenu.getVisibility() != View.VISIBLE && !isAnimating) { } else if (dy < 0 && _fabMenu.getVisibility() != View.VISIBLE && !_isAnimating) {
_fabMenu.setVisibility(View.VISIBLE); _fabMenu.setVisibility(View.VISIBLE);
_fabMenu.animate() _fabMenu.animate()
.translationY(0) .translationY(0)
@ -598,7 +581,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
.setListener(new AnimatorListenerAdapter() { .setListener(new AnimatorListenerAdapter() {
@Override @Override
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
isAnimating = false; _isAnimating = false;
super.onAnimationEnd(animation); super.onAnimationEnd(animation);
} }
}).start(); }).start();

View file

@ -10,21 +10,25 @@ import android.content.Intent;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Toast; import android.widget.Toast;
import com.beemdevelopment.aegis.Preferences; import com.beemdevelopment.aegis.AegisApplication;
import com.beemdevelopment.aegis.BuildConfig;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.Theme; import com.beemdevelopment.aegis.Theme;
import com.beemdevelopment.aegis.ViewMode; import com.beemdevelopment.aegis.ViewMode;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials; import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
import com.beemdevelopment.aegis.db.DatabaseManager;
import com.beemdevelopment.aegis.db.DatabaseManagerException;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.helpers.FingerprintHelper; import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.beemdevelopment.aegis.helpers.PermissionHelper; import com.beemdevelopment.aegis.helpers.PermissionHelper;
import com.beemdevelopment.aegis.importers.AegisFileImporter; import com.beemdevelopment.aegis.importers.AegisFileImporter;
@ -38,6 +42,7 @@ import com.beemdevelopment.aegis.ui.preferences.SwitchPreference;
import com.beemdevelopment.aegis.util.ByteInputStream; import com.beemdevelopment.aegis.util.ByteInputStream;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.takisoft.preferencex.PreferenceFragmentCompat; import com.takisoft.preferencex.PreferenceFragmentCompat;
import com.topjohnwu.superuser.Shell;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
@ -51,18 +56,8 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import com.beemdevelopment.aegis.AegisApplication; import androidx.appcompat.app.AlertDialog;
import com.beemdevelopment.aegis.BuildConfig; import androidx.preference.Preference;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.db.DatabaseManager;
import com.beemdevelopment.aegis.db.DatabaseManagerException;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.topjohnwu.superuser.Shell;
public class PreferencesFragment extends PreferenceFragmentCompat { public class PreferencesFragment extends PreferenceFragmentCompat {
// activity request codes // activity request codes

View file

@ -8,19 +8,19 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.Theme; import com.beemdevelopment.aegis.Theme;
import com.google.zxing.BarcodeFormat; import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.google.zxing.Result;
import com.beemdevelopment.aegis.helpers.SquareFinderView; import com.beemdevelopment.aegis.helpers.SquareFinderView;
import com.beemdevelopment.aegis.otp.GoogleAuthInfo; import com.beemdevelopment.aegis.otp.GoogleAuthInfo;
import com.beemdevelopment.aegis.otp.GoogleAuthInfoException; import com.beemdevelopment.aegis.otp.GoogleAuthInfoException;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.Result;
import java.util.Collections; import java.util.Collections;
import me.dm7.barcodescanner.core.IViewFinder; import me.dm7.barcodescanner.core.IViewFinder;
import me.dm7.barcodescanner.zxing.ZXingScannerView; import me.dm7.barcodescanner.zxing.ZXingScannerView;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import static android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK; import static android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
import static android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT; import static android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT;

View file

@ -2,30 +2,29 @@ package com.beemdevelopment.aegis.ui;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.crypto.KeyStoreHandle; import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException; import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
import com.beemdevelopment.aegis.db.DatabaseFileCredentials; import com.beemdevelopment.aegis.db.DatabaseFileCredentials;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.helpers.FingerprintHelper; import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.beemdevelopment.aegis.ui.views.SlotAdapter; import com.beemdevelopment.aegis.ui.views.SlotAdapter;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import com.beemdevelopment.aegis.R; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot; import androidx.recyclerview.widget.LinearLayoutManager;
import com.beemdevelopment.aegis.db.slots.PasswordSlot; import androidx.recyclerview.widget.RecyclerView;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.db.slots.SlotException;
public class SlotManagerActivity extends AegisActivity implements SlotAdapter.Listener, Dialogs.SlotListener { public class SlotManagerActivity extends AegisActivity implements SlotAdapter.Listener, Dialogs.SlotListener {
private DatabaseFileCredentials _creds; private DatabaseFileCredentials _creds;

View file

@ -2,10 +2,11 @@ package com.beemdevelopment.aegis.ui.preferences;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.util.AttributeSet;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.SwitchPreferenceCompat; import androidx.preference.SwitchPreferenceCompat;
import android.util.AttributeSet;
public class SwitchPreference extends SwitchPreferenceCompat { public class SwitchPreference extends SwitchPreferenceCompat {
private Preference.OnPreferenceChangeListener _listener; private Preference.OnPreferenceChangeListener _listener;

View file

@ -5,8 +5,6 @@ import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintManager;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -14,23 +12,22 @@ import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.github.paolorotolo.appintro.ISlidePolicy; import com.beemdevelopment.aegis.R;
import com.github.paolorotolo.appintro.ISlideSelectionListener;
import com.beemdevelopment.aegis.crypto.KeyStoreHandle; import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException; import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.helpers.EditTextHelper; import com.beemdevelopment.aegis.helpers.EditTextHelper;
import com.beemdevelopment.aegis.helpers.FingerprintUiHelper; import com.beemdevelopment.aegis.helpers.FingerprintUiHelper;
import com.github.paolorotolo.appintro.ISlidePolicy;
import com.github.paolorotolo.appintro.ISlideSelectionListener;
import com.google.android.material.snackbar.Snackbar;
import com.mattprecious.swirl.SwirlView; import com.mattprecious.swirl.SwirlView;
import java.lang.reflect.UndeclaredThrowableException;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import com.beemdevelopment.aegis.R; import androidx.fragment.app.Fragment;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.Slot;
public class CustomAuthenticatedSlide extends Fragment implements FingerprintUiHelper.Callback, ISlidePolicy, ISlideSelectionListener { public class CustomAuthenticatedSlide extends Fragment implements FingerprintUiHelper.Callback, ISlidePolicy, ISlideSelectionListener {
private int _cryptType; private int _cryptType;
@ -105,7 +102,7 @@ public class CustomAuthenticatedSlide extends Fragment implements FingerprintUiH
} }
key = _storeHandle.generateKey(_fingerSlot.getUUID().toString()); key = _storeHandle.generateKey(_fingerSlot.getUUID().toString());
} catch (KeyStoreHandleException e) { } catch (KeyStoreHandleException e) {
throw new UndeclaredThrowableException(e); throw new RuntimeException(e);
} }
if (_fingerHelper == null) { if (_fingerHelper == null) {
@ -116,7 +113,7 @@ public class CustomAuthenticatedSlide extends Fragment implements FingerprintUiH
try { try {
_fingerCipher = Slot.createEncryptCipher(key); _fingerCipher = Slot.createEncryptCipher(key);
} catch (Exception e) { } catch (Exception e) {
throw new UndeclaredThrowableException(e); throw new RuntimeException(e);
} }
_fingerHelper.startListening(new FingerprintManager.CryptoObject(_fingerCipher)); _fingerHelper.startListening(new FingerprintManager.CryptoObject(_fingerCipher));
break; break;

View file

@ -3,8 +3,6 @@ package com.beemdevelopment.aegis.ui.slides;
import android.content.Intent; import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.material.snackbar.Snackbar;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -12,10 +10,12 @@ import android.widget.RadioButton;
import android.widget.RadioGroup; import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import com.github.paolorotolo.appintro.ISlidePolicy;
import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.beemdevelopment.aegis.R; import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.github.paolorotolo.appintro.ISlidePolicy;
import com.google.android.material.snackbar.Snackbar;
import androidx.fragment.app.Fragment;
public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy, RadioGroup.OnCheckedChangeListener { public class CustomAuthenticationSlide extends Fragment implements ISlidePolicy, RadioGroup.OnCheckedChangeListener {
public static final int CRYPT_TYPE_INVALID = 0; public static final int CRYPT_TYPE_INVALID = 0;

View file

@ -2,15 +2,13 @@ package com.beemdevelopment.aegis.ui.tasks;
import android.content.Context; import android.content.Context;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.crypto.CryptoUtils; import com.beemdevelopment.aegis.crypto.CryptoUtils;
import com.beemdevelopment.aegis.crypto.SCryptParameters; import com.beemdevelopment.aegis.crypto.SCryptParameters;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.slots.PasswordSlot;
public class DerivationTask extends ProgressDialogTask<DerivationTask.Params, SecretKey> { public class DerivationTask extends ProgressDialogTask<DerivationTask.Params, SecretKey> {
private Callback _cb; private Callback _cb;

View file

@ -4,9 +4,11 @@ import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Process; import android.os.Process;
import androidx.annotation.CallSuper;
import com.beemdevelopment.aegis.ui.Dialogs; import com.beemdevelopment.aegis.ui.Dialogs;
import androidx.annotation.CallSuper;
public abstract class ProgressDialogTask<Params, Result> extends AsyncTask<Params, Void, Result> { public abstract class ProgressDialogTask<Params, Result> extends AsyncTask<Params, Void, Result> {
private ProgressDialog _dialog; private ProgressDialog _dialog;

View file

@ -2,19 +2,17 @@ package com.beemdevelopment.aegis.ui.tasks;
import android.content.Context; import android.content.Context;
import com.beemdevelopment.aegis.crypto.MasterKey;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import com.beemdevelopment.aegis.R; import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.crypto.MasterKey;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot; import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot; import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.Slot; import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.db.slots.SlotList;
import com.beemdevelopment.aegis.db.slots.SlotException; import com.beemdevelopment.aegis.db.slots.SlotException;
import com.beemdevelopment.aegis.db.slots.SlotIntegrityException; import com.beemdevelopment.aegis.db.slots.SlotIntegrityException;
import com.beemdevelopment.aegis.db.slots.SlotList;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
public class SlotListTask<T extends Slot> extends ProgressDialogTask<SlotListTask.Params, MasterKey> { public class SlotListTask<T extends Slot> extends ProgressDialogTask<SlotListTask.Params, MasterKey> {
private Callback _cb; private Callback _cb;

View file

@ -1,14 +1,14 @@
package com.beemdevelopment.aegis.ui.views; package com.beemdevelopment.aegis.ui.views;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.SortCategory; import com.beemdevelopment.aegis.SortCategory;
import com.beemdevelopment.aegis.ViewMode; import com.beemdevelopment.aegis.ViewMode;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.helpers.ItemTouchHelperAdapter; import com.beemdevelopment.aegis.helpers.ItemTouchHelperAdapter;
import com.beemdevelopment.aegis.helpers.comparators.IssuerNameComparator;
import com.beemdevelopment.aegis.otp.HotpInfo; import com.beemdevelopment.aegis.otp.HotpInfo;
import com.beemdevelopment.aegis.otp.OtpInfo; import com.beemdevelopment.aegis.otp.OtpInfo;
import com.beemdevelopment.aegis.otp.OtpInfoException; import com.beemdevelopment.aegis.otp.OtpInfoException;
@ -19,8 +19,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import com.beemdevelopment.aegis.R; import androidx.recyclerview.widget.RecyclerView;
import com.beemdevelopment.aegis.db.DatabaseEntry;
public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements ItemTouchHelperAdapter { public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements ItemTouchHelperAdapter {
private List<DatabaseEntry> _entries; private List<DatabaseEntry> _entries;
@ -161,8 +160,7 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
if (_sortCategory != sortCategory && sortCategory != SortCategory.CUSTOM) { if (_sortCategory != sortCategory && sortCategory != SortCategory.CUSTOM) {
Collections.sort(_shownEntries, SortCategory.getComparator(sortCategory)); Collections.sort(_shownEntries, SortCategory.getComparator(sortCategory));
if(SortCategory.isReversed(sortCategory)) if (SortCategory.isReversed(sortCategory)) {
{
Collections.reverse(_shownEntries); Collections.reverse(_shownEntries);
} }

View file

@ -3,13 +3,14 @@ package com.beemdevelopment.aegis.ui.views;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.os.Handler;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.TextDrawable;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.helpers.TextDrawableHelper; import com.beemdevelopment.aegis.helpers.TextDrawableHelper;
import com.beemdevelopment.aegis.helpers.UiRefresher; import com.beemdevelopment.aegis.helpers.UiRefresher;
import com.beemdevelopment.aegis.otp.HotpInfo; import com.beemdevelopment.aegis.otp.HotpInfo;
@ -17,9 +18,7 @@ import com.beemdevelopment.aegis.otp.OtpInfo;
import com.beemdevelopment.aegis.otp.SteamInfo; import com.beemdevelopment.aegis.otp.SteamInfo;
import com.beemdevelopment.aegis.otp.TotpInfo; import com.beemdevelopment.aegis.otp.TotpInfo;
import com.beemdevelopment.aegis.R; import androidx.recyclerview.widget.RecyclerView;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import android.os.Handler;
public class EntryHolder extends RecyclerView.ViewHolder { public class EntryHolder extends RecyclerView.ViewHolder {
private TextView _profileName; private TextView _profileName;

View file

@ -2,27 +2,26 @@ package com.beemdevelopment.aegis.ui.views;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.ItemTouchHelper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.AnimationUtils; import android.view.animation.AnimationUtils;
import android.view.animation.LayoutAnimationController; import android.view.animation.LayoutAnimationController;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.SortCategory; import com.beemdevelopment.aegis.SortCategory;
import com.beemdevelopment.aegis.ViewMode; import com.beemdevelopment.aegis.ViewMode;
import com.beemdevelopment.aegis.db.DatabaseEntry;
import com.beemdevelopment.aegis.helpers.SimpleItemTouchHelperCallback; import com.beemdevelopment.aegis.helpers.SimpleItemTouchHelperCallback;
import com.beemdevelopment.aegis.helpers.UiRefresher; import com.beemdevelopment.aegis.helpers.UiRefresher;
import com.beemdevelopment.aegis.otp.TotpInfo; import com.beemdevelopment.aegis.otp.TotpInfo;
import java.util.List; import java.util.List;
import com.beemdevelopment.aegis.R; import androidx.fragment.app.Fragment;
import com.beemdevelopment.aegis.db.DatabaseEntry; import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class EntryListView extends Fragment implements EntryAdapter.Listener { public class EntryListView extends Fragment implements EntryAdapter.Listener {
private EntryAdapter _adapter; private EntryAdapter _adapter;
@ -219,6 +218,5 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
void onEntryDrop(DatabaseEntry entry); void onEntryDrop(DatabaseEntry entry);
void onEntryChange(DatabaseEntry entry); void onEntryChange(DatabaseEntry entry);
void onScroll(int dx, int dy); void onScroll(int dx, int dy);
} }
} }

View file

@ -4,10 +4,11 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.beemdevelopment.aegis.R;
import java.util.ArrayList; import java.util.ArrayList;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.beemdevelopment.aegis.R;
public class GroupAdapter extends RecyclerView.Adapter<GroupHolder> { public class GroupAdapter extends RecyclerView.Adapter<GroupHolder> {
private GroupAdapter.Listener _listener; private GroupAdapter.Listener _listener;

View file

@ -1,12 +1,13 @@
package com.beemdevelopment.aegis.ui.views; package com.beemdevelopment.aegis.ui.views;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.beemdevelopment.aegis.R; import com.beemdevelopment.aegis.R;
import androidx.recyclerview.widget.RecyclerView;
public class GroupHolder extends RecyclerView.ViewHolder { public class GroupHolder extends RecyclerView.ViewHolder {
private TextView _slotName; private TextView _slotName;
private ImageView _buttonDelete; private ImageView _buttonDelete;

View file

@ -3,13 +3,14 @@ package com.beemdevelopment.aegis.ui.views;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.animation.LinearInterpolator; import android.view.animation.LinearInterpolator;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import com.beemdevelopment.aegis.otp.TotpInfo; import com.beemdevelopment.aegis.otp.TotpInfo;
import androidx.annotation.RequiresApi;
public class PeriodProgressBar extends ProgressBar { public class PeriodProgressBar extends ProgressBar {
private int _period; private int _period;

View file

@ -1,15 +1,16 @@
package com.beemdevelopment.aegis.ui.views; package com.beemdevelopment.aegis.ui.views;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import java.util.ArrayList;
import com.beemdevelopment.aegis.R; import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.slots.Slot; import com.beemdevelopment.aegis.db.slots.Slot;
import java.util.ArrayList;
import androidx.recyclerview.widget.RecyclerView;
public class SlotAdapter extends RecyclerView.Adapter<SlotHolder> { public class SlotAdapter extends RecyclerView.Adapter<SlotHolder> {
private Listener _listener; private Listener _listener;
private ArrayList<Slot> _slots; private ArrayList<Slot> _slots;

View file

@ -1,21 +1,20 @@
package com.beemdevelopment.aegis.ui.views; package com.beemdevelopment.aegis.ui.views;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.crypto.KeyStoreHandle; import com.beemdevelopment.aegis.crypto.KeyStoreHandle;
import com.beemdevelopment.aegis.crypto.KeyStoreHandleException; import com.beemdevelopment.aegis.crypto.KeyStoreHandleException;
import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import com.beemdevelopment.aegis.R;
import com.beemdevelopment.aegis.db.slots.FingerprintSlot; import com.beemdevelopment.aegis.db.slots.FingerprintSlot;
import com.beemdevelopment.aegis.db.slots.PasswordSlot; import com.beemdevelopment.aegis.db.slots.PasswordSlot;
import com.beemdevelopment.aegis.db.slots.RawSlot; import com.beemdevelopment.aegis.db.slots.RawSlot;
import com.beemdevelopment.aegis.db.slots.Slot; import com.beemdevelopment.aegis.db.slots.Slot;
import com.beemdevelopment.aegis.helpers.FingerprintHelper;
import androidx.recyclerview.widget.RecyclerView;
public class SlotHolder extends RecyclerView.ViewHolder { public class SlotHolder extends RecyclerView.ViewHolder {
private TextView _slotUsed; private TextView _slotUsed;

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -1,13 +1,13 @@
package com.beemdevelopment.aegis; package com.beemdevelopment.aegis;
import com.beemdevelopment.aegis.crypto.otp.HOTP;
import com.beemdevelopment.aegis.crypto.otp.OTP;
import org.junit.Test; import org.junit.Test;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import com.beemdevelopment.aegis.crypto.otp.HOTP;
import com.beemdevelopment.aegis.crypto.otp.OTP;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class HOTPTest { public class HOTPTest {

View file

@ -1,14 +1,11 @@
package com.beemdevelopment.aegis; package com.beemdevelopment.aegis;
import org.junit.Test;
import com.beemdevelopment.aegis.crypto.otp.OTP; import com.beemdevelopment.aegis.crypto.otp.OTP;
import com.beemdevelopment.aegis.crypto.otp.TOTP; import com.beemdevelopment.aegis.crypto.otp.TOTP;
import com.beemdevelopment.aegis.encoding.Hex;
import com.beemdevelopment.aegis.encoding.HexException; import com.beemdevelopment.aegis.encoding.HexException;
import java.nio.ByteBuffer; import org.junit.Test;
import java.nio.ByteOrder;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;