Some misc fixes

This commit is contained in:
Alexander Bakker 2018-06-09 21:40:18 +02:00
parent 152cc8b562
commit a2e5504eef
6 changed files with 12 additions and 8 deletions

View file

@ -310,7 +310,7 @@ public class EditEntryActivity extends AegisActivity {
finish(true); finish(true);
}); });
break; break;
case R.id.action_default_image: case R.id.action_default_icon:
TextDrawable drawable = TextDrawableHelper.generate(_entry.getIssuer(), _entry.getName(), _iconView); TextDrawable drawable = TextDrawableHelper.generate(_entry.getIssuer(), _entry.getName(), _iconView);
_iconView.setImageDrawable(drawable); _iconView.setImageDrawable(drawable);
_hasCustomImage = false; _hasCustomImage = false;
@ -328,7 +328,7 @@ public class EditEntryActivity extends AegisActivity {
menu.findItem(R.id.action_delete).setVisible(false); menu.findItem(R.id.action_delete).setVisible(false);
} }
if (!_hasCustomImage) { if (!_hasCustomImage) {
menu.findItem(R.id.action_default_image).setVisible(false); menu.findItem(R.id.action_default_icon).setVisible(false);
} }
return true; return true;

View file

@ -99,7 +99,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
setIntent(intent); setIntent(intent);
if (!doShortcutActions() || _db.isLocked()) { if (!doShortcutActions() || _db.isLocked()) {
startAuthActivity(); unlockDatabase(null);
} }
} }
@ -155,6 +155,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
} else if (data.getBooleanExtra("needsRefresh", false)) { } else if (data.getBooleanExtra("needsRefresh", false)) {
boolean showIssuer = getPreferences().isIssuerVisible(); boolean showIssuer = getPreferences().isIssuerVisible();
_entryListView.setShowIssuer(showIssuer); _entryListView.setShowIssuer(showIssuer);
_entryListView.refresh(true);
} }
} }
@ -361,6 +362,10 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
} }
private void unlockDatabase(MasterKey key) { private void unlockDatabase(MasterKey key) {
if (_loaded) {
return;
}
try { try {
if (!_db.isLoaded()) { if (!_db.isLoaded()) {
_db.load(); _db.load();

View file

@ -142,7 +142,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Pas
if (!_db.getFile().isEncrypted()) { if (!_db.getFile().isEncrypted()) {
PasswordDialogFragment dialog = new PasswordDialogFragment(); PasswordDialogFragment dialog = new PasswordDialogFragment();
// TODO: find a less ugly way to obtain the fragment manager // TODO: find a less ugly way to obtain the fragment manager
dialog.show(((AppCompatActivity)getActivity()).getSupportFragmentManager(), null); dialog.show(getActivity().getSupportFragmentManager(), null);
} else { } else {
new AlertDialog.Builder(getActivity()) new AlertDialog.Builder(getActivity())
.setTitle("Disable encryption") .setTitle("Disable encryption")

View file

@ -131,7 +131,6 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
public void setShowIssuer(boolean showIssuer) { public void setShowIssuer(boolean showIssuer) {
_adapter.setShowIssuer(showIssuer); _adapter.setShowIssuer(showIssuer);
_adapter.refresh(true);
} }
public void addEntry(DatabaseEntry entry) { public void addEntry(DatabaseEntry entry) {

View file

@ -13,7 +13,7 @@
app:showAsAction="never"/> app:showAsAction="never"/>
<item <item
android:id="@+id/action_default_image" android:id="@+id/action_default_icon"
android:title="@string/action_default_image" android:title="@string/action_default_icon"
app:showAsAction="never"/> app:showAsAction="never"/>
</menu> </menu>

View file

@ -3,7 +3,7 @@
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="action_import">Import</string> <string name="action_import">Import</string>
<string name="action_delete">Delete</string> <string name="action_delete">Delete</string>
<string name="action_default_image">Set default image</string> <string name="action_default_icon">Restore default icon</string>
<string name="discard">Discard</string> <string name="discard">Discard</string>
<string name="save">Save</string> <string name="save">Save</string>
<string name="title_activity_intro">IntroActivity</string> <string name="title_activity_intro">IntroActivity</string>