mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-16 23:12:51 +00:00
Fix serialization of entry icons and some other stuff
This commit is contained in:
parent
8419e1f35d
commit
606d6e77e9
7 changed files with 31 additions and 15 deletions
|
@ -115,10 +115,10 @@ public class EditEntryActivity extends AegisActivity {
|
|||
|
||||
// fill the fields with values if possible
|
||||
if (_entry != null) {
|
||||
if (_entry.getIcon() != null) {
|
||||
if (_entry.hasIcon()) {
|
||||
byte[] imageBytes = _entry.getIcon();
|
||||
Bitmap image = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
|
||||
_iconView.setImageBitmap(image);
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
|
||||
_iconView.setImageBitmap(bitmap);
|
||||
_hasCustomImage = true;
|
||||
} else {
|
||||
TextDrawable drawable = TextDrawableHelper.generate(_entry.getIssuer(), _entry.getName(), _iconView);
|
||||
|
|
|
@ -411,9 +411,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
private void loadEntries() {
|
||||
updateLockIcon();
|
||||
|
||||
for (DatabaseEntry entry : _db.getEntries()) {
|
||||
_entryListView.addEntry(entry);
|
||||
}
|
||||
_entryListView.addEntries(_db.getEntries());
|
||||
}
|
||||
|
||||
private void updateLockIcon() {
|
||||
|
|
|
@ -43,6 +43,11 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
|||
}
|
||||
}
|
||||
|
||||
public void addEntries(List<DatabaseEntry> entries) {
|
||||
_entries.addAll(entries);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void removeEntry(DatabaseEntry entry) {
|
||||
entry = getEntryByUUID(entry.getUUID());
|
||||
int position = _entries.indexOf(entry);
|
||||
|
|
|
@ -76,7 +76,7 @@ public class EntryHolder extends RecyclerView.ViewHolder {
|
|||
_profileIssuer.setText(" - " + entry.getIssuer());
|
||||
}
|
||||
|
||||
if (entry.getIcon() != null) {
|
||||
if (_entry.hasIcon()) {
|
||||
byte[] imageBytes = entry.getIcon();
|
||||
Bitmap image = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
|
||||
_profileDrawable.setImageBitmap(image);
|
||||
|
|
|
@ -10,6 +10,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.impy.aegis.R;
|
||||
import me.impy.aegis.db.DatabaseEntry;
|
||||
import me.impy.aegis.helpers.SimpleItemTouchHelperCallback;
|
||||
|
@ -135,6 +137,11 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
|||
checkPeriodUniformity();
|
||||
}
|
||||
|
||||
public void addEntries(List<DatabaseEntry> entries) {
|
||||
_adapter.addEntries(entries);
|
||||
checkPeriodUniformity();
|
||||
}
|
||||
|
||||
public void removeEntry(DatabaseEntry entry) {
|
||||
_adapter.removeEntry(entry);
|
||||
checkPeriodUniformity();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue