Use different big icon for empty state

This commit is contained in:
seven332 committed 2016-03-11 18:59:01 +08:00
1 parent 85d201a9ff
commit 37ee0f2076
20 files changed
+208 -69

No files matched your search

@@ -43,7 +43,7 @@ import com.hippo.ehviewer.client.EhUtils;
import com.hippo.ehviewer.ui.scene.AnalyticsScene;
import com.hippo.ehviewer.ui.scene.BaseScene;
import com.hippo.ehviewer.ui.scene.CookieSignInScene;
import com.hippo.ehviewer.ui.scene.DownloadLabelScene;
import com.hippo.ehviewer.ui.scene.DownloadLabelsScene;
import com.hippo.ehviewer.ui.scene.DownloadsScene;
import com.hippo.ehviewer.ui.scene.FavoritesScene;
import com.hippo.ehviewer.ui.scene.GalleryCommentsScene;
@@ -107,7 +107,7 @@ public final class MainActivity extends StageActivity
registerLaunchMode(GalleryCommentsScene.class, SceneFragment.LAUNCH_MODE_STANDARD);
registerLaunchMode(GalleryPreviewsScene.class, SceneFragment.LAUNCH_MODE_STANDARD);
registerLaunchMode(DownloadsScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
registerLaunchMode(DownloadLabelScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
registerLaunchMode(DownloadLabelsScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
registerLaunchMode(FavoritesScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
registerLaunchMode(HistoryScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TOP);
registerLaunchMode(ProgressScene.class, SceneFragment.LAUNCH_MODE_STANDARD);
@@ -17,6 +17,7 @@
package com.hippo.ehviewer.ui.scene;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
@@ -49,12 +50,13 @@ import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.ehviewer.EhApplication;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.dao.DownloadLabel;
import com.hippo.util.DrawableManager;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.ViewUtils;
import java.util.List;
public class DownloadLabelScene extends ToolbarScene {
public class DownloadLabelsScene extends ToolbarScene {
/*---------------
Whole life cycle
@@ -89,14 +91,16 @@ public class DownloadLabelScene extends ToolbarScene {
@Override
public View onCreateView2(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.scene_download_label, container, false);
View view = inflater.inflate(R.layout.scene_label_list, container, false);
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
View tip = ViewUtils.$$(view, R.id.tip);
TextView tipText = (TextView) ViewUtils.$$(tip, R.id.tip_text);
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
mViewTransition = new ViewTransition(mRecyclerView, tip);
tipText.setText(R.string.no_download_label);
Drawable drawable = DrawableManager.getDrawable(getContext(), R.drawable.big_label);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
tip.setCompoundDrawables(null, drawable, null, null);
tip.setText(R.string.no_download_label);
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
RecyclerViewTouchActionGuardManager guardManager = new RecyclerViewTouchActionGuardManager();
@@ -131,7 +135,7 @@ public class DownloadLabelScene extends ToolbarScene {
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setTitle(R.string.label);
setTitle(R.string.download_labels);
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
}
@@ -159,7 +163,7 @@ public class DownloadLabelScene extends ToolbarScene {
int id = item.getItemId();
switch (id) {
case R.id.action_add: {
EditTextDialogBuilder builder = new EditTextDialogBuilder(getContext(), null, getString(R.string.label));
EditTextDialogBuilder builder = new EditTextDialogBuilder(getContext(), null, getString(R.string.download_labels));
builder.setTitle(R.string.new_label_title);
builder.setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.show();
@@ -290,7 +294,7 @@ public class DownloadLabelScene extends ToolbarScene {
if (label == v) {
DownloadLabel raw = mList.get(index);
EditTextDialogBuilder builder = new EditTextDialogBuilder(
getContext(), raw.getLabel(), getString(R.string.label));
getContext(), raw.getLabel(), getString(R.string.download_labels));
builder.setTitle(R.string.rename_label_title);
builder.setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.show();
@@ -314,7 +314,7 @@ public class DownloadsScene extends ToolbarScene
View view = inflater.inflate(R.layout.drawer_list, container, false);
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setTitle(R.string.drawer_download_label_title);
toolbar.setTitle(R.string.download_labels);
toolbar.inflateMenu(R.menu.drawer_download);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
@@ -322,7 +322,7 @@ public class DownloadsScene extends ToolbarScene
int id = item.getItemId();
switch (id) {
case R.id.action_settings:
startScene(new Announcer(DownloadLabelScene.class));
startScene(new Announcer(DownloadLabelsScene.class));
return true;
case R.id.action_default_download_label:
DownloadManager dm = EhApplication.getDownloadManager(getContext());
@@ -20,6 +20,7 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
@@ -51,6 +52,7 @@ import com.hippo.scene.SceneFragment;
import com.hippo.scene.StageActivity;
import com.hippo.scene.TransitionHelper;
import com.hippo.util.ApiHelper;
import com.hippo.util.DrawableManager;
import com.hippo.view.ViewTransition;
import com.hippo.widget.LoadImageView;
import com.hippo.yorozuya.ResourcesUtils;
@@ -87,9 +89,13 @@ public class HistoryScene extends ToolbarScene
View content = ViewUtils.$$(view, R.id.content);
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(content, R.id.recycler_view);
FastScroller fastScroller = (FastScroller) ViewUtils.$$(content, R.id.fast_scroller);
View tip = ViewUtils.$$(view, R.id.tip);
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
mViewTransition = new ViewTransition(content, tip);
Drawable drawable = DrawableManager.getDrawable(getContext(), R.drawable.big_history);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
tip.setCompoundDrawables(null, drawable, null, null);
Resources resources = getResources();
mList = EhDB.getHistoryLazyList();
@@ -107,9 +113,9 @@ public class HistoryScene extends ToolbarScene
mRecyclerView.setPadding(paddingV, paddingH, paddingV, paddingH);
fastScroller.attachToRecyclerView(mRecyclerView);
HandlerDrawable drawable = new HandlerDrawable();
drawable.setColor(ResourcesUtils.getAttrColor(getContext(), R.attr.colorAccent));
fastScroller.setHandlerDrawable(drawable);
HandlerDrawable handlerDrawable = new HandlerDrawable();
handlerDrawable.setColor(ResourcesUtils.getAttrColor(getContext(), R.attr.colorAccent));
fastScroller.setHandlerDrawable(handlerDrawable);
if (null != mList && mList.size() > 0) {
mViewTransition.showView(0);
@@ -17,6 +17,7 @@
package com.hippo.ehviewer.ui.scene;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
@@ -45,6 +46,7 @@ import com.hippo.easyrecyclerview.EasyRecyclerView;
import com.hippo.ehviewer.EhDB;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.dao.QuickSearch;
import com.hippo.util.DrawableManager;
import com.hippo.view.ViewTransition;
import com.hippo.yorozuya.ViewUtils;
@@ -85,14 +87,16 @@ public final class QuickSearchScene extends ToolbarScene {
@Override
public View onCreateView2(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.scene_download_label, container, false);
View view = inflater.inflate(R.layout.scene_label_list, container, false);
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
View tip = ViewUtils.$$(view, R.id.tip);
TextView tipText = (TextView) ViewUtils.$$(tip, R.id.tip_text);
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
mViewTransition = new ViewTransition(mRecyclerView, tip);
tipText.setText(R.string.no_quick_search);
Drawable drawable = DrawableManager.getDrawable(getContext(), R.drawable.big_search);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
tip.setCompoundDrawables(null, drawable, null, null);
tip.setText(R.string.no_quick_search);
// touch guard manager (this class is required to suppress scrolling while swipe-dismiss animation is running)
RecyclerViewTouchActionGuardManager guardManager = new RecyclerViewTouchActionGuardManager();