Added preference to show / hide issuers

pull/41/head
Michael Schättgen 8 years ago
parent 54e5fba7c0
commit 03713c303c

@ -2,7 +2,9 @@ package me.impy.aegis;
import android.animation.ObjectAnimator;
import android.content.ClipData;
import android.content.SharedPreferences;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.ContactsContract;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@ -110,9 +112,11 @@ public class KeyProfileAdapter extends RecyclerView.Adapter<KeyProfileAdapter.Ke
ImageView profileDrawable;
KeyProfile keyProfile;
ProgressBar progressBar;
View _itemView;
KeyProfileHolder(final View itemView) {
super(itemView);
_itemView = itemView;
profileName = (TextView) itemView.findViewById(R.id.profile_name);
profileCode = (TextView) itemView.findViewById(R.id.profile_code);
profileIssuer = (TextView) itemView.findViewById(R.id.profile_issuer);
@ -127,7 +131,16 @@ public class KeyProfileAdapter extends RecyclerView.Adapter<KeyProfileAdapter.Ke
this.keyProfile = profile;
profileName.setText(profile.Name);
profileCode.setText(profile.Code);
profileIssuer.setText(" - " + profile.Info.getIssuer());
// So that we can have text in the designer without showing it to our user
profileIssuer.setText("");
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_itemView.getContext());
if(sharedPreferences.getBoolean("pref_issuer", false))
{
profileIssuer.setText(" - " + profile.Info.getIssuer());
}
profileDrawable.setImageDrawable(generateTextDrawable(profile));
}

@ -172,6 +172,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
mKeyProfileAdapter.notifyDataSetChanged();
setPreferredTheme();
}

@ -4,4 +4,7 @@
<string name="title_activity_intro">IntroActivity</string>
<string name="settings">Preferences</string>
<string name="pref_night_mode">Night mode</string>
<string name="pref_night_mode_description">Enable this to use darker colors</string>
<string name="pref_issuers">Show the issuer</string>
<string name="pref_issuers_description">Enable this to show the issuer next to the profile name</string>
</resources>

@ -5,5 +5,12 @@
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_night_mode"
android:title="@string/pref_night_mode" />
android:title="@string/pref_night_mode"
android:summary="@string/pref_night_mode_description"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_issuer"
android:title="@string/pref_issuers"
android:summary="@string/pref_issuers_description"/>
</PreferenceScreen>
Loading…
Cancel
Save