From 447ef9a510d611ea2040d612cda0773b11084ae2 Mon Sep 17 00:00:00 2001 From: seven332 Date: Thu, 30 Apr 2015 22:36:01 +0800 Subject: [PATCH] Show suggestion name when add quick search --- .../ehviewer/ui/GalleryListActivity.java | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/GalleryListActivity.java b/app/src/main/java/com/hippo/ehviewer/ui/GalleryListActivity.java index 2c1ad5ead..c142015f9 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/GalleryListActivity.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/GalleryListActivity.java @@ -550,16 +550,16 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View. public boolean onClick(MaterialAlertDialog dialog, int position) { final GalleryInfo gi = mGalleryListView.getGalleryInfo(longClickItemIndex); switch (position) { - case 0: // Add favourite item - FavoriteHelper.addToFavorite(GalleryListActivity.this, gi, null); - break; - case 1: - Intent it = new Intent(GalleryListActivity.this, DownloadService.class); - it.setAction(DownloadService.ACTION_ADD); - it.putExtra(DownloadService.KEY_GALLERY_INFO, gi); - startService(it); - MaterialToast.showToast(R.string.toast_add_download); - break; + case 0: // Add favourite item + FavoriteHelper.addToFavorite(GalleryListActivity.this, gi, null); + break; + case 1: + Intent it = new Intent(GalleryListActivity.this, DownloadService.class); + it.setAction(DownloadService.ACTION_ADD); + it.putExtra(DownloadService.KEY_GALLERY_INFO, gi); + startService(it); + MaterialToast.showToast(R.string.toast_add_download); + break; } return true; } @@ -1416,8 +1416,16 @@ public class GalleryListActivity extends AbsTranslucentActivity implements View. case R.id.action_add: // TODO if (lus != null) { + String suggestionName = null; + int mode = lus.getMode(); + if (mode == ListUrls.MODE_NORMAL || mode == ListUrls.MODE_UPLOADER) { + suggestionName = lus.getSearch(); + } else if (mode == ListUrls.MODE_TAG) { + suggestionName = lus.getTag(); + } View view = ViewUtils.inflateDialogView(R.layout.set_name, false); final EditText et = (EditText) view.findViewById(R.id.set_name_edit); + et.setText(suggestionName); new MaterialAlertDialog.Builder(this).setTitle("添加当前状态至快速搜索") // TODO .setView(view, true) .setDefaultButton(MaterialAlertDialog.POSITIVE | MaterialAlertDialog.NEGATIVE)