mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-21 22:39:12 +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);
|
return _prefs.getBoolean("pref_secure_screen", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIssuerVisible() {
|
public boolean isAccountNameVisible() {
|
||||||
return _prefs.getBoolean("pref_issuer", false);
|
return _prefs.getBoolean("pref_account_name", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIntroDone() {
|
public boolean isIntroDone() {
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
||||||
// set up the entry view
|
// set up the entry view
|
||||||
_entryListView = (EntryListView) getSupportFragmentManager().findFragmentById(R.id.key_profiles);
|
_entryListView = (EntryListView) getSupportFragmentManager().findFragmentById(R.id.key_profiles);
|
||||||
_entryListView.setListener(this);
|
_entryListView.setListener(this);
|
||||||
_entryListView.setShowIssuer(getPreferences().isIssuerVisible());
|
_entryListView.setShowAccountName(getPreferences().isAccountNameVisible());
|
||||||
|
|
||||||
// set up the floating action button
|
// set up the floating action button
|
||||||
_fabMenu = findViewById(R.id.fab);
|
_fabMenu = findViewById(R.id.fab);
|
||||||
|
@ -153,8 +153,8 @@ public class MainActivity extends AegisActivity implements EntryListView.Listene
|
||||||
if (data.getBooleanExtra("needsRecreate", false)) {
|
if (data.getBooleanExtra("needsRecreate", false)) {
|
||||||
recreate();
|
recreate();
|
||||||
} else if (data.getBooleanExtra("needsRefresh", false)) {
|
} else if (data.getBooleanExtra("needsRefresh", false)) {
|
||||||
boolean showIssuer = getPreferences().isIssuerVisible();
|
boolean showAccountName = getPreferences().isAccountNameVisible();
|
||||||
_entryListView.setShowIssuer(showIssuer);
|
_entryListView.setShowAccountName(showAccountName);
|
||||||
_entryListView.refresh(true);
|
_entryListView.refresh(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class PreferencesFragment extends PreferenceFragmentCompat implements Pas
|
||||||
});
|
});
|
||||||
timeoutPreference.getOnPreferenceChangeListener().onPreferenceChange(timeoutPreference, timeoutPreference.getText());*/
|
timeoutPreference.getOnPreferenceChangeListener().onPreferenceChange(timeoutPreference, timeoutPreference.getText());*/
|
||||||
|
|
||||||
Preference issuerPreference = findPreference("pref_issuer");
|
Preference issuerPreference = findPreference("pref_account_name");
|
||||||
issuerPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
issuerPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
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 {
|
public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements ItemTouchHelperAdapter {
|
||||||
private List<DatabaseEntry> _entries;
|
private List<DatabaseEntry> _entries;
|
||||||
private static Listener _listener;
|
private static Listener _listener;
|
||||||
private boolean _showIssuer;
|
private boolean _showAccountName;
|
||||||
|
|
||||||
// keeps track of the viewholders that are currently bound
|
// keeps track of the viewholders that are currently bound
|
||||||
private List<EntryHolder> _holders;
|
private List<EntryHolder> _holders;
|
||||||
|
@ -32,8 +32,8 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
||||||
_listener = listener;
|
_listener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShowIssuer(boolean showIssuer) {
|
public void setShowAccountName(boolean showAccountName) {
|
||||||
_showIssuer = showIssuer;
|
_showAccountName = showAccountName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntry(DatabaseEntry entry) {
|
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) {
|
public void onBindViewHolder(final EntryHolder holder, int position) {
|
||||||
DatabaseEntry entry = _entries.get(position);
|
DatabaseEntry entry = _entries.get(position);
|
||||||
boolean showProgress = !isPeriodUniform() && entry.getInfo() instanceof TotpInfo;
|
boolean showProgress = !isPeriodUniform() && entry.getInfo() instanceof TotpInfo;
|
||||||
holder.setData(entry, _showIssuer, showProgress);
|
holder.setData(entry, _showAccountName, showProgress);
|
||||||
if (showProgress) {
|
if (showProgress) {
|
||||||
holder.startRefreshLoop();
|
holder.startRefreshLoop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class EntryHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
public EntryHolder(final View view) {
|
public EntryHolder(final View view) {
|
||||||
super(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);
|
_profileCode = view.findViewById(R.id.profile_code);
|
||||||
_profileIssuer = view.findViewById(R.id.profile_issuer);
|
_profileIssuer = view.findViewById(R.id.profile_issuer);
|
||||||
_profileDrawable = view.findViewById(R.id.ivTextDrawable);
|
_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;
|
_entry = entry;
|
||||||
|
|
||||||
// only show the progress bar if there is no uniform period and the entry type is TotpInfo
|
// 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
|
// only show the button if this entry is of type HotpInfo
|
||||||
_buttonRefresh.setVisibility(entry.getInfo() instanceof HotpInfo ? View.VISIBLE : View.GONE);
|
_buttonRefresh.setVisibility(entry.getInfo() instanceof HotpInfo ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
_profileName.setText(entry.getName());
|
_profileIssuer.setText(entry.getIssuer());
|
||||||
_profileIssuer.setText("");
|
_profileName.setText("");
|
||||||
if (showIssuer) {
|
if (showAccountName) {
|
||||||
_profileIssuer.setText(" - " + entry.getIssuer());
|
_profileName.setText(" - " + entry.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entry.hasIcon()) {
|
if (_entry.hasIcon()) {
|
||||||
|
|
|
@ -129,8 +129,8 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
||||||
_listener.onEntryChange(entry);
|
_listener.onEntryChange(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShowIssuer(boolean showIssuer) {
|
public void setShowAccountName(boolean showAccountName) {
|
||||||
_adapter.setShowIssuer(showIssuer);
|
_adapter.setShowAccountName(showAccountName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntry(DatabaseEntry entry) {
|
public void addEntry(DatabaseEntry entry) {
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/profile_name"
|
android:id="@+id/profile_issuer"
|
||||||
android:text="Keyprofile Title"
|
android:text="Issuer"
|
||||||
android:textColor="?attr/secondaryText"
|
android:textColor="?attr/secondaryText"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
|
@ -66,12 +66,12 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/profile_issuer"
|
android:id="@+id/profile_account_name"
|
||||||
android:text=" - Issuer"
|
android:text=" - AccountName"
|
||||||
android:textColor="@color/extra_info_text"
|
android:textColor="@color/extra_info_text"
|
||||||
android:includeFontPadding="false"
|
android:includeFontPadding="false"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:layout_toRightOf="@id/profile_name"
|
android:layout_toRightOf="@id/profile_issuer"
|
||||||
android:layout_below="@id/profile_code"
|
android:layout_below="@id/profile_code"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"/>
|
android:maxLines="1"/>
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
<string name="settings">Preferences</string>
|
<string name="settings">Preferences</string>
|
||||||
<string name="pref_dark_mode_title">Dark mode</string>
|
<string name="pref_dark_mode_title">Dark mode</string>
|
||||||
<string name="pref_dark_mode_summary">Enable this to use darker colors</string>
|
<string name="pref_dark_mode_summary">Enable this to use darker colors</string>
|
||||||
<string name="pref_issuer_title">Show the issuer</string>
|
<string name="pref_account_name_title">Show the account name</string>
|
||||||
<string name="pref_issuer_summary">Enable this to show the issuer next to the profile name</string>
|
<string name="pref_account_name_summary">Enable this to show the account name next to the issuer</string>
|
||||||
<string name="pref_timeout_title">Timeout</string>
|
<string name="pref_timeout_title">Timeout</string>
|
||||||
<string name="pref_timeout_summary">Automatically lock the database after %1$s seconds of inactivity</string>
|
<string name="pref_timeout_summary">Automatically lock the database after %1$s seconds of inactivity</string>
|
||||||
<string name="pref_slots_title">Key slots</string>
|
<string name="pref_slots_title">Key slots</string>
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
<android.support.v7.preference.SwitchPreferenceCompat
|
<android.support.v7.preference.SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pref_issuer"
|
android:key="pref_account_name"
|
||||||
android:title="@string/pref_issuer_title"
|
android:title="@string/pref_account_name_title"
|
||||||
android:summary="@string/pref_issuer_summary"/>
|
android:summary="@string/pref_account_name_summary"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|
Loading…
Add table
Reference in a new issue