mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-28 17:48:11 +00:00
Add some toast
This commit is contained in:
parent
ca68f0525d
commit
daf81e02e6
4 changed files with 22 additions and 17 deletions
|
@ -86,7 +86,7 @@ public class CustomAuthenticatedSlide extends Fragment implements FingerprintUiH
|
||||||
if (_storeHandle == null) {
|
if (_storeHandle == null) {
|
||||||
_storeHandle = new KeyStoreHandle();
|
_storeHandle = new KeyStoreHandle();
|
||||||
}
|
}
|
||||||
// TODO: consider regenerating the key if it exists
|
// TODO: consider regenerating the key here if it already exists
|
||||||
if (!_storeHandle.keyExists()) {
|
if (!_storeHandle.keyExists()) {
|
||||||
key = _storeHandle.generateKey(true);
|
key = _storeHandle.generateKey(true);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import me.impy.aegis.helpers.ItemTouchHelperAdapter;
|
import me.impy.aegis.helpers.ItemTouchHelperAdapter;
|
||||||
|
|
|
@ -81,7 +81,8 @@ public class MainActivity extends AppCompatActivity {
|
||||||
Intent intro = new Intent(this, IntroActivity.class);
|
Intent intro = new Intent(this, IntroActivity.class);
|
||||||
startActivityForResult(intro, CODE_DO_INTRO);
|
startActivityForResult(intro, CODE_DO_INTRO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: feedback
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "An error occurred while trying to deserialize the database", Toast.LENGTH_LONG).show();
|
||||||
throw new UndeclaredThrowableException(e);
|
throw new UndeclaredThrowableException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +214,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
_db.addKey(entry);
|
_db.addKey(entry);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// TODO: feedback
|
Toast.makeText(this, "An error occurred while trying to add an entry", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +236,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
_db.setMasterKey(key);
|
_db.setMasterKey(key);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: feedback
|
e.printStackTrace();
|
||||||
throw new UndeclaredThrowableException(e);
|
Toast.makeText(this, "An error occurred while trying to load/decrypt the database", Toast.LENGTH_LONG).show();
|
||||||
|
recreate();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadKeyProfiles();
|
loadKeyProfiles();
|
||||||
|
@ -247,8 +250,10 @@ public class MainActivity extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
_db.setMasterKey(key);
|
_db.setMasterKey(key);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: feedback
|
e.printStackTrace();
|
||||||
throw new UndeclaredThrowableException(e);
|
Toast.makeText(this, "An error occurred while trying to decrypt the database", Toast.LENGTH_LONG).show();
|
||||||
|
recreate();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadKeyProfiles();
|
loadKeyProfiles();
|
||||||
|
@ -315,14 +320,13 @@ public class MainActivity extends AppCompatActivity {
|
||||||
_db.removeKey(profile.getEntry());
|
_db.removeKey(profile.getEntry());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
//TODO: feedback
|
Toast.makeText(this, "An error occurred while trying to delete an entry", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_keyProfiles.remove(_clickedItemPosition);
|
_keyProfiles.remove(_clickedItemPosition);
|
||||||
_keyProfileAdapter.notifyItemRemoved(_clickedItemPosition);
|
_keyProfileAdapter.notifyItemRemoved(_clickedItemPosition);
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.no, (dialog, which) -> {
|
.setNegativeButton(android.R.string.no, null)
|
||||||
})
|
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,8 +424,8 @@ public class MainActivity extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
_db.save();
|
_db.save();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
//TODO: feedback
|
e.printStackTrace();
|
||||||
throw new UndeclaredThrowableException(e);
|
Toast.makeText(this, "An error occurred while trying to save the database", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,14 +436,16 @@ public class MainActivity extends AppCompatActivity {
|
||||||
for (DatabaseEntry entry : _db.getKeys()) {
|
for (DatabaseEntry entry : _db.getKeys()) {
|
||||||
_keyProfiles.add(new KeyProfile(entry));
|
_keyProfiles.add(new KeyProfile(entry));
|
||||||
}
|
}
|
||||||
_keyProfileAdapter.notifyDataSetChanged();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Toast.makeText(this, "An error occurred while trying to load database entries", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(_keyProfiles, (p1, p2) -> {
|
Collections.sort(_keyProfiles, (p1, p2) -> {
|
||||||
return p1.getEntry().getOrder() >= p2.getEntry().getOrder() ? 1 : -1;
|
return p1.getEntry().getOrder() >= p2.getEntry().getOrder() ? 1 : -1;
|
||||||
});
|
});
|
||||||
|
_keyProfileAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLockIcon() {
|
private void updateLockIcon() {
|
||||||
|
|
|
@ -40,16 +40,16 @@ public class Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addKey(DatabaseEntry entry) throws Exception {
|
public void addKey(DatabaseEntry entry) {
|
||||||
entry.setID(_entries.size() + 1);
|
entry.setID(_entries.size() + 1);
|
||||||
_entries.add(entry);
|
_entries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeKey(DatabaseEntry entry) throws Exception {
|
public void removeKey(DatabaseEntry entry) {
|
||||||
_entries.remove(entry);
|
_entries.remove(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DatabaseEntry> getKeys() throws Exception {
|
public List<DatabaseEntry> getKeys() {
|
||||||
return _entries;
|
return _entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue