diff --git a/bin/EhViewer.apk b/bin/EhViewer.apk index 02a4285c1..f3f551c61 100644 Binary files a/bin/EhViewer.apk and b/bin/EhViewer.apk differ diff --git a/bin/R.txt b/bin/R.txt index a835f3b94..61d3fb063 100644 --- a/bin/R.txt +++ b/bin/R.txt @@ -101,38 +101,41 @@ int drawable ic_action_favourite 0x7f02000d int drawable ic_action_jump 0x7f02000e int drawable ic_action_pause 0x7f02000f int drawable ic_action_refresh 0x7f020010 -int drawable ic_action_search 0x7f020011 -int drawable ic_action_settings 0x7f020012 -int drawable ic_action_start 0x7f020013 -int drawable ic_launcher 0x7f020014 -int drawable ic_navigation_drawer 0x7f020015 -int drawable imageset 0x7f020016 -int drawable indicator_arrow 0x7f020017 -int drawable indicator_bg_bottom 0x7f020018 -int drawable indicator_bg_top 0x7f020019 -int drawable manga 0x7f02001a -int drawable mask 0x7f02001b -int drawable misc 0x7f02001c -int drawable non_h 0x7f02001d -int drawable refresh 0x7f02001e -int drawable sadpanda 0x7f02001f -int drawable scrollbar_blue 0x7f020020 -int drawable scrollbar_white 0x7f020021 -int drawable star 0x7f020022 -int drawable star_empty 0x7f020023 -int drawable star_half 0x7f020024 -int drawable unknown 0x7f020025 -int drawable wait 0x7f020026 -int drawable western 0x7f020027 +int drawable ic_action_remove 0x7f020011 +int drawable ic_action_search 0x7f020012 +int drawable ic_action_settings 0x7f020013 +int drawable ic_action_start 0x7f020014 +int drawable ic_launcher 0x7f020015 +int drawable ic_navigation_drawer 0x7f020016 +int drawable imageset 0x7f020017 +int drawable indicator_arrow 0x7f020018 +int drawable indicator_bg_bottom 0x7f020019 +int drawable indicator_bg_top 0x7f02001a +int drawable manga 0x7f02001b +int drawable mask 0x7f02001c +int drawable misc 0x7f02001d +int drawable non_h 0x7f02001e +int drawable refresh 0x7f02001f +int drawable sadpanda 0x7f020020 +int drawable scrollbar_blue 0x7f020021 +int drawable scrollbar_white 0x7f020022 +int drawable star 0x7f020023 +int drawable star_empty 0x7f020024 +int drawable star_half 0x7f020025 +int drawable textfield 0x7f020026 +int drawable unknown 0x7f020027 +int drawable wait 0x7f020028 +int drawable western 0x7f020029 int id action 0x7f07004c -int id action_download 0x7f07008c -int id action_favourite 0x7f07008b -int id action_jump 0x7f07008f -int id action_refresh 0x7f07008e -int id action_search 0x7f07008d -int id action_settings 0x7f070090 +int id action_download 0x7f07008f +int id action_favourite 0x7f07008e +int id action_jump 0x7f070092 +int id action_refresh 0x7f070091 +int id action_search 0x7f070090 +int id action_settings 0x7f070093 int id alignBounds 0x7f070013 int id alignMargins 0x7f070014 +int id autoCompleteTextView1 0x7f070089 int id both 0x7f070008 int id bottom 0x7f070016 int id bottom_panel 0x7f070081 @@ -249,15 +252,17 @@ int id pull_to_refresh_progress 0x7f070085 int id pull_to_refresh_sub_text 0x7f070087 int id pull_to_refresh_text 0x7f070086 int id rate 0x7f070071 +int id remove 0x7f07008a int id right 0x7f070001 int id rotate 0x7f07000c int id sadpanda 0x7f07006c int id scroll_view 0x7f070041 int id scrollview 0x7f070010 +int id search_bar 0x7f070088 int id search_text 0x7f070058 int id selected_view 0x7f070004 -int id set_name_edit 0x7f070088 -int id slidingmenumain 0x7f070089 +int id set_name_edit 0x7f07008b +int id slidingmenumain 0x7f07008c int id spinner_min_rating 0x7f070064 int id start 0x7f07001f int id text_username 0x7f07007b @@ -267,7 +272,7 @@ int id top 0x7f070015 int id type 0x7f070070 int id username 0x7f070077 int id vertical 0x7f070012 -int id wait_message 0x7f07008a +int id wait_message 0x7f07008d int id webview 0x7f07000f int layout detail 0x7f030000 int layout detail_normal 0x7f030001 @@ -293,9 +298,10 @@ int layout page_list 0x7f030014 int layout page_list_panel 0x7f030015 int layout pull_to_refresh_header_horizontal 0x7f030016 int layout pull_to_refresh_header_vertical 0x7f030017 -int layout set_name 0x7f030018 -int layout slidingmenumain 0x7f030019 -int layout wait 0x7f03001a +int layout search_view 0x7f030018 +int layout set_name 0x7f030019 +int layout slidingmenumain 0x7f03001a +int layout wait 0x7f03001b int menu detail 0x7f0d0000 int menu main 0x7f0d0001 int raw change_log 0x7f060000 diff --git a/bin/classes.dex b/bin/classes.dex index f234b61ff..b46269035 100644 Binary files a/bin/classes.dex and b/bin/classes.dex differ diff --git a/bin/dexedLibs/gridlayout_v7-9aadecd3606a07a44286cb470164fa04.jar b/bin/dexedLibs/gridlayout_v7-9aadecd3606a07a44286cb470164fa04.jar index 9fbd5604a..91cd6226c 100644 Binary files a/bin/dexedLibs/gridlayout_v7-9aadecd3606a07a44286cb470164fa04.jar and b/bin/dexedLibs/gridlayout_v7-9aadecd3606a07a44286cb470164fa04.jar differ diff --git a/bin/dexedLibs/library-8cd7abb8953cf577c4eead38fb2ed13b.jar b/bin/dexedLibs/library-8cd7abb8953cf577c4eead38fb2ed13b.jar index 9a0fde95e..57a0c37af 100644 Binary files a/bin/dexedLibs/library-8cd7abb8953cf577c4eead38fb2ed13b.jar and b/bin/dexedLibs/library-8cd7abb8953cf577c4eead38fb2ed13b.jar differ diff --git a/bin/dexedLibs/slidingmenu-f48f3a4eceb3b9455e8ae38a55377052.jar b/bin/dexedLibs/slidingmenu-f48f3a4eceb3b9455e8ae38a55377052.jar index 29a68be83..e9da45e34 100644 Binary files a/bin/dexedLibs/slidingmenu-f48f3a4eceb3b9455e8ae38a55377052.jar and b/bin/dexedLibs/slidingmenu-f48f3a4eceb3b9455e8ae38a55377052.jar differ diff --git a/bin/res/crunch/drawable-hdpi/ic_action_remove.png b/bin/res/crunch/drawable-hdpi/ic_action_remove.png new file mode 100644 index 000000000..33737d77a Binary files /dev/null and b/bin/res/crunch/drawable-hdpi/ic_action_remove.png differ diff --git a/bin/res/crunch/drawable-mdpi/ic_action_remove.png b/bin/res/crunch/drawable-mdpi/ic_action_remove.png new file mode 100644 index 000000000..8964e6031 Binary files /dev/null and b/bin/res/crunch/drawable-mdpi/ic_action_remove.png differ diff --git a/bin/res/crunch/drawable-xhdpi/ic_action_remove.png b/bin/res/crunch/drawable-xhdpi/ic_action_remove.png new file mode 100644 index 000000000..91c39b9c6 Binary files /dev/null and b/bin/res/crunch/drawable-xhdpi/ic_action_remove.png differ diff --git a/bin/res/crunch/drawable-xxhdpi/ic_action_remove.png b/bin/res/crunch/drawable-xxhdpi/ic_action_remove.png new file mode 100644 index 000000000..6ec25df8c Binary files /dev/null and b/bin/res/crunch/drawable-xxhdpi/ic_action_remove.png differ diff --git a/bin/res/crunch/drawable-xxhdpi/textfield.9.png b/bin/res/crunch/drawable-xxhdpi/textfield.9.png new file mode 100644 index 000000000..63b9cd523 Binary files /dev/null and b/bin/res/crunch/drawable-xxhdpi/textfield.9.png differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ index 2a970ae2e..7753caf15 100644 Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ diff --git a/res/drawable-hdpi/ic_action_remove.png b/res/drawable-hdpi/ic_action_remove.png new file mode 100644 index 000000000..e4c4327f4 Binary files /dev/null and b/res/drawable-hdpi/ic_action_remove.png differ diff --git a/res/drawable-mdpi/ic_action_remove.png b/res/drawable-mdpi/ic_action_remove.png new file mode 100644 index 000000000..b08b2d49a Binary files /dev/null and b/res/drawable-mdpi/ic_action_remove.png differ diff --git a/res/drawable-xhdpi/ic_action_remove.png b/res/drawable-xhdpi/ic_action_remove.png new file mode 100644 index 000000000..1f34ab43a Binary files /dev/null and b/res/drawable-xhdpi/ic_action_remove.png differ diff --git a/res/drawable-xxhdpi/ic_action_remove.png b/res/drawable-xxhdpi/ic_action_remove.png new file mode 100644 index 000000000..8dec2b837 Binary files /dev/null and b/res/drawable-xxhdpi/ic_action_remove.png differ diff --git a/res/drawable-xxhdpi/textfield.9.png b/res/drawable-xxhdpi/textfield.9.png new file mode 100644 index 000000000..141d33de6 Binary files /dev/null and b/res/drawable-xxhdpi/textfield.9.png differ diff --git a/res/layout/search_view.xml b/res/layout/search_view.xml new file mode 100644 index 000000000..6f3715aac --- /dev/null +++ b/res/layout/search_view.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file diff --git a/res/menu/main.xml b/res/menu/main.xml index 1182c3f98..cf8806341 100644 --- a/res/menu/main.xml +++ b/res/menu/main.xml @@ -3,7 +3,6 @@ diff --git a/src/com/hippo/ehviewer/activity/MangaListActivity.java b/src/com/hippo/ehviewer/activity/MangaListActivity.java index 7ea0f1082..7d7736319 100644 --- a/src/com/hippo/ehviewer/activity/MangaListActivity.java +++ b/src/com/hippo/ehviewer/activity/MangaListActivity.java @@ -1441,6 +1441,7 @@ public class MangaListActivity extends SlidingActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); + SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); final SearchView searchView = @@ -1460,6 +1461,8 @@ public class MangaListActivity extends SlidingActivity { return true; } }); + + // Make search view custom look int searchTextID = searchView.getContext(). getResources().getIdentifier("android:id/search_src_text", null, null); if (searchTextID > 0) { @@ -1470,6 +1473,16 @@ public class MangaListActivity extends SlidingActivity { searchText.setHintTextColor(Color.WHITE); } } + + int removeImageID = searchView.getContext(). + getResources().getIdentifier("android:id/search_close_btn", null, null); + if (removeImageID > 0) { + ImageView removeImage = + (ImageView)searchView.findViewById(removeImageID); + if (removeImage != null) + removeImage.setImageResource(R.drawable.ic_action_remove); + } + return true; } diff --git a/src/com/hippo/ehviewer/network/Downloader.java b/src/com/hippo/ehviewer/network/Downloader.java index 497582372..35a4be4ae 100644 --- a/src/com/hippo/ehviewer/network/Downloader.java +++ b/src/com/hippo/ehviewer/network/Downloader.java @@ -80,6 +80,10 @@ public class Downloader implements Runnable { if (Cache.hasSdCard()) while(true) { try { + if (mDi.status == DownloadInfo.STOP) + throw new StopRequestException(STOP, + "Download is stopped"); + mDownloadSize = 0; mRedirectionCount = 0; status = COMPLETED; @@ -164,6 +168,11 @@ public class Downloader implements Runnable { InputStream in = null; OutputStream out = null; File file = null; + + if (mDi.status == DownloadInfo.STOP) + throw new StopRequestException(STOP, + "Download is stopped"); + try { try { in = conn.getInputStream(); @@ -211,7 +220,7 @@ public class Downloader implements Runnable { if (mListener != null) mListener.onDownloadStatusUpdate(mDownloadSize, mTotalSize); - if (mDi.status == mDi.STOP) + if (mDi.status == DownloadInfo.STOP) throw new StopRequestException(STOP, "Download is stopped"); } diff --git a/src/com/hippo/ehviewer/service/DownloadService.java b/src/com/hippo/ehviewer/service/DownloadService.java index 72ecacf3e..194a407ea 100644 --- a/src/com/hippo/ehviewer/service/DownloadService.java +++ b/src/com/hippo/ehviewer/service/DownloadService.java @@ -51,7 +51,7 @@ public class DownloadService extends Service { public void onDownloadMangaAllStart() { mBuilder.setContentTitle(getString(R.string.start_download_task)) .setContentText(null) - .setProgress(0, 0, true).setOngoing(true); + .setProgress(0, 0, true).setOngoing(true).setAutoCancel(false);; mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build()); } @@ -66,7 +66,7 @@ public class DownloadService extends Service { mBuilder.setContentTitle(getString(R.string.downloading) + " " + Download.get(id).title) .setContentText(null) - .setProgress(0, 0, true).setOngoing(true); + .setProgress(0, 0, true).setOngoing(true).setAutoCancel(false);; mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build()); } @@ -75,7 +75,8 @@ public class DownloadService extends Service { mBuilder.setContentTitle(getString(R.string.downloading) + " " + Download.get(id).title) .setContentText(startIndex + " / " + pageSum) - .setProgress(pageSum, startIndex, false).setOngoing(true); + .setProgress(pageSum, startIndex, false).setOngoing(true) + .setAutoCancel(false); mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build()); } @@ -91,7 +92,8 @@ public class DownloadService extends Service { mBuilder.setContentTitle(getString(R.string.download_successfully) + " " + Download.get(id).title); else mBuilder.setContentTitle(getString(R.string.download_unsuccessfully) + " " + Download.get(id).title); - mBuilder.setContentText(null).setProgress(0, 0, false).setOngoing(false); + mBuilder.setContentText(null).setProgress(0, 0, false).setOngoing(false) + .setAutoCancel(true); mNotifyManager.notify(Integer.parseInt(id), mBuilder.build()); } @@ -100,7 +102,8 @@ public class DownloadService extends Service { mBuilder.setContentTitle(getString(R.string.downloading) + " " + Download.get(id).title) .setContentText(index + " / " + pageSum) - .setProgress(pageSum, index, false).setOngoing(true); + .setProgress(pageSum, index, false).setOngoing(true) + .setAutoCancel(false); mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build()); } diff --git a/src/com/hippo/ehviewer/util/EhClient.java b/src/com/hippo/ehviewer/util/EhClient.java index 026fba45b..4360e5c1a 100644 --- a/src/com/hippo/ehviewer/util/EhClient.java +++ b/src/com/hippo/ehviewer/util/EhClient.java @@ -267,6 +267,7 @@ public class EhClient { conn.addRequestProperty("Accept-Encoding", "gzip"); conn.setRequestProperty("User-Agent", userAgent); conn.setConnectTimeout(TIMEOUT); + conn.setReadTimeout(TIMEOUT); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestMethod("POST"); @@ -323,6 +324,7 @@ public class EhClient { conn.addRequestProperty("Accept-Encoding", "gzip"); conn.setRequestProperty("User-Agent", userAgent); conn.setConnectTimeout(TIMEOUT); + conn.setReadTimeout(TIMEOUT); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestMethod("POST"); @@ -379,6 +381,7 @@ public class EhClient { conn.addRequestProperty("Accept-Encoding", "gzip"); conn.setRequestProperty("User-Agent", userAgent); conn.setConnectTimeout(TIMEOUT); + conn.setReadTimeout(TIMEOUT); conn.connect(); getStringHUC(conn, sb); @@ -1374,6 +1377,8 @@ public class EhClient { } } catch (MalformedURLException e) { e.printStackTrace(); + mComplete = false; + break; } } else { mComplete = false; diff --git a/src/com/hippo/ehviewer/view/SearchView.java b/src/com/hippo/ehviewer/view/SearchView.java new file mode 100644 index 000000000..d77ac352f --- /dev/null +++ b/src/com/hippo/ehviewer/view/SearchView.java @@ -0,0 +1,24 @@ +package com.hippo.ehviewer.view; + +import com.hippo.ehviewer.R; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.widget.LinearLayout; + +public class SearchView extends LinearLayout { + public SearchView(Context context) { + super(context, null); + } + + public SearchView(Context context, AttributeSet attrs) { + super(context, attrs); + + LayoutInflater inflater = (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + inflater.inflate(R.layout.search_view, this, true); + } + + +}