Move thumbnail toggle into the size selector
This commit is contained in:
parent
e9254fca6f
commit
ccbe2ef19c
8 changed files with 24 additions and 25 deletions
|
@ -309,7 +309,6 @@ public class MainActivity extends BaseActivity
|
|||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
if (key.equals(getString(R.string.settings_key_label_size)) ||
|
||||
key.equals(getString(R.string.settings_key_label_scroll)) ||
|
||||
key.equals(getString(R.string.settings_key_thumbnail_visible)) ||
|
||||
key.equals(getString(R.string.settings_key_thumbnail_size))) {
|
||||
adapter.notifyDataSetChanged();
|
||||
} else if (key.equals(getString(R.string.settings_key_tap_to_reveal)) ||
|
||||
|
|
|
@ -84,10 +84,10 @@ public class EntryThumbnail {
|
|||
}
|
||||
|
||||
public static Bitmap getThumbnailGraphic(Context context, String label, int size, EntryThumbnails thumbnail) {
|
||||
if(thumbnail == EntryThumbnails.Default) {
|
||||
if (thumbnail == EntryThumbnails.Default && size > 0) {
|
||||
LetterBitmap letterBitmap = new LetterBitmap(context);
|
||||
return letterBitmap.getLetterTile(label, label, size, size);
|
||||
}
|
||||
} else if (thumbnail != EntryThumbnails.Default) {
|
||||
|
||||
try {
|
||||
if (thumbnail.getAssetType() == AssetType.Vector) {
|
||||
|
@ -103,6 +103,7 @@ public class EntryThumbnail {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher_round);
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ public class Settings {
|
|||
}
|
||||
|
||||
public boolean getThumbnailVisible() {
|
||||
return getBoolean(R.string.settings_key_thumbnail_visible, true);
|
||||
return getThumbnailSize() > 0;
|
||||
}
|
||||
|
||||
public int getThumbnailSize() {
|
||||
|
|
|
@ -168,7 +168,9 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntryViewHolder>
|
|||
}
|
||||
|
||||
entryViewHolder.setLabelSize(settings.getLabelSize());
|
||||
if(settings.getThumbnailVisible()) {
|
||||
entryViewHolder.setThumbnailSize(settings.getThumbnailSize());
|
||||
}
|
||||
entryViewHolder.setLabelScroll(settings.getScrollLabel());
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,9 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
thumbnailImg.setVisibility(settings.getThumbnailVisible() ? View.VISIBLE : View.GONE);
|
||||
|
||||
int thumbnailSize = settings.getThumbnailSize();
|
||||
if(settings.getThumbnailVisible()) {
|
||||
thumbnailImg.setImageBitmap(EntryThumbnail.getThumbnailGraphic(context, label, thumbnailSize, thumbnail));
|
||||
}
|
||||
|
||||
if (this.tapToReveal) {
|
||||
if (isVisible) {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<string name="settings_key_theme" translatable="false">pref_theme</string>
|
||||
<string name="settings_key_label_size" translatable="false">pref_label_size_sp</string>
|
||||
<string name="settings_key_label_scroll" translatable="false">pref_label_scroll</string>
|
||||
<string name="settings_key_thumbnail_visible" translatable="false">pref_thumbnail_visible</string>
|
||||
<string name="settings_key_thumbnail_size" translatable="false">pref_thumbnail_size</string>
|
||||
|
||||
<string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string>
|
||||
|
@ -93,6 +92,7 @@
|
|||
</string-array>
|
||||
|
||||
<string-array name="settings_values_thumbnail_size" translatable="false">
|
||||
<item>0dp</item>
|
||||
<item>32dp</item>
|
||||
<item>46dp</item>
|
||||
<item>64dp</item>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
<string name="settings_title_theme">Theme</string>
|
||||
<string name="settings_title_label_size">Label font size</string>
|
||||
<string name="settings_title_label_scroll">Scroll label</string>
|
||||
<string name="settings_title_thumbnail_visible_ask">Show thumbnails</string>
|
||||
<string name="settings_title_thumbnail_size_ask">Thumbnail size</string>
|
||||
|
||||
<string name="settings_title_backup_ask">Ask for filename</string>
|
||||
|
@ -84,6 +83,7 @@
|
|||
</string-array>
|
||||
|
||||
<string-array name="settings_entries_thumbnail_size">
|
||||
<item>Hidden</item>
|
||||
<item>Small</item>
|
||||
<item>Default</item>
|
||||
<item>Medium</item>
|
||||
|
|
|
@ -76,11 +76,6 @@
|
|||
android:summary="@string/settings_desc_label_scroll"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/settings_key_thumbnail_visible"
|
||||
android:title="@string/settings_title_thumbnail_visible_ask"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<ListPreference
|
||||
android:key="@string/settings_key_thumbnail_size"
|
||||
android:title="@string/settings_title_thumbnail_size_ask"
|
||||
|
|
Loading…
Reference in a new issue