diff --git a/app/build.gradle b/app/build.gradle
index 6c14ead6c..6ec2ed13a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -79,6 +79,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:customtabs:23.2.0'
compile 'com.android.support:design:23.2.0'
+ compile 'com.github.amlcurran.showcaseview:library:5.4.1'
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.6'
compile 'de.greenrobot:greendao:2.0.0'
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
diff --git a/app/src/main/java/com/hippo/ehviewer/Settings.java b/app/src/main/java/com/hippo/ehviewer/Settings.java
index 8c0a52e63..78d31c0d7 100644
--- a/app/src/main/java/com/hippo/ehviewer/Settings.java
+++ b/app/src/main/java/com/hippo/ehviewer/Settings.java
@@ -635,4 +635,51 @@ public class Settings {
public static void putSaveParseErrorBody(boolean value) {
putBoolean(KEY_SAVE_PARSE_ERROR_BODY, value);
}
+
+ /********************
+ ****** Guide
+ ********************/
+ private static final String KEY_GUIDE_QUICK_SEARCH = "guide_quick_search";
+ private static final boolean DEFAULT_GUIDE_QUICK_SEARCH = true;
+
+ public static boolean getGuideQuickSearch() {
+ return getBoolean(KEY_GUIDE_QUICK_SEARCH, DEFAULT_GUIDE_QUICK_SEARCH);
+ }
+
+ public static void putGuideQuickSearch(boolean value) {
+ putBoolean(KEY_GUIDE_QUICK_SEARCH, value);
+ }
+
+ private static final String KEY_GUIDE_COLLECTIONS = "guide_collections";
+ private static final boolean DEFAULT_GUIDE_COLLECTIONS = true;
+
+ public static boolean getGuideCollections() {
+ return getBoolean(KEY_GUIDE_COLLECTIONS, DEFAULT_GUIDE_COLLECTIONS);
+ }
+
+ public static void putGuideCollections(boolean value) {
+ putBoolean(KEY_GUIDE_COLLECTIONS, value);
+ }
+
+ private static final String KEY_GUIDE_DOWNLOAD_THUMB = "guide_download_thumb";
+ private static final boolean DEFAULT_GUIDE_DOWNLOAD_THUMB = true;
+
+ public static boolean getGuideDownloadThumb() {
+ return getBoolean(KEY_GUIDE_DOWNLOAD_THUMB, DEFAULT_GUIDE_DOWNLOAD_THUMB);
+ }
+
+ public static void putGuideDownloadThumb(boolean value) {
+ putBoolean(KEY_GUIDE_DOWNLOAD_THUMB, value);
+ }
+
+ private static final String KEY_GUIDE_DOWNLOAD_LABELS = "guide_download_labels";
+ private static final boolean DEFAULT_GUIDE_DOWNLOAD_LABELS = true;
+
+ public static boolean getGuideDownloadLabels() {
+ return getBoolean(KEY_GUIDE_DOWNLOAD_LABELS, DEFAULT_GUIDE_DOWNLOAD_LABELS);
+ }
+
+ public static void puttGuideDownloadLabels(boolean value) {
+ putBoolean(KEY_GUIDE_DOWNLOAD_LABELS, value);
+ }
}
diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/DownloadsScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/DownloadsScene.java
index 849ab592a..366b45c29 100644
--- a/app/src/main/java/com/hippo/ehviewer/ui/scene/DownloadsScene.java
+++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/DownloadsScene.java
@@ -20,6 +20,7 @@ import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.Intent;
+import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
@@ -34,6 +35,7 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SimpleItemAnimator;
import android.support.v7.widget.Toolbar;
import android.util.SparseBooleanArray;
+import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
@@ -45,6 +47,10 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import com.github.amlcurran.showcaseview.ShowcaseView;
+import com.github.amlcurran.showcaseview.SimpleShowcaseEventListener;
+import com.github.amlcurran.showcaseview.targets.PointTarget;
+import com.github.amlcurran.showcaseview.targets.ViewTarget;
import com.hippo.app.CheckBoxDialogBuilder;
import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.easyrecyclerview.FastScroller;
@@ -75,6 +81,7 @@ import com.hippo.yorozuya.FileUtils;
import com.hippo.yorozuya.LongList;
import com.hippo.yorozuya.ObjectUtils;
import com.hippo.yorozuya.ResourcesUtils;
+import com.hippo.yorozuya.SimpleHandler;
import com.hippo.yorozuya.ViewUtils;
import java.util.ArrayList;
@@ -113,6 +120,8 @@ public class DownloadsScene extends ToolbarScene
private FabLayout mFabLayout;
@Nullable
private DownloadAdapter mAdapter;
+ @Nullable
+ private LinearLayoutManager mLayoutManager;
@Override
public int getNavCheckedItem() {
@@ -224,7 +233,8 @@ public class DownloadsScene extends ToolbarScene
mAdapter = new DownloadAdapter();
mAdapter.setHasStableIds(true);
mRecyclerView.setAdapter(mAdapter);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+ mLayoutManager = new LinearLayoutManager(getContext());
+ mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setSelector(RippleSalon.generateRippleDrawable(false));
mRecyclerView.setDrawSelectorOnTop(true);
mRecyclerView.hasFixedSize();
@@ -255,9 +265,85 @@ public class DownloadsScene extends ToolbarScene
updateView();
+ guide();
+
return view;
}
+ private void guide() {
+ if (Settings.getGuideDownloadThumb()) {
+ SimpleHandler.getInstance().post(new Runnable() {
+ @Override
+ public void run() {
+ guideDownloadThumb();
+ }
+ });
+ } else {
+ guideDownloadLabels();
+ }
+ }
+
+ private void guideDownloadThumb() {
+ if (!Settings.getGuideDownloadThumb() || null == mLayoutManager || null == mRecyclerView) {
+ guideDownloadLabels();
+ return;
+ }
+ int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
+ if (position < 0) {
+ guideDownloadLabels();
+ return;
+ }
+ RecyclerView.ViewHolder holder = mRecyclerView.findViewHolderForAdapterPosition(position);
+ if (null == holder) {
+ guideDownloadLabels();
+ return;
+ }
+
+ new ShowcaseView.Builder(getActivity())
+ .withMaterialShowcase()
+ .setStyle(R.style.Guide)
+ .setTarget(new ViewTarget(((DownloadHolder) holder).thumb))
+ .blockAllTouches()
+ .setContentTitle(R.string.guide_download_thumb_title)
+ .setContentText(R.string.guide_download_thumb_text)
+ .replaceEndButton(R.layout.button_guide)
+ .setShowcaseEventListener(new SimpleShowcaseEventListener() {
+ @Override
+ public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
+ ViewUtils.removeFromParent(showcaseView);
+ Settings.putGuideDownloadThumb(false);
+ guideDownloadLabels();
+ }
+ }).build();
+ }
+
+ private void guideDownloadLabels() {
+ if (!Settings.getGuideDownloadLabels()) {
+ return;
+ }
+
+ Display display = getActivity().getWindowManager().getDefaultDisplay();
+ Point point = new Point();
+ display.getSize(point);
+
+ new ShowcaseView.Builder(getActivity())
+ .withMaterialShowcase()
+ .setStyle(R.style.Guide)
+ .setTarget(new PointTarget(point.x, point.y / 3))
+ .blockAllTouches()
+ .setContentTitle(R.string.guide_download_labels_title)
+ .setContentText(R.string.guide_download_labels_text)
+ .replaceEndButton(R.layout.button_guide)
+ .setShowcaseEventListener(new SimpleShowcaseEventListener() {
+ @Override
+ public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
+ ViewUtils.removeFromParent(showcaseView);
+ Settings.puttGuideDownloadLabels(false);
+ openDrawer(Gravity.RIGHT);
+ }
+ }).build();
+ }
+
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
@@ -273,6 +359,7 @@ public class DownloadsScene extends ToolbarScene
mFabLayout = null;
mViewTransition = null;
mAdapter = null;
+ mLayoutManager = null;
}
@Override
diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.java
index abd043913..1113cc635 100644
--- a/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.java
+++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/FavoritesScene.java
@@ -19,6 +19,7 @@ package com.hippo.ehviewer.ui.scene;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
+import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
@@ -33,6 +34,7 @@ import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ImageSpan;
import android.util.SparseBooleanArray;
+import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
@@ -42,6 +44,9 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
+import com.github.amlcurran.showcaseview.ShowcaseView;
+import com.github.amlcurran.showcaseview.SimpleShowcaseEventListener;
+import com.github.amlcurran.showcaseview.targets.PointTarget;
import com.hippo.annotation.Implemented;
import com.hippo.drawable.DrawerArrowDrawable;
import com.hippo.easyrecyclerview.EasyRecyclerView;
@@ -297,9 +302,38 @@ public class FavoritesScene extends BaseScene implements
mHelper.firstRefresh();
}
+ guideCollections();
+
return view;
}
+ private void guideCollections() {
+ if (!Settings.getGuideCollections()) {
+ return;
+ }
+
+ Display display = getActivity().getWindowManager().getDefaultDisplay();
+ Point point = new Point();
+ display.getSize(point);
+
+ new ShowcaseView.Builder(getActivity())
+ .withMaterialShowcase()
+ .setStyle(R.style.Guide)
+ .setTarget(new PointTarget(point.x, point.y / 3))
+ .blockAllTouches()
+ .setContentTitle(R.string.guide_collections_title)
+ .setContentText(R.string.guide_collections_text)
+ .replaceEndButton(R.layout.button_guide)
+ .setShowcaseEventListener(new SimpleShowcaseEventListener() {
+ @Override
+ public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
+ ViewUtils.removeFromParent(showcaseView);
+ Settings.putGuideCollections(false);
+ openDrawer(Gravity.RIGHT);
+ }
+ }).build();
+ }
+
// keyword of mUrlBuilder, fav cat of mUrlBuilder, mFavCatArray.
// They changed, call it
private void updateSearchBar() {
diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.java
index 74278da70..ce867e1ef 100644
--- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.java
+++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryListScene.java
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
+import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.IntDef;
@@ -35,6 +36,7 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ImageSpan;
+import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
@@ -45,6 +47,9 @@ import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
+import com.github.amlcurran.showcaseview.ShowcaseView;
+import com.github.amlcurran.showcaseview.SimpleShowcaseEventListener;
+import com.github.amlcurran.showcaseview.targets.PointTarget;
import com.hippo.app.EditTextDialogBuilder;
import com.hippo.drawable.AddDeleteDrawable;
import com.hippo.drawable.DrawerArrowDrawable;
@@ -399,9 +404,38 @@ public final class GalleryListScene extends BaseScene
mHelper.firstRefresh();
}
+ guideQuickSearch();
+
return view;
}
+ private void guideQuickSearch() {
+ if (!Settings.getGuideQuickSearch()) {
+ return;
+ }
+
+ Display display = getActivity().getWindowManager().getDefaultDisplay();
+ Point point = new Point();
+ display.getSize(point);
+
+ new ShowcaseView.Builder(getActivity())
+ .withMaterialShowcase()
+ .setStyle(R.style.Guide)
+ .setTarget(new PointTarget(point.x, point.y / 3))
+ .blockAllTouches()
+ .setContentTitle(R.string.guide_quick_search_title)
+ .setContentText(R.string.guide_quick_search_text)
+ .replaceEndButton(R.layout.button_guide)
+ .setShowcaseEventListener(new SimpleShowcaseEventListener() {
+ @Override
+ public void onShowcaseViewDidHide(ShowcaseView showcaseView) {
+ ViewUtils.removeFromParent(showcaseView);
+ Settings.putGuideQuickSearch(false);
+ openDrawer(Gravity.RIGHT);
+ }
+ }).build();
+ }
+
@Override
public void onDestroyView() {
super.onDestroyView();
diff --git a/app/src/main/res/layout/button_guide.xml b/app/src/main/res/layout/button_guide.xml
new file mode 100644
index 000000000..3b17f3d0f
--- /dev/null
+++ b/app/src/main/res/layout/button_guide.xml
@@ -0,0 +1,27 @@
+
+
+
+
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index 3958fa4f9..22130042e 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -408,6 +408,16 @@
被玩坏了
+
+ 快速搜索
+ 从右侧滑动打开快速搜索面板
+ 收藏夹
+ 从右侧滑动来选择收藏夹
+ 下载标签
+ 从右侧滑动打开下载标签面板
+ 画廊详情
+ 点击缩略图查看画廊详情
+
来自未来
刚刚
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 42d601ea6..2a44c84f4 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -408,6 +408,16 @@
被玩壞了
+
+ 快速搜索
+ 從右側滑動打開快速搜索面板
+ 收藏夾
+ 從右側滑動來選擇收藏夾
+ 下載標籤
+ 從右側滑動打開下載標籤面板
+ 畫廊詳情
+ 點擊縮略圖查看畫廊詳情
+
來自未來
剛剛
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 555ddfe8a..0ef55b3b2 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -408,6 +408,16 @@
被玩壞了
+
+ 快速搜尋
+ 從右側滑動開啟快速搜尋面板
+ 收藏夾
+ 從右側滑動來選擇收藏夾
+ 下載標籤
+ 從右側滑動開啟下載標籤面板
+ 畫廊詳情
+ 點選縮圖檢視畫廊詳情
+
來自未來
剛剛
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1e6423008..d3119ac52 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -448,6 +448,16 @@
Something wrong happened
+
+ Quick Search
+ Swipe right to open quick search panel
+ Collections
+ Swipe right to select collections
+ Download labels
+ Swipe right to open download labels panel
+ Gallery detail
+ Click thumb to view gallery detail
+
From the future
Just now
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 644a5974f..18ccb040c 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -137,4 +137,18 @@
- mini
+
+
+
+
+
+