parent
372e9d1610
commit
73772126b8
8 changed files with 46 additions and 4 deletions
|
@ -72,6 +72,7 @@ If you want to discuss this app, share ideas for features or get help with bugs
|
|||
* [LicensesDialog](https://github.com/PSDev/LicensesDialog)
|
||||
* [MaterialProgressBar](https://github.com/DreaminginCodeZH/MaterialProgressBar)
|
||||
* [OpenPGP API library](https://github.com/open-keychain/openpgp-api)
|
||||
* [VNTNumberPickerPreference](https://github.com/vanniktech/VNTNumberPickerPreference)
|
||||
* [ZXing Android Embedded](https://github.com/journeyapps/zxing-android-embedded)
|
||||
|
||||
#### Code examples used:
|
||||
|
|
|
@ -38,4 +38,5 @@ dependencies {
|
|||
compile 'commons-codec:commons-codec:1.5'
|
||||
compile 'me.zhanghai.android.materialprogressbar:library:1.4.1'
|
||||
compile 'org.sufficientlysecure:openpgp-api:12.0'
|
||||
compile 'com.vanniktech:vntnumberpickerpreference:1.0.0'
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.preference.PreferenceManager;
|
|||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
|
@ -56,6 +57,7 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntriesCardAdapter.
|
|||
implements ItemTouchHelperAdapter, Filterable {
|
||||
|
||||
private Context context;
|
||||
private SharedPreferences sharedPrefs;
|
||||
private EntryFilter filter;
|
||||
private ArrayList<Entry> entries;
|
||||
private ArrayList<Integer> displayedEntries;
|
||||
|
@ -64,6 +66,8 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntriesCardAdapter.
|
|||
public EntriesCardAdapter(Context context) {
|
||||
this.context = context;
|
||||
|
||||
this.sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
loadEntries();
|
||||
}
|
||||
|
||||
|
@ -140,12 +144,14 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntriesCardAdapter.
|
|||
entryViewHolder.customPeriodLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (sharedPref.getBoolean(context.getString(R.string.settings_key_tap_to_reveal), false)) {
|
||||
if (sharedPrefs.getBoolean(context.getString(R.string.settings_key_tap_to_reveal), false)) {
|
||||
entryViewHolder.enableTapToReveal();
|
||||
} else {
|
||||
entryViewHolder.disableTapToReveal();
|
||||
}
|
||||
|
||||
int fontSize = sharedPrefs.getInt(context.getString(R.string.settings_key_label_size), context.getResources().getInteger(R.integer.settings_default_label_size));
|
||||
entryViewHolder.OTPLabel.setTextSize(TypedValue.COMPLEX_UNIT_PT, fontSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:textSize="8pt" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -18,6 +18,12 @@
|
|||
<copyright>Copyright (C) 2015 Dominik Schürmann</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>VNTNumberPickerPreference</name>
|
||||
<url>https://github.com/vanniktech/VNTNumberPickerPreference</url>
|
||||
<copyright>Copyright (C) 2014-2016 Vanniktech - Niklas Baudy</copyright>
|
||||
<license>Apache Software License 2.0</license>
|
||||
</notice>
|
||||
<notice>
|
||||
<name>ZXing Android Embedded</name>
|
||||
<url>https://github.com/journeyapps/zxing-android-embedded</url>
|
||||
|
|
9
app/src/main/res/values/settings.xml
Normal file
9
app/src/main/res/values/settings.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Default values -->
|
||||
<integer name="settings_default_label_size">8</integer>
|
||||
|
||||
<!-- Constraints -->
|
||||
<integer name="settings_min_label_size">4</integer>
|
||||
<integer name="settings_max_label_size">12</integer>
|
||||
</resources>
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
<!-- Categories -->
|
||||
<string name="settings_category_title_security">Security</string>
|
||||
<string name="settings_category_title_ui">User interface</string>
|
||||
<string name="settings_category_title_openpgp">OpenPGP</string>
|
||||
|
||||
<!-- Titles -->
|
||||
|
@ -11,6 +12,8 @@
|
|||
<string name="settings_title_auth_device">Require device credentials</string>
|
||||
<string name="settings_title_backup_password">Backup password</string>
|
||||
|
||||
<string name="settings_title_label_size">Label font size</string>
|
||||
|
||||
<string name="settings_title_openpgp_provider">Select OpenPGP provider</string>
|
||||
<string name="settings_title_openpgp_keyid">Select OpenPGP key</string>
|
||||
<string name="settings_title_openpgp_sign">Sign encrypted backups</string>
|
||||
|
@ -40,6 +43,8 @@
|
|||
<string name="settings_key_auth_device" translatable="false">pref_auth_device</string>
|
||||
<string name="settings_key_backup_password" translatable="false">pref_backup_password</string>
|
||||
|
||||
<string name="settings_key_label_size" translatable="false">pref_label_size</string>
|
||||
|
||||
<string name="settings_key_openpgp_provider">pref_openpgp_provider</string>
|
||||
<string name="settings_key_openpgp_keyid">pref_openpgp_keyid</string>
|
||||
<string name="settings_key_openpgp_sign">pref_openpgp_sign</string>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_category_title_security">
|
||||
|
@ -24,6 +26,18 @@
|
|||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_category_title_ui">
|
||||
|
||||
<com.vanniktech.vntnumberpickerpreference.VNTNumberPickerPreference
|
||||
android:key="@string/settings_key_label_size"
|
||||
android:title="@string/settings_title_label_size"
|
||||
android:defaultValue="@integer/settings_default_label_size"
|
||||
app:vnt_maxValue="@integer/settings_max_label_size"
|
||||
app:vnt_minValue="@integer/settings_min_label_size" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/settings_category_title_openpgp">
|
||||
|
||||
|
|
Loading…
Reference in a new issue