diff --git a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryDetailParser.java b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryDetailParser.java index 8f69ddcf7..27f9a6717 100644 --- a/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryDetailParser.java +++ b/app/src/main/java/com/hippo/ehviewer/client/parser/GalleryDetailParser.java @@ -272,7 +272,10 @@ public class GalleryDetailParser { if (key.startsWith("Posted")) { gd.posted = value; } else if (key.startsWith("Parent")) { - gd.parent = value; + Element a = es.get(1).children().first(); + if (a != null) { + gd.parent = a.attr("href"); + } } else if (key.startsWith("Visible")) { gd.visible = value; } else if (key.startsWith("Language")) { diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryInfoScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryInfoScene.java index 6ecd81d21..060a0d371 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryInfoScene.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryInfoScene.java @@ -36,6 +36,7 @@ import com.hippo.easyrecyclerview.EasyRecyclerView; import com.hippo.easyrecyclerview.LinearDividerItemDecoration; import com.hippo.ehviewer.R; import com.hippo.ehviewer.Settings; +import com.hippo.ehviewer.UrlOpener; import com.hippo.ehviewer.client.EhUrl; import com.hippo.ehviewer.client.EhUtils; import com.hippo.ehviewer.client.data.GalleryDetail; @@ -51,6 +52,9 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler public static final String KEY_KEYS = "keys"; public static final String KEY_VALUES = "values"; + private static final int INDEX_URL = 3; + private static final int INDEX_PARENT = 10; + /*--------------- Whole life cycle ---------------*/ @@ -199,15 +203,19 @@ public final class GalleryInfoScene extends ToolbarScene implements EasyRecycler public boolean onItemClick(EasyRecyclerView parent, View view, int position, long id) { Context context = getContext2(); if (null != context && 0 != position && null != mValues) { - ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); - cmb.setPrimaryClip(ClipData.newPlainText(null, mValues.get(position))); + if (position == INDEX_PARENT) { + UrlOpener.openUrl(context, mValues.get(position), true); + } else { + ClipboardManager cmb = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); + cmb.setPrimaryClip(ClipData.newPlainText(null, mValues.get(position))); - if (position == 3) { - // Save it to avoid detect the gallery - Settings.putClipboardTextHashCode(mValues.get(position).hashCode()); + if (position == INDEX_URL) { + // Save it to avoid detect the gallery + Settings.putClipboardTextHashCode(mValues.get(position).hashCode()); + } + + showTip(R.string.copied_to_clipboard, LENGTH_SHORT); } - - showTip(R.string.copied_to_clipboard, LENGTH_SHORT); return true; } else { return false;