mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-04 12:24:49 +00:00
Switched issuer with account name
This commit is contained in:
parent
cebf933c18
commit
54c85a09de
9 changed files with 28 additions and 28 deletions
|
@ -19,8 +19,8 @@ public class Preferences {
|
|||
return _prefs.getBoolean("pref_secure_screen", true);
|
||||
}
|
||||
|
||||
public boolean isIssuerVisible() {
|
||||
return _prefs.getBoolean("pref_issuer", false);
|
||||
public boolean isAccountNameVisible() {
|
||||
return _prefs.getBoolean("pref_account_name", false);
|
||||
}
|
||||
|
||||
public boolean isIntroDone() {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
// set up the entry view
|
||||
_entryListView = (EntryListView) getSupportFragmentManager().findFragmentById(R.id.key_profiles);
|
||||
_entryListView.setListener(this);
|
||||
_entryListView.setShowIssuer(getPreferences().isIssuerVisible());
|
||||
_entryListView.setShowAccountName(getPreferences().isAccountNameVisible());
|
||||
|
||||
// set up the floating action button
|
||||
_fabMenu = findViewById(R.id.fab);
|
||||
|
@ -153,8 +153,8 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
|||
if (data.getBooleanExtra("needsRecreate", false)) {
|
||||
recreate();
|
||||
} else if (data.getBooleanExtra("needsRefresh", false)) {
|
||||
boolean showIssuer = getPreferences().isIssuerVisible();
|
||||
_entryListView.setShowIssuer(showIssuer);
|
||||
boolean showAccountName = getPreferences().isAccountNameVisible();
|
||||
_entryListView.setShowAccountName(showAccountName);
|
||||
_entryListView.refresh(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Pas
|
|||
});
|
||||
timeoutPreference.getOnPreferenceChangeListener().onPreferenceChange(timeoutPreference, timeoutPreference.getText());*/
|
||||
|
||||
Preference issuerPreference = findPreference("pref_issuer");
|
||||
Preference issuerPreference = findPreference("pref_account_name");
|
||||
issuerPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
|
|
|
@ -21,7 +21,7 @@ import me.impy.aegis.otp.TotpInfo;
|
|||
public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements ItemTouchHelperAdapter {
|
||||
private List<DatabaseEntry> _entries;
|
||||
private static Listener _listener;
|
||||
private boolean _showIssuer;
|
||||
private boolean _showAccountName;
|
||||
|
||||
// keeps track of the viewholders that are currently bound
|
||||
private List<EntryHolder> _holders;
|
||||
|
@ -32,8 +32,8 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
|||
_listener = listener;
|
||||
}
|
||||
|
||||
public void setShowIssuer(boolean showIssuer) {
|
||||
_showIssuer = showIssuer;
|
||||
public void setShowAccountName(boolean showAccountName) {
|
||||
_showAccountName = showAccountName;
|
||||
}
|
||||
|
||||
public void addEntry(DatabaseEntry entry) {
|
||||
|
@ -126,7 +126,7 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
|||
public void onBindViewHolder(final EntryHolder holder, int position) {
|
||||
DatabaseEntry entry = _entries.get(position);
|
||||
boolean showProgress = !isPeriodUniform() && entry.getInfo() instanceof TotpInfo;
|
||||
holder.setData(entry, _showIssuer, showProgress);
|
||||
holder.setData(entry, _showAccountName, showProgress);
|
||||
if (showProgress) {
|
||||
holder.startRefreshLoop();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class EntryHolder extends RecyclerView.ViewHolder {
|
|||
|
||||
public EntryHolder(final View view) {
|
||||
super(view);
|
||||
_profileName = view.findViewById(R.id.profile_name);
|
||||
_profileName = view.findViewById(R.id.profile_account_name);
|
||||
_profileCode = view.findViewById(R.id.profile_code);
|
||||
_profileIssuer = view.findViewById(R.id.profile_issuer);
|
||||
_profileDrawable = view.findViewById(R.id.ivTextDrawable);
|
||||
|
@ -58,7 +58,7 @@ public class EntryHolder extends RecyclerView.ViewHolder {
|
|||
});
|
||||
}
|
||||
|
||||
public void setData(DatabaseEntry entry, boolean showIssuer, boolean showProgress) {
|
||||
public void setData(DatabaseEntry entry, boolean showAccountName, boolean showProgress) {
|
||||
_entry = entry;
|
||||
|
||||
// only show the progress bar if there is no uniform period and the entry type is TotpInfo
|
||||
|
@ -70,10 +70,10 @@ public class EntryHolder extends RecyclerView.ViewHolder {
|
|||
// only show the button if this entry is of type HotpInfo
|
||||
_buttonRefresh.setVisibility(entry.getInfo() instanceof HotpInfo ? View.VISIBLE : View.GONE);
|
||||
|
||||
_profileName.setText(entry.getName());
|
||||
_profileIssuer.setText("");
|
||||
if (showIssuer) {
|
||||
_profileIssuer.setText(" - " + entry.getIssuer());
|
||||
_profileIssuer.setText(entry.getIssuer());
|
||||
_profileName.setText("");
|
||||
if (showAccountName) {
|
||||
_profileName.setText(" - " + entry.getName());
|
||||
}
|
||||
|
||||
if (_entry.hasIcon()) {
|
||||
|
|
|
@ -129,8 +129,8 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
|||
_listener.onEntryChange(entry);
|
||||
}
|
||||
|
||||
public void setShowIssuer(boolean showIssuer) {
|
||||
_adapter.setShowIssuer(showIssuer);
|
||||
public void setShowAccountName(boolean showAccountName) {
|
||||
_adapter.setShowAccountName(showAccountName);
|
||||
}
|
||||
|
||||
public void addEntry(DatabaseEntry entry) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue