diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java index 097d5aaff..3d5bd6d9e 100755 --- a/app/src/main/java/com/hippo/ehviewer/Settings.java +++ b/app/src/main/java/com/hippo/ehviewer/Settings.java @@ -314,6 +314,13 @@ public class Settings { return getBoolean(KEY_SHOW_JPN_TITLE, DEFAULT_SHOW_JPN_TITLE); } + private static final String KEY_SHOW_GALLERY_PAGES = "show_gallery_pages"; + private static final boolean DEFAULT_SHOW_GALLERY_PAGES = false; + + public static boolean getShowGalleryPages() { + return getBoolean(KEY_SHOW_GALLERY_PAGES, DEFAULT_SHOW_GALLERY_PAGES); + } + public static final String KEY_DEFAULT_CATEGORIES = "default_categories"; public static final int DEFAULT_DEFAULT_CATEGORIES = EhUtils.ALL_CATEGORY; diff --git a/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java b/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java index 87db1b1ec..4fe690d8f 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java +++ b/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java @@ -209,7 +209,7 @@ public class EhEngine { } } - if (list.size() > 0 && (Settings.getShowJpnTitle() || sEhFilter.needCallApi())) { + if (list.size() > 0 && (Settings.getShowJpnTitle() || Settings.getShowGalleryPages() || sEhFilter.needCallApi())) { // Fill by api fillGalleryListByApi(task, okHttpClient, list); @@ -905,7 +905,7 @@ public class EhEngine { } } - if (list.size() > 0 && (Settings.getShowJpnTitle() || sEhFilter.needCallApi())) { + if (list.size() > 0 && (Settings.getShowJpnTitle() || Settings.getShowGalleryPages() || sEhFilter.needCallApi())) { // Fill by api fillGalleryListByApi(task, okHttpClient, list); diff --git a/app/src/main/java/com/hippo/ehviewer/client/data/GalleryInfo.java b/app/src/main/java/com/hippo/ehviewer/client/data/GalleryInfo.java index 3f94a14ab..d63f66d06 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/data/GalleryInfo.java +++ b/app/src/main/java/com/hippo/ehviewer/client/data/GalleryInfo.java @@ -90,6 +90,7 @@ public class GalleryInfo implements Parcelable { public float rating; @Nullable public String[] simpleTags; + public int pages; public int thumbWidth; public int thumbHeight; diff --git a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryApiParser.java b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryApiParser.java index cd0897233..c319a77da 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryApiParser.java +++ b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryApiParser.java @@ -53,6 +53,7 @@ public class GalleryApiParser { tags[j] = tagJa.getString(j); } gi.simpleTags = tags; + gi.pages = Integer.parseInt(g.getString("filecount")); } } diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryAdapter.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryAdapter.java index d49ea2d7f..defa0414f 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryAdapter.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryAdapter.java @@ -27,8 +27,8 @@ import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.RelativeLayout; import android.widget.TextView; - import com.hippo.drawable.TriangleDrawable; import com.hippo.easyrecyclerview.MarginItemDecoration; import com.hippo.ehviewer.R; @@ -38,7 +38,6 @@ import com.hippo.ehviewer.client.EhUtils; import com.hippo.ehviewer.client.data.GalleryInfo; import com.hippo.ehviewer.widget.TileThumb; import com.hippo.widget.recyclerview.AutoStaggeredGridLayoutManager; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -179,6 +178,17 @@ abstract class GalleryAdapter extends RecyclerView.Adapter { category.setBackgroundColor(EhUtils.getCategoryColor(gi.category)); } holder.posted.setText(gi.posted); + if (gi.pages == 0) { + holder.pages.setText(null); + RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.simpleLanguage.getLayoutParams(); + lp.addRule(RelativeLayout.LEFT_OF, 0); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + } else { + holder.pages.setText(Integer.toString(gi.pages) + "P"); + RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.simpleLanguage.getLayoutParams(); + lp.addRule(RelativeLayout.LEFT_OF, R.id.pages); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); + } holder.simpleLanguage.setText(gi.simpleLanguage); break; } diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryHolder.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryHolder.java index 8844cf8e3..6a0537dc5 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryHolder.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryHolder.java @@ -32,6 +32,7 @@ class GalleryHolder extends RecyclerView.ViewHolder { public final SimpleRatingView rating; public final TextView category; public final TextView posted; + public final TextView pages; public final TextView simpleLanguage; public GalleryHolder(View itemView) { @@ -43,6 +44,7 @@ class GalleryHolder extends RecyclerView.ViewHolder { rating = (SimpleRatingView) itemView.findViewById(R.id.rating); category = (TextView) itemView.findViewById(R.id.category); posted = (TextView) itemView.findViewById(R.id.posted); + pages = (TextView) itemView.findViewById(R.id.pages); simpleLanguage = (TextView) itemView.findViewById(R.id.simple_language); } } diff --git a/app/src/main/res/layout/item_gallery_list.xml b/app/src/main/res/layout/item_gallery_list.xml index 203017040..dff879511 100644 --- a/app/src/main/res/layout/item_gallery_list.xml +++ b/app/src/main/res/layout/item_gallery_list.xml @@ -81,7 +81,7 @@ android:layout_marginBottom="4dp"/> + + diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 77fc95a58..49eec549d 100755 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -418,6 +418,8 @@ 显示日文标题 尝试显示日文标题。这会使获取画廊列表花费更多时间 显示默认标题。一般是英文标题 + 显示画廊页数 + 在画廊列表中显示页数。这会使获取画廊列表花费更多时间 过滤 过滤标题,上传者,标签和标签组 移动网络警告 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 10194edd7..66f203a21 100755 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -417,6 +417,8 @@ 顯示日文標題 嘗試顯示日文標題。這會使獲取畫廊列表花費更多時間 顯示默認標題。一般是英文標題 + 顯示畫廊頁數 + 在畫廊列表中顯示頁數。這會使獲取畫廊列表花費更多時間 過濾 過濾標題,上傳者,標籤和標籤組 移動網絡警告 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3595873de..b5665592e 100755 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -417,6 +417,8 @@ 顯示日文標題 嘗試顯示日文標題。這會使取得圖庫列表時間增加 顯示預設的標題。通常是英文的 + 顯示圖庫頁數 + 在圖庫列表中顯示頁數。這會使取得圖庫列表時間增加 篩選 篩選標題,上傳者,標籤和標籤命名空間 行動數據警告 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 49ce650eb..071cc1bcc 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -461,6 +461,8 @@ Show Japanese title Try to show Japanese title. It takes more time to get gallery list Show default title. It is usually English title + Show gallery pages + Display the number of pages in the gallery list. It takes more time to get gallery list Filter Filter by title, uploader, tag and tag namespace Cellular network warning diff --git a/app/src/main/res/xml/eh_settings.xml b/app/src/main/res/xml/eh_settings.xml index 8c1d24a8a..a260b5e76 100644 --- a/app/src/main/res/xml/eh_settings.xml +++ b/app/src/main/res/xml/eh_settings.xml @@ -82,6 +82,12 @@ app:summaryOff="@string/settings_eh_show_jpn_title_summary_off" android:defaultValue="false"/> + +