Support resize thumb, Implement #193
This commit is contained in:
1 parent
62b00c758c
commit
a5161bba6f
10 files changed
+51
-12
No files matched your search
@@ -100,6 +100,11 @@ public class Settings {
|
|||||||
private static final int DEFAULT_VERSION_CODE = 0;
|
private static final int DEFAULT_VERSION_CODE = 0;
|
||||||
private static final String KEY_DISPLAY_NAME = "display_name";
|
private static final String KEY_DISPLAY_NAME = "display_name";
|
||||||
private static final String DEFAULT_DISPLAY_NAME = null;
|
private static final String DEFAULT_DISPLAY_NAME = null;
|
||||||
|
public static final String KEY_LIST_THUMB_SIZE = "list_tile_size";
|
||||||
|
private static final int DEFAULT_LIST_THUMB_SIZE = 40;
|
||||||
|
private static int LIST_THUMB_SIZE = 40;
|
||||||
|
|
||||||
|
public static boolean LIST_THUMB_SIZE_INITED = false;
|
||||||
private static final String KEY_AVATAR = "avatar";
|
private static final String KEY_AVATAR = "avatar";
|
||||||
private static final String DEFAULT_AVATAR = null;
|
private static final String DEFAULT_AVATAR = null;
|
||||||
private static final String KEY_SHOW_WARNING = "show_warning";
|
private static final String KEY_SHOW_WARNING = "show_warning";
|
||||||
@@ -1168,4 +1173,14 @@ public class Settings {
|
|||||||
public static void putPasswdToArchivePasswds(String value) {
|
public static void putPasswdToArchivePasswds(String value) {
|
||||||
putStringToStringSet(KEY_ARCHIVE_PASSWDS, value);
|
putStringToStringSet(KEY_ARCHIVE_PASSWDS, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getListThumbSize() {
|
||||||
|
if (LIST_THUMB_SIZE_INITED) {
|
||||||
|
return LIST_THUMB_SIZE;
|
||||||
|
}
|
||||||
|
int size = 3 * getInt(KEY_LIST_THUMB_SIZE, DEFAULT_LIST_THUMB_SIZE);
|
||||||
|
LIST_THUMB_SIZE = size;
|
||||||
|
LIST_THUMB_SIZE_INITED = true;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ public class EhFragment extends BasePreferenceFragment {
|
|||||||
Preference blackDarkTheme = findPreference(Settings.KEY_BLACK_DARK_THEME);
|
Preference blackDarkTheme = findPreference(Settings.KEY_BLACK_DARK_THEME);
|
||||||
Preference gallerySite = findPreference(Settings.KEY_GALLERY_SITE);
|
Preference gallerySite = findPreference(Settings.KEY_GALLERY_SITE);
|
||||||
Preference listMode = findPreference(Settings.KEY_LIST_MODE);
|
Preference listMode = findPreference(Settings.KEY_LIST_MODE);
|
||||||
|
Preference listThumbSize = findPreference(Settings.KEY_LIST_THUMB_SIZE);
|
||||||
Preference detailSize = findPreference(Settings.KEY_DETAIL_SIZE);
|
Preference detailSize = findPreference(Settings.KEY_DETAIL_SIZE);
|
||||||
Preference thumbSize = findPreference(Settings.KEY_THUMB_SIZE);
|
Preference thumbSize = findPreference(Settings.KEY_THUMB_SIZE);
|
||||||
Preference showTagTranslations = findPreference(Settings.KEY_SHOW_TAG_TRANSLATIONS);
|
Preference showTagTranslations = findPreference(Settings.KEY_SHOW_TAG_TRANSLATIONS);
|
||||||
@@ -46,6 +47,7 @@ public class EhFragment extends BasePreferenceFragment {
|
|||||||
theme.setOnPreferenceChangeListener(this);
|
theme.setOnPreferenceChangeListener(this);
|
||||||
gallerySite.setOnPreferenceChangeListener(this);
|
gallerySite.setOnPreferenceChangeListener(this);
|
||||||
listMode.setOnPreferenceChangeListener(this);
|
listMode.setOnPreferenceChangeListener(this);
|
||||||
|
listThumbSize.setOnPreferenceChangeListener(this);
|
||||||
detailSize.setOnPreferenceChangeListener(this);
|
detailSize.setOnPreferenceChangeListener(this);
|
||||||
thumbSize.setOnPreferenceChangeListener(this);
|
thumbSize.setOnPreferenceChangeListener(this);
|
||||||
showTagTranslations.setOnPreferenceChangeListener(this);
|
showTagTranslations.setOnPreferenceChangeListener(this);
|
||||||
@@ -70,6 +72,10 @@ public class EhFragment extends BasePreferenceFragment {
|
|||||||
} else if (Settings.KEY_LIST_MODE.equals(key)) {
|
} else if (Settings.KEY_LIST_MODE.equals(key)) {
|
||||||
requireActivity().setResult(Activity.RESULT_OK);
|
requireActivity().setResult(Activity.RESULT_OK);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (Settings.KEY_LIST_THUMB_SIZE.equals(key)) {
|
||||||
|
Settings.LIST_THUMB_SIZE_INITED = false;
|
||||||
|
requireActivity().setResult(Activity.RESULT_OK);
|
||||||
|
return true;
|
||||||
} else if (Settings.KEY_DETAIL_SIZE.equals(key)) {
|
} else if (Settings.KEY_DETAIL_SIZE.equals(key)) {
|
||||||
requireActivity().setResult(Activity.RESULT_OK);
|
requireActivity().setResult(Activity.RESULT_OK);
|
||||||
} else if (Settings.KEY_THUMB_SIZE.equals(key)) {
|
} else if (Settings.KEY_THUMB_SIZE.equals(key)) {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.hippo.ehviewer.widget
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import com.hippo.ehviewer.Settings
|
||||||
|
|
||||||
|
class ResizeableFixedThumb @JvmOverloads constructor(
|
||||||
|
context: Context, attrs: AttributeSet? = null
|
||||||
|
) : FixedThumb(context, attrs) {
|
||||||
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
|
setMeasuredDimension(Settings.getListThumbSize() * 2, Settings.getListThumbSize() * 3)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.hippo.ehviewer.widget.FixedThumb
|
<com.hippo.ehviewer.widget.ResizeableFixedThumb
|
||||||
android:id="@+id/thumb"
|
android:id="@+id/thumb"
|
||||||
android:layout_width="@dimen/gallery_list_thumb_width"
|
android:layout_width="0dp"
|
||||||
android:layout_height="@dimen/gallery_list_thumb_height"
|
android:layout_height="0dp"
|
||||||
app:alwaysCutAndScale="true"
|
app:alwaysCutAndScale="true"
|
||||||
app:retryType="longClick" />
|
app:retryType="longClick" />
|
||||||
|
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<com.hippo.ehviewer.widget.FixedThumb
|
<com.hippo.ehviewer.widget.ResizeableFixedThumb
|
||||||
android:id="@+id/thumb"
|
android:id="@+id/thumb"
|
||||||
android:layout_width="@dimen/gallery_list_thumb_width"
|
android:layout_width="0dp"
|
||||||
android:layout_height="@dimen/gallery_list_thumb_height"
|
android:layout_height="0dp"
|
||||||
app:alwaysCutAndScale="true"
|
app:alwaysCutAndScale="true"
|
||||||
app:retryType="click"/>
|
app:retryType="click"/>
|
||||||
|
|
||||||
|
|||||||
@@ -768,4 +768,5 @@
|
|||||||
<string name="archive_need_passwd">归档文件需要密码</string>
|
<string name="archive_need_passwd">归档文件需要密码</string>
|
||||||
<string name="passwd_wrong">密码错误</string>
|
<string name="passwd_wrong">密码错误</string>
|
||||||
<string name="passwd_cannot_be_empty">密码不能为空</string>
|
<string name="passwd_cannot_be_empty">密码不能为空</string>
|
||||||
|
<string name="list_tile_thumb_size">详情模式下缩略图大小</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -134,10 +134,6 @@
|
|||||||
<attr name="url" format="string" />
|
<attr name="url" format="string" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="SeekBarPreference">
|
|
||||||
<attr name="max" format="integer" />
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="FastScroller">
|
<declare-styleable name="FastScroller">
|
||||||
<attr name="handler" format="reference" />
|
<attr name="handler" format="reference" />
|
||||||
<attr name="draggable" format="boolean" />
|
<attr name="draggable" format="boolean" />
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
<dimen name="rating_size">16dp</dimen>
|
<dimen name="rating_size">16dp</dimen>
|
||||||
<dimen name="rating_interval">1dp</dimen>
|
<dimen name="rating_interval">1dp</dimen>
|
||||||
|
|
||||||
<dimen name="gallery_list_thumb_height">120dp</dimen>
|
|
||||||
<dimen name="gallery_list_thumb_width">80dp</dimen>
|
|
||||||
<!-- 4dp - 4dp, 4dp for card padding -->
|
<!-- 4dp - 4dp, 4dp for card padding -->
|
||||||
<dimen name="gallery_list_interval">0dp</dimen>
|
<dimen name="gallery_list_interval">0dp</dimen>
|
||||||
<!-- 8dp - 4dp, 4dp for card padding -->
|
<!-- 8dp - 4dp, 4dp for card padding -->
|
||||||
|
|||||||
@@ -832,4 +832,5 @@
|
|||||||
<string name="archive_need_passwd">Archive need password</string>
|
<string name="archive_need_passwd">Archive need password</string>
|
||||||
<string name="passwd_wrong">Password Wrong</string>
|
<string name="passwd_wrong">Password Wrong</string>
|
||||||
<string name="passwd_cannot_be_empty">Password can\'t be empty</string>
|
<string name="passwd_cannot_be_empty">Password can\'t be empty</string>
|
||||||
|
<string name="list_tile_thumb_size">Thumb size in thumb mode</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -82,6 +82,15 @@
|
|||||||
app:entryValues="@array/list_mode_entry_values"
|
app:entryValues="@array/list_mode_entry_values"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
|
<SeekBarPreference
|
||||||
|
android:defaultValue="40"
|
||||||
|
android:key="list_tile_size"
|
||||||
|
android:title="@string/list_tile_thumb_size"
|
||||||
|
android:max="60"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:min="30"
|
||||||
|
app:showSeekBarValue="true" />
|
||||||
|
|
||||||
<rikka.preference.SimpleMenuPreference
|
<rikka.preference.SimpleMenuPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:key="detail_size"
|
android:key="detail_size"
|
||||||
|
|||||||
Reference in new issue
Block a user