From be2d9654158287d4bf128519fa150fb83debd2b6 Mon Sep 17 00:00:00 2001 From: Haleydu <44172947+Haleydu@users.noreply.github.com> Date: Mon, 3 Aug 2020 20:20:59 +0800 Subject: [PATCH] =?UTF-8?q?Add=20options=20to=20automatically=20resize=20i?= =?UTF-8?q?mages=20=E4=BF=AE=E5=BE=A9=E7=9C=8B=E5=A4=A7=E5=9C=96=E6=99=82?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=9C=83=E6=A8=A1=E7=B3=8A=E7=9A=84=E5=95=8F?= =?UTF-8?q?=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hiroshi/cimoc/manager/PreferenceManager.java | 1 + .../com/hiroshi/cimoc/ui/activity/ReaderActivity.java | 1 + .../hiroshi/cimoc/ui/activity/SettingsActivity.java | 3 +++ .../com/hiroshi/cimoc/ui/adapter/ReaderAdapter.java | 11 +++++++++-- app/src/main/res/layout/activity_settings.xml | 7 +++++++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 7 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java b/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java index 001e8104..493b5a28 100644 --- a/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java +++ b/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java @@ -38,6 +38,7 @@ public class PreferenceManager { public static final String PREF_READER_HIDE_NAV = "pref_reader_hide_nav"; public static final String PREF_READER_BAN_DOUBLE_CLICK = "pref_reader_ban_double_click"; public static final String PREF_READER_PAGING = "pref_reader_paging"; + public static final String PREF_READER_CLOSEAUTORESIZEIMAGE = "pref_reader_closeautoresizeimage "; public static final String PREF_READER_PAGING_REVERSE = "pref_reader_paging_reverse"; public static final String PREF_READER_WHITE_EDGE = "pref_reader_white_edge"; public static final String PREF_READER_WHITE_BACKGROUND = "pref_reader_white_background"; diff --git a/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java b/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java index 72c91d90..82083858 100644 --- a/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java +++ b/app/src/main/java/com/hiroshi/cimoc/ui/activity/ReaderActivity.java @@ -226,6 +226,7 @@ private void initReaderAdapter() { mReaderAdapter.setDoubleTap(!mPreference.getBoolean(PreferenceManager.PREF_READER_BAN_DOUBLE_CLICK, false)); mReaderAdapter.setVertical(turn == PreferenceManager.READER_TURN_ATB); mReaderAdapter.setPaging(mPreference.getBoolean(PreferenceManager.PREF_READER_PAGING, false)); + mReaderAdapter.setCloseAutoResizeImage(mPreference.getBoolean(PreferenceManager.PREF_READER_CLOSEAUTORESIZEIMAGE, false)); mReaderAdapter.setPagingReverse(mPreference.getBoolean(PreferenceManager.PREF_READER_PAGING_REVERSE, false)); mReaderAdapter.setWhiteEdge(mPreference.getBoolean(PreferenceManager.PREF_READER_WHITE_EDGE, false)); mReaderAdapter.setBanTurn(mPreference.getBoolean(PreferenceManager.PREF_READER_PAGE_BAN_TURN, false)); diff --git a/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java b/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java index fed54fff..ad2145cd 100644 --- a/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java +++ b/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java @@ -66,6 +66,8 @@ public class SettingsActivity extends BackActivity implements SettingsView { CheckBoxPreference mReaderBanDoubleClick; @BindView(R.id.settings_reader_paging) CheckBoxPreference mReaderPaging; + @BindView(R.id.settings_reader_closeautoresizeimage) + CheckBoxPreference mReaderCloseAutoResizeImage; @BindView(R.id.settings_reader_paging_reverse) CheckBoxPreference mReaderPagingReverse; @BindView(R.id.settings_reader_white_edge) @@ -121,6 +123,7 @@ protected void initView() { mReaderHideNav.bindPreference(PreferenceManager.PREF_READER_HIDE_NAV, false); mReaderBanDoubleClick.bindPreference(PreferenceManager.PREF_READER_BAN_DOUBLE_CLICK, false); mReaderPaging.bindPreference(PreferenceManager.PREF_READER_PAGING, false); + mReaderCloseAutoResizeImage.bindPreference(PreferenceManager.PREF_READER_CLOSEAUTORESIZEIMAGE, false); mReaderPagingReverse.bindPreference(PreferenceManager.PREF_READER_PAGING_REVERSE, false); mReaderWhiteEdge.bindPreference(PreferenceManager.PREF_READER_WHITE_EDGE, false); mReaderWhiteBackground.bindPreference(PreferenceManager.PREF_READER_WHITE_BACKGROUND, false); diff --git a/app/src/main/java/com/hiroshi/cimoc/ui/adapter/ReaderAdapter.java b/app/src/main/java/com/hiroshi/cimoc/ui/adapter/ReaderAdapter.java index 33fd9528..460af493 100644 --- a/app/src/main/java/com/hiroshi/cimoc/ui/adapter/ReaderAdapter.java +++ b/app/src/main/java/com/hiroshi/cimoc/ui/adapter/ReaderAdapter.java @@ -13,6 +13,7 @@ import com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilderSupplier; import com.facebook.drawee.controller.BaseControllerListener; import com.facebook.drawee.view.DraweeView; +import com.facebook.imagepipeline.common.ResizeOptions; import com.facebook.imagepipeline.image.ImageInfo; import com.facebook.imagepipeline.listener.BaseRequestListener; import com.facebook.imagepipeline.request.ImageRequest; @@ -53,8 +54,10 @@ public class ReaderAdapter extends BaseAdapter { private boolean isWhiteEdge; private boolean isBanTurn; private boolean isDoubleTap; + private boolean isCloseAutoResizeImage; private float mScaleFactor; + public ReaderAdapter(Context context, List list) { super(context, list); } @@ -133,11 +136,11 @@ public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatabl // TODO 切图后可能需要修改图片高度和宽度 MangaPostprocessor processor = new MangaPostprocessor(imageUrl, isPaging, isPagingReverse, isWhiteEdge); imageRequestBuilder.setPostprocessor(processor); -/* if (isNeedResize(imageUrl)) { + if (!isCloseAutoResizeImage) { ResizeOptions options = isVertical ? new ResizeOptions(App.mWidthPixels, App.mHeightPixels) : new ResizeOptions(App.mHeightPixels, App.mWidthPixels); imageRequestBuilder.setResizeOptions(options); - }*/ + } imageRequestBuilder.setRequestListener(new BaseRequestListener() { @Override public void onRequestSuccess(ImageRequest request, String requestId, boolean isPrefetch) { @@ -188,6 +191,10 @@ public void setPagingReverse(boolean pagingReverse) { isPagingReverse = pagingReverse; } + public void setCloseAutoResizeImage(boolean closeAutoResizeImage) { + isCloseAutoResizeImage = closeAutoResizeImage; + } + public void setWhiteEdge(boolean whiteEdge) { isWhiteEdge = whiteEdge; } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index c545e81c..ef7c2564 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -89,6 +89,13 @@ app:summary="@string/settings_reader_paging_summary" app:title="@string/settings_reader_paging" /> + + 隱藏導航欄 閱讀狀態底部隱藏導航欄 自動切割大圖 + 關閉自動調整圖像大小 反向切割大圖 閱讀狀態自動切割大圖 + 閱讀狀態關閉自動調整圖像大小\n(提升速度,但是圖片可能模糊) 交換大圖切割後位置 雙擊放大百分比 下載設定 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 507b68c7..0346f45b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -154,8 +154,10 @@ 隐藏导航栏 阅读状态底部隐藏导航栏 自动切割大图 + 关闭自动调整图像大小 反向切割大图 阅读状态自动切割大图 + 阅读状态关闭自动调整图像大小\n(提升速度,但是图片可能模糊) 交换大图切割后位置 双击放大百分比 下载设置