Compare commits

...
19 Commits
Author SHA1 Message Date
seven332 c6c060b5e2 0.4.4 2014-04-06 13:49:54 +08:00
seven332 def283de08 添加 charset 识别 2014-04-06 13:45:52 +08:00
seven332 be3d3189ec 学习使用 ProGuard 2014-04-06 11:30:40 +08:00
seven332 0581b7cc53 使用更安全的 Log 2014-04-06 11:11:57 +08:00
seven332 79b75e5de1 0.4.3 2014-04-05 23:57:52 +08:00
seven332 f7be9dec18 添加更新服务器选择 2014-04-05 23:51:48 +08:00
seven332 566226958f 临时解决 endIndex 大于 size 的问题 2014-04-05 23:15:07 +08:00
seven332 e45db97a54 用 json 检查更新 2014-04-05 22:28:45 +08:00
seven332 ea58ffed74 用 json 检查更新 2014-04-05 22:28:11 +08:00
seven332 eb1e49e7c7 更丰富的错误提示 2014-04-05 00:08:10 +08:00
seven332 b69c71a54b 0.4.2 2014-04-04 23:26:37 +08:00
seven332 3aff219639 修正由于 gif 格式图片导致的崩溃 2014-04-04 23:13:33 +08:00
seven332 e1edd00fb0 继续 2014-04-03 20:16:34 +08:00
seven332 70e0aada25 调整EhClient 2014-04-03 19:28:57 +08:00
seven332 1c11ac38ea 添加内置存储空间或 Sd Card 检测 2014-04-02 19:56:49 +08:00
seven332 7ac8878f83 修正网络错误时进入详情界面应用崩溃 2014-04-02 13:05:22 +08:00
seven332 a48a18ba84 0.4.1 2014-04-02 12:54:21 +08:00
seven332 8a2a2061a9 添加断点下载 2014-04-01 21:37:27 +08:00
seven332 b1f772eb2f 修正单点触控缩放错误 2014-04-01 11:39:02 +08:00
83 changed files with 212834 additions and 4623 deletions

No files matched your search

+3 -3
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="10"
android:versionName="0.4.0" >
android:versionCode="14"
android:versionName="0.4.4" >
<uses-sdk
android:minSdkVersion="14"
@@ -13,7 +13,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".CrashApplication"
android:name=".AppContext"
android:allowBackup="true"
android:largeHeap="false"
android:hardwareAccelerated="true"
+3 -3
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="10"
android:versionName="0.4.0" >
android:versionCode="14"
android:versionName="0.4.4" >
<uses-sdk
android:minSdkVersion="14"
@@ -13,7 +13,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".CrashApplication"
android:name=".AppContext"
android:allowBackup="true"
android:largeHeap="false"
android:hardwareAccelerated="true"
BIN
View File
Binary file not shown.
-478
View File
@@ -1,478 +0,0 @@
int array download_item_long_click 0x7f080006
int array favourite_item_long_click 0x7f080005
int array is_exhentai 0x7f080009
int array list_item_long_click 0x7f080004
int array list_list_title 0x7f080000
int array min_rating 0x7f080001
int array page_scaling_entries 0x7f080002
int array page_scaling_entry_values 0x7f080003
int array preference_screen_ori_entries 0x7f080007
int array preference_screen_ori_entry_values 0x7f080008
int array pull_next 0x7f08000c
int array pull_pre 0x7f08000b
int array pull_refresh 0x7f08000a
int attr adjustViewBounds 0x7f01000e
int attr alignmentMode 0x7f010004
int attr baseline 0x7f010014
int attr baselineAlignBottom 0x7f010012
int attr columnCount 0x7f010002
int attr columnOrderPreserved 0x7f010006
int attr cropToPadding 0x7f010013
int attr drawableAlpha 0x7f010015
int attr layout_column 0x7f010009
int attr layout_columnSpan 0x7f01000a
int attr layout_gravity 0x7f01000b
int attr layout_row 0x7f010007
int attr layout_rowSpan 0x7f010008
int attr mask 0x7f010016
int attr maxHeight 0x7f010010
int attr maxWidth 0x7f01000f
int attr orientation 0x7f010000
int attr rowCount 0x7f010001
int attr rowOrderPreserved 0x7f010005
int attr scaleType 0x7f01000d
int attr src 0x7f01000c
int attr tint 0x7f010011
int attr useDefaultMargins 0x7f010003
int color blue_dark 0x7f090001
int color blue_light 0x7f090000
int dimen activity_horizontal_margin 0x7f070001
int dimen activity_vertical_margin 0x7f070002
int dimen default_gap 0x7f070000
int dimen menu_offset 0x7f070004
int dimen shadow_width 0x7f070003
int drawable artistcg 0x7f020000
int drawable asianporn 0x7f020001
int drawable back 0x7f020002
int drawable cosplay 0x7f020003
int drawable doujinshi 0x7f020004
int drawable front 0x7f020005
int drawable gamecg 0x7f020006
int drawable ic_action_action_search 0x7f020007
int drawable ic_action_completed 0x7f020008
int drawable ic_action_core_overflow 0x7f020009
int drawable ic_action_download 0x7f02000a
int drawable ic_action_favourite 0x7f02000b
int drawable ic_action_jump 0x7f02000c
int drawable ic_action_pause 0x7f02000d
int drawable ic_action_refresh 0x7f02000e
int drawable ic_action_remove 0x7f02000f
int drawable ic_action_search 0x7f020010
int drawable ic_action_settings 0x7f020011
int drawable ic_action_start 0x7f020012
int drawable ic_launcher 0x7f020013
int drawable ic_navigation_drawer 0x7f020014
int drawable ic_pulltorefresh_arrow 0x7f020015
int drawable ic_touch 0x7f020016
int drawable imageset 0x7f020017
int drawable manga 0x7f020018
int drawable mask 0x7f020019
int drawable misc 0x7f02001a
int drawable non_h 0x7f02001b
int drawable progress_large 0x7f02001c
int drawable progress_small 0x7f02001d
int drawable sadpanda 0x7f02001e
int drawable scrollbar_blue 0x7f02001f
int drawable scrollbar_white 0x7f020020
int drawable spinner_16_inner 0x7f020021
int drawable spinner_16_outer 0x7f020022
int drawable spinner_76_inner 0x7f020023
int drawable spinner_76_outer 0x7f020024
int drawable star 0x7f020025
int drawable star_empty 0x7f020026
int drawable star_half 0x7f020027
int drawable textfield 0x7f020028
int drawable unknown 0x7f020029
int drawable welcome 0x7f02002a
int drawable western 0x7f02002b
int id action 0x7f06003d
int id action_download 0x7f060089
int id action_favourite 0x7f060088
int id action_jump 0x7f06008c
int id action_refresh 0x7f06008b
int id action_search 0x7f06008a
int id action_settings 0x7f06008d
int id alignBounds 0x7f060002
int id alignMargins 0x7f060003
int id app_start_view 0x7f060086
int id autoCompleteTextView1 0x7f060083
int id bottom 0x7f060005
int id bottom_panel 0x7f060075
int id button_artistcg 0x7f060041
int id button_asianporn 0x7f060047
int id button_check_login 0x7f06006d
int id button_cosplay 0x7f060046
int id button_doujinshi 0x7f06003f
int id button_gamecg 0x7f060042
int id button_imageset 0x7f060045
int id button_login 0x7f06006c
int id button_manga 0x7f060040
int id button_misc 0x7f060048
int id button_non_h 0x7f060044
int id button_read 0x7f06002b
int id button_western 0x7f060043
int id center 0x7f06000c
int id centerCrop 0x7f060017
int id centerInside 0x7f060018
int id center_horizontal 0x7f06000a
int id center_vertical 0x7f060008
int id checkbox_advance 0x7f06004a
int id checkbox_sdesc 0x7f06004e
int id checkbox_sdt1 0x7f060051
int id checkbox_sdt2 0x7f060052
int id checkbox_sh 0x7f060053
int id checkbox_sname 0x7f06004c
int id checkbox_sr 0x7f060054
int id checkbox_stags 0x7f06004d
int id checkbox_sto 0x7f060050
int id checkbox_storr 0x7f06004f
int id clip_horizontal 0x7f06000f
int id clip_vertical 0x7f06000e
int id cover 0x7f060060
int id custom 0x7f060034
int id detail_average 0x7f060029
int id detail_button_cancel 0x7f06002d
int id detail_button_every 0x7f06002f
int id detail_button_known 0x7f060030
int id detail_button_once 0x7f06002e
int id detail_cover 0x7f06001b
int id detail_language 0x7f060027
int id detail_pages 0x7f060025
int id detail_people 0x7f06002a
int id detail_posted 0x7f060024
int id detail_rate 0x7f060028
int id detail_refresh 0x7f060021
int id detail_size 0x7f060026
int id detail_title 0x7f06001c
int id detail_type 0x7f060022
int id detail_uploader 0x7f060023
int id detail_wait 0x7f060020
int id download 0x7f060039
int id drawer_layout 0x7f060059
int id drawer_login 0x7f060066
int id drawer_login_over 0x7f060067
int id end 0x7f060011
int id favourite 0x7f06003e
int id fill 0x7f06000d
int id fill_horizontal 0x7f06000b
int id fill_vertical 0x7f060009
int id filter_advance 0x7f06004b
int id fitCenter 0x7f060015
int id fitEnd 0x7f060016
int id fitStart 0x7f060014
int id fitXY 0x7f060013
int id footer_progressBar 0x7f060079
int id footer_tip_text 0x7f06007a
int id head_arrowImageView 0x7f06007f
int id head_contentLayout 0x7f06007e
int id head_progressBar 0x7f060080
int id head_tipsTextView 0x7f060081
int id header 0x7f060077
int id header_arrow_image 0x7f06007b
int id header_progressBar 0x7f06007c
int id header_tip_text 0x7f06007d
int id horizontal 0x7f060000
int id info 0x7f06003c
int id is_exhentai 0x7f060068
int id left 0x7f060006
int id list 0x7f060035
int id list_button_logout 0x7f060070
int id list_jump_edit 0x7f060058
int id list_jump_sum 0x7f060056
int id list_jump_to 0x7f060057
int id list_list 0x7f06005b
int id list_main 0x7f06005a
int id list_menu_list 0x7f060064
int id list_menu_login 0x7f060065
int id list_no_found 0x7f06005f
int id list_refresh 0x7f06005d
int id list_view 0x7f060078
int id list_wait_first 0x7f06005c
int id list_wait_login 0x7f06006e
int id list_wait_logout 0x7f060071
int id manga_detail 0x7f06001a
int id manga_detail_normal 0x7f06001d
int id manga_detail_offensive 0x7f06001e
int id manga_detail_pining 0x7f06001f
int id manga_detail_scrollview 0x7f060019
int id matrix 0x7f060012
int id message 0x7f060033
int id name 0x7f060061
int id negative_button 0x7f060036
int id neutral_button 0x7f060037
int id page_list 0x7f06002c
int id pager 0x7f06006b
int id paper_list_layout 0x7f060072
int id paper_list_wait 0x7f060073
int id password 0x7f06006a
int id positive_button 0x7f060038
int id preview_button_refresh 0x7f060074
int id preview_num 0x7f060076
int id progressBar 0x7f06003b
int id rate 0x7f060063
int id remove 0x7f060084
int id right 0x7f060007
int id sadpanda 0x7f06005e
int id scroll_view 0x7f060032
int id search_bar 0x7f060082
int id search_text 0x7f060049
int id set_name_edit 0x7f060085
int id spinner_min_rating 0x7f060055
int id start 0x7f060010
int id text_username 0x7f06006f
int id thumb 0x7f06003a
int id title 0x7f060031
int id top 0x7f060004
int id type 0x7f060062
int id username 0x7f060069
int id vertical 0x7f060001
int id wait_message 0x7f060087
int layout detail 0x7f030000
int layout detail_normal 0x7f030001
int layout detail_offensive 0x7f030002
int layout detail_pining 0x7f030003
int layout dialog 0x7f030004
int layout download 0x7f030005
int layout download_item 0x7f030006
int layout favourite 0x7f030007
int layout filter 0x7f030008
int layout jump 0x7f030009
int layout list 0x7f03000a
int layout list_item 0x7f03000b
int layout list_item_text 0x7f03000c
int layout list_menu_list 0x7f03000d
int layout list_menu_login 0x7f03000e
int layout login 0x7f03000f
int layout manga 0x7f030010
int layout menu_item 0x7f030011
int layout menu_login 0x7f030012
int layout menu_login_over 0x7f030013
int layout page_list 0x7f030014
int layout page_list_panel 0x7f030015
int layout pull_list_view 0x7f030016
int layout pull_list_view_footer 0x7f030017
int layout pull_list_view_header 0x7f030018
int layout pull_to_refresh_head 0x7f030019
int layout search_view 0x7f03001a
int layout set_name 0x7f03001b
int layout start 0x7f03001c
int layout wait 0x7f03001d
int menu detail 0x7f0c0000
int menu main 0x7f0c0001
int raw change_log 0x7f050000
int raw thanks 0x7f050001
int string _default 0x7f0a0094
int string action_refresh 0x7f0a0058
int string action_settings 0x7f0a0059
int string actual_size 0x7f0a009c
int string add 0x7f0a0090
int string add_tag 0x7f0a0071
int string add_to_favourite 0x7f0a00a0
int string advance_search_left 0x7f0a00a6
int string app_name 0x7f0a0000
int string cache_large 0x7f0a006e
int string changelog 0x7f0a008a
int string check_login 0x7f0a000a
int string checkbox_advance 0x7f0a0013
int string checkbox_sdesc 0x7f0a0016
int string checkbox_sdt1 0x7f0a0019
int string checkbox_sdt2 0x7f0a001a
int string checkbox_sh 0x7f0a001b
int string checkbox_sname 0x7f0a0014
int string checkbox_sr 0x7f0a001c
int string checkbox_stags 0x7f0a0015
int string checkbox_sto 0x7f0a0018
int string checkbox_storr 0x7f0a0017
int string checking_update 0x7f0a002a
int string create_cache_error 0x7f0a0070
int string dailog_check_network 0x7f0a0005
int string dailog_network_error_no 0x7f0a0007
int string dailog_network_error_yes 0x7f0a0006
int string dailog_waring_no 0x7f0a0004
int string dailog_waring_plain 0x7f0a0002
int string dailog_waring_title 0x7f0a0001
int string dailog_waring_yes 0x7f0a0003
int string detail_average 0x7f0a0032
int string detail_button_cancel 0x7f0a0037
int string detail_button_every 0x7f0a0039
int string detail_button_known 0x7f0a003b
int string detail_button_once 0x7f0a0038
int string detail_button_read 0x7f0a0036
int string detail_language 0x7f0a0031
int string detail_not_rated 0x7f0a003d
int string detail_offensive 0x7f0a0035
int string detail_offensive_title 0x7f0a0034
int string detail_pages 0x7f0a002f
int string detail_people 0x7f0a0033
int string detail_pining 0x7f0a003a
int string detail_posted 0x7f0a002e
int string detail_preview_error 0x7f0a003c
int string detail_size 0x7f0a0030
int string detail_uploader 0x7f0a002d
int string develop 0x7f0a00a5
int string dialog_messgae_login_or_not 0x7f0a000e
int string dialog_send_crash_no 0x7f0a0023
int string dialog_send_crash_plain 0x7f0a0021
int string dialog_send_crash_title 0x7f0a0020
int string dialog_send_crash_yes 0x7f0a0022
int string dialog_title_login_or_not 0x7f0a000d
int string dialog_wait_send_crash_msg 0x7f0a0008
int string download 0x7f0a0097
int string download_successfully 0x7f0a0080
int string download_task_finished 0x7f0a007e
int string download_unsuccessfully 0x7f0a0081
int string downloading 0x7f0a007f
int string em_can_not_reach 0x7f0a0054
int string em_check_login_error 0x7f0a004d
int string em_client_protocol 0x7f0a0049
int string em_host_error 0x7f0a0057
int string em_login_error 0x7f0a004c
int string em_logout_error 0x7f0a004e
int string em_network_error 0x7f0a0043
int string em_no_network 0x7f0a0053
int string em_no_network_2 0x7f0a0055
int string em_open_input_stream_error 0x7f0a0047
int string em_parser_error 0x7f0a0046
int string em_put_cache_error 0x7f0a004a
int string em_read_input_stream_error 0x7f0a0048
int string em_request_error 0x7f0a0056
int string em_response_code_error 0x7f0a0045
int string em_retry 0x7f0a0050
int string em_retry_times 0x7f0a0051
int string em_timeout 0x7f0a0044
int string em_unknown_error 0x7f0a0052
int string em_url_error 0x7f0a004f
int string em_url_format_error 0x7f0a004b
int string error 0x7f0a0089
int string exit_tip 0x7f0a0009
int string favourite 0x7f0a0096
int string first_page 0x7f0a003f
int string fit_to_height 0x7f0a009e
int string fit_to_screen 0x7f0a009f
int string fit_to_width 0x7f0a009d
int string found_update 0x7f0a002c
int string hint_no_keyword 0x7f0a0012
int string homepage 0x7f0a0095
int string input_error 0x7f0a006f
int string jump 0x7f0a0092
int string jump_sum 0x7f0a001d
int string jump_to 0x7f0a001e
int string landscape 0x7f0a005d
int string last_page 0x7f0a0084
int string list_title 0x7f0a0027
int string load_pre 0x7f0a003e
int string login 0x7f0a008b
int string logout 0x7f0a008c
int string new_tag_name 0x7f0a0076
int string no_found 0x7f0a0026
int string not_login 0x7f0a000f
int string not_started 0x7f0a0082
int string password 0x7f0a008f
int string period 0x7f0a0087
int string portrait 0x7f0a005c
int string preference_author 0x7f0a006c
int string preference_author_summary 0x7f0a006d
int string preference_auto_page_cache 0x7f0a0067
int string preference_auto_page_cache_summary_off 0x7f0a0069
int string preference_auto_page_cache_summary_on 0x7f0a0068
int string preference_cache_summary 0x7f0a0065
int string preference_cache_summary_no 0x7f0a0066
int string preference_category_about 0x7f0a006b
int string preference_category_cache 0x7f0a0060
int string preference_category_display 0x7f0a005a
int string preference_clear_cp_cache 0x7f0a0062
int string preference_clear_page_cache 0x7f0a0064
int string preference_cp_cache 0x7f0a0061
int string preference_download_path 0x7f0a006a
int string preference_page_cache 0x7f0a0063
int string preference_page_scaling 0x7f0a005e
int string preference_screen_ori 0x7f0a005b
int string preference_settings_title 0x7f0a005f
int string pull_next_pull 0x7f0a007b
int string pull_next_release 0x7f0a007c
int string pull_pre_pull 0x7f0a0079
int string pull_pre_release 0x7f0a007a
int string pull_refresh_pull 0x7f0a0077
int string pull_refresh_release 0x7f0a0078
int string refresh 0x7f0a0088
int string remove 0x7f0a00a1
int string remove_info_data 0x7f0a00a2
int string retry_max_next 0x7f0a0042
int string retry_max_pre 0x7f0a0041
int string sadpanda 0x7f0a0085
int string some_page 0x7f0a0093
int string star_2 0x7f0a0098
int string star_3 0x7f0a0099
int string star_4 0x7f0a009a
int string star_5 0x7f0a009b
int string start_download_task 0x7f0a007d
int string start_reloading 0x7f0a0040
int string tag_change_name 0x7f0a0075
int string tag_name 0x7f0a0072
int string tag_name_empty 0x7f0a0073
int string tag_name_exist 0x7f0a0074
int string tap_update 0x7f0a0029
int string thanks 0x7f0a00a4
int string toast_add_download 0x7f0a0025
int string toast_add_favourite 0x7f0a0024
int string toast_invalid_page 0x7f0a001f
int string toast_login_failed 0x7f0a000c
int string toast_login_succeeded 0x7f0a000b
int string toast_logout_failed 0x7f0a0011
int string toast_logout_succeeded 0x7f0a0010
int string unfinished 0x7f0a0086
int string up_to_date 0x7f0a002b
int string update 0x7f0a00a3
int string update_message 0x7f0a0028
int string username 0x7f0a008e
int string wait 0x7f0a008d
int string waiting 0x7f0a0083
int string what_to_do 0x7f0a0091
int style ActionBar 0x7f0b0000
int style AppTheme 0x7f0b0009
int style AppTheme_NoActionBar 0x7f0b000a
int style AppTheme_NoActionBar_Transparent 0x7f0b000b
int style Button 0x7f0b0003
int style Button_Blue 0x7f0b0004
int style Button_White 0x7f0b0005
int style OverFlow 0x7f0b0001
int style PopupMenu 0x7f0b0002
int style ProgressBar 0x7f0b0006
int style ProgressBar_Large 0x7f0b0008
int style ProgressBar_Small 0x7f0b0007
int[] styleable CheckImage { 0x7f010016 }
int styleable CheckImage_mask 0
int[] styleable GridLayout { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 }
int styleable GridLayout_alignmentMode 4
int styleable GridLayout_columnCount 2
int styleable GridLayout_columnOrderPreserved 6
int styleable GridLayout_orientation 0
int styleable GridLayout_rowCount 1
int styleable GridLayout_rowOrderPreserved 5
int styleable GridLayout_useDefaultMargins 3
int[] styleable GridLayout_Layout { 0x010100f4, 0x010100f5, 0x010100f6, 0x010100f7, 0x010100f8, 0x010100f9, 0x010100fa, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b }
int styleable GridLayout_Layout_android_layout_height 1
int styleable GridLayout_Layout_android_layout_margin 2
int styleable GridLayout_Layout_android_layout_marginBottom 6
int styleable GridLayout_Layout_android_layout_marginLeft 3
int styleable GridLayout_Layout_android_layout_marginRight 5
int styleable GridLayout_Layout_android_layout_marginTop 4
int styleable GridLayout_Layout_android_layout_width 0
int styleable GridLayout_Layout_layout_column 9
int styleable GridLayout_Layout_layout_columnSpan 10
int styleable GridLayout_Layout_layout_gravity 11
int styleable GridLayout_Layout_layout_row 7
int styleable GridLayout_Layout_layout_rowSpan 8
int[] styleable SuperImageView { 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015 }
int styleable SuperImageView_adjustViewBounds 2
int styleable SuperImageView_baseline 8
int styleable SuperImageView_baselineAlignBottom 6
int styleable SuperImageView_cropToPadding 7
int styleable SuperImageView_drawableAlpha 9
int styleable SuperImageView_maxHeight 4
int styleable SuperImageView_maxWidth 3
int styleable SuperImageView_scaleType 1
int styleable SuperImageView_src 0
int styleable SuperImageView_tint 5
int xml searchable 0x7f040000
int xml settings 0x7f040001
BIN
View File
Binary file not shown.
+122
View File
@@ -0,0 +1,122 @@
# view AndroidManifest.xml #generated:15
-keep class com.hippo.ehviewer.AppContext { <init>(...); }
# view AndroidManifest.xml #generated:24
-keep class com.hippo.ehviewer.StartActivity { <init>(...); }
# view AndroidManifest.xml #generated:77
-keep class com.hippo.ehviewer.activity.DownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:69
-keep class com.hippo.ehviewer.activity.FavouriteActivity { <init>(...); }
# view AndroidManifest.xml #generated:55
-keep class com.hippo.ehviewer.activity.MangaActivity { <init>(...); }
# view AndroidManifest.xml #generated:48
-keep class com.hippo.ehviewer.activity.MangaDetailActivity { <init>(...); }
# view AndroidManifest.xml #generated:86
-keep class com.hippo.ehviewer.activity.MangaDownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:35
-keep class com.hippo.ehviewer.activity.MangaListActivity { <init>(...); }
# view AndroidManifest.xml #generated:61
-keep class com.hippo.ehviewer.activity.SettingsActivity { <init>(...); }
# view res/layout/gl_root_group.xml #generated:7
-keep class com.hippo.ehviewer.gallery.ui.GLRootView { <init>(...); }
# view res/xml/settings.xml #generated:13
# view res/xml/settings.xml #generated:21
# view res/xml/settings.xml #generated:5
# view res/xml/settings.xml #generated:71
-keep class com.hippo.ehviewer.preference.AutoListPreference { <init>(...); }
# view AndroidManifest.xml #generated:94
-keep class com.hippo.ehviewer.service.DownloadService { <init>(...); }
# view res/layout/dialog.xml #generated:70
# view res/layout/dialog.xml #generated:77
# view res/layout/dialog.xml #generated:84
-keep class com.hippo.ehviewer.view.AlertButton { <init>(...); }
# view res/layout/filter.xml #generated:19
# view res/layout/filter.xml #generated:27
# view res/layout/filter.xml #generated:37
# view res/layout/filter.xml #generated:45
# view res/layout/filter.xml #generated:55
# view res/layout/filter.xml #generated:63
# view res/layout/filter.xml #generated:73
# view res/layout/filter.xml #generated:81
# view res/layout/filter.xml #generated:91
# view res/layout/filter.xml #generated:99
-keep class com.hippo.ehviewer.view.CheckImage { <init>(...); }
# view res/layout/download_item.xml #generated:1
-keep class com.hippo.ehviewer.view.DownloadItemLayout { <init>(...); }
# view res/layout/list.xml #generated:6
-keep class com.hippo.ehviewer.view.GetPaddingRelativeLayout { <init>(...); }
# view res/layout/manga.xml #generated:1
-keep class com.hippo.ehviewer.view.MangaViewPager { <init>(...); }
# view res/layout/detail.xml #generated:20
# view res/layout/download_item.xml #generated:8
-keep class com.hippo.ehviewer.view.OlImageView { <init>(...); }
# view res/layout/list_menu_list.xml #generated:1
-keep class com.hippo.ehviewer.view.TagListView { <init>(...); }
# view res/layout/page_list.xml #generated:13
-keep class com.hippo.ehviewer.widget.AutoWrapLayout { <init>(...); }
# view res/layout/list.xml #generated:1
-keep class com.hippo.ehviewer.widget.DrawerLayout { <init>(...); }
# view res/layout/list_item.xml #generated:6
-keep class com.hippo.ehviewer.widget.LoadImageView { <init>(...); }
# view res/layout/list.xml #generated:12
-keep class com.hippo.ehviewer.widget.PullListView { <init>(...); }
# onClick res/layout/page_list_panel.xml #generated:6
-keepclassmembers class * { *** ButtonBack(...); }
# onClick res/layout/page_list_panel.xml #generated:25
-keepclassmembers class * { *** ButtonFront(...); }
# onClick res/layout/page_list.xml #generated:28
-keepclassmembers class * { *** ButtonPreviewRefresh(...); }
# onClick res/layout/menu_login.xml #generated:17
-keepclassmembers class * { *** buttonCheckLogin(...); }
# onClick res/layout/detail_offensive.xml #generated:41
-keepclassmembers class * { *** buttonEvery(...); }
# onClick res/layout/detail_offensive.xml #generated:23
# onClick res/layout/detail_pining.xml #generated:15
-keepclassmembers class * { *** buttonFinsh(...); }
# onClick res/layout/menu_login.xml #generated:6
-keepclassmembers class * { *** buttonLogin(...); }
# onClick res/layout/menu_login_over.xml #generated:16
-keepclassmembers class * { *** buttonLogout(...); }
# onClick res/layout/detail_offensive.xml #generated:31
-keepclassmembers class * { *** buttonOnce(...); }
# onClick res/layout/detail_normal.xml #generated:73
-keepclassmembers class * { *** buttonRead(...); }
# onClick res/layout/detail.xml #generated:60
# onClick res/layout/list.xml #generated:25
-keepclassmembers class * { *** buttonRefresh(...); }
# onClick res/layout/page_list_panel.xml #generated:12
-keepclassmembers class * { *** goTo(...); }
Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

BIN
View File
Binary file not shown.
+20 -20
View File
@@ -1,20 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
+199426
View File
File diff suppressed because it is too large. Load diff
+5196
View File
File diff suppressed because it is too large. Load diff
+700
View File
@@ -0,0 +1,700 @@
android.support.v4.app.BackStackState
android.support.v4.app.BackStackState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.Fragment$SavedState
android.support.v4.app.Fragment$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.FragmentManagerState
android.support.v4.app.FragmentManagerState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.FragmentState
android.support.v4.app.FragmentState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.FragmentTabHost: void setOnTabChangedListener(android.widget.TabHost$OnTabChangeListener)
android.support.v4.app.FragmentTabHost$SavedState
android.support.v4.app.FragmentTabHost$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.content.ModernAsyncTask$Status: android.support.v4.content.ModernAsyncTask$Status[] values()
android.support.v4.content.ModernAsyncTask$Status: android.support.v4.content.ModernAsyncTask$Status valueOf(java.lang.String)
android.support.v4.view.PagerTabStrip: void setTabIndicatorColor(int)
android.support.v4.view.PagerTabStrip: void setTabIndicatorColorResource(int)
android.support.v4.view.PagerTabStrip: int getTabIndicatorColor()
android.support.v4.view.PagerTabStrip: void setTextSpacing(int)
android.support.v4.view.PagerTabStrip: void setBackgroundDrawable(android.graphics.drawable.Drawable)
android.support.v4.view.PagerTabStrip: void setBackgroundColor(int)
android.support.v4.view.PagerTabStrip: void setBackgroundResource(int)
android.support.v4.view.PagerTabStrip: void setDrawFullUnderline(boolean)
android.support.v4.view.PagerTabStrip: boolean getDrawFullUnderline()
android.support.v4.view.PagerTabStrip: int getMinHeight()
android.support.v4.view.PagerTitleStrip: void setSingleLineAllCaps(android.widget.TextView)
android.support.v4.view.PagerTitleStrip: void setTextSpacing(int)
android.support.v4.view.PagerTitleStrip: int getTextSpacing()
android.support.v4.view.PagerTitleStrip: void setNonPrimaryAlpha(float)
android.support.v4.view.PagerTitleStrip: void setTextColor(int)
android.support.v4.view.PagerTitleStrip: void setGravity(int)
android.support.v4.view.PagerTitleStrip: int getMinHeight()
android.support.v4.view.ViewPager: void setScrollState(int)
android.support.v4.view.ViewPager: void setAdapter(android.support.v4.view.PagerAdapter)
android.support.v4.view.ViewPager: android.support.v4.view.PagerAdapter getAdapter()
android.support.v4.view.ViewPager: void setOnAdapterChangeListener(android.support.v4.view.ViewPager$OnAdapterChangeListener)
android.support.v4.view.ViewPager: int getClientWidth()
android.support.v4.view.ViewPager: void setCurrentItem(int)
android.support.v4.view.ViewPager: int getCurrentItem()
android.support.v4.view.ViewPager: void setOnPageChangeListener(android.support.v4.view.ViewPager$OnPageChangeListener)
android.support.v4.view.ViewPager: void setChildrenDrawingOrderEnabledCompat(boolean)
android.support.v4.view.ViewPager: int getOffscreenPageLimit()
android.support.v4.view.ViewPager: void setOffscreenPageLimit(int)
android.support.v4.view.ViewPager: void setPageMargin(int)
android.support.v4.view.ViewPager: int getPageMargin()
android.support.v4.view.ViewPager: void setPageMarginDrawable(android.graphics.drawable.Drawable)
android.support.v4.view.ViewPager: void setPageMarginDrawable(int)
android.support.v4.view.ViewPager: void setScrollingCacheEnabled(boolean)
android.support.v4.view.ViewPager$SavedState
android.support.v4.view.ViewPager$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.widget.DrawerLayout: void setScrimColor(int)
android.support.v4.widget.DrawerLayout: void setDrawerListener(android.support.v4.widget.DrawerLayout$DrawerListener)
android.support.v4.widget.DrawerLayout: void setDrawerLockMode(int)
android.support.v4.widget.DrawerLayout$SavedState
android.support.v4.widget.DrawerLayout$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.widget.SlidingPaneLayout: void setParallaxDistance(int)
android.support.v4.widget.SlidingPaneLayout: int getParallaxDistance()
android.support.v4.widget.SlidingPaneLayout: void setSliderFadeColor(int)
android.support.v4.widget.SlidingPaneLayout: int getSliderFadeColor()
android.support.v4.widget.SlidingPaneLayout: void setCoveredFadeColor(int)
android.support.v4.widget.SlidingPaneLayout: int getCoveredFadeColor()
android.support.v4.widget.SlidingPaneLayout: void setPanelSlideListener(android.support.v4.widget.SlidingPaneLayout$PanelSlideListener)
android.support.v4.widget.SlidingPaneLayout: void setShadowDrawable(android.graphics.drawable.Drawable)
android.support.v4.widget.SlidingPaneLayout: void setShadowResource(int)
android.support.v4.widget.SlidingPaneLayout$SavedState
android.support.v4.widget.SlidingPaneLayout$SavedState: android.os.Parcelable$Creator CREATOR
com.hippo.ehviewer.AppContext
com.hippo.ehviewer.AppContext: AppContext()
com.hippo.ehviewer.R$array: int download_item_long_click
com.hippo.ehviewer.R$array: int favourite_item_long_click
com.hippo.ehviewer.R$array: int is_exhentai
com.hippo.ehviewer.R$array: int list_item_long_click
com.hippo.ehviewer.R$array: int list_list_title
com.hippo.ehviewer.R$array: int min_rating
com.hippo.ehviewer.R$array: int page_scaling_entries
com.hippo.ehviewer.R$array: int page_scaling_entry_values
com.hippo.ehviewer.R$array: int preference_screen_ori_entries
com.hippo.ehviewer.R$array: int preference_screen_ori_entry_values
com.hippo.ehviewer.R$array: int preference_update_server_entries
com.hippo.ehviewer.R$array: int preference_update_server_entry_values
com.hippo.ehviewer.R$array: int start_position_entries
com.hippo.ehviewer.R$array: int start_position_values
com.hippo.ehviewer.R$attr: int adjustViewBounds
com.hippo.ehviewer.R$attr: int baseLine
com.hippo.ehviewer.R$attr: int baseline
com.hippo.ehviewer.R$attr: int baselineAlignBottom
com.hippo.ehviewer.R$attr: int cropToPadding
com.hippo.ehviewer.R$attr: int drawableAlpha
com.hippo.ehviewer.R$attr: int mask
com.hippo.ehviewer.R$attr: int maxHeight
com.hippo.ehviewer.R$attr: int maxWidth
com.hippo.ehviewer.R$attr: int scaleType
com.hippo.ehviewer.R$attr: int src
com.hippo.ehviewer.R$attr: int tint
com.hippo.ehviewer.R$color: int blue_dark
com.hippo.ehviewer.R$color: int blue_light
com.hippo.ehviewer.R$dimen: int activity_horizontal_margin
com.hippo.ehviewer.R$dimen: int activity_vertical_margin
com.hippo.ehviewer.R$dimen: int menu_offset
com.hippo.ehviewer.R$dimen: int shadow_width
com.hippo.ehviewer.R$drawable: int artistcg
com.hippo.ehviewer.R$drawable: int asianporn
com.hippo.ehviewer.R$drawable: int back
com.hippo.ehviewer.R$drawable: int cosplay
com.hippo.ehviewer.R$drawable: int doujinshi
com.hippo.ehviewer.R$drawable: int front
com.hippo.ehviewer.R$drawable: int gamecg
com.hippo.ehviewer.R$drawable: int ic_action_action_search
com.hippo.ehviewer.R$drawable: int ic_action_completed
com.hippo.ehviewer.R$drawable: int ic_action_core_overflow
com.hippo.ehviewer.R$drawable: int ic_action_download
com.hippo.ehviewer.R$drawable: int ic_action_favourite
com.hippo.ehviewer.R$drawable: int ic_action_jump
com.hippo.ehviewer.R$drawable: int ic_action_pause
com.hippo.ehviewer.R$drawable: int ic_action_refresh
com.hippo.ehviewer.R$drawable: int ic_action_remove
com.hippo.ehviewer.R$drawable: int ic_action_search
com.hippo.ehviewer.R$drawable: int ic_action_settings
com.hippo.ehviewer.R$drawable: int ic_action_start
com.hippo.ehviewer.R$drawable: int ic_launcher
com.hippo.ehviewer.R$drawable: int ic_navigation_drawer
com.hippo.ehviewer.R$drawable: int ic_pulltorefresh_arrow
com.hippo.ehviewer.R$drawable: int ic_touch
com.hippo.ehviewer.R$drawable: int imageset
com.hippo.ehviewer.R$drawable: int manga
com.hippo.ehviewer.R$drawable: int mask
com.hippo.ehviewer.R$drawable: int misc
com.hippo.ehviewer.R$drawable: int non_h
com.hippo.ehviewer.R$drawable: int progress_large
com.hippo.ehviewer.R$drawable: int progress_small
com.hippo.ehviewer.R$drawable: int sadpanda
com.hippo.ehviewer.R$drawable: int scrollbar_blue
com.hippo.ehviewer.R$drawable: int scrollbar_white
com.hippo.ehviewer.R$drawable: int spinner_16_inner
com.hippo.ehviewer.R$drawable: int spinner_16_outer
com.hippo.ehviewer.R$drawable: int spinner_76_inner
com.hippo.ehviewer.R$drawable: int spinner_76_outer
com.hippo.ehviewer.R$drawable: int star
com.hippo.ehviewer.R$drawable: int star_empty
com.hippo.ehviewer.R$drawable: int star_half
com.hippo.ehviewer.R$drawable: int unknown
com.hippo.ehviewer.R$drawable: int welcome
com.hippo.ehviewer.R$drawable: int western
com.hippo.ehviewer.R$id: int action
com.hippo.ehviewer.R$id: int action_download
com.hippo.ehviewer.R$id: int action_favourite
com.hippo.ehviewer.R$id: int action_jump
com.hippo.ehviewer.R$id: int action_refresh
com.hippo.ehviewer.R$id: int action_search
com.hippo.ehviewer.R$id: int action_settings
com.hippo.ehviewer.R$id: int app_start_view
com.hippo.ehviewer.R$id: int autoCompleteTextView1
com.hippo.ehviewer.R$id: int bottom
com.hippo.ehviewer.R$id: int bottom_panel
com.hippo.ehviewer.R$id: int button_artistcg
com.hippo.ehviewer.R$id: int button_asianporn
com.hippo.ehviewer.R$id: int button_check_login
com.hippo.ehviewer.R$id: int button_cosplay
com.hippo.ehviewer.R$id: int button_doujinshi
com.hippo.ehviewer.R$id: int button_gamecg
com.hippo.ehviewer.R$id: int button_imageset
com.hippo.ehviewer.R$id: int button_login
com.hippo.ehviewer.R$id: int button_manga
com.hippo.ehviewer.R$id: int button_misc
com.hippo.ehviewer.R$id: int button_non_h
com.hippo.ehviewer.R$id: int button_read
com.hippo.ehviewer.R$id: int button_western
com.hippo.ehviewer.R$id: int center
com.hippo.ehviewer.R$id: int centerCrop
com.hippo.ehviewer.R$id: int centerInside
com.hippo.ehviewer.R$id: int checkbox_advance
com.hippo.ehviewer.R$id: int checkbox_sdesc
com.hippo.ehviewer.R$id: int checkbox_sdt1
com.hippo.ehviewer.R$id: int checkbox_sdt2
com.hippo.ehviewer.R$id: int checkbox_sh
com.hippo.ehviewer.R$id: int checkbox_sname
com.hippo.ehviewer.R$id: int checkbox_sr
com.hippo.ehviewer.R$id: int checkbox_stags
com.hippo.ehviewer.R$id: int checkbox_sto
com.hippo.ehviewer.R$id: int checkbox_storr
com.hippo.ehviewer.R$id: int cover
com.hippo.ehviewer.R$id: int custom
com.hippo.ehviewer.R$id: int detail_average
com.hippo.ehviewer.R$id: int detail_button_cancel
com.hippo.ehviewer.R$id: int detail_button_every
com.hippo.ehviewer.R$id: int detail_button_known
com.hippo.ehviewer.R$id: int detail_button_once
com.hippo.ehviewer.R$id: int detail_cover
com.hippo.ehviewer.R$id: int detail_language
com.hippo.ehviewer.R$id: int detail_pages
com.hippo.ehviewer.R$id: int detail_people
com.hippo.ehviewer.R$id: int detail_posted
com.hippo.ehviewer.R$id: int detail_rate
com.hippo.ehviewer.R$id: int detail_refresh
com.hippo.ehviewer.R$id: int detail_size
com.hippo.ehviewer.R$id: int detail_title
com.hippo.ehviewer.R$id: int detail_type
com.hippo.ehviewer.R$id: int detail_uploader
com.hippo.ehviewer.R$id: int detail_wait
com.hippo.ehviewer.R$id: int download
com.hippo.ehviewer.R$id: int drawer_layout
com.hippo.ehviewer.R$id: int drawer_login
com.hippo.ehviewer.R$id: int drawer_login_over
com.hippo.ehviewer.R$id: int favourite
com.hippo.ehviewer.R$id: int filter_advance
com.hippo.ehviewer.R$id: int fitCenter
com.hippo.ehviewer.R$id: int fitEnd
com.hippo.ehviewer.R$id: int fitStart
com.hippo.ehviewer.R$id: int fitXY
com.hippo.ehviewer.R$id: int footer_progressBar
com.hippo.ehviewer.R$id: int footer_tip_text
com.hippo.ehviewer.R$id: int gl_root_view
com.hippo.ehviewer.R$id: int head_arrowImageView
com.hippo.ehviewer.R$id: int head_contentLayout
com.hippo.ehviewer.R$id: int head_progressBar
com.hippo.ehviewer.R$id: int head_tipsTextView
com.hippo.ehviewer.R$id: int header
com.hippo.ehviewer.R$id: int header_arrow_image
com.hippo.ehviewer.R$id: int header_progressBar
com.hippo.ehviewer.R$id: int header_tip_text
com.hippo.ehviewer.R$id: int info
com.hippo.ehviewer.R$id: int is_exhentai
com.hippo.ehviewer.R$id: int list
com.hippo.ehviewer.R$id: int list_button_logout
com.hippo.ehviewer.R$id: int list_jump_edit
com.hippo.ehviewer.R$id: int list_jump_sum
com.hippo.ehviewer.R$id: int list_jump_to
com.hippo.ehviewer.R$id: int list_list
com.hippo.ehviewer.R$id: int list_main
com.hippo.ehviewer.R$id: int list_menu_list
com.hippo.ehviewer.R$id: int list_menu_login
com.hippo.ehviewer.R$id: int list_no_found
com.hippo.ehviewer.R$id: int list_refresh
com.hippo.ehviewer.R$id: int list_view
com.hippo.ehviewer.R$id: int list_wait_first
com.hippo.ehviewer.R$id: int list_wait_login
com.hippo.ehviewer.R$id: int list_wait_logout
com.hippo.ehviewer.R$id: int main
com.hippo.ehviewer.R$id: int manga_detail
com.hippo.ehviewer.R$id: int manga_detail_normal
com.hippo.ehviewer.R$id: int manga_detail_offensive
com.hippo.ehviewer.R$id: int manga_detail_pining
com.hippo.ehviewer.R$id: int manga_detail_scrollview
com.hippo.ehviewer.R$id: int matrix
com.hippo.ehviewer.R$id: int message
com.hippo.ehviewer.R$id: int name
com.hippo.ehviewer.R$id: int negative_button
com.hippo.ehviewer.R$id: int neutral_button
com.hippo.ehviewer.R$id: int page_list
com.hippo.ehviewer.R$id: int pager
com.hippo.ehviewer.R$id: int paper_list_layout
com.hippo.ehviewer.R$id: int paper_list_wait
com.hippo.ehviewer.R$id: int password
com.hippo.ehviewer.R$id: int positive_button
com.hippo.ehviewer.R$id: int preview_button_refresh
com.hippo.ehviewer.R$id: int preview_num
com.hippo.ehviewer.R$id: int progressBar
com.hippo.ehviewer.R$id: int rate
com.hippo.ehviewer.R$id: int remove
com.hippo.ehviewer.R$id: int sadpanda
com.hippo.ehviewer.R$id: int scroll_view
com.hippo.ehviewer.R$id: int search_bar
com.hippo.ehviewer.R$id: int search_text
com.hippo.ehviewer.R$id: int set_name_edit
com.hippo.ehviewer.R$id: int spinner_min_rating
com.hippo.ehviewer.R$id: int tags_layout
com.hippo.ehviewer.R$id: int text_username
com.hippo.ehviewer.R$id: int thumb
com.hippo.ehviewer.R$id: int title
com.hippo.ehviewer.R$id: int top
com.hippo.ehviewer.R$id: int type
com.hippo.ehviewer.R$id: int username
com.hippo.ehviewer.R$id: int wait_message
com.hippo.ehviewer.R$layout: int detail
com.hippo.ehviewer.R$layout: int detail_normal
com.hippo.ehviewer.R$layout: int detail_offensive
com.hippo.ehviewer.R$layout: int detail_pining
com.hippo.ehviewer.R$layout: int dialog
com.hippo.ehviewer.R$layout: int download
com.hippo.ehviewer.R$layout: int download_item
com.hippo.ehviewer.R$layout: int favourite
com.hippo.ehviewer.R$layout: int filter
com.hippo.ehviewer.R$layout: int gl_root_group
com.hippo.ehviewer.R$layout: int jump
com.hippo.ehviewer.R$layout: int list
com.hippo.ehviewer.R$layout: int list_item
com.hippo.ehviewer.R$layout: int list_item_text
com.hippo.ehviewer.R$layout: int list_menu_list
com.hippo.ehviewer.R$layout: int list_menu_login
com.hippo.ehviewer.R$layout: int login
com.hippo.ehviewer.R$layout: int manga
com.hippo.ehviewer.R$layout: int menu_item
com.hippo.ehviewer.R$layout: int menu_login
com.hippo.ehviewer.R$layout: int menu_login_over
com.hippo.ehviewer.R$layout: int page_list
com.hippo.ehviewer.R$layout: int page_list_panel
com.hippo.ehviewer.R$layout: int pull_list_view
com.hippo.ehviewer.R$layout: int pull_list_view_footer
com.hippo.ehviewer.R$layout: int pull_list_view_header
com.hippo.ehviewer.R$layout: int pull_to_refresh_head
com.hippo.ehviewer.R$layout: int search_view
com.hippo.ehviewer.R$layout: int set_name
com.hippo.ehviewer.R$layout: int start
com.hippo.ehviewer.R$layout: int wait
com.hippo.ehviewer.R$menu: int detail
com.hippo.ehviewer.R$menu: int main
com.hippo.ehviewer.R$raw: int change_log
com.hippo.ehviewer.R$raw: int thanks
com.hippo.ehviewer.R$string: int _default
com.hippo.ehviewer.R$string: int action_refresh
com.hippo.ehviewer.R$string: int action_settings
com.hippo.ehviewer.R$string: int actual_size
com.hippo.ehviewer.R$string: int add
com.hippo.ehviewer.R$string: int add_tag
com.hippo.ehviewer.R$string: int add_to_favourite
com.hippo.ehviewer.R$string: int advance_search_left
com.hippo.ehviewer.R$string: int app_name
com.hippo.ehviewer.R$string: int bottom_left
com.hippo.ehviewer.R$string: int bottom_right
com.hippo.ehviewer.R$string: int cache_large
com.hippo.ehviewer.R$string: int center
com.hippo.ehviewer.R$string: int changelog
com.hippo.ehviewer.R$string: int check_login
com.hippo.ehviewer.R$string: int checkbox_advance
com.hippo.ehviewer.R$string: int checkbox_sdesc
com.hippo.ehviewer.R$string: int checkbox_sdt1
com.hippo.ehviewer.R$string: int checkbox_sdt2
com.hippo.ehviewer.R$string: int checkbox_sh
com.hippo.ehviewer.R$string: int checkbox_sname
com.hippo.ehviewer.R$string: int checkbox_sr
com.hippo.ehviewer.R$string: int checkbox_stags
com.hippo.ehviewer.R$string: int checkbox_sto
com.hippo.ehviewer.R$string: int checkbox_storr
com.hippo.ehviewer.R$string: int checking_update
com.hippo.ehviewer.R$string: int create_cache_error
com.hippo.ehviewer.R$string: int dailog_check_network
com.hippo.ehviewer.R$string: int dailog_network_error_no
com.hippo.ehviewer.R$string: int dailog_network_error_yes
com.hippo.ehviewer.R$string: int dailog_waring_no
com.hippo.ehviewer.R$string: int dailog_waring_plain
com.hippo.ehviewer.R$string: int dailog_waring_title
com.hippo.ehviewer.R$string: int dailog_waring_yes
com.hippo.ehviewer.R$string: int detail_average
com.hippo.ehviewer.R$string: int detail_button_cancel
com.hippo.ehviewer.R$string: int detail_button_every
com.hippo.ehviewer.R$string: int detail_button_known
com.hippo.ehviewer.R$string: int detail_button_once
com.hippo.ehviewer.R$string: int detail_language
com.hippo.ehviewer.R$string: int detail_not_rated
com.hippo.ehviewer.R$string: int detail_offensive
com.hippo.ehviewer.R$string: int detail_offensive_title
com.hippo.ehviewer.R$string: int detail_pages
com.hippo.ehviewer.R$string: int detail_people
com.hippo.ehviewer.R$string: int detail_pining
com.hippo.ehviewer.R$string: int detail_posted
com.hippo.ehviewer.R$string: int detail_preview_error
com.hippo.ehviewer.R$string: int detail_size
com.hippo.ehviewer.R$string: int detail_uploader
com.hippo.ehviewer.R$string: int develop
com.hippo.ehviewer.R$string: int dialog_messgae_login_or_not
com.hippo.ehviewer.R$string: int dialog_send_crash_no
com.hippo.ehviewer.R$string: int dialog_send_crash_plain
com.hippo.ehviewer.R$string: int dialog_send_crash_title
com.hippo.ehviewer.R$string: int dialog_send_crash_yes
com.hippo.ehviewer.R$string: int dialog_title_login_or_not
com.hippo.ehviewer.R$string: int dialog_wait_send_crash_msg
com.hippo.ehviewer.R$string: int download
com.hippo.ehviewer.R$string: int download_successfully
com.hippo.ehviewer.R$string: int download_task_finished
com.hippo.ehviewer.R$string: int download_unsuccessfully
com.hippo.ehviewer.R$string: int downloading
com.hippo.ehviewer.R$string: int em_can_not_reach
com.hippo.ehviewer.R$string: int em_check_login_error
com.hippo.ehviewer.R$string: int em_client_protocol
com.hippo.ehviewer.R$string: int em_host_error
com.hippo.ehviewer.R$string: int em_invalid_request
com.hippo.ehviewer.R$string: int em_login_error
com.hippo.ehviewer.R$string: int em_logout_error
com.hippo.ehviewer.R$string: int em_network_error
com.hippo.ehviewer.R$string: int em_no_network
com.hippo.ehviewer.R$string: int em_no_network_2
com.hippo.ehviewer.R$string: int em_no_sdcard
com.hippo.ehviewer.R$string: int em_open_input_stream_error
com.hippo.ehviewer.R$string: int em_parser_error
com.hippo.ehviewer.R$string: int em_put_cache_error
com.hippo.ehviewer.R$string: int em_read_input_stream_error
com.hippo.ehviewer.R$string: int em_redirection_error
com.hippo.ehviewer.R$string: int em_request_error
com.hippo.ehviewer.R$string: int em_response_code_error
com.hippo.ehviewer.R$string: int em_retry
com.hippo.ehviewer.R$string: int em_retry_times
com.hippo.ehviewer.R$string: int em_timeout
com.hippo.ehviewer.R$string: int em_unexpected_response_code
com.hippo.ehviewer.R$string: int em_unknown_error
com.hippo.ehviewer.R$string: int em_unknown_host
com.hippo.ehviewer.R$string: int em_url_error
com.hippo.ehviewer.R$string: int em_url_format_error
com.hippo.ehviewer.R$string: int error
com.hippo.ehviewer.R$string: int exit_tip
com.hippo.ehviewer.R$string: int favourite
com.hippo.ehviewer.R$string: int first_page
com.hippo.ehviewer.R$string: int fit_to_height
com.hippo.ehviewer.R$string: int fit_to_screen
com.hippo.ehviewer.R$string: int fit_to_width
com.hippo.ehviewer.R$string: int fixed_scale
com.hippo.ehviewer.R$string: int footer_fail
com.hippo.ehviewer.R$string: int footer_loaded
com.hippo.ehviewer.R$string: int footer_loading
com.hippo.ehviewer.R$string: int found_update
com.hippo.ehviewer.R$string: int hint_no_keyword
com.hippo.ehviewer.R$string: int homepage
com.hippo.ehviewer.R$string: int input_error
com.hippo.ehviewer.R$string: int jump
com.hippo.ehviewer.R$string: int jump_sum
com.hippo.ehviewer.R$string: int jump_to
com.hippo.ehviewer.R$string: int landscape
com.hippo.ehviewer.R$string: int last_page
com.hippo.ehviewer.R$string: int list_title
com.hippo.ehviewer.R$string: int load_pre
com.hippo.ehviewer.R$string: int login
com.hippo.ehviewer.R$string: int logout
com.hippo.ehviewer.R$string: int menu
com.hippo.ehviewer.R$string: int new_tag_name
com.hippo.ehviewer.R$string: int next_page
com.hippo.ehviewer.R$string: int no_found
com.hippo.ehviewer.R$string: int not_login
com.hippo.ehviewer.R$string: int not_started
com.hippo.ehviewer.R$string: int password
com.hippo.ehviewer.R$string: int period
com.hippo.ehviewer.R$string: int portrait
com.hippo.ehviewer.R$string: int pre_page
com.hippo.ehviewer.R$string: int preference_author
com.hippo.ehviewer.R$string: int preference_author_summary
com.hippo.ehviewer.R$string: int preference_auto_page_cache
com.hippo.ehviewer.R$string: int preference_auto_page_cache_summary_off
com.hippo.ehviewer.R$string: int preference_auto_page_cache_summary_on
com.hippo.ehviewer.R$string: int preference_cache
com.hippo.ehviewer.R$string: int preference_cache_summary
com.hippo.ehviewer.R$string: int preference_cache_summary_no
com.hippo.ehviewer.R$string: int preference_category_about
com.hippo.ehviewer.R$string: int preference_category_cache
com.hippo.ehviewer.R$string: int preference_category_display
com.hippo.ehviewer.R$string: int preference_clear_cache
com.hippo.ehviewer.R$string: int preference_download_path
com.hippo.ehviewer.R$string: int preference_page_scaling
com.hippo.ehviewer.R$string: int preference_screen_ori
com.hippo.ehviewer.R$string: int preference_settings_title
com.hippo.ehviewer.R$string: int preference_start_position
com.hippo.ehviewer.R$string: int preference_update_server
com.hippo.ehviewer.R$string: int pull_load_cancel
com.hippo.ehviewer.R$string: int pull_load_doing
com.hippo.ehviewer.R$string: int pull_load_done
com.hippo.ehviewer.R$string: int pull_load_pull
com.hippo.ehviewer.R$string: int pull_load_release
com.hippo.ehviewer.R$string: int pull_pre_cancel
com.hippo.ehviewer.R$string: int pull_pre_doing
com.hippo.ehviewer.R$string: int pull_pre_done
com.hippo.ehviewer.R$string: int pull_pre_pull
com.hippo.ehviewer.R$string: int pull_pre_release
com.hippo.ehviewer.R$string: int pull_refresh_cancel
com.hippo.ehviewer.R$string: int pull_refresh_doing
com.hippo.ehviewer.R$string: int pull_refresh_done
com.hippo.ehviewer.R$string: int pull_refresh_pull
com.hippo.ehviewer.R$string: int pull_refresh_release
com.hippo.ehviewer.R$string: int read
com.hippo.ehviewer.R$string: int refresh
com.hippo.ehviewer.R$string: int remove
com.hippo.ehviewer.R$string: int remove_info_data
com.hippo.ehviewer.R$string: int retry_max_next
com.hippo.ehviewer.R$string: int retry_max_pre
com.hippo.ehviewer.R$string: int sadpanda
com.hippo.ehviewer.R$string: int some_page
com.hippo.ehviewer.R$string: int star_2
com.hippo.ehviewer.R$string: int star_3
com.hippo.ehviewer.R$string: int star_4
com.hippo.ehviewer.R$string: int star_5
com.hippo.ehviewer.R$string: int start_download_task
com.hippo.ehviewer.R$string: int start_reloading
com.hippo.ehviewer.R$string: int tag_change_name
com.hippo.ehviewer.R$string: int tag_name
com.hippo.ehviewer.R$string: int tag_name_empty
com.hippo.ehviewer.R$string: int tag_name_exist
com.hippo.ehviewer.R$string: int tap_update
com.hippo.ehviewer.R$string: int thanks
com.hippo.ehviewer.R$string: int toast_add_download
com.hippo.ehviewer.R$string: int toast_add_favourite
com.hippo.ehviewer.R$string: int toast_invalid_page
com.hippo.ehviewer.R$string: int toast_login_failed
com.hippo.ehviewer.R$string: int toast_login_succeeded
com.hippo.ehviewer.R$string: int toast_logout_failed
com.hippo.ehviewer.R$string: int toast_logout_succeeded
com.hippo.ehviewer.R$string: int top_left
com.hippo.ehviewer.R$string: int top_right
com.hippo.ehviewer.R$string: int unfinished
com.hippo.ehviewer.R$string: int up_to_date
com.hippo.ehviewer.R$string: int update
com.hippo.ehviewer.R$string: int update_message
com.hippo.ehviewer.R$string: int update_server_google
com.hippo.ehviewer.R$string: int update_server_qiniu
com.hippo.ehviewer.R$string: int username
com.hippo.ehviewer.R$string: int wait
com.hippo.ehviewer.R$string: int waiting
com.hippo.ehviewer.R$string: int what_to_do
com.hippo.ehviewer.R$string: int zoom_in
com.hippo.ehviewer.R$string: int zoom_out
com.hippo.ehviewer.R$style: int ActionBar
com.hippo.ehviewer.R$style: int AppTheme
com.hippo.ehviewer.R$style: int AppTheme_NoActionBar
com.hippo.ehviewer.R$style: int AppTheme_NoActionBar_Transparent
com.hippo.ehviewer.R$style: int Button
com.hippo.ehviewer.R$style: int Button_Blue
com.hippo.ehviewer.R$style: int Button_White
com.hippo.ehviewer.R$style: int OverFlow
com.hippo.ehviewer.R$style: int PopupMenu
com.hippo.ehviewer.R$style: int ProgressBar
com.hippo.ehviewer.R$style: int ProgressBar_Large
com.hippo.ehviewer.R$style: int ProgressBar_Small
com.hippo.ehviewer.R$styleable: int[] AutoWrapLayout
com.hippo.ehviewer.R$styleable: int AutoWrapLayout_baseLine
com.hippo.ehviewer.R$styleable: int[] CheckImage
com.hippo.ehviewer.R$styleable: int CheckImage_mask
com.hippo.ehviewer.R$styleable: int[] SuperImageView
com.hippo.ehviewer.R$styleable: int SuperImageView_adjustViewBounds
com.hippo.ehviewer.R$styleable: int SuperImageView_baseline
com.hippo.ehviewer.R$styleable: int SuperImageView_baselineAlignBottom
com.hippo.ehviewer.R$styleable: int SuperImageView_cropToPadding
com.hippo.ehviewer.R$styleable: int SuperImageView_drawableAlpha
com.hippo.ehviewer.R$styleable: int SuperImageView_maxHeight
com.hippo.ehviewer.R$styleable: int SuperImageView_maxWidth
com.hippo.ehviewer.R$styleable: int SuperImageView_scaleType
com.hippo.ehviewer.R$styleable: int SuperImageView_src
com.hippo.ehviewer.R$styleable: int SuperImageView_tint
com.hippo.ehviewer.R$xml: int searchable
com.hippo.ehviewer.R$xml: int settings
com.hippo.ehviewer.StartActivity
com.hippo.ehviewer.StartActivity: StartActivity()
com.hippo.ehviewer.activity.DownloadActivity
com.hippo.ehviewer.activity.DownloadActivity: DownloadActivity()
com.hippo.ehviewer.activity.FavouriteActivity
com.hippo.ehviewer.activity.FavouriteActivity: FavouriteActivity()
com.hippo.ehviewer.activity.FavouriteActivity: void buttonListItemCancel(android.view.View)
com.hippo.ehviewer.activity.MangaActivity
com.hippo.ehviewer.activity.MangaActivity: MangaActivity()
com.hippo.ehviewer.activity.MangaDetailActivity
com.hippo.ehviewer.activity.MangaDetailActivity: MangaDetailActivity()
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonRefresh(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonFinsh(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonOnce(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonEvery(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonRead(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void ButtonBack(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void ButtonFront(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void ButtonPreviewRefresh(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void goTo(android.view.View)
com.hippo.ehviewer.activity.MangaDownloadActivity
com.hippo.ehviewer.activity.MangaDownloadActivity: MangaDownloadActivity()
com.hippo.ehviewer.activity.MangaListActivity
com.hippo.ehviewer.activity.MangaListActivity: MangaListActivity()
com.hippo.ehviewer.activity.MangaListActivity: void buttonRefresh(android.view.View)
com.hippo.ehviewer.activity.MangaListActivity: void buttonLogout(android.view.View)
com.hippo.ehviewer.activity.MangaListActivity: void buttonLogin(android.view.View)
com.hippo.ehviewer.activity.MangaListActivity: void buttonCheckLogin(android.view.View)
com.hippo.ehviewer.activity.SettingsActivity
com.hippo.ehviewer.activity.SettingsActivity: SettingsActivity()
com.hippo.ehviewer.gallery.ui.GLRootView
com.hippo.ehviewer.gallery.ui.GLRootView: GLRootView(android.content.Context)
com.hippo.ehviewer.gallery.ui.GLRootView: GLRootView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.gallery.ui.GLRootView: void setContentPane(com.hippo.ehviewer.gallery.ui.GLView)
com.hippo.ehviewer.gallery.ui.GLRootView: void setOrientationSource(com.hippo.ehviewer.gallery.ui.OrientationSource)
com.hippo.ehviewer.gallery.ui.GLRootView: int getDisplayRotation()
com.hippo.ehviewer.gallery.ui.GLRootView: int getCompensation()
com.hippo.ehviewer.gallery.ui.GLRootView: android.graphics.Matrix getCompensationMatrix()
com.hippo.ehviewer.gallery.ui.GLRootView: void setLightsOutMode(boolean)
com.hippo.ehviewer.preference.AutoListPreference
com.hippo.ehviewer.preference.AutoListPreference: AutoListPreference(android.content.Context)
com.hippo.ehviewer.preference.AutoListPreference: AutoListPreference(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.service.DownloadService
com.hippo.ehviewer.service.DownloadService: DownloadService()
com.hippo.ehviewer.view.AlertButton
com.hippo.ehviewer.view.AlertButton: AlertButton(android.content.Context)
com.hippo.ehviewer.view.AlertButton: AlertButton(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.AlertButton: AlertButton(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.CheckImage
com.hippo.ehviewer.view.CheckImage: CheckImage(android.content.Context)
com.hippo.ehviewer.view.CheckImage: CheckImage(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.CheckImage: CheckImage(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.DownloadItemLayout
com.hippo.ehviewer.view.DownloadItemLayout: DownloadItemLayout(android.content.Context)
com.hippo.ehviewer.view.DownloadItemLayout: DownloadItemLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.DownloadItemLayout: DownloadItemLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.GetPaddingRelativeLayout
com.hippo.ehviewer.view.GetPaddingRelativeLayout: GetPaddingRelativeLayout(android.content.Context)
com.hippo.ehviewer.view.GetPaddingRelativeLayout: GetPaddingRelativeLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.GetPaddingRelativeLayout: GetPaddingRelativeLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.OlImageView
com.hippo.ehviewer.view.OlImageView: void setOnLoadListener(com.hippo.ehviewer.view.OlImageView$OnLoadListener)
com.hippo.ehviewer.view.OlImageView: OlImageView(android.content.Context)
com.hippo.ehviewer.view.OlImageView: OlImageView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.OlImageView: OlImageView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.OlImageView: void setUrl(java.lang.String)
com.hippo.ehviewer.view.OlImageView: java.lang.String getUrl()
com.hippo.ehviewer.view.OlImageView: void setKey(java.lang.String)
com.hippo.ehviewer.view.OlImageView: java.lang.String getKey()
com.hippo.ehviewer.view.OlImageView: int getStatus()
com.hippo.ehviewer.view.SuperImageView: SuperImageView(android.content.Context)
com.hippo.ehviewer.view.SuperImageView: SuperImageView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.SuperImageView: SuperImageView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.SuperImageView: boolean getAdjustViewBounds()
com.hippo.ehviewer.view.SuperImageView: void setAdjustViewBounds(boolean)
com.hippo.ehviewer.view.SuperImageView: int getMaxWidth()
com.hippo.ehviewer.view.SuperImageView: void setMaxWidth(int)
com.hippo.ehviewer.view.SuperImageView: int getMaxHeight()
com.hippo.ehviewer.view.SuperImageView: void setMaxHeight(int)
com.hippo.ehviewer.view.SuperImageView: android.graphics.drawable.Drawable getDrawable()
com.hippo.ehviewer.view.SuperImageView: int getResourceWidth()
com.hippo.ehviewer.view.SuperImageView: int getResourceHeight()
com.hippo.ehviewer.view.SuperImageView: android.graphics.Movie getMovie()
com.hippo.ehviewer.view.SuperImageView: void setImageResource(int)
com.hippo.ehviewer.view.SuperImageView: void setImageURI(android.net.Uri)
com.hippo.ehviewer.view.SuperImageView: void setImageDrawable(android.graphics.drawable.Drawable)
com.hippo.ehviewer.view.SuperImageView: void setImageMovie(android.graphics.Movie)
com.hippo.ehviewer.view.SuperImageView: void setImageInputStream(java.io.InputStream)
com.hippo.ehviewer.view.SuperImageView: void setImageBitmap(android.graphics.Bitmap)
com.hippo.ehviewer.view.SuperImageView: void setSelected(boolean)
com.hippo.ehviewer.view.SuperImageView: void setImageLevel(int)
com.hippo.ehviewer.view.SuperImageView: void setScaleType(com.hippo.ehviewer.view.SuperImageView$ScaleType)
com.hippo.ehviewer.view.SuperImageView: com.hippo.ehviewer.view.SuperImageView$ScaleType getScaleType()
com.hippo.ehviewer.view.SuperImageView: android.graphics.Matrix getImageMatrix()
com.hippo.ehviewer.view.SuperImageView: void setImageMatrix(android.graphics.Matrix)
com.hippo.ehviewer.view.SuperImageView: boolean getCropToPadding()
com.hippo.ehviewer.view.SuperImageView: void setCropToPadding(boolean)
com.hippo.ehviewer.view.SuperImageView: int getBaseline()
com.hippo.ehviewer.view.SuperImageView: void setBaseline(int)
com.hippo.ehviewer.view.SuperImageView: void setBaselineAlignBottom(boolean)
com.hippo.ehviewer.view.SuperImageView: boolean getBaselineAlignBottom()
com.hippo.ehviewer.view.SuperImageView: void setColorFilter(int)
com.hippo.ehviewer.view.SuperImageView: void setXfermode(android.graphics.Xfermode)
com.hippo.ehviewer.view.SuperImageView: android.graphics.ColorFilter getColorFilter()
com.hippo.ehviewer.view.SuperImageView: void setColorFilter(android.graphics.ColorFilter)
com.hippo.ehviewer.view.SuperImageView: int getImageAlpha()
com.hippo.ehviewer.view.SuperImageView: void setImageAlpha(int)
com.hippo.ehviewer.view.SuperImageView: void setAlpha(int)
com.hippo.ehviewer.view.SuperImageView: void setVisibility(int)
com.hippo.ehviewer.view.SuperImageView$ScaleType: com.hippo.ehviewer.view.SuperImageView$ScaleType[] values()
com.hippo.ehviewer.view.SuperImageView$ScaleType: com.hippo.ehviewer.view.SuperImageView$ScaleType valueOf(java.lang.String)
com.hippo.ehviewer.view.TagListView
com.hippo.ehviewer.view.TagListView: TagListView(android.content.Context)
com.hippo.ehviewer.view.TagListView: TagListView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.TagListView: TagListView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.TagListView: void setStableItemCount(int)
com.hippo.ehviewer.view.TagListView: void setOnModifyListener(com.hippo.ehviewer.view.TagListView$OnModifyListener)
com.hippo.ehviewer.view.TagListView: void setOnMoveLister(com.hippo.ehviewer.view.TagListView$OnMoveLister)
com.hippo.ehviewer.view.TagListView: void setItemList(java.util.ArrayList)
com.hippo.ehviewer.widget.AutoWrapLayout
com.hippo.ehviewer.widget.AutoWrapLayout: AutoWrapLayout(android.content.Context)
com.hippo.ehviewer.widget.AutoWrapLayout: AutoWrapLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.AutoWrapLayout: AutoWrapLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.AutoWrapLayout: void setBaseLine(com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine)
com.hippo.ehviewer.widget.AutoWrapLayout: com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine getScaleType()
com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine: com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine[] values()
com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine: com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine valueOf(java.lang.String)
com.hippo.ehviewer.widget.DrawerLayout
com.hippo.ehviewer.widget.DrawerLayout: DrawerLayout(android.content.Context)
com.hippo.ehviewer.widget.DrawerLayout: DrawerLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.DrawerLayout: DrawerLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.DrawerLayout: void setScrimColor(int)
com.hippo.ehviewer.widget.DrawerLayout: void setDrawerListener(com.hippo.ehviewer.widget.DrawerLayout$DrawerListener)
com.hippo.ehviewer.widget.DrawerLayout: void setDrawerLockMode(int)
com.hippo.ehviewer.widget.DrawerLayout: void setEnabled(boolean)
com.hippo.ehviewer.widget.DrawerLayout$SavedState
com.hippo.ehviewer.widget.DrawerLayout$SavedState: android.os.Parcelable$Creator CREATOR
com.hippo.ehviewer.widget.LoadImageView
com.hippo.ehviewer.widget.LoadImageView: LoadImageView(android.content.Context)
com.hippo.ehviewer.widget.LoadImageView: LoadImageView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.LoadImageView: LoadImageView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.LoadImageView: void setState(int)
com.hippo.ehviewer.widget.LoadImageView: void setOnClickListener(com.hippo.ehviewer.ImageLoadManager)
com.hippo.ehviewer.widget.LoadImageView: java.lang.String getUrl()
com.hippo.ehviewer.widget.LoadImageView: java.lang.String getKey()
com.hippo.ehviewer.widget.LoadImageView: int getState()
com.hippo.ehviewer.widget.PullListView
com.hippo.ehviewer.widget.PullListView: PullListView(android.content.Context)
com.hippo.ehviewer.widget.PullListView: PullListView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.PullListView: PullListView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.PullListView: android.widget.ListView getListView()
com.hippo.ehviewer.widget.PullListView: void setHeaderEnabled(boolean)
com.hippo.ehviewer.widget.PullListView: void setOnRefreshListener(com.hippo.ehviewer.widget.PullListView$OnHeaderRefreshListener)
com.hippo.ehviewer.widget.PullListView: void setFooterEnabled(boolean)
com.hippo.ehviewer.widget.PullListView: void setOnFooterRefreshListener(com.hippo.ehviewer.widget.PullListView$OnFooterRefreshListener)
com.hippo.ehviewer.widget.PullListView: void setActionWhenShow(boolean)
org.apache.commons.lang3.ClassUtils$Interfaces: org.apache.commons.lang3.ClassUtils$Interfaces[] values()
org.apache.commons.lang3.ClassUtils$Interfaces: org.apache.commons.lang3.ClassUtils$Interfaces valueOf(java.lang.String)
org.apache.commons.lang3.JavaVersion: org.apache.commons.lang3.JavaVersion[] values()
org.apache.commons.lang3.JavaVersion: org.apache.commons.lang3.JavaVersion valueOf(java.lang.String)
org.apache.commons.lang3.Range$ComparableComparator: org.apache.commons.lang3.Range$ComparableComparator[] values()
org.apache.commons.lang3.Range$ComparableComparator: org.apache.commons.lang3.Range$ComparableComparator valueOf(java.lang.String)
org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION: org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION[] values()
org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION: org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION valueOf(java.lang.String)
org.apache.commons.lang3.time.StopWatch$SplitState: org.apache.commons.lang3.time.StopWatch$SplitState[] values()
org.apache.commons.lang3.time.StopWatch$SplitState: org.apache.commons.lang3.time.StopWatch$SplitState valueOf(java.lang.String)
org.apache.commons.lang3.time.StopWatch$State: org.apache.commons.lang3.time.StopWatch$State[] values()
org.apache.commons.lang3.time.StopWatch$State: org.apache.commons.lang3.time.StopWatch$State valueOf(java.lang.String)
+2687
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -12,3 +12,4 @@
# Project target.
target=android-19
#proguard.config=E:/Android/android-sdk/tools/proguard/proguard-android.txt:proguard-project.txt
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

+24 -25
View File
@@ -1,26 +1,25 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/textfield" >
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:singleLine="true"
android:background="@android:color/transparent" >
</AutoCompleteTextView>
<ImageView
android:id="@+id/remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_action_remove" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/search_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:singleLine="true"
android:background="@android:color/transparent" >
</AutoCompleteTextView>
<ImageView
android:id="@+id/remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_action_remove" />
</LinearLayout>
+21
View File
@@ -1,3 +1,24 @@
Version 0.4.4 (2014-04-06)
* 修复错误的日志输出导致的崩溃
Version 0.4.3 (2014-04-05)
* 更丰富的错误提示
* 禁止多次同时更新
* 修正由于版本之间数据不同导致的阅读时崩溃
* 添加更新服务器选择
Version 0.4.2 (2014-04-04)
* 添加内置存储空间或 Sd Card 检测
* 修正由于 gif 格式图片导致的崩溃
* 修正由文件夹名而可能产生的错误
* 优化网络连接
Version 0.4.1 (2014-04-02)
* 修正单点触控缩放错误
* 修正下载完毕后无法读取最后一页
* 修正从非第一页开始阅读应用崩溃错误
* 修正网络错误时进入详情界面应用崩溃
Version 0.4.0 (2014-04-01)
* 全新的阅读界面
* 优化内存
+12 -4
View File
@@ -112,7 +112,12 @@
<string name="em_can_not_reach">你所在的网络无法连接到 e-hentai</string>
<string name="em_no_network_2">无网络连接?</string>
<string name="em_request_error">请求错误</string>
<string name="em_unknown_host">无法解析主机</string>
<string name="em_unexpected_response_code">非预期的响应码:%d</string>
<string name="em_redirection_error">太多重定向</string>
<string name="em_host_error">主机错误</string>
<string name="em_invalid_request">无效的请求</string>
<string name="em_no_sdcard">未挂载 SD卡</string>
<!-- Action -->
<string name="action_refresh">刷新</string>
@@ -129,16 +134,15 @@
<string name="preference_settings_title">设置</string>
<string name="preference_category_cache">缓存</string>
<string name="preference_cp_cache">封面与预览缓存大小</string>
<string name="preference_clear_cp_cache">清除封面与预览缓存</string>
<string name="preference_page_cache">页面缓存大小</string>
<string name="preference_clear_page_cache">清除页面缓存</string>
<string name="preference_cache">缓存大小</string>
<string name="preference_clear_cache">清除缓存</string>
<string name="preference_cache_summary" formatted="false">大小 : %.2f / %d MB</string>
<string name="preference_cache_summary_no">无缓存</string>
<string name="preference_auto_page_cache">自动清理页面缓存</string>
<string name="preference_auto_page_cache_summary_on">当应用关闭时清除页面缓存</string>
<string name="preference_auto_page_cache_summary_off">啥都不做</string>
<string name="preference_download_path">下载路径</string>
<string name="preference_update_server">更新服务器</string>
<string name="preference_category_about">关于</string>
@@ -148,6 +152,10 @@
<string name="input_error">输入错误</string>
<string name="create_cache_error">创建缓存错误</string>
<!-- server -->
<string name="update_server_google">国外服务器</string>
<string name="update_server_qiniu">国内服务器</string>
<!-- Tag -->
<string name="add_tag">添加标签</string>
<string name="tag_name">标签名称:</string>
+12 -1
View File
@@ -75,9 +75,20 @@
<item>2</item>
</string-array>
<string-array name="preference_update_server_entries">
<item>@string/update_server_google</item>
<item>@string/update_server_qiniu</item>
</string-array>
<string-array name="preference_update_server_entry_values" translatable="false">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="is_exhentai" translatable="false">
<item>g.e-hentai.org</item>
<item>exhentai.org</item>
</string-array>
</resources>
+13 -5
View File
@@ -116,8 +116,13 @@
<string name="em_no_network">No network</string>
<string name="em_can_not_reach">Your network can not reach e-hentai</string>
<string name="em_no_network_2">No network ?</string>
<string name="em_request_error">Request error</string>
<string name="em_request_error">Request error</string>
<string name="em_unknown_host">Hostname can not be resolved</string>
<string name="em_unexpected_response_code">Unexpected response code : %d</string>
<string name="em_redirection_error">Too many redirects</string>
<string name="em_host_error">Host error</string>
<string name="em_invalid_request">Invalid request</string>
<string name="em_no_sdcard">SD card is Unmounted</string>
<!-- Action -->
<string name="action_refresh">Refresh</string>
@@ -133,16 +138,15 @@
<string name="preference_settings_title">Settings</string>
<string name="preference_category_cache">Cache</string>
<string name="preference_cp_cache">Cover and preview cache size</string>
<string name="preference_clear_cp_cache">Clear cover and preview cache</string>
<string name="preference_page_cache">Page cache size</string>
<string name="preference_clear_page_cache">Clear page cache</string>
<string name="preference_cache">Cache size</string>
<string name="preference_clear_cache">Clear cache</string>
<string name="preference_cache_summary" formatted="false">Size : %.2f / %d MB</string>
<string name="preference_cache_summary_no">No cache</string>
<string name="preference_auto_page_cache">Auto clear page cache</string>
<string name="preference_auto_page_cache_summary_on">Clean page cache when the application close</string>
<string name="preference_auto_page_cache_summary_off">Leave page cache alone</string>
<string name="preference_download_path">Download path</string>
<string name="preference_update_server">Update server</string>
<string name="preference_category_about">About</string>
@@ -155,6 +159,10 @@
<string name="create_cache_error">Create cache error</string>
<!-- server -->
<string name="update_server_google">Google</string>
<string name="update_server_qiniu">Qiniu</string>
<!-- Tag -->
<string name="add_tag">Add tag</string>
<string name="tag_name">Tag name : </string>
+12 -4
View File
@@ -31,12 +31,12 @@
<EditTextPreference
android:defaultValue="25"
android:inputType="number"
android:key="preference_cp_cache"
android:title="@string/preference_cp_cache" />
android:key="preference_cache"
android:title="@string/preference_cache" />
<Preference
android:key="preference_clear_cp_cache"
android:title="@string/preference_clear_cp_cache" />
android:key="preference_clear_cache"
android:title="@string/preference_clear_cache" />
</PreferenceCategory>
@@ -68,6 +68,14 @@
android:title="@string/update"
android:summary="@string/tap_update" />
<com.hippo.ehviewer.preference.AutoListPreference
android:defaultValue="1"
android:entries="@array/preference_update_server_entries"
android:entryValues="@array/preference_update_server_entry_values"
android:key="preference_update_server"
android:summary="%s"
android:title="@string/preference_update_server" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/develop" >
@@ -9,23 +9,29 @@ import com.hippo.ehviewer.util.Download;
import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Favourite;
import com.hippo.ehviewer.util.Tag;
import com.hippo.ehviewer.util.ThreadPool;
import com.hippo.ehviewer.util.Ui;
import android.app.Application;
import android.util.Log;
import android.widget.Toast;
public class CrashApplication extends Application implements UncaughtExceptionHandler {
public class AppContext extends Application implements UncaughtExceptionHandler {
private static final String TAG = "CrashApplication";
@SuppressWarnings("unused")
private static final String TAG = "AppContext";
private Thread.UncaughtExceptionHandler mDefaultHandler;
private EhClient mEhClient;
private ThreadPool mNetworkThreadPool;
@Override
public void onCreate() {
super.onCreate();
Log.i(TAG, "onCreate");
// TODO Init everything
mNetworkThreadPool = new ThreadPool(1, 2);
Config.init(this);
Ui.init(this);
Cache.init(this);
@@ -33,13 +39,21 @@ public class CrashApplication extends Application implements UncaughtExceptionHa
Tag.init(this);
Crash.init(this);
BeautifyScreen.init(this);
EhClient.init(this);
mEhClient = new EhClient(this);
Download.init(this);
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
}
public EhClient getEhClient() {
return mEhClient;
}
public ThreadPool getNetworkThreadPool() {
return mNetworkThreadPool;
}
@Override
public void uncaughtException(Thread thread, Throwable ex) {
if (!handleException(ex) && mDefaultHandler != null) {
+111 -111
View File
@@ -1,111 +1,111 @@
package com.hippo.ehviewer;
import com.hippo.ehviewer.util.Ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout.LayoutParams;
@SuppressLint("NewApi")
public class BeautifyScreen {
private static final String TAG = "BeautifyScreen";
private static Context mContext;
private static int mStatusBarHeight = 0;
private static int mNavigationBarHeight = 0;
private static int sbbId = 0;
private static int nbbId = 1;
private BeautifyScreen(){}
public static void init(Context context) {
mContext = context;
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = context.getResources();
int sbhResourceId = resources.getIdentifier("status_bar_height",
"dimen", "android");
if (sbhResourceId > 0)
mStatusBarHeight = resources
.getDimensionPixelSize(sbhResourceId);
int nbhResourceId = resources.getIdentifier(
"navigation_bar_height", "dimen", "android");
if (nbhResourceId > 0)
mNavigationBarHeight = resources
.getDimensionPixelSize(nbhResourceId);
}
}
public static void ColourfyScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = activity.getResources();
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
win.setAttributes(winParams);
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
// Add status bar background
if (mStatusBarHeight > 0) {
View statusBarView = new View(mContext);
LayoutParams params1 = new LayoutParams(
LayoutParams.MATCH_PARENT, mStatusBarHeight);
params1.gravity = Gravity.TOP;
statusBarView.setLayoutParams(params1);
statusBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
statusBarView.setId(sbbId);
decorViewGroup.addView(statusBarView);
}
// Add navigation bar background
if (Ui.hasNavigationBar() && mNavigationBarHeight > 0 &&
isPortrait(activity)) {
View navigationBarView = new View(mContext);
LayoutParams params2 = new LayoutParams(
LayoutParams.MATCH_PARENT, mNavigationBarHeight);
params2.gravity = Gravity.BOTTOM;
navigationBarView.setLayoutParams(params2);
navigationBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
navigationBarView.setId(nbbId);
decorViewGroup.addView(navigationBarView);
}
}
}
private static boolean isPortrait(Activity activity) {
DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.heightPixels > dm.widthPixels;
}
public static void fixColour(Activity activity) {
if (Build.VERSION.SDK_INT < 19)
return;
Window win = activity.getWindow();
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
View navigationBarView = decorViewGroup.findViewById(nbbId);
if (navigationBarView == null)
return;
if (!isPortrait(activity))
navigationBarView.setVisibility(View.GONE);
else
navigationBarView.setVisibility(View.VISIBLE);
}
}
package com.hippo.ehviewer;
import com.hippo.ehviewer.util.Ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import com.hippo.ehviewer.util.Log;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout.LayoutParams;
@SuppressLint("NewApi")
public class BeautifyScreen {
private static final String TAG = "BeautifyScreen";
private static Context mContext;
private static int mStatusBarHeight = 0;
private static int mNavigationBarHeight = 0;
private static int sbbId = 0;
private static int nbbId = 1;
private BeautifyScreen(){}
public static void init(Context context) {
mContext = context;
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = context.getResources();
int sbhResourceId = resources.getIdentifier("status_bar_height",
"dimen", "android");
if (sbhResourceId > 0)
mStatusBarHeight = resources
.getDimensionPixelSize(sbhResourceId);
int nbhResourceId = resources.getIdentifier(
"navigation_bar_height", "dimen", "android");
if (nbhResourceId > 0)
mNavigationBarHeight = resources
.getDimensionPixelSize(nbhResourceId);
}
}
public static void ColourfyScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = activity.getResources();
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
win.setAttributes(winParams);
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
// Add status bar background
if (mStatusBarHeight > 0) {
View statusBarView = new View(mContext);
LayoutParams params1 = new LayoutParams(
LayoutParams.MATCH_PARENT, mStatusBarHeight);
params1.gravity = Gravity.TOP;
statusBarView.setLayoutParams(params1);
statusBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
statusBarView.setId(sbbId);
decorViewGroup.addView(statusBarView);
}
// Add navigation bar background
if (Ui.hasNavigationBar() && mNavigationBarHeight > 0 &&
isPortrait(activity)) {
View navigationBarView = new View(mContext);
LayoutParams params2 = new LayoutParams(
LayoutParams.MATCH_PARENT, mNavigationBarHeight);
params2.gravity = Gravity.BOTTOM;
navigationBarView.setLayoutParams(params2);
navigationBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
navigationBarView.setId(nbbId);
decorViewGroup.addView(navigationBarView);
}
}
}
private static boolean isPortrait(Activity activity) {
DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.heightPixels > dm.widthPixels;
}
public static void fixColour(Activity activity) {
if (Build.VERSION.SDK_INT < 19)
return;
Window win = activity.getWindow();
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
View navigationBarView = decorViewGroup.findViewById(nbbId);
if (navigationBarView == null)
return;
if (!isPortrait(activity))
navigationBarView.setVisibility(View.GONE);
else
navigationBarView.setVisibility(View.VISIBLE);
}
}
+306 -306
View File
@@ -1,306 +1,306 @@
package com.hippo.ehviewer;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.jakewharton.disklrucache.DiskLruCache;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.os.Environment;
import android.util.Log;
// For Gallery cover key is gid,
// for example , gid is 618395, token is 0439fa3666,
// so key is 618395
// For Gallery preview key is gid-preview-num-row,
// for example , gid is 618395, token is 0439fa3666, page2
// so key is 618395-preview-2-0
// For Gallery image key is gid-preview-num,
// for example , gid is 618395, token is 0439fa3666, image2
// so key is 618395-image-2
public class DiskCache {
private static String TAG = "ImageDiskCache";
private static final int VALUE_IDX = 0;
private Context mContext;
private BitmapFactory.Options opt;
private final DiskLruCache diskLruCache;
public DiskCache(Context context, String path, long maxSize) throws NameNotFoundException, IOException {
this.mContext = context;
opt = Ui.getBitmapOpt();
if (!Cache.hasSdCard()) {
throw new IllegalStateException("Has no SdCard.");
}
File dir = new File(Environment.getExternalStorageDirectory() + path);
int version = mContext.getPackageManager().getPackageInfo(
mContext.getPackageName(), 0).versionCode;
version = 1;
diskLruCache = DiskLruCache.open(dir, version, 1, maxSize);
}
public long size() {
return diskLruCache.size();
}
public long maxSize() {
return diskLruCache.getMaxSize();
}
public void setMaxSize(long maxSize) {
diskLruCache.setMaxSize(maxSize);
}
public void close() {
try {
diskLruCache.close();
} catch (IOException e) {
Log.d(TAG, "diskLruCache close error !");
}
}
public boolean hasKey(String key) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if(snapshot==null)
return false;
snapshot.close();
return true;
}
public Object get(String key, int type) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if (snapshot == null)
return null;
InputStream is = snapshot.getInputStream(VALUE_IDX);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
return null;
}
public boolean put(String key, InputStream is) throws IOException {
DiskLruCache.Editor editor = diskLruCache.edit(key);
if (editor == null)
return false;
BufferedOutputStream bos = new BufferedOutputStream(editor.newOutputStream(VALUE_IDX));
OutputStream os = new CacheOutputStream(bos, editor);
Util.copy(is, os);
return true;
}
public void clear() {
try {
diskLruCache.delete();
} catch (IOException e) {
}
}
private class CacheOutputStream extends FilterOutputStream {
private final DiskLruCache.Editor editor;
private boolean failed = false;
private CacheOutputStream(OutputStream os, DiskLruCache.Editor editor) {
super(os);
this.editor = editor;
}
@Override
public void close() throws IOException {
IOException closeException = null;
try {
super.close();
} catch (IOException e) {
closeException = e;
}
if (failed) {
editor.abort();
} else {
editor.commit();
}
if (closeException != null) throw closeException;
}
@Override
public void flush() throws IOException {
try {
super.flush();
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(int oneByte) throws IOException {
try {
super.write(oneByte);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer) throws IOException {
try {
super.write(buffer);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer, int offset, int length) throws IOException {
try {
super.write(buffer, offset, length);
} catch (IOException e) {
failed = true;
throw e;
}
}
}
/*
private Context context = null;
private File dir = null;
int maxSize = 1024 * 10;
public DiskCache(Context context, String path, int maxSize) {
this.context = context;
this.maxSize = maxSize;
if (maxSize <= 0)
maxSize = 1024 * 10;
File rootdir = Environment.getExternalStorageDirectory();
dir = new File(rootdir + path);
dir.mkdirs();
}
public boolean hasKey(String key) {
synchronized (key) {
File file = new File(dir, key);
if (file.exists()) {
if (file.isDirectory())
file.delete();
else
return true;
}
return false;
}
}
public Object get(String key, int type) {
synchronized (key) {
File file = new File(dir, key);
if (!file.isFile())
return null;
try {
InputStream is = new FileInputStream(file);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, Util.opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
} catch (FileNotFoundException e) {
Log.d(TAG, "WTF, I have checked that the file does exists.");
e.printStackTrace();
}
return null;
}
}
public boolean put(String key, InputStream is) throws IOException {
synchronized (key) {
File file = new File(dir, key);
try {
file.delete();
file.createNewFile();
} catch (IOException e) {
dir.mkdirs();
file.delete();
try {
file.createNewFile();
} catch (IOException e1) {
Log.d(TAG, "WTF, mkdirs didn't work? Path is " + file.getPath());
e1.printStackTrace();
return false;
}
}
try {
Util.inputStream2File(is, file);
return true;
} catch (IOException e) {
Log.d(TAG, "Put " + key + " error.");
throw e;
}
}
}
public void clear() {
clearDirectory(dir);
}
private void clearDirectory(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) clearDirectory(file);
file.delete();
}
}*/
/*
* private static String getStingMD5(String s) { String re = null; try {
* MessageDigest messageDigest =MessageDigest.getInstance(Algorithm); byte[]
* inputByteArray = s.getBytes(); messageDigest.update(inputByteArray);
* byte[] resultByteArray = messageDigest.digest(); re =
* byteArrayToHex(resultByteArray); } catch (NoSuchAlgorithmException e) {
* e.printStackTrace(); Log.d(TAG, e.getMessage()); } return re; }
*
* private static String byteArrayToHex(byte[] byteArray) { char[] hexDigits
* = {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F' };
* char[] resultCharArray =new char[byteArray.length * 2]; int index = 0;
* for (byte b : byteArray) { resultCharArray[index++] = hexDigits[b>>> 4 &
* 0xf]; resultCharArray[index++] = hexDigits[b& 0xf]; } return new
* String(resultCharArray); }
*/
}
package com.hippo.ehviewer;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.jakewharton.disklrucache.DiskLruCache;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.os.Environment;
import com.hippo.ehviewer.util.Log;
// For Gallery cover key is gid,
// for example , gid is 618395, token is 0439fa3666,
// so key is 618395
// For Gallery preview key is gid-preview-num-row,
// for example , gid is 618395, token is 0439fa3666, page2
// so key is 618395-preview-2-0
// For Gallery image key is gid-preview-num,
// for example , gid is 618395, token is 0439fa3666, image2
// so key is 618395-image-2
public class DiskCache {
private static String TAG = "ImageDiskCache";
private static final int VALUE_IDX = 0;
private Context mContext;
private BitmapFactory.Options opt;
private final DiskLruCache diskLruCache;
public DiskCache(Context context, String path, long maxSize) throws NameNotFoundException, IOException {
this.mContext = context;
opt = Ui.getBitmapOpt();
if (!Cache.hasSdCard()) {
throw new IllegalStateException("Has no SdCard.");
}
File dir = new File(Environment.getExternalStorageDirectory() + path);
int version = mContext.getPackageManager().getPackageInfo(
mContext.getPackageName(), 0).versionCode;
version = 1;
diskLruCache = DiskLruCache.open(dir, version, 1, maxSize);
}
public long size() {
return diskLruCache.size();
}
public long maxSize() {
return diskLruCache.getMaxSize();
}
public void setMaxSize(long maxSize) {
diskLruCache.setMaxSize(maxSize);
}
public void close() {
try {
diskLruCache.close();
} catch (IOException e) {
Log.d(TAG, "diskLruCache close error !");
}
}
public boolean hasKey(String key) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if(snapshot==null)
return false;
snapshot.close();
return true;
}
public Object get(String key, int type) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if (snapshot == null)
return null;
InputStream is = snapshot.getInputStream(VALUE_IDX);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
return null;
}
public boolean put(String key, InputStream is) throws IOException {
DiskLruCache.Editor editor = diskLruCache.edit(key);
if (editor == null)
return false;
BufferedOutputStream bos = new BufferedOutputStream(editor.newOutputStream(VALUE_IDX));
OutputStream os = new CacheOutputStream(bos, editor);
Util.copy(is, os);
return true;
}
public void clear() {
try {
diskLruCache.delete();
} catch (IOException e) {
}
}
private class CacheOutputStream extends FilterOutputStream {
private final DiskLruCache.Editor editor;
private boolean failed = false;
private CacheOutputStream(OutputStream os, DiskLruCache.Editor editor) {
super(os);
this.editor = editor;
}
@Override
public void close() throws IOException {
IOException closeException = null;
try {
super.close();
} catch (IOException e) {
closeException = e;
}
if (failed) {
editor.abort();
} else {
editor.commit();
}
if (closeException != null) throw closeException;
}
@Override
public void flush() throws IOException {
try {
super.flush();
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(int oneByte) throws IOException {
try {
super.write(oneByte);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer) throws IOException {
try {
super.write(buffer);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer, int offset, int length) throws IOException {
try {
super.write(buffer, offset, length);
} catch (IOException e) {
failed = true;
throw e;
}
}
}
/*
private Context context = null;
private File dir = null;
int maxSize = 1024 * 10;
public DiskCache(Context context, String path, int maxSize) {
this.context = context;
this.maxSize = maxSize;
if (maxSize <= 0)
maxSize = 1024 * 10;
File rootdir = Environment.getExternalStorageDirectory();
dir = new File(rootdir + path);
dir.mkdirs();
}
public boolean hasKey(String key) {
synchronized (key) {
File file = new File(dir, key);
if (file.exists()) {
if (file.isDirectory())
file.delete();
else
return true;
}
return false;
}
}
public Object get(String key, int type) {
synchronized (key) {
File file = new File(dir, key);
if (!file.isFile())
return null;
try {
InputStream is = new FileInputStream(file);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, Util.opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
} catch (FileNotFoundException e) {
Log.d(TAG, "WTF, I have checked that the file does exists.");
e.printStackTrace();
}
return null;
}
}
public boolean put(String key, InputStream is) throws IOException {
synchronized (key) {
File file = new File(dir, key);
try {
file.delete();
file.createNewFile();
} catch (IOException e) {
dir.mkdirs();
file.delete();
try {
file.createNewFile();
} catch (IOException e1) {
Log.d(TAG, "WTF, mkdirs didn't work? Path is " + file.getPath());
e1.printStackTrace();
return false;
}
}
try {
Util.inputStream2File(is, file);
return true;
} catch (IOException e) {
Log.d(TAG, "Put " + key + " error.");
throw e;
}
}
}
public void clear() {
clearDirectory(dir);
}
private void clearDirectory(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) clearDirectory(file);
file.delete();
}
}*/
/*
* private static String getStingMD5(String s) { String re = null; try {
* MessageDigest messageDigest =MessageDigest.getInstance(Algorithm); byte[]
* inputByteArray = s.getBytes(); messageDigest.update(inputByteArray);
* byte[] resultByteArray = messageDigest.digest(); re =
* byteArrayToHex(resultByteArray); } catch (NoSuchAlgorithmException e) {
* e.printStackTrace(); Log.d(TAG, e.getMessage()); } return re; }
*
* private static String byteArrayToHex(byte[] byteArray) { char[] hexDigits
* = {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F' };
* char[] resultCharArray =new char[byteArray.length * 2]; int index = 0;
* for (byte b : byteArray) { resultCharArray[index++] = hexDigits[b>>> 4 &
* 0xf]; resultCharArray[index++] = hexDigits[b& 0xf]; } return new
* String(resultCharArray); }
*/
}
+8 -7
View File
@@ -12,7 +12,7 @@ import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
public class ImageLoadManager {
private static final String TAG = "ImageLoadManager";
@@ -78,10 +78,11 @@ public class ImageLoadManager {
}
LoadImageView liv = curLoadTask.liv;
String key = liv.getKey();
Bitmap bitmap;
if ((bitmap = mMemoryCache.get(key)) == null) {
bitmap = (Bitmap)mDiskCache.get(key, Util.BITMAP);
if (bitmap != null)
Bitmap bitmap = null;
if (mMemoryCache == null || (bitmap = mMemoryCache.get(key)) == null) {
if (mDiskCache != null
&& (bitmap = (Bitmap)mDiskCache.get(key, Util.BITMAP)) != null
&& mMemoryCache != null)
mMemoryCache.put(key, bitmap);
}
@@ -126,7 +127,7 @@ public class ImageLoadManager {
@Override
public void run() {
LoadTask loadTask;
HttpHelper httpHelper = new HttpHelper();
HttpHelper httpHelper = new HttpHelper(mContext);
while (true) {
synchronized (ImageDownloadManager.this) {
if (mDownloadTask.isEmpty()) {
@@ -143,7 +144,7 @@ public class ImageLoadManager {
Message msg = new Message();
msg.obj = loadTask;
if (bitmap == null) {
Log.d(TAG, mContext.getString(httpHelper.getLastEMsgId()));
Log.d(TAG, httpHelper.getEMsg());
loadTask.bitmap = Ui.BITMAP_TOUCH;
liv.setState(LoadImageView.FAIL);
liv.setOnClickListener(ImageLoadManager.this);
+45 -6
View File
@@ -1,10 +1,12 @@
package com.hippo.ehviewer;
import com.hippo.ehviewer.activity.MangaListActivity;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Crash;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.widget.DialogBuilder;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@@ -25,8 +27,10 @@ import android.widget.RelativeLayout;
public class StartActivity extends Activity {
private static final int CHECK_WARING = 0;
private static final int CHECK_CRESH = 1;
private static final int CHECK_NETWORK = 2;
private static final int CHECK_NETWORK = 1;
private static final int CHECK_CRASH = 2;
private static final int CHECK_EXTERNAL_STORAGE = 3;
private String lastCrash;
private boolean isAnimationOver = false;
@@ -64,7 +68,7 @@ public class StartActivity extends Activity {
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
check(CHECK_CRESH);
check(CHECK_CRASH);
}
})
.setNegativeButton(R.string.dailog_network_error_no,
@@ -94,7 +98,8 @@ public class StartActivity extends Activity {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
checkOver();
check(CHECK_EXTERNAL_STORAGE);
}
}).show();
@@ -112,8 +117,28 @@ public class StartActivity extends Activity {
((AlertButton)v).dialog.dismiss();
lastCrash = null;
check(CHECK_EXTERNAL_STORAGE);
}
}).create();
}
private AlertDialog createNoSdCardDialog() {
return new DialogBuilder(this).setCancelable(false)
.setTitle("未检测到内置存储空间或 Sd Card")
.setMessage("未检测到内置存储空间或 Sd Card,您无法使用磁盘缓存与下载功能,用户体验会很糟,是否继续?")
.setPositiveButton("我不介意", new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
checkOver();
}
}).setNegativeButton("算了", new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
finish();
}
}).create();
}
@@ -157,6 +182,15 @@ public class StartActivity extends Activity {
check(CHECK_WARING);
}
/**
* Order is
* 1. check waring
* 2. check network
* 3. check crash
* 4. check external storage
*
* @param order
*/
private void check(int order) {
switch (order) {
case CHECK_WARING:
@@ -169,11 +203,16 @@ public class StartActivity extends Activity {
createNetworkErrorDialog().show();
return;
}
case CHECK_CRESH:
case CHECK_CRASH:
if ((lastCrash = Crash.getLastCrash()) != null) {
createSendCrashDialog().show();
return;
}
case CHECK_EXTERNAL_STORAGE:
if (!Cache.hasSdCard()) {
createNoSdCardDialog().show();
return;
}
}
checkOver();
}
+178 -103
View File
@@ -1,41 +1,59 @@
package com.hippo.ehviewer;
import java.io.File;
import java.net.MalformedURLException;
import android.app.Activity;
import android.app.AlertDialog;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.view.View;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.network.Downloader;
import com.hippo.ehviewer.network.HttpHelper;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Future;
import com.hippo.ehviewer.util.FutureListener;
import com.hippo.ehviewer.util.ThreadPool;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.util.ThreadPool.Job;
import com.hippo.ehviewer.util.ThreadPool.JobContext;
// TODO return onFailure when downloading update or check update
// TODO add disable to achieve
public class UpdateHelper {
@SuppressWarnings("unused")
private static final String TAG = "UpdateHelper";
private static final int NOTIFICATION_ID = -1;
// Update host
private static final int GOOGLE = 0;
private static final int QINIU = 1;
public static final String UPDATE_API = "http://ehviewersu.appsp0t.com/API";
private Activity mActivity;
private String updateFileName;
private OnCheckUpdateListener listener;
private AppContext mAppContext;
private OnCheckUpdateListener mListener;
private static boolean mEnabled = true;
private int downloadHost = QINIU;
public interface OnCheckUpdateListener {
public void onSuccess(String version, long size, String url, String info);
public void onNoUpdate();
public void onFailure(String eMsg);
}
public UpdateHelper(Activity activity) {
mActivity = activity;
public UpdateHelper(AppContext appContext) {
mAppContext = appContext;
}
public UpdateHelper SetOnCheckUpdateListener(OnCheckUpdateListener listener) {
this.mListener = listener;
return this;
}
public void autoCheckUpdate() {
@@ -43,108 +61,162 @@ public class UpdateHelper {
checkUpdate();
}
public static void setEnabled(boolean enabled) {
mEnabled = enabled;
}
class CheckUpdatePackage {
public OnCheckUpdateListener listener;
public AppContext appContext;
public String pageContext;
public HttpHelper hp;
}
public void checkUpdate() {
EhClient.checkUpdate(new EhClient.OnCheckUpdateListener() {
final HttpHelper hp = new HttpHelper(mAppContext);
ThreadPool threadPool = mAppContext.getNetworkThreadPool();
threadPool.submit(new Job<String>() {
@Override
public void onSuccess(String pageContext) {
Config.setUpdateDate();
String[] items = pageContext.split("\n");
if (items.length > 3) {
public String run(JobContext jc) {
if (!mEnabled) {
return "working";
}
mEnabled = false;
PackageManager pm = mAppContext.getPackageManager();
PackageInfo pi = null;
try {
pi = pm.getPackageInfo(mAppContext.getPackageName(), PackageManager.GET_ACTIVITIES);
if (listener != null)
listener.onSuccess(pageContext);
JSONObject jo = new JSONObject();
jo.put("method", "update");
String newVer = items[0];
JSONObject detailJO = new JSONObject();
detailJO.put("version", pi.versionName);
detailJO.put("server", Config.getUpdateServer());
String tempUrl = "";
switch (downloadHost) {
case GOOGLE:
tempUrl = EhClient.UPDATE_URL + items[1];
break;
case QINIU:
tempUrl = EhClient.UPDATE_URI_QINIU + Util.getFileForUrl(items[1]);
break;
}
final String url = tempUrl;
final String name = url.substring(url.lastIndexOf('/')+1);
updateFileName = name;
String size = items[2];
String info = items[3];
jo.put("detail", detailJO);
AlertDialog dialog = new DialogBuilder(mActivity).setTitle(R.string.update)
.setMessage(String.format(mActivity.getString(R.string.update_message), newVer, size, info))
.setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
}
}).setPositiveButton(android.R.string.ok, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
Downloader d = new Downloader();
try {
d.resetData(Config.getDownloadPath(), name, url);
d.setOnDownloadListener(new UpdateListener());
new Thread(d).start();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}).create();
if (!mActivity.isFinishing())
dialog.show();
} else {
if(pageContext.equals("none")) {
if (listener != null)
listener.onNoUpdate();
} else if(pageContext.equals("error")){
if (listener != null)
listener.onFailure(R.string.em_request_error);
} else {
if (listener != null)
listener.onFailure(R.string.em_host_error);
}
return hp.postJson(UPDATE_API, jo.toString());
} catch (NameNotFoundException e) {
e.printStackTrace();
return "NameNotFound";
} catch (JSONException e) {
e.printStackTrace();
return "JSONException";
}
}
}, new FutureListener<String>() {
@Override
public void onFailure(int eMesgId) {
Log.d(TAG, mActivity.getString(eMesgId));
if (listener != null)
listener.onFailure(eMesgId);
public void onFutureDone(Future<String> future) {
String pageContext = future.get();
CheckUpdatePackage checkUpdatePackage = new CheckUpdatePackage();
checkUpdatePackage.appContext = mAppContext;
checkUpdatePackage.listener = mListener;
checkUpdatePackage.pageContext = pageContext;
checkUpdatePackage.hp = hp;
Message msg = new Message();
msg.obj = checkUpdatePackage;
mHandler.sendMessage(msg);
}
});
}
public UpdateHelper SetOnCheckUpdateListener(OnCheckUpdateListener listener) {
this.listener = listener;
return this;
}
// TODO move dialog into listener
private static Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
CheckUpdatePackage checkUpdatePackage = (CheckUpdatePackage)msg.obj;
OnCheckUpdateListener listener = checkUpdatePackage.listener;
AppContext appContext = checkUpdatePackage.appContext;
String pageContext = checkUpdatePackage.pageContext;
if (pageContext != null) {
Config.setUpdateDate();
if (pageContext.equals("working")) {
if (listener != null)
listener.onFailure("正在检查更新或者下载更新"); // TODO
}
else if (pageContext.equals("NameNotFound")) {
if (listener != null)
listener.onFailure("NameNotFound"); // TODO
} else if (pageContext.equals("JSONException")) {
if (listener != null)
listener.onFailure("JSONException"); // TODO
} else {
try {
JSONObject jo = new JSONObject(pageContext);
JSONObject updateJO = jo.getJSONObject("update");
String version = updateJO.getString("version");
if (version.equals("error")) {
if (listener != null)
listener.onFailure(appContext.getString(R.string.em_invalid_request));
} else if (version.equals("none")) {
if (listener != null)
listener.onNoUpdate();
} else {
long size = updateJO.getLong("size");
String url = updateJO.getString("url");
String info = updateJO.getString("info");
if (listener != null)
listener.onSuccess(version, size, url, info);
}
} catch (JSONException e) {
e.printStackTrace();
if (listener != null)
listener.onFailure(appContext.getString(R.string.em_host_error));
}
}
} else {
if (listener != null)
listener.onFailure(checkUpdatePackage.hp.getEMsg());
}
}
};
public interface OnCheckUpdateListener {
public void onSuccess(String pageContext);
public void onNoUpdate();
public void onFailure(int eMesgId);
}
private class UpdateListener implements Downloader.OnDownloadListener {
public static class UpdateListener implements Downloader.OnDownloadListener {
private Context mContext;
private String mFileName;
private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;
public UpdateListener() {
public UpdateListener(Context context, String fileName) {
mContext = context;
mFileName = fileName;
mNotifyManager = (NotificationManager)
mActivity.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(mActivity.getApplicationContext());
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(mContext);
mBuilder.setSmallIcon(R.drawable.ic_launcher);
}
@Override
public void onDownloadStart(int totalSize) {
mBuilder.setContentTitle("正在下载更新")
public void onDownloadStartConnect() {
mBuilder.setContentTitle("开始下载更新") // TODO
.setContentText(null)
.setProgress(0, 0, true).setOngoing(true);
mNotifyManager.notify(233, mBuilder.build());
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
@Override
public void onDownloadStartDownload(int totalSize) {
mBuilder.setContentTitle("正在下载更新")
.setContentText(String.format("%.2f / %.2f KB", 0/1024.0f, totalSize/1024.0f))
.setProgress(totalSize, 0, false).setOngoing(true);
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
@Override
public void onDownloadStatusUpdate(
@@ -152,23 +224,26 @@ public class UpdateHelper {
mBuilder.setContentTitle("正在下载更新")
.setContentText(String.format("%.2f / %.2f KB", downloadSize/1024.0f, totalSize/1024.0f))
.setProgress(totalSize, downloadSize, false).setOngoing(true);
mNotifyManager.notify(233, mBuilder.build());
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
@Override
public void onDownloadOver(boolean ok, int eMesgId) {
if (ok) {
mNotifyManager.cancel(233);
public void onDownloadOver(int status) {
if (status == Downloader.COMPLETED) {
mNotifyManager.cancel(NOTIFICATION_ID);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Config.getDownloadPath(), updateFileName)),
intent.setDataAndType(Uri.fromFile(new File(Config.getDownloadPath(), mFileName)),
"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mActivity.getApplicationContext().startActivity(intent);
mContext.startActivity(intent);
} else {
mBuilder.setContentTitle("下载更新失败")
.setContentText(null)
.setProgress(0, 0, false).setOngoing(false);
.setContentText(null)
.setProgress(0, 0, false).setOngoing(false);
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
setEnabled(true);
}
}
}
@@ -8,7 +8,6 @@ import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.DownloadInfo;
import com.hippo.ehviewer.ListMangaDetail;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.service.DownloadService;
import com.hippo.ehviewer.service.DownloadServiceConnection;
import com.hippo.ehviewer.util.Cache;
@@ -20,6 +19,7 @@ import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.view.DownloadItemLayout;
import com.hippo.ehviewer.view.OlImageView;
import com.hippo.ehviewer.widget.DialogBuilder;
import android.app.Activity;
import android.app.AlertDialog;
@@ -33,7 +33,7 @@ import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
@@ -8,7 +8,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -27,7 +27,6 @@ import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.ImageLoadManager;
import com.hippo.ehviewer.ListMangaDetail;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.service.DownloadService;
import com.hippo.ehviewer.service.DownloadServiceConnection;
import com.hippo.ehviewer.util.Cache;
@@ -37,6 +36,7 @@ import com.hippo.ehviewer.util.Favourite;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.view.OlImageView;
import com.hippo.ehviewer.widget.DialogBuilder;
import com.hippo.ehviewer.widget.LoadImageView;
public class FavouriteActivity extends Activity{
@@ -5,9 +5,14 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringEscapeUtils;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.R.id;
@@ -21,8 +26,6 @@ import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.MangaImage;
import com.hippo.ehviewer.view.MangaViewPager;
import android.annotation.SuppressLint;
import android.app.Activity;
@@ -34,7 +37,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -49,6 +52,9 @@ import android.widget.Toast;
public class MangaActivity extends Activity {
private String TAG = "MangaActivity";
private AppContext mAppContext;
private EhClient mEhClient;
private RelativeLayout mainView;
private String gid;
@@ -72,12 +78,13 @@ public class MangaActivity extends Activity {
private File mFolder;
private ImageSet mImageSet;
private Downloader mDownloader;
// two element, first is web url, second is image url
private ArrayList<String[]> imagesUrl;
private List<String[]> imagesUrl;
private class MangaUrlGetListener implements EhClient.OnGetManagaUrlListener {
// TODO use downloader to download image
// TODO combine it with MangaDownloadActivity
private class MangaUrlGetListener implements EhClient.OnGetMangaUrlListener {
@Override
public void onSuccess(Object checkFlag, String[] arg) {
@@ -94,18 +101,18 @@ public class MangaActivity extends Activity {
String[] urls = imagesUrl.get(index);
if (urls == null) {
imagesUrl.add(index, urls = new String[2]);
imagesUrl.set(index, urls = new String[2]);
}
urls[1] = imageUrl;
if (index == firstPage - 1 || (index == firstPage && allPrePageUrl == null)) {
allPrePageUrl = prePageUrl;
if (index > 0)
imagesUrl.add(index - 1, new String[]{allPrePageUrl, null});
imagesUrl.set(index - 1, new String[]{allPrePageUrl, null});
}
if (index == lastPage) {
allNextPageUrl = nextPageUrl;
if (index < pageSum - 1)
imagesUrl.add(index + 1, new String[]{allNextPageUrl, null});
imagesUrl.set(index + 1, new String[]{allNextPageUrl, null});
}
if (index != firstPage - 1 && (index == firstPage && allPrePageUrl == null) && index != lastPage) {
Log.e(TAG, "targetPage != firstPage - 1 && (targetPage == firstPage && allPrePageUrl == null) && targetPage != lastPage");
@@ -113,12 +120,13 @@ public class MangaActivity extends Activity {
final String imageName = String.format("%05d", index + 1) + "." + Util.getExtension(imageUrl);
final Downloader downloader = new Downloader(MangaActivity.this);
try {
mDownloader.resetData(mFolder.getPath(),
downloader.resetData(mFolder.getPath(),
imageName,
imageUrl);
} catch (MalformedURLException e) {
onFailure(checkFlag, R.string.em_url_format_error);
onFailure(checkFlag, mAppContext.getString(R.string.em_url_format_error));
e.printStackTrace();
}
@@ -131,8 +139,8 @@ public class MangaActivity extends Activity {
onGetImage(index, Downloader.COMPLETED, nextPageUrl);
} else {
mDownloader.run();
onGetImage(index, mDownloader.getStatus(), nextPageUrl);
downloader.run();
onGetImage(index, downloader.getStatus(), nextPageUrl);
}
}
}.start();
@@ -172,13 +180,13 @@ public class MangaActivity extends Activity {
getPrePage = false;
} else if (index == lastPage && nextPageUrl != "last") { // If get nextPage
lastPage++;
EhClient.getManagaUrl(nextPageUrl, lastPage, new MangaUrlGetListener());
mEhClient.getMangaUrl(nextPageUrl, lastPage, new MangaUrlGetListener());
mImageSet.changeState(lastPage, ImageSet.STATE_LOADING);
}
}
@Override
public void onFailure(Object checkFlag, int errorMessageId) {
public void onFailure(Object checkFlag, String eMsg) {
if (stopFlag) {
Log.d(TAG, "Stop by stop flag");
return;
@@ -186,15 +194,15 @@ public class MangaActivity extends Activity {
retryTimes++;
int targetPage = (Integer)checkFlag;
if (retryTimes < maxRetry) {
Toast.makeText(MangaActivity.this, getString(errorMessageId) + " " +
Toast.makeText(MangaActivity.this, eMsg + " " +
String.format(getString(R.string.em_retry_times), retryTimes),
Toast.LENGTH_SHORT).show();
if (targetPage == firstPage - 1 &&
getPrePage == true) {
EhClient.getManagaUrl(allPrePageUrl, targetPage, new MangaUrlGetListener());
mEhClient.getMangaUrl(allPrePageUrl, targetPage, new MangaUrlGetListener());
}
else {
EhClient.getManagaUrl(allNextPageUrl, targetPage, new MangaUrlGetListener());
mEhClient.getMangaUrl(allNextPageUrl, targetPage, new MangaUrlGetListener());
}
mImageSet.changeState(targetPage, ImageSet.STATE_LOADING);
} else {
@@ -251,6 +259,9 @@ public class MangaActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.gl_root_group);
mAppContext = (AppContext)getApplication();
mEhClient = mAppContext.getEhClient();
int screenOri = Config.getScreenOriMode();
if (screenOri != getRequestedOrientation())
setRequestedOrientation(screenOri);
@@ -278,7 +289,7 @@ public class MangaActivity extends Activity {
lastPage = firstPage;
gid = intent.getStringExtra("gid");
title = intent.getStringExtra("title");
mFolder = new File(Config.getDownloadPath(), title);
mFolder = new File(Config.getDownloadPath(), StringEscapeUtils.escapeHtml4(title));
if (mFolder.isFile())
mFolder.delete();
mFolder.mkdirs();
@@ -303,17 +314,23 @@ public class MangaActivity extends Activity {
if (mStop && index == lastPage) {
mStop = false;
MangaUrlGetListener listener = new MangaUrlGetListener();
EhClient.getManagaUrl(allNextPageUrl, lastPage, listener);
mEhClient.getMangaUrl(allNextPageUrl, lastPage, listener);
mImageSet.changeState(lastPage, ImageSet.STATE_LOADING);
}
}
@Override
public void onTapDoubleText(int index) {
// TODO Auto-generated method stub
}
});
isv.setOnScrollPageListener(new GalleryView.OnScrollPageListener() {
@Override
public void onScrollPage(int index) {
if (mStop && index == lastPage) {
mStop = false;
EhClient.getManagaUrl(allNextPageUrl, lastPage, new MangaUrlGetListener());
mEhClient.getMangaUrl(allNextPageUrl, lastPage, new MangaUrlGetListener());
mImageSet.changeState(lastPage, ImageSet.STATE_LOADING);
}
@@ -321,7 +338,7 @@ public class MangaActivity extends Activity {
&& !allPrePageUrl.equals("first")
&& index == firstPage - 1) {
getPrePage = true;
EhClient.getManagaUrl(allPrePageUrl, firstPage - 1, new MangaUrlGetListener());
mEhClient.getMangaUrl(allPrePageUrl, firstPage - 1, new MangaUrlGetListener());
mImageSet.changeState(firstPage - 1, ImageSet.STATE_LOADING);
}
}
@@ -329,9 +346,6 @@ public class MangaActivity extends Activity {
GLRootView glrv= (GLRootView)findViewById(R.id.gl_root_view);
glrv.setContentPane(isv);
// Start download
mDownloader = new Downloader();
String url = intent.getStringExtra("url");
allNextPageUrl = url;
allPrePageUrl = null;
@@ -341,11 +355,11 @@ public class MangaActivity extends Activity {
if (firstPage == pageSum - 1)
allNextPageUrl = "last";
imagesUrl = new ArrayList<String[]>(pageSum);
imagesUrl.add(lastPage, new String[]{url, null});
imagesUrl = new ArrayList<String[]>(Collections.nCopies(pageSum, (String[])null));
imagesUrl.set(lastPage, new String[]{url, null});
// Get image and next page
EhClient.getManagaUrl(url, lastPage, new MangaUrlGetListener());
mEhClient.getMangaUrl(url, lastPage, new MangaUrlGetListener());
mImageSet.changeState(lastPage, ImageSet.STATE_LOADING);
}
@@ -2,12 +2,12 @@ package com.hippo.ehviewer.activity;
import java.util.ArrayList;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.MangaDetail;
import com.hippo.ehviewer.PageList;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.service.DownloadService;
import com.hippo.ehviewer.service.DownloadServiceConnection;
import com.hippo.ehviewer.util.Cache;
@@ -18,6 +18,7 @@ import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.OlImageView;
import com.hippo.ehviewer.widget.AutoWrapLayout;
import com.hippo.ehviewer.widget.DialogBuilder;
import com.hippo.ehviewer.widget.AutoWrapLayout.BaseLine;
import android.app.Activity;
@@ -32,7 +33,7 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -58,6 +59,9 @@ public class MangaDetailActivity extends Activity {
private static final String TAG = "MangaDetailActivity";
private AppContext mAppContext;
private EhClient mEhClient;
private String url;
//private String gid;
//private String token;
@@ -212,7 +216,7 @@ public class MangaDetailActivity extends Activity {
}
private class MangaDetailGetListener implements
EhClient.OnGetManagaDetailListener {
EhClient.OnGetMangaDetailListener {
@Override
public void onSuccess(MangaDetail md) {
Cache.mdCache.put(mangaDetail.gid, md);
@@ -220,12 +224,12 @@ public class MangaDetailActivity extends Activity {
}
@Override
public void onFailure(int errorMessageId) {
public void onFailure(String eMsg) {
// Delete progress bar
waitPb.setVisibility(View.GONE);
// Show refresh button
Toast.makeText(MangaDetailActivity.this,
getString(errorMessageId), Toast.LENGTH_SHORT).show();
eMsg, Toast.LENGTH_SHORT).show();
refeshButton.setVisibility(View.VISIBLE);
}
@@ -235,7 +239,7 @@ public class MangaDetailActivity extends Activity {
// Refresh
public void buttonRefresh(View v) {
MangaDetailGetListener listener = new MangaDetailGetListener();
EhClient.getManagaDetail(url, mangaDetail, listener);
mEhClient.getMangaDetail(url, mangaDetail, listener);
// Delete refresh button
refeshButton.setVisibility(View.GONE);
// Add progressBar
@@ -261,7 +265,7 @@ public class MangaDetailActivity extends Activity {
}
MangaDetailGetListener listener = new MangaDetailGetListener();
EhClient.getManagaDetail(url, mangaDetail, listener);
mEhClient.getMangaDetail(url, mangaDetail, listener);
// Delete offensiveView
mangaDetailOffensive.setVisibility(View.GONE);
// Add progressBar
@@ -282,7 +286,7 @@ public class MangaDetailActivity extends Activity {
}
MangaDetailGetListener listener = new MangaDetailGetListener();
EhClient.getManagaDetail(url, mangaDetail, listener);
mEhClient.getMangaDetail(url, mangaDetail, listener);
// Delete offensiveView
mangaDetailOffensive.setVisibility(View.GONE);
// Add progressBar
@@ -387,7 +391,7 @@ public class MangaDetailActivity extends Activity {
tempUrl += "/";
tempUrl += "?p=" + curPage;
EhClient.getPageList(tempUrl, curPage,
mEhClient.getPageList(tempUrl, curPage,
new EhClient.OnGetPageListListener() {
@Override
public void onSuccess(Object checkFlag, PageList pageList) {
@@ -397,11 +401,11 @@ public class MangaDetailActivity extends Activity {
}
@Override
public void onFailure(Object checkFlag, int errorMessageId) {
public void onFailure(Object checkFlag, String eMsg) {
int page = (Integer)checkFlag;
if (page == curPage) {
Toast.makeText(MangaDetailActivity.this,
getString(errorMessageId), Toast.LENGTH_SHORT).show();
eMsg, Toast.LENGTH_SHORT).show();
waitPageList.setVisibility(View.GONE);
previewRefreshButton.setVisibility(View.VISIBLE);
}
@@ -440,6 +444,9 @@ public class MangaDetailActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail);
mAppContext = (AppContext)getApplication();
mEhClient = mAppContext.getEhClient();
int screenOri = Config.getScreenOriMode();
if (screenOri != getRequestedOrientation())
setRequestedOrientation(screenOri);
@@ -512,7 +519,7 @@ public class MangaDetailActivity extends Activity {
if (getFromCache)
layout(mangaDetail);
else
EhClient.getManagaDetail(url, mangaDetail, new MangaDetailGetListener());
mEhClient.getMangaDetail(url, mangaDetail, new MangaDetailGetListener());
}
private void layout(MangaDetail md) {
@@ -4,15 +4,17 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import org.apache.commons.lang3.StringEscapeUtils;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.gallery.GalleryView;
import com.hippo.ehviewer.gallery.data.DownloadImageSet;
import com.hippo.ehviewer.gallery.data.ImageSet;
import com.hippo.ehviewer.gallery.ui.GLRootView;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.MangaImage;
import com.hippo.ehviewer.view.MangaViewPager;
import android.R.color;
import android.annotation.SuppressLint;
@@ -28,7 +30,7 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -46,16 +48,6 @@ public class MangaDownloadActivity extends Activity {
private RelativeLayout mainView;
private DownloadImageSet mDownloadImageSet;
class ImageLoadPackage {
public MangaImage mMangaImage;
public Bitmap mBitmap;
public ImageLoadPackage(MangaImage mangaImage, Bitmap bitmap) {
mMangaImage = mangaImage;
mBitmap = bitmap;
}
}
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -91,7 +83,9 @@ public class MangaDownloadActivity extends Activity {
int endIndex = intent.getIntExtra(KEY_END_INDEX, 0);
GLRootView glrv= (GLRootView)findViewById(R.id.gl_root_view);
mDownloadImageSet = new DownloadImageSet(this, gid, new File(Config.getDownloadPath(), title), size, 0, endIndex, null);
File folder = new File(Config.getDownloadPath(), StringEscapeUtils.escapeHtml4(title));
folder.mkdirs();
mDownloadImageSet = new DownloadImageSet(this, gid, folder, size, 0, endIndex, null);
GalleryView isv = new GalleryView(getApplicationContext(), mDownloadImageSet, 0);
isv.setOnEdgeListener(new GalleryView.OnEdgeListener() {
@Override
@@ -104,6 +98,9 @@ public class MangaDownloadActivity extends Activity {
}
});
glrv.setContentPane(isv);
// Avoid error when use Movie
//glrv.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
@Override
@@ -1,15 +1,16 @@
package com.hippo.ehviewer.activity;
import java.net.MalformedURLException;
import java.util.ArrayList;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.ImageLoadManager;
import com.hippo.ehviewer.ListMangaDetail;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.UpdateHelper;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.dialog.SuperDialogUtil;
import com.hippo.ehviewer.network.Downloader;
import com.hippo.ehviewer.service.DownloadService;
import com.hippo.ehviewer.service.DownloadServiceConnection;
import com.hippo.ehviewer.util.Cache;
@@ -18,14 +19,17 @@ import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Favourite;
import com.hippo.ehviewer.util.Tag;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.view.CheckImage;
import com.hippo.ehviewer.view.GetPaddingRelativeLayout;
import com.hippo.ehviewer.view.TagListView;
import com.hippo.ehviewer.view.TagsAdapter;
import com.hippo.ehviewer.widget.DialogBuilder;
import com.hippo.ehviewer.widget.DrawerLayout;
import com.hippo.ehviewer.widget.LoadImageView;
import com.hippo.ehviewer.widget.PullListView;
import com.hippo.ehviewer.widget.SuperDialogUtil;
import com.hippo.ehviewer.widget.PullListView.OnFooterRefreshListener;
import com.hippo.ehviewer.widget.PullListView.OnHeaderRefreshListener;
@@ -74,6 +78,9 @@ public class MangaListActivity extends Activity {
@SuppressWarnings("unused")
private static String TAG = "MangaListActivity";
private AppContext mAppContext;
private EhClient mEhClient;
private DrawerLayout drawer;
private GetPaddingRelativeLayout mainLayout;
private TagListView listMenu;
@@ -161,17 +168,17 @@ public class MangaListActivity extends Activity {
waitloginView.setVisibility(View.VISIBLE);
String username = ((EditText) loginDialog.findViewById(R.id.username)).getText().toString();
String password = ((EditText) loginDialog.findViewById(R.id.password)).getText().toString();
EhClient.login(username, password, new EhClient.OnLoginListener() {
mEhClient.login(username, password, new EhClient.OnLoginListener() {
@Override
public void onSuccess() {
checkLogin(true);
}
@Override
public void onFailure(int errorMessageId) {
public void onFailure(String eMsg) {
loginButton.setVisibility(View.VISIBLE);
waitloginView.setVisibility(View.GONE);
Toast.makeText(MangaListActivity.this,
getString(errorMessageId),
eMsg,
Toast.LENGTH_SHORT).show();
loginDialog.show();
}
@@ -709,7 +716,7 @@ public class MangaListActivity extends Activity {
}
private class MangaListGetListener implements
EhClient.OnGetManagaListListener {
EhClient.OnGetMangaListListener {
@Override
public void onSuccess(Object checkFlag, ArrayList<ListMangaDetail> newLmdArray,
int indexPerPage, int maxPage) {
@@ -828,7 +835,7 @@ public class MangaListActivity extends Activity {
}
@Override
public void onFailure(Object checkFlag, int errorMessageId) {
public void onFailure(Object checkFlag, String eMsg) {
MangaListGetPackage getPackage = (MangaListGetPackage)checkFlag;
if (getPackage.stamp != lastGetStamp)
return;
@@ -847,7 +854,7 @@ public class MangaListActivity extends Activity {
pullListView.setVisibility(View.GONE);
freshButton.setVisibility(View.VISIBLE);
Toast.makeText(MangaListActivity.this,
getString(errorMessageId), Toast.LENGTH_SHORT)
eMsg, Toast.LENGTH_SHORT)
.show();
lmdArray.clear();
gmlAdapter.notifyDataSetChanged();
@@ -856,7 +863,7 @@ public class MangaListActivity extends Activity {
freshButton.setVisibility(View.GONE);
Toast.makeText(
MangaListActivity.this,
getString(errorMessageId),
eMsg,
Toast.LENGTH_SHORT).show();
}
@@ -1024,6 +1031,9 @@ public class MangaListActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
mAppContext = (AppContext)getApplication();
mEhClient = mAppContext.getEhClient();
int screenOri = Config.getScreenOriMode();
if (screenOri != getRequestedOrientation())
setRequestedOrientation(screenOri);
@@ -1210,7 +1220,7 @@ public class MangaListActivity extends Activity {
listUrls.setPage(0);
else
listUrls.setPage(firstPage - 1);
EhClient.getManagaList(listUrls.getUrl(),
mEhClient.getMangaList(listUrls.getUrl(),
new MangaListGetPackage((lastGetStamp = System.currentTimeMillis()), listUrls, false, title),
new MangaListGetListener());
}
@@ -1220,7 +1230,7 @@ public class MangaListActivity extends Activity {
mListFirst = true;
mLoadListOver = false;
RefreshPackage rp = (RefreshPackage)obj;
EhClient.getManagaList(rp.listUrls.getUrl(),
mEhClient.getMangaList(rp.listUrls.getUrl(),
new MangaListGetPackage((lastGetStamp = System.currentTimeMillis()),
rp.listUrls, true, rp.title),
new MangaListGetListener());
@@ -1234,7 +1244,7 @@ public class MangaListActivity extends Activity {
if (listUrls.setPage(lastPage + 1)) {
mListFirst = true;
mLoadListOver = false;
EhClient.getManagaList(listUrls.getUrl(),
mEhClient.getMangaList(listUrls.getUrl(),
new MangaListGetPackage((lastGetStamp = System.currentTimeMillis()), listUrls, false, title),
new MangaListGetListener());
}
@@ -1299,6 +1309,7 @@ public class MangaListActivity extends Activity {
checkUpdate();
// Check login
layoutDrawRight();
checkLogin(false);
// get MangeList
@@ -1406,7 +1417,50 @@ public class MangaListActivity extends Activity {
}
private void checkUpdate() {
new UpdateHelper(this).autoCheckUpdate();
new UpdateHelper((AppContext)getApplication())
.SetOnCheckUpdateListener(new UpdateHelper.OnCheckUpdateListener() {
@Override
public void onSuccess(String version, long size,
final String url, String info) {
String sizeStr = Util.sizeToString(size);
AlertDialog dialog = SuperDialogUtil.createUpdateDialog(MangaListActivity.this,
version, sizeStr, info,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
// TODO
try {
Downloader downloader = new Downloader(MangaListActivity.this);
String fileName = Util.getFileForUrl(url);
downloader.resetData(Config.getDownloadPath(), fileName, url);
downloader.setOnDownloadListener(
new UpdateHelper.UpdateListener(MangaListActivity.this,
fileName));
new Thread(downloader).start();
} catch (MalformedURLException e) {
UpdateHelper.setEnabled(true);
}
}
}, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
UpdateHelper.setEnabled(true);
}
});
if (!MangaListActivity.this.isFinishing())
dialog.show();
}
@Override
public void onNoUpdate() {
UpdateHelper.setEnabled(true);
}
@Override
public void onFailure(String eMsg) {
UpdateHelper.setEnabled(true);
}
}).autoCheckUpdate();
}
private void checkLogin(boolean force) {
@@ -1414,7 +1468,7 @@ public class MangaListActivity extends Activity {
loginButton.setVisibility(View.GONE);
checkLoginButton.setVisibility(View.GONE);
waitloginView.setVisibility(View.VISIBLE);
EhClient.checkLogin(new EhClient.OnCheckLoginListener() {
mEhClient.checkLogin(new EhClient.OnCheckLoginListener() {
@Override
public void onSuccess() {
Config.loginNow();
@@ -1425,7 +1479,7 @@ public class MangaListActivity extends Activity {
}
@Override
public void onFailure(int errorMessageId) {
public void onFailure(String eMsg) {
loginButton.setVisibility(View.VISIBLE);
if (Config.isLogin())
checkLoginButton.setVisibility(View.VISIBLE);
@@ -1433,7 +1487,7 @@ public class MangaListActivity extends Activity {
checkLoginButton.setVisibility(View.GONE);
waitloginView.setVisibility(View.GONE);
Toast.makeText(MangaListActivity.this,
getString(errorMessageId),
eMsg,
Toast.LENGTH_SHORT).show();
}
});
@@ -1441,11 +1495,11 @@ public class MangaListActivity extends Activity {
}
private void layoutDrawRight() {
if (EhClient.isLogin()) { // If have login
if (mEhClient.isLogin()) { // If have login
loginView.setVisibility(View.GONE);
loginOverView.setVisibility(View.VISIBLE);
usernameText.setText(EhClient.getUsername());
usernameText.setText(mEhClient.getUsername());
logoutButton.setVisibility(View.VISIBLE);
waitlogoutView.setVisibility(View.GONE);
} else {
@@ -1498,7 +1552,7 @@ public class MangaListActivity extends Activity {
public void buttonLogout(View paramView) {
logoutButton.setVisibility(View.GONE);
waitlogoutView.setVisibility(View.VISIBLE);
EhClient.logout(new EhClient.OnLogoutListener() {
mEhClient.logout(new EhClient.OnLogoutListener() {
@Override
public void onSuccess() {
Toast.makeText(MangaListActivity.this,
@@ -1509,9 +1563,9 @@ public class MangaListActivity extends Activity {
}
@Override
public void onFailure(int errorMessageId) {
public void onFailure(String eMsg) {
Toast.makeText(MangaListActivity.this,
getString(errorMessageId),
eMsg,
Toast.LENGTH_SHORT).show();
logoutButton.setVisibility(View.VISIBLE);
waitlogoutView.setVisibility(View.GONE);
@@ -1,7 +1,9 @@
package com.hippo.ehviewer.activity;
import java.io.InputStream;
import java.net.MalformedURLException;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.R;
@@ -9,11 +11,14 @@ import com.hippo.ehviewer.UpdateHelper;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.MangaImage;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.widget.DialogBuilder;
import com.hippo.ehviewer.widget.SuperDialogUtil;
import com.hippo.ehviewer.network.Downloader;
import com.hippo.ehviewer.preference.AutoListPreference;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
@@ -29,9 +34,13 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.support.v4.util.LruCache;
import android.view.View;
import android.webkit.WebView;
import android.widget.Toast;
// TODO 添加服务器选择
public class SettingsActivity extends PreferenceActivity {
@SuppressWarnings("unused")
private static String TAG = "Settings";
@@ -40,9 +49,8 @@ public class SettingsActivity extends PreferenceActivity {
public LruCache<String, Bitmap> memoryCache;
private static final String CP_CACHE = "preference_cp_cache";
private static final String CLEAR_CP_CACHE = "preference_clear_cp_cache";
private static final String PAGE_SCALING = "preference_page_scaling";
private static final String CACHE = "preference_cache";
private static final String CLEAR_CACHE = "preference_clear_cache";
private static final String AUTHOR = "preference_author";
private static final String SCREEN_ORI = "preference_screen_ori";
private static final String CHANGELOG = "preference_changelog";
@@ -50,11 +58,8 @@ public class SettingsActivity extends PreferenceActivity {
private static final String UPDATE = "preference_update";
private static final String RAN = "preference_remove_all_noification";
private EditTextPreference cpCachePre;
private Preference clearCpCachePre;
private EditTextPreference pageCachePre;
private Preference clearPageCachePre;
private AutoListPreference pageScalingListPre;
private EditTextPreference cachePre;
private Preference clearCachePre;
private Preference authorPer;
private AutoListPreference screenOriPer;
private Preference changelogPer;
@@ -98,8 +103,8 @@ public class SettingsActivity extends PreferenceActivity {
// Set PreferenceActivity
PreferenceScreen screen = getPreferenceScreen();
cpCachePre = (EditTextPreference) screen.findPreference(CP_CACHE);
cpCachePre
cachePre = (EditTextPreference) screen.findPreference(CACHE);
cachePre
.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference,
@@ -142,9 +147,9 @@ public class SettingsActivity extends PreferenceActivity {
}
});
clearCpCachePre = (Preference) screen.findPreference(CLEAR_CP_CACHE);
clearCachePre = (Preference) screen.findPreference(CLEAR_CACHE);
updateCpCacheSummary();
clearCpCachePre
clearCachePre
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
@@ -153,30 +158,6 @@ public class SettingsActivity extends PreferenceActivity {
return true;
}
});
pageScalingListPre = (AutoListPreference) screen
.findPreference(PAGE_SCALING);
pageScalingListPre
.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference,
Object newValue) {
MangaImage.setMode(Integer.parseInt((String) newValue));
return true;
}
});
/*
final AutoListPreference start_position =
(AutoListPreference)screen.findPreference(START_POSITION);
start_position.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference,
Object newValue) {
// TODO Auto-generated method stub
return false;
}
});*/
// Connect me !
@@ -238,24 +219,60 @@ public class SettingsActivity extends PreferenceActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
update.setSummary(R.string.checking_update);
new UpdateHelper(SettingsActivity.this)
new UpdateHelper((AppContext)SettingsActivity.this.getApplication())
.SetOnCheckUpdateListener(new UpdateHelper.OnCheckUpdateListener() {
@Override
public void onSuccess(String pageContext) {
public void onSuccess(String version, long size,
final String url, String info) {
update.setSummary(R.string.found_update);
update.setEnabled(true);
String sizeStr = Util.sizeToString(size);
AlertDialog dialog = SuperDialogUtil.createUpdateDialog(SettingsActivity.this,
version, sizeStr, info,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
// TODO
try {
Downloader downloader = new Downloader(SettingsActivity.this);
String fileName = Util.getFileForUrl(url);
downloader.resetData(Config.getDownloadPath(), fileName, url);
downloader.setOnDownloadListener(
new UpdateHelper.UpdateListener(SettingsActivity.this,
fileName));
new Thread(downloader).start();
} catch (MalformedURLException e) {
update.setSummary(R.string.em_url_format_error);
UpdateHelper.setEnabled(true);
}
update.setEnabled(true);
}
}, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
update.setEnabled(true);
UpdateHelper.setEnabled(true);
}
});
if (!SettingsActivity.this.isFinishing())
dialog.show();
}
@Override
public void onNoUpdate() {
update.setSummary(R.string.up_to_date);
update.setEnabled(true);
UpdateHelper.setEnabled(true);
}
@Override
public void onFailure(int eMesgId) {
update.setSummary(eMesgId);
public void onFailure(String eMsg) {
update.setSummary(eMsg);
update.setEnabled(true);
UpdateHelper.setEnabled(true);
}
}).checkUpdate();
update.setEnabled(false);
return true;
}
@@ -275,15 +292,15 @@ public class SettingsActivity extends PreferenceActivity {
private void updateCpCacheSummary() {
if (Cache.cpCache != null) {
clearCpCachePre.setSummary(String.format(
clearCachePre.setSummary(String.format(
getString(R.string.preference_cache_summary),
Cache.cpCache.size() / 1024 / 1024f,
Cache.cpCache.maxSize() / 1024 / 1024));
clearCpCachePre.setEnabled(true);
clearCachePre.setEnabled(true);
} else {
clearCpCachePre
clearCachePre
.setSummary(getString(R.string.preference_cache_summary_no));
clearCpCachePre.setEnabled(false);
clearCachePre.setEnabled(false);
}
}
}
@@ -1,18 +0,0 @@
package com.hippo.ehviewer.dialog;
import com.hippo.ehviewer.R;
import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
public class SuperDialogUtil {
public static void setTitle(AlertDialog dialog, String title) {
TextView titleView = (TextView)dialog.findViewById(R.id.title);
titleView.setVisibility(View.VISIBLE);
titleView.setText(title);
}
}
@@ -0,0 +1,48 @@
package com.hippo.ehviewer.exception;
public class FileException extends Exception {
public static final int MKDIR_ERROR = 0x0;
public static final int CREATE_FILE_ERROR = 0x1;
public static final int NOT_DIR = 0x2;
public static final int NOT_FILE = 0x3;
public static final int CANNOT_EXECUTE = 0x4;
public static final int CANNOT_READ = 0x5;
public static final int CANNOT_WRITE = 0x6;
private int mErrorCode;
private static final long serialVersionUID = 1L;
public FileException(int errorCode) {
mErrorCode = errorCode;
}
public int getErrorCode() {
return mErrorCode;
}
// TODO
public String getMessage() {
switch (mErrorCode) {
case MKDIR_ERROR:
return "mkdir error";
case CREATE_FILE_ERROR:
return "create file error";
case NOT_DIR:
return "it is not a dir";
case NOT_FILE:
return "it is not a file";
case CANNOT_EXECUTE:
return "can not execute";
case CANNOT_READ:
return "can not read";
case CANNOT_WRITE:
return "can not write";
default:
return "unknown error";
}
}
}
@@ -0,0 +1,5 @@
package com.hippo.ehviewer.exception;
public class NoSdCardException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -0,0 +1,5 @@
package com.hippo.ehviewer.exception;
public class RedirectionException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -0,0 +1,21 @@
package com.hippo.ehviewer.exception;
public class ResponseCodeException extends Exception {
private static final long serialVersionUID = 1L;
private static final String eMsg = "Error response code";
private int mResponseCode;
public ResponseCodeException(int responseCode) {
this(responseCode, eMsg);
}
public ResponseCodeException(int responseCode, String message) {
super(message);
mResponseCode = responseCode;
}
public int getResponseCode() {
return mResponseCode;
}
}
@@ -0,0 +1,5 @@
package com.hippo.ehviewer.exception;
public class StopRequestException extends Exception {
private static final long serialVersionUID = 1L;
}
+158 -38
View File
@@ -3,17 +3,23 @@ package com.hippo.ehviewer.gallery;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Movie;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.MotionEvent;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.gallery.data.ImageSet;
import com.hippo.ehviewer.gallery.glrenderer.BitmapTexture;
import com.hippo.ehviewer.gallery.glrenderer.ColorTexture;
import com.hippo.ehviewer.gallery.glrenderer.GLCanvas;
import com.hippo.ehviewer.gallery.glrenderer.GLPaint;
import com.hippo.ehviewer.gallery.glrenderer.MovieTexture;
import com.hippo.ehviewer.gallery.glrenderer.StringTexture;
import com.hippo.ehviewer.gallery.glrenderer.UploadedTexture;
import com.hippo.ehviewer.gallery.ui.GLView;
import com.hippo.ehviewer.gallery.ui.GestureRecognizer;
import com.hippo.ehviewer.gallery.util.GalleryUtils;
@@ -21,6 +27,9 @@ import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.TimeRunner;
import com.hippo.ehviewer.util.Ui;
// TODO 双击加载该页
// TODO 长按从该页开始加载
// TODO 手动触屏滑动可能闪烁
public class GalleryView extends GLView {
@@ -83,8 +92,11 @@ public class GalleryView extends GLView {
private static final int TAP_AREA_MASK_COLOR = 0x88000000;
// TODO
private static final int BACKGROUND_COLOR = Color.BLACK;
private static final int MASK_COLOR = 0x88000000;
private final GestureRecognizer mGestureRecognizer;
private Context mContext;
@@ -139,6 +151,7 @@ public class GalleryView extends GLView {
public interface OnTapTextListener {
public void onTapText(int index);
public void onTapDoubleText(int index);
}
public interface OnScrollPageListener {
@@ -170,7 +183,7 @@ public class GalleryView extends GLView {
setState();
mGestureRecognizer = new GestureRecognizer(mContext, new MyGestureListener());
setBackgroundColor(GalleryUtils.intColorToFloatARGBArray(Color.BLACK));
setBackgroundColor(GalleryUtils.intColorToFloatARGBArray(BACKGROUND_COLOR));
showItems = new ShowItem[TARGET_INDEX_SIZE];
@@ -233,13 +246,15 @@ public class GalleryView extends GLView {
protected void render(GLCanvas canvas) {
super.render(canvas);
boolean hasMovie = false;
ShowItem item;
switch (mScrollState) {
case SCROLL_NONE:
item = showItems[CUR_TARGET_INDEX];
if (item != null) {
if (item != null)
item.draw(canvas);
}
if (item instanceof MovieImage)
hasMovie |= true;
break;
case SCROLL_LEFT:
@@ -247,9 +262,14 @@ public class GalleryView extends GLView {
item = showItems[PRE_TARGET_INDEX];
if (item != null)
item.draw(canvas, scrollXOffset, scrollYOffset);
if (item instanceof MovieImage)
hasMovie |= true;
item = showItems[CUR_TARGET_INDEX];
if (item != null)
item.draw(canvas, scrollXOffset, scrollYOffset);
if (item instanceof MovieImage)
hasMovie |= true;
break;
case SCROLL_RIGHT:
@@ -257,9 +277,14 @@ public class GalleryView extends GLView {
item = showItems[CUR_TARGET_INDEX];
if (item != null)
item.draw(canvas, scrollXOffset, scrollYOffset);
if (item instanceof MovieImage)
hasMovie |= true;
item = showItems[NEXT_TARGET_INDEX];
if (item != null)
item.draw(canvas, scrollXOffset, scrollYOffset);
if (item instanceof MovieImage)
hasMovie |= true;
break;
}
@@ -267,8 +292,26 @@ public class GalleryView extends GLView {
if (mShowTapArea && mInit)
drawTapArea(canvas);
// Mask to reduce brightness
// TODO Mask to reduce brightness
//canvas.fillRect(0, 0, mWidth, mHeight, MASK_COLOR);
// TODO
if (hasMovie) {
Log.d(TAG, "hasMovie");
new Thread() {
@Override
public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
invalidate();
}
}
}.start();
}
}
private void resetSizePosition() {
@@ -494,7 +537,7 @@ public class GalleryView extends GLView {
if (showItem != null)
showItem.recycle();
if (state == ImageSet.STATE_LOADED)
showItems[targetIndex] = new Image();
showItems[targetIndex] = new EmptyItem();
else {
showItems[targetIndex] = new Text(getErrorStateString(state));
}
@@ -534,21 +577,28 @@ public class GalleryView extends GLView {
class DecodeImageListener implements ImageSet.OnDecodeOverListener {
@Override
public void onDecodeOver(Bitmap bmp, int index) {
public void onDecodeOver(Object res, int index) {
int targetIndex = index - mCurIndex + 1;
ShowItem showItem;
Image image;
if (targetIndex < 0 || targetIndex > 2
|| !((showItem = showItems[targetIndex]) instanceof Image)
|| (image = (Image)showItem).isLoaded()) {// If it do not need any more
if (bmp != null)
bmp.recycle();
|| !((showItem = showItems[targetIndex]) instanceof EmptyItem)) {// If it do not need any more
if (res != null && res instanceof Bitmap)
((Bitmap)res).recycle();
} else {
if (bmp == null) {
showItems[targetIndex] = new Text("读取图片错误");
if (res == null) {
showItems[targetIndex] = new Text("读取图片错误"); // TODO
} else {
image.load(bmp);
if (res instanceof Bitmap) {
BitmapImage bi = new BitmapImage();
bi.load((Bitmap)res);
showItems[targetIndex] = bi;
} else {
MovieImage mi = new MovieImage();
mi.load((Movie)res);
showItems[targetIndex] = mi;
}
}
resetSizePosition(targetIndex);
}
@@ -594,6 +644,8 @@ public class GalleryView extends GLView {
rect.set(rect.left - xOffset, rect.top - yOffset, rect.right + xOffset, rect.bottom + yOffset);
adjustPosition(curShowItem);
invalidate();
return true;
}
@@ -733,7 +785,7 @@ public class GalleryView extends GLView {
|| showItems[CUR_TARGET_INDEX] instanceof Text) {
if (mOnTapTextListener != null)
mOnTapTextListener.onTapText(mCurIndex);
return true;
//return true;
}
if (isInArea(leftArea, (int)x, (int)y)) {
@@ -766,6 +818,12 @@ public class GalleryView extends GLView {
return true;
}
@Override
public void onLongPress(MotionEvent e) {
// TODO Auto-generated method stub
}
@Override
public boolean onScrollBegin(float dx, float dy, float totalX,
float totalY) {
@@ -1007,7 +1065,7 @@ public class GalleryView extends GLView {
*
* @param showItem
*/
public void adjustPosition(ShowItem showItem) {
private void adjustPosition(ShowItem showItem) {
Rect rect = showItem.mRect;
int showWidth = rect.width();
int showHeight = rect.height();
@@ -1077,18 +1135,36 @@ public class GalleryView extends GLView {
public abstract void recycle();
}
private class Image extends ShowItem{
private BitmapTexture mTexture;
private Bitmap mContextBmp;
private class EmptyItem extends ShowItem{
private ColorTexture mTexture;
public EmptyItem() {
mTexture = new ColorTexture(BACKGROUND_COLOR);
}
@Override
public void recycle() {
mTexture = null;
}
@Override
public void draw(GLCanvas canvas, int xOffset, int yOffset) {
mTexture.draw(canvas, xOffset, yOffset);
}
}
private abstract class Image extends ShowItem{
private UploadedTexture mTexture;
public float imageScale = 1;
public void load(Bitmap bmp) {
if (mTexture != null)
recycle();
mTexture = new BitmapTexture(bmp);
mContextBmp = bmp;
width = bmp.getWidth();
height = bmp.getHeight();
/**
* You must call init before draw
* @param texture
*/
public void init(UploadedTexture texture) {
mTexture = texture;
imageScale = 1;
}
@@ -1096,18 +1172,6 @@ public class GalleryView extends GLView {
return mTexture != null;
}
@Override
public void recycle() {
if (mTexture == null)
return;
mTexture.recycle();
mContextBmp.recycle();
mTexture = null;
mContextBmp = null;
}
@Override
public void draw(GLCanvas canvas, int xOffset, int yOffset) {
if (mTexture != null) {
@@ -1189,6 +1253,62 @@ public class GalleryView extends GLView {
}
}
private class BitmapImage extends Image{
private BitmapTexture mTexture;
private Bitmap mContextBmp;
public void load(Bitmap bmp) {
if (mTexture != null)
recycle();
mContextBmp = bmp;
mTexture = new BitmapTexture(bmp);
width = mContextBmp.getWidth();
height = mContextBmp.getHeight();
super.init(mTexture);
}
@Override
public void recycle() {
if (mTexture == null)
return;
mTexture.recycle();
mContextBmp.recycle();
mTexture = null;
mContextBmp = null;
}
}
private class MovieImage extends Image{
private MovieTexture mTexture;
private Movie mContextMovie;
public void load(Movie movie) {
if (mTexture != null)
recycle();
mContextMovie = movie;
mTexture = MovieTexture.newInstance(mContextMovie);
width = mContextMovie.width();
height = mContextMovie.height();
super.init(mTexture);
}
@Override
public void recycle() {
if (mTexture == null)
return;
mTexture.recycle();
mTexture = null;
mContextMovie = null;
}
}
private class Text extends ShowItem{
private StringTexture mTexture;
@@ -23,7 +23,7 @@ import android.database.Cursor;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import java.io.Closeable;
import java.io.IOException;
@@ -11,9 +11,7 @@ import android.content.IntentFilter;
import com.hippo.ehviewer.service.DownloadService;
public class DownloadImageSet extends ImageSet {
public DownloadImageSet(Context context, String gid, File folder, int size,
int startIndex, int endIndex, Set<Integer> failIndexSet) {
super(context, gid, folder, size, startIndex, endIndex, failIndexSet);
@@ -17,9 +17,12 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.graphics.Movie;
import com.hippo.ehviewer.util.Log;
import android.util.SparseArray;
// TODO 初期建立一个线程检索文件夹中所有文件以寻找到所有图片文件
/**
* @author Hippo
*
@@ -31,8 +34,15 @@ import android.util.SparseArray;
*/
public class ImageSet {
@SuppressWarnings("unused")
private static final String TAG = "ImageSet";
private static final String GIF_EXTENSION = "gif";
public static final int TYPE_NONE = 0x0;
public static final int TYPE_BITMAP = 0x1;
public static final int TYPE_MOVIE = 0x2;
public static final int INVALID_ID = -1;
public static final int STATE_NONE = 0;
@@ -55,27 +65,60 @@ public class ImageSet {
}
public interface OnDecodeOverListener {
void onDecodeOver(Bitmap bmp, int index);
/**
* May return Bitmap or Movie
*
* @param res
* @param index
*/
void onDecodeOver(Object res, int index);
}
private class ImageData {
int state;
String fileName;
int type;
public ImageData() {
state = STATE_NONE;
fileName = null;
type = TYPE_NONE;
}
}
// [startIndex, endIndex)
public ImageSet(Context context, String gid, File folder, int size, int startIndex, int endIndex,
Set<Integer> failIndexSet) {
if (folder == null || !folder.isDirectory())
throw new IllegalArgumentException("Folder is null or not directory");
size = 0;
// TODO
/*
if (folder == null)
throw new IllegalArgumentException("Folder is null");
if (!folder.isDirectory())
throw new IllegalArgumentException("Folder is not directory, path is " + folder.getPath());
*/
if (size < 0)
size = 0;
if (endIndex > size)
endIndex = size;
if (startIndex < 0)
startIndex = 0;
if (startIndex > endIndex)
startIndex = endIndex;
// TODO
/*
if (size < 0 || startIndex < 0
|| startIndex > endIndex || endIndex > size)
throw new IllegalArgumentException("size or index value error");
throw new IllegalArgumentException("size or index value error, size = "
+ size + ", startIndex = " + startIndex
+ ", endIndex = " + endIndex + ", path is " + folder.getPath());
*/
mContext = context;
mGid = gid;
@@ -124,37 +167,39 @@ public class ImageSet {
else
state = imageData.state;
if (state == STATE_LOADED && listener != null) {
mThreadPool.submit(new Job<Bitmap>() {
mThreadPool.submit(new Job<Object>() {
@Override
public Bitmap run(JobContext jc) {
Bitmap bmp = null;
if (imageData.fileName == null) {
imageData.fileName = getFileForName(getFileNameForIndex(index));
}
if (imageData.fileName == null)
public Object run(JobContext jc) {
Object res = null;
if (imageData.fileName == null
&& !getFileForName(getFileNameForIndex(index), imageData))
return null;
Log.d(TAG, imageData.fileName);
File file = new File(mFolder, imageData.fileName);
FileInputStream fis = null;
try {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
fis = new FileInputStream(file);
bmp = BitmapFactory.decodeStream(fis, null, opt);
if (imageData.type == TYPE_BITMAP) {
BitmapFactory.Options opt = new BitmapFactory.Options();
// TODO why only ARGB_8888 always work well, other may slit image
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
res = BitmapFactory.decodeStream(fis, null, opt);
} else if (imageData.type == TYPE_MOVIE) {
res = Movie.decodeStream(fis);
} else {
// TYPE_NONE or something else, get error
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (fis != null)
Util.closeStreamQuietly(fis);
}
return bmp;
return res;
}
}, new FutureListener<Bitmap>() {
}, new FutureListener<Object>() {
@Override
public void onFutureDone(Future<Bitmap> future) {
public void onFutureDone(Future<Object> future) {
listener.onDecodeOver(future.get(), index);
}
});
@@ -167,13 +212,19 @@ public class ImageSet {
return String.format("%05d", index + 1);
}
public String getFileForName(String name) {
public boolean getFileForName(String name, ImageData imageData) {
String[] list = mFolder.list();
for (String item : list) {
if(name.equals(Util.getName(item)))
return item;
if(name.equals(Util.getName(item))) {
imageData.fileName = item;
if (Util.getExtension(item).toLowerCase().equals(GIF_EXTENSION))
imageData.type = TYPE_MOVIE;
else
imageData.type = TYPE_BITMAP;
return true;
}
}
return null;
return false;
}
public void changeState(int index, int state) {
@@ -17,7 +17,7 @@
package com.hippo.ehviewer.gallery.glrenderer;
import android.graphics.RectF;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.gallery.common.Utils;
@@ -22,7 +22,7 @@ import android.graphics.RectF;
import android.opengl.GLU;
import android.opengl.GLUtils;
import android.opengl.Matrix;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.gallery.common.Utils;
import com.hippo.ehviewer.util.IntArray;
@@ -21,7 +21,7 @@ import android.graphics.RectF;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import android.opengl.Matrix;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.util.IntArray;
@@ -0,0 +1,45 @@
package com.hippo.ehviewer.gallery.glrenderer;
import junit.framework.Assert;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Movie;
import com.hippo.ehviewer.util.Log;
public class MovieTexture extends CanvasTexture {
private static final int DEFAULT_MOVIE_DURATION = 1000;
private final Movie mMovie;
private final int mDuration;
private final long mMovieStart;
private MovieTexture(Movie movie, int width, int height) {
super(width, height);
mMovie = movie;
int dur = mMovie.duration();
if (dur == 0)
mDuration = DEFAULT_MOVIE_DURATION;
else
mDuration = dur;
mMovieStart = System.currentTimeMillis();
}
public static MovieTexture newInstance(Movie movie) {
Assert.assertTrue(movie != null);
return new MovieTexture(movie, movie.width(), movie.height());
}
@Override
protected boolean onBind(GLCanvas canvas) {
invalidateContent();
setSize(mMovie.width(), mMovie.height());
return super.onBind(canvas);
}
@Override
protected void onDraw(Canvas canvas, Bitmap backing) {
mMovie.setTime((int)((System.currentTimeMillis() - mMovieStart) % mDuration));
mMovie.draw(canvas, 0, 0);
}
}
@@ -16,7 +16,7 @@
package com.hippo.ehviewer.gallery.glrenderer;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import javax.microedition.khronos.opengles.GL11;
@@ -19,7 +19,7 @@ package com.hippo.ehviewer.gallery.glrenderer;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.opengl.GLUtils;
import com.hippo.ehviewer.util.Log;
import junit.framework.Assert;
import java.util.HashMap;
@@ -231,7 +231,7 @@ public abstract class UploadedTexture extends BasicTexture {
int format = GLUtils.getInternalFormat(bitmap);
int type = GLUtils.getType(bitmap);
Config config = bitmap.getConfig();
canvas.initializeTextureSize(this, format, type);
canvas.texSubImage2D(this, mBorder, mBorder, bitmap, format, type);
@@ -26,7 +26,7 @@ import android.os.Build;
import android.os.Process;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;
@@ -19,7 +19,7 @@ package com.hippo.ehviewer.gallery.ui;
import android.annotation.SuppressLint;
import android.graphics.Rect;
import android.os.SystemClock;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.MotionEvent;
import com.hippo.ehviewer.gallery.anim.CanvasAnimation;
@@ -31,6 +31,7 @@ public class GestureRecognizer {
public interface Listener {
boolean onSingleTapUp(float x, float y);
boolean onDoubleTap(float x, float y);
void onLongPress(MotionEvent e);
boolean onScrollBegin(float dx, float dy, float totalX, float totalY);
boolean onScroll(float dx, float dy, float totalX, float totalY);
boolean onScrollEnd();
@@ -89,7 +90,12 @@ public class GestureRecognizer {
public boolean onDoubleTap(MotionEvent e) {
return mListener.onDoubleTap(e.getX(), e.getY());
}
@Override
public void onLongPress(MotionEvent e) {
mListener.onLongPress(e);
}
@Override
public boolean onScroll(
MotionEvent e1, MotionEvent e2, float dx, float dy) {
@@ -27,7 +27,7 @@ import android.os.Environment;
import android.os.StatFs;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.WindowManager;
import com.hippo.ehviewer.util.ThreadPool.CancelListener;
@@ -0,0 +1,14 @@
package com.hippo.ehviewer.network;
public class Constant {
public static final int HTTP_TEMP_REDIRECT = 307;
public static String defaultUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36";
public static String userAgent = System.getProperty("http.agent", defaultUserAgent);
public static final int DEFAULT_TIMEOUT = 5 * 1000;
public static final int MAX_REDIRECTS = 5;
public static final int BUFFER_SIZE = 4096;
}
+242 -90
View File
@@ -1,56 +1,75 @@
package com.hippo.ehviewer.network;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.net.UnknownHostException;
import android.util.Log;
import org.apache.http.conn.ConnectTimeoutException;
import com.hippo.ehviewer.DownloadInfo;
import android.content.Context;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.exception.FileException;
import com.hippo.ehviewer.exception.NoSdCardException;
import com.hippo.ehviewer.exception.RedirectionException;
import com.hippo.ehviewer.exception.ResponseCodeException;
import com.hippo.ehviewer.exception.StopRequestException;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Util;
// TODO 添加检查次磁盘空间
/**
* Thread unsafe
*
* @author Hippo
*
*/
public class Downloader implements Runnable {
private static final String TAG = "Downloader";
public static final int HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
public static final int HTTP_TEMP_REDIRECT = 307;
public static final int COMPLETED = 0;
public static final int STOP = -1;
public static final int NO_SDCARD = -2;
public static final int STATUS_HTTP_DATA_ERROR = -3;
public static final int STATUS_TOO_MANY_REDIRECTS = -4;
public static final int STATUS_FILE_ERROR = -5;
public static final int NONE = 0x0;
public static final int READY = 0x1;
public static final int CONNECTING = 0x2;
public static final int DOWNLOADING = 0x3;
public static final int FAILED = 0x4;
public static final int COMPLETED = 0x5;
public static final int STOPED = 0x6;
private static final int BUFFER_SIZE = 4096;
private static final int MAX_RETRY = 3;
private static final int MAX_REDIRECTS = 5;
private static final int MAX_RETRY = 5;
private static final int DEFAULT_TIMEOUT = 5 * 1000;
private Context mContext;
private File mFolder;
private String mPath;
private String mFileName;
private URL mUrl;
private Controlor mContorlor;
private int mTotalSize;
// If support Content-Range, start from it
private int mDownloadSize = 0;
private int mRedirectionCount = 0;
private int status;
private int status = NONE;
private OnDownloadListener mListener;
private Exception mException;
public interface OnDownloadListener {
public void onDownloadStart(int totalSize);
public void onDownloadStartConnect();
public void onDownloadStartDownload(int totalSize);
public void onDownloadStatusUpdate(int downloadSize, int totalSize);
public void onDownloadOver(boolean ok, int eMesgId);
public void onDownloadOver(int status);
}
public class Controlor {
@@ -73,10 +92,11 @@ public class Downloader implements Runnable {
mPath = path;
mFileName = fileName;
mUrl = new URL(urlStr);
mException = null;
mDownloadSize = 0;
mRedirectionCount = 0;
status = COMPLETED;
status = READY;
mContorlor.reset();
return mContorlor;
@@ -86,87 +106,154 @@ public class Downloader implements Runnable {
mListener = listener;
}
public Downloader() {
public Downloader(Context context) {
mContext = context;
mContorlor = new Controlor();
}
public String getEMsg() {
if (mException == null)
return mContext.getString(R.string.em_unknown_error);
else if (mException instanceof MalformedURLException)
return mContext.getString(R.string.em_url_format_error);
else if (mException instanceof ConnectTimeoutException ||
mException instanceof SocketTimeoutException)
return mContext.getString(R.string.em_timeout);
else if (mException instanceof UnknownHostException)
return mContext.getString(R.string.em_unknown_host);
else if (mException instanceof ResponseCodeException)
return String.format(mContext.getString(R.string.em_unexpected_response_code),
((ResponseCodeException)mException).getResponseCode());
else if (mException instanceof RedirectionException)
return mContext.getString(R.string.em_redirection_error);
else if (mException instanceof SocketException)
return "SocketException : " + mException.getMessage();
else if (mException instanceof NoSdCardException)
return mContext.getString(R.string.em_no_sdcard);
else if (mException instanceof FileException)
return ((FileException)mException).getMessage();
else
return mException.getMessage();
}
@Override
public void run() {
boolean ok = false;
int retryTimes = 0;
if (Cache.hasSdCard())
while(true) {
if (Cache.hasSdCard()) {
boolean checkFolder = false;
try {
initFolder();
checkFolder = true;
} catch (Exception e) {
mException = e;
e.printStackTrace();
}
while(checkFolder) {
try {
if (mContorlor.isStop())
throw new StopRequestException(STOP, "Download is stopped");
mDownloadSize = 0;
throw new StopRequestException();
mRedirectionCount = 0;
status = COMPLETED;
status = READY;
executeDownload();
ok = true;
status = COMPLETED;
break;
} catch (StopRequestException e) {
} catch (Exception e) {
mException = e;
e.printStackTrace();
status = e.getFinalStatus();
if (status == STOP || retryTimes > MAX_RETRY)
if (mContorlor.isStop() || retryTimes > MAX_RETRY) {
status = FAILED;
break;
}
retryTimes++;
}
}
else
status = NO_SDCARD;
} else
mException = new NoSdCardException();
if (mContorlor.isStop())
status = STOPED;
if (mListener != null)
mListener.onDownloadOver(ok, status);
mListener.onDownloadOver(status);
}
public int getStatus() {
return status;
}
private void executeDownload() throws StopRequestException {
while (mRedirectionCount++ < MAX_REDIRECTS) {
private void initFolder() throws Exception {
mFolder = new File(mPath);
if (!mFolder.exists()) {
if (!mFolder.mkdirs())
throw new FileException(FileException.MKDIR_ERROR);
} else if (!mFolder.isDirectory()){
throw new FileException(FileException.NOT_DIR);
}
if (!mFolder.canWrite())
throw new FileException(FileException.CANNOT_WRITE);
}
private void executeDownload() throws Exception {
while (mRedirectionCount++ < Constant.MAX_REDIRECTS) {
HttpURLConnection conn = null;
try {
Log.d(TAG, "Get file " + mUrl.toString());
status = CONNECTING;
if (mListener != null)
mListener.onDownloadStartConnect();
conn = (HttpURLConnection)mUrl.openConnection();
conn.setInstanceFollowRedirects(false);
conn.addRequestProperty("Range", "bytes=0-"); // TODO
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.addRequestProperty("Range", "bytes=" + mDownloadSize + "-");
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
processResponseHeaders(conn);
status = DOWNLOADING;
if (mListener != null)
mListener.onDownloadStart(mTotalSize);
mListener.onDownloadStartDownload(mTotalSize);
transferData(conn);
return;
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
mUrl = new URL(mUrl, location);
continue;
default:
StopRequestException.throwUnhandledHttpError(
responseCode, conn.getResponseMessage());
throw new ResponseCodeException(responseCode);
}
} catch (IOException e) {
// Trouble with low-level sockets
throw new StopRequestException(STATUS_HTTP_DATA_ERROR, e);
} catch (Exception e) {
throw e;
} finally {
if (conn != null) conn.disconnect();
if (conn != null)
conn.disconnect();
}
}
throw new StopRequestException(STATUS_TOO_MANY_REDIRECTS, "Too many redirects");
throw new RedirectionException();
}
/**
@@ -176,67 +263,96 @@ public class Downloader implements Runnable {
*/
private void processResponseHeaders(HttpURLConnection conn) {
mTotalSize = conn.getContentLength();
// bytes 500-999/1234
String range;
int index;
if (mTotalSize == -1
&& (range = conn.getHeaderField("Content-Range")) != null
&& (index = range.lastIndexOf('/')) != -1) {
try {
mTotalSize = Integer.parseInt(range.substring(index + 1));
} catch (Exception e) {
e.printStackTrace();
if ((range = conn.getHeaderField("Content-Range")) != null) { // Support Content-Range
boolean newNum = true;
int numIndex = 0;
int num = 0;
int length = range.length();
char ch;
for (int i = 0; i < length; i++) {
ch = range.charAt(i);
if (ch >= '0' && ch <= '9') {
if (newNum) {
newNum = false;
num = ch - '0';
} else
num = num * 10 + ch - '0';
} else {
if (!newNum) {
newNum = true;
if (numIndex == 0)
mDownloadSize = num;
else if (numIndex == 2)
mTotalSize = num;
numIndex++;
}
}
}
if (numIndex == 2)
mTotalSize = num;
} else { // Do not support Content-Range, restart download
mDownloadSize = 0;
}
}
/**
* Transfer data from the given connection to the destination file.
*/
private void transferData(HttpURLConnection conn) throws StopRequestException {
private void transferData(HttpURLConnection conn) throws Exception {
InputStream in = null;
OutputStream out = null;
RandomAccessFile raf = null;
File file = null;
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
throw new StopRequestException();
try {
try {
in = conn.getInputStream();
} catch (IOException e) {
throw new StopRequestException(STATUS_HTTP_DATA_ERROR, e);
throw e; // TODO
}
try {
file = new File(mPath, mFileName);
out = new FileOutputStream(file);
raf = new RandomAccessFile(file, "rw");
raf.seek(mDownloadSize);
} catch (IOException e) {
throw new StopRequestException(STATUS_FILE_ERROR, e);
throw new FileException(FileException.CREATE_FILE_ERROR);
}
// Start streaming data, periodically watch for pause/cancel
// commands and checking disk space as needed.
transferData(in, out);
transferData(in, raf);
} finally {
Util.closeStreamQuietly(in);
try {
if (out != null) out.flush();
} catch (IOException e) {
} finally {
Util.closeStreamQuietly(out);
}
if (in != null)
Util.closeStreamQuietly(in);
if (raf != null)
try {
raf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* Transfer as much data as possible from the HTTP response to the
* destination file.
*/
@SuppressWarnings("unused")
private void transferData(InputStream in, OutputStream out)
throws StopRequestException {
final byte data[] = new byte[BUFFER_SIZE];
for (;;) {
throws Exception {
final byte data[] = new byte[Constant.BUFFER_SIZE];
while (true) {
if (mContorlor.isStop())
throw new StopRequestException();
int bytesRead = readFromResponse(data, in);
if (bytesRead == -1) { // success, end of stream already reached
return;
@@ -246,10 +362,30 @@ public class Downloader implements Runnable {
mDownloadSize += bytesRead;
if (mListener != null)
mListener.onDownloadStatusUpdate(mDownloadSize, mTotalSize);
}
}
/**
* Transfer as much data as possible from the HTTP response to the
* destination file.
*/
private void transferData(InputStream in, RandomAccessFile raf)
throws Exception {
final byte data[] = new byte[Constant.BUFFER_SIZE];
while (true) {
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
throw new StopRequestException();
int bytesRead = readFromResponse(data, in);
if (bytesRead == -1) { // success, end of stream already reached
return;
}
writeDataToDestination(data, bytesRead, raf);
mDownloadSize += bytesRead;
if (mListener != null)
mListener.onDownloadStatusUpdate(mDownloadSize, mTotalSize);
}
}
@@ -260,13 +396,30 @@ public class Downloader implements Runnable {
* @return the number of bytes actually read or -1 if the end of the stream has been reached
*/
private int readFromResponse(byte[] data, InputStream entityStream)
throws StopRequestException {
throws Exception {
try {
return entityStream.read(data);
} catch (IOException ex) {
} catch (IOException e) {
// TODO: handle stream errors the same as other retries
throw new StopRequestException(STATUS_HTTP_DATA_ERROR,
"Failed reading response: " + ex, ex);
throw e;
}
}
/**
* Write a data buffer to the destination file.
* @param data buffer containing the data to write
* @param bytesRead how many bytes to write from the buffer
*/
private void writeDataToDestination(byte[] data, int bytesRead, OutputStream out)
throws Exception {
try {
out.write(data, 0, bytesRead);
return;
} catch (IOException e) {
// TODO: better differentiate between DRM and disk failures
// TODO: check disk is full
throw e;
}
}
@@ -275,16 +428,15 @@ public class Downloader implements Runnable {
* @param data buffer containing the data to write
* @param bytesRead how many bytes to write from the buffer
*/
private void writeDataToDestination(byte[] data, int bytesRead, OutputStream out)
throws StopRequestException {
private void writeDataToDestination(byte[] data, int bytesRead, RandomAccessFile raf)
throws Exception {
try {
out.write(data, 0, bytesRead);
raf.write(data, 0, bytesRead);
return;
} catch (IOException ex) {
} catch (IOException e) {
// TODO: better differentiate between DRM and disk failures
// TODO: check disk is full
throw new StopRequestException(STATUS_FILE_ERROR,
"Failed to write data: " + ex);
throw e;
}
}
}
+410 -56
View File
@@ -2,24 +2,35 @@ package com.hippo.ehviewer.network;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import org.apache.http.conn.ConnectTimeoutException;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.exception.RedirectionException;
import com.hippo.ehviewer.exception.ResponseCodeException;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
/**
* It is not thread safe
@@ -30,79 +41,421 @@ import android.util.Log;
public class HttpHelper {
private static final String TAG = "HttpHelper";
private static final String userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36";
private static final int DEFAULT_TIMEOUT = 5 * 1000;
private static String DEFAULT_CHARSET = "utf-8";
private static String CHARSET_KEY = "charset=";
private int lastEMsgId = R.string.em_unknown_error;
private Context mContext;
private Exception mException;
public HttpHelper(Context context) {
mContext = context;
}
/**
* Get last error message id
* Get last error message
* @return
*/
public int getLastEMsgId() {
return lastEMsgId;
public String getEMsg() {
if (mException == null)
return mContext.getString(R.string.em_unknown_error);
else if (mException instanceof MalformedURLException)
return mContext.getString(R.string.em_url_format_error);
else if (mException instanceof ConnectTimeoutException ||
mException instanceof SocketTimeoutException)
return mContext.getString(R.string.em_timeout);
else if (mException instanceof UnknownHostException)
return mContext.getString(R.string.em_unknown_host);
else if (mException instanceof ResponseCodeException)
return String.format(mContext.getString(R.string.em_unexpected_response_code),
((ResponseCodeException)mException).getResponseCode());
else if (mException instanceof RedirectionException)
return mContext.getString(R.string.em_redirection_error);
else if (mException instanceof SocketException)
return "SocketException : " + mException.getMessage();
else
return mException.getMessage();
}
private String getPageContext(HttpURLConnection conn)
throws IOException {
String pageContext = null;
InputStream is = null;
ByteArrayOutputStream baos = null;
try {
is = conn.getInputStream();
String encoding = conn.getContentEncoding();
if (encoding != null && encoding.equals("gzip"))
is = new GZIPInputStream(is);
baos = new ByteArrayOutputStream();
Util.copy(is, baos, Constant.BUFFER_SIZE);
// Get charset
String charset = null;
List<String> contentType = conn.getHeaderFields().get("Content-Type");
if (contentType != null) {
for (String item : contentType) {
if (item == null)
continue;
int index = -1;
if ((index = item.indexOf(CHARSET_KEY)) != -1) {
charset = item.substring(index + CHARSET_KEY.length());
break;
}
}
}
// Use default charset
if (charset == null) {
charset = DEFAULT_CHARSET;
}
pageContext = baos.toString(charset);
} catch (IOException e) {
throw e;
} finally {
Util.closeStreamQuietly(is);
Util.closeStreamQuietly(baos);
}
return pageContext;
}
public String get(String urlStr) {
mException = null;
int redirectionCount = 0;
URL url = null;
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http get " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
return getPageContext(conn);
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
default:
throw new ResponseCodeException(responseCode);
}
}
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
public String post(String urlStr, String[][] args) {
mException = null;
int redirectionCount = 0;
URL url = null;
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http post " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(true);
conn.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
StringBuilder sb = new StringBuilder();
int i = 0;
for (String[] arg : args) {
if (i != 0)
sb.append("&");
sb.append(URLEncoder.encode(arg[0], "UTF-8"));
sb.append("=");
sb.append(URLEncoder.encode(arg[1], "UTF-8"));
i++;
}
out.writeBytes(sb.toString());
out.flush();
out.close();
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
return getPageContext(conn);
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
default:
throw new ResponseCodeException(responseCode);
}
}
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
public String post(String urlStr, String str) {
mException = null;
int redirectionCount = 0;
URL url = null;
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http post " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(true);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
out.writeBytes(str);
out.flush();
out.close();
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
return getPageContext(conn);
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
default:
throw new ResponseCodeException(responseCode);
}
}
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
public String postJson(String urlStr, String jsonStr) {
mException = null;
int redirectionCount = 0;
URL url = null;
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http post " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(true);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Accept", "application/json");
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
out.writeBytes(jsonStr);
out.flush();
out.close();
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
return getPageContext(conn);
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
default:
throw new ResponseCodeException(responseCode);
}
}
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
public Bitmap getImage(String urlStr, String key,
LruCache<String, Bitmap> memoryCache,
DiskCache diskCache, boolean getImage) {
mException = null;
int redirectionCount = 0;
URL url = null;
HttpURLConnection conn = null;
ByteArrayOutputStream baos = null;
InputStream is = null;
Bitmap bitmap = null;
try {
Log.d(TAG, "Get Image " + urlStr);
URL url = new URL(urlStr);
conn = (HttpURLConnection)url.openConnection();
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.connect();
is = conn.getInputStream();
if (diskCache == null) {
if (getImage
&& (bitmap = BitmapFactory.decodeStream(is, null, Ui.getBitmapOpt())) != null) {
if (memoryCache != null)
memoryCache.put(key, bitmap);
}
} else {
boolean twice = memoryCache != null || getImage;
if (twice) {
baos = new ByteArrayOutputStream();
Util.copy(is, baos);
byte[] bytes = baos.toByteArray();
// To disk cache
is = new ByteArrayInputStream(bytes);
diskCache.put(key, is);
is.close();
//
is = new ByteArrayInputStream(bytes);
Bitmap bmp = BitmapFactory.decodeStream(is, null, Ui.getBitmapOpt());
if (bmp != null) {
if (memoryCache != null)
memoryCache.put(key, bmp);
if (getImage)
bitmap = bmp;
Log.d(TAG, "Http get bitmap " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection)url.openConnection();
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
Bitmap bitmap = null;
is = conn.getInputStream();
if (diskCache == null) {
if (getImage
&& (bitmap = BitmapFactory.decodeStream(is, null, Ui.getBitmapOpt())) != null) {
if (memoryCache != null)
memoryCache.put(key, bitmap);
}
} else {
boolean twice = memoryCache != null || getImage;
if (twice) {
baos = new ByteArrayOutputStream();
Util.copy(is, baos);
byte[] bytes = baos.toByteArray();
// To disk cache
is = new ByteArrayInputStream(bytes);
diskCache.put(key, is);
is.close();
//
is = new ByteArrayInputStream(bytes);
Bitmap bmp = BitmapFactory.decodeStream(is, null, Ui.getBitmapOpt());
if (bmp != null) {
if (memoryCache != null)
memoryCache.put(key, bmp);
if (getImage)
bitmap = bmp;
}
is.close();
baos.close();
} else {
diskCache.put(key, is);
}
}
is.close();
baos.close();
} else {
diskCache.put(key, is);
return bitmap;
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
default:
throw new ResponseCodeException(responseCode);
}
}
} catch (MalformedURLException e) {
lastEMsgId = R.string.em_url_error;
e.printStackTrace();
} catch (ConnectTimeoutException e) {
lastEMsgId = R.string.em_timeout;
e.printStackTrace();
} catch (UnknownHostException e) {
lastEMsgId = R.string.em_no_network_2;
e.printStackTrace();
} catch (IOException e) {
lastEMsgId = R.string.em_network_error;
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (baos != null)
Util.closeStreamQuietly(baos);
@@ -111,6 +464,7 @@ public class HttpHelper {
if (conn != null)
conn.disconnect();
}
return bitmap;
mException = new RedirectionException();
return null;
}
}
@@ -1,31 +0,0 @@
package com.hippo.ehviewer.network;
class StopRequestException extends Exception {
private final int mFinalStatus;
public StopRequestException(int finalStatus, String message) {
super(message);
mFinalStatus = finalStatus;
}
public StopRequestException(int finalStatus, Throwable t) {
super(t);
mFinalStatus = finalStatus;
}
public StopRequestException(int finalStatus, String message, Throwable t) {
super(message, t);
mFinalStatus = finalStatus;
}
public int getFinalStatus() {
return mFinalStatus;
}
public static StopRequestException throwUnhandledHttpError(int code, String message)
throws StopRequestException {
final String error = "Unhandled HTTP response: " + code + " " + message;
throw new StopRequestException(code, error);
}
}
@@ -3,11 +3,13 @@ package com.hippo.ehviewer.service;
import java.util.HashMap;
import java.util.Map;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.DownloadInfo;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.activity.DownloadActivity;
import com.hippo.ehviewer.util.Download;
import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.EhClient.DownloadMangaManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -17,7 +19,7 @@ import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
public class DownloadService extends Service {
private static final int DOWNLOAD_NOTIFY_ID = -1;
@@ -27,16 +29,20 @@ public class DownloadService extends Service {
public static final String KEY_INDEX = "index";
public static final String KEY_STATE = "state";
private AppContext mAppContext;
private ServiceBinder mBinder = null;
private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;
private DownloadMangaManager downloadMangaManager;
@Override
public void onCreate() {
super.onCreate();
Log.d(TAG, "Service onCreate");
mAppContext = (AppContext)getApplication();
mBinder = new ServiceBinder();
mNotifyManager = (NotificationManager)
@@ -48,8 +54,10 @@ public class DownloadService extends Service {
PendingIntent pendingIntent = PendingIntent.getActivity(DownloadService.this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(pendingIntent);
EhClient.DownloadMangaManager.setDownloadService(this);
EhClient.DownloadMangaManager.setOnDownloadMangaListener(new EhClient.OnDownloadMangaListener() {
downloadMangaManager = mAppContext.getEhClient().new DownloadMangaManager();
downloadMangaManager.setDownloadService(this);
downloadMangaManager.setOnDownloadMangaListener(new EhClient.OnDownloadMangaListener() {
@Override
public void onDownloadMangaAllStart() {
mBuilder.setContentTitle(getString(R.string.start_download_task))
@@ -90,6 +98,7 @@ public class DownloadService extends Service {
.setProgress(pageSum, startIndex, false).setOngoing(true)
.setAutoCancel(false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
mNotifyManager.cancel(Integer.parseInt(id));
}
}
@@ -116,12 +125,17 @@ public class DownloadService extends Service {
@Override
public void onDownloadPage(String id, int pageSum, int index) {
mBuilder.setContentTitle(getString(R.string.downloading)
+ " " + Download.get(id).title)
.setContentText(index + " / " + pageSum)
.setProgress(pageSum, index, false).setOngoing(true)
.setAutoCancel(false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
DownloadInfo di = Download.get(id);
if (di == null)
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
else {
mBuilder.setContentTitle(getString(R.string.downloading)
+ " " + di.title)
.setContentText(index + " / " + pageSum)
.setProgress(pageSum, index, false).setOngoing(true)
.setAutoCancel(false);
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
}
}
@Override
@@ -200,11 +214,11 @@ public class DownloadService extends Service {
|| di.status == DownloadInfo.WAITING)
return;
di.status = DownloadInfo.WAITING;
EhClient.DownloadMangaManager.add(di);
downloadMangaManager.add(di);
}
public void cancel(String id) {
EhClient.DownloadMangaManager.cancel(id);
downloadMangaManager.cancel(id);
}
public void notifyUpdate(){
+1 -1
View File
@@ -6,7 +6,7 @@ import android.graphics.Bitmap;
import android.os.Build;
import android.os.Environment;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.MangaDetail;
+22 -5
View File
@@ -1,7 +1,5 @@
package com.hippo.ehviewer.util;
import com.hippo.ehviewer.view.MangaImage;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
@@ -29,6 +27,9 @@ public class Config {
private static final String DOWNLOAD_PATH = "preference_download_path";
private static final String DOWNLOAD_PATH_DEFAULT = Environment.getExternalStorageDirectory() + "/EhViewer/download/";
private static final String UPDATE_SERVER = "preference_update_server";
private static final String UPDATE_SERVER_DEFAULT = "1";
private static boolean mInit = false;
private static Context mContext;
@@ -46,9 +47,6 @@ public class Config {
mContext = context;
mConfigPre = PreferenceManager.getDefaultSharedPreferences(mContext);
// Init what in config
MangaImage.setMode(getPageScalingMode());
}
/**
@@ -195,4 +193,23 @@ public class Config {
mConfigPre.edit().putInt(KEY_UPDATE_DATE, date).apply();
}
public static String getUpdateServer() {
int value = 1;
try {
value = Integer.parseInt(mConfigPre.getString(UPDATE_SERVER, null));
} catch (Exception e) {
mConfigPre.edit().putString(UPDATE_SERVER, UPDATE_SERVER_DEFAULT)
.apply();
}
switch (value) {
case 1:
return "qiniu";
case 0:
default:
return "google";
}
}
}
+196 -196
View File
@@ -1,196 +1,196 @@
package com.hippo.ehviewer.util;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
public class Crash {
private static final String TAG = "Crash";
private static Context mContext;
private static String externalCrashFilePath = "/EhViewer/crash";
private static String internalCrashFilePath = "/crash";
private static final String NEW_CRAHS = "new_crash";
private static final String LAST_CRASH_POSITION = "last_crash_position";
private static final String LAST_CRASH_NAME = "last_crash_name";
private static DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
private static boolean mInit = false;
/**
* Init Crash
*
* @param context Application context
*/
public static void init(Context context) {
if (mInit)
return;
mInit = true;
mContext = context;
}
/**
* Is init
* @return True if init
*/
public static boolean isInit() {
return mInit;
}
/**
* Save throwable infomation to file
*
* @param ex The throwable to store
*/
public static void saveCrashInfo2File(Throwable ex) {
StringBuffer sb = new StringBuffer();
collectDeviceInfo(sb);
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
Throwable cause = ex.getCause();
while (cause != null) {
cause.printStackTrace(printWriter);
cause = cause.getCause();
}
printWriter.close();
String result = writer.toString();
Log.e(TAG, result);
sb.append("======== CrashInfo ========\n");
sb.append(result);
try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "crash-" + time + "-" + timestamp + ".log";
String path = null;
boolean position = false;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
path = Environment.getExternalStorageDirectory() + externalCrashFilePath;
position = true;
}
else {
path = mContext.getFilesDir() + internalCrashFilePath;
position = false;
}
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
FileOutputStream fos = new FileOutputStream(new File(path, fileName));
fos.write(sb.toString().getBytes());
fos.close();
// Record info for next time upload
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
SharedPreferences.Editor editor = configPre.edit();
editor.putBoolean(NEW_CRAHS, true);
editor.putBoolean(LAST_CRASH_POSITION, position);
editor.putString(LAST_CRASH_NAME, fileName);
editor.commit();
} catch (Exception e) {
Log.e(TAG, "An error occured while writing crash file...", e);
}
}
private static void collectDeviceInfo(StringBuffer sb) {
try {
PackageManager pm = mContext.getPackageManager();
PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);
if (pi != null) {
String versionName = pi.versionName == null ? "null" : pi.versionName;
String versionCode = String.valueOf(pi.versionCode);
sb.append("======== PackageInfo ========\n");
sb.append("PackageName=" + pi.packageName + "\n");
sb.append("VersionName=" + versionName + "\n");
sb.append("VersionCode=" + versionCode + "\n");
sb.append("\n");
}
} catch (NameNotFoundException e) {
Log.e(TAG, "an error occured when collect package info", e);
}
sb.append("======== DeviceInfo ========\n");
sb.append("BOARD=" + Build.BOARD + "\n");
sb.append("BOOTLOADER=" + Build.BOOTLOADER + "\n");
sb.append("CPU_ABI=" + Build.CPU_ABI + "\n");
sb.append("CPU_ABI2=" + Build.CPU_ABI2 + "\n");
sb.append("DEVICE=" + Build.DEVICE + "\n");
sb.append("DISPLAY=" + Build.DISPLAY + "\n");
sb.append("FINGERPRINT=" + Build.FINGERPRINT + "\n");
sb.append("HARDWARE=" + Build.HARDWARE + "\n");
sb.append("HOST=" + Build.HOST + "\n");
sb.append("ID=" + Build.ID + "\n");
sb.append("MANUFACTURER=" + Build.MANUFACTURER + "\n");
sb.append("MODEL=" + Build.MODEL + "\n");
sb.append("PRODUCT=" + Build.PRODUCT + "\n");
sb.append("RADIO=" + Build.getRadioVersion() + "\n");
sb.append("SERIAL=" + Build.SERIAL + "\n");
sb.append("TAGS=" + Build.TAGS + "\n");
sb.append("TYPE=" + Build.TYPE + "\n");
sb.append("USER=" + Build.USER + "\n");
sb.append("CODENAME=" + Build.VERSION.CODENAME + "\n");
sb.append("INCREMENTAL=" + Build.VERSION.INCREMENTAL + "\n");
sb.append("RELEASE=" + Build.VERSION.RELEASE + "\n");
sb.append("SDK=" + Build.VERSION.SDK_INT + "\n");
sb.append("\n");
}
/**
* Check is there last crash
*
* @return Return the crash String or null if there is no
*/
public static String getLastCrash() {
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
if (!configPre.getBoolean(NEW_CRAHS, false))
return null;
boolean position = configPre.getBoolean(LAST_CRASH_POSITION, false);
String lastCrashName;
if ((lastCrashName = configPre.getString(LAST_CRASH_NAME, null)) == null)
return null;
File lastCrashFile;
if (position) {
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
return null;
lastCrashFile = new File(Environment.getExternalStorageDirectory() + externalCrashFilePath, lastCrashName);
}
else {
lastCrashFile = new File(mContext.getFilesDir() + internalCrashFilePath, lastCrashName);
}
if (!lastCrashFile.isFile())
return null;
try {
byte[] buffer = new byte[(int) lastCrashFile.length()];
DataInputStream din = new DataInputStream(new FileInputStream(lastCrashFile));
din.readFully(buffer);
din.close();
configPre.edit().putBoolean(NEW_CRAHS, false).commit();
return new String(buffer);
} catch (Exception e) {
Log.e(TAG, "An error occured while reading crash file...", e);
}
return null;
}
}
package com.hippo.ehviewer.util;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Environment;
import com.hippo.ehviewer.util.Log;
public class Crash {
private static final String TAG = "Crash";
private static Context mContext;
private static String externalCrashFilePath = "/EhViewer/crash";
private static String internalCrashFilePath = "/crash";
private static final String NEW_CRAHS = "new_crash";
private static final String LAST_CRASH_POSITION = "last_crash_position";
private static final String LAST_CRASH_NAME = "last_crash_name";
private static DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
private static boolean mInit = false;
/**
* Init Crash
*
* @param context Application context
*/
public static void init(Context context) {
if (mInit)
return;
mInit = true;
mContext = context;
}
/**
* Is init
* @return True if init
*/
public static boolean isInit() {
return mInit;
}
/**
* Save throwable infomation to file
*
* @param ex The throwable to store
*/
public static void saveCrashInfo2File(Throwable ex) {
StringBuffer sb = new StringBuffer();
collectDeviceInfo(sb);
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
Throwable cause = ex.getCause();
while (cause != null) {
cause.printStackTrace(printWriter);
cause = cause.getCause();
}
printWriter.close();
String result = writer.toString();
Log.e(TAG, result);
sb.append("======== CrashInfo ========\n");
sb.append(result);
try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "crash-" + time + "-" + timestamp + ".log";
String path = null;
boolean position = false;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
path = Environment.getExternalStorageDirectory() + externalCrashFilePath;
position = true;
}
else {
path = mContext.getFilesDir() + internalCrashFilePath;
position = false;
}
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
FileOutputStream fos = new FileOutputStream(new File(path, fileName));
fos.write(sb.toString().getBytes());
fos.close();
// Record info for next time upload
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
SharedPreferences.Editor editor = configPre.edit();
editor.putBoolean(NEW_CRAHS, true);
editor.putBoolean(LAST_CRASH_POSITION, position);
editor.putString(LAST_CRASH_NAME, fileName);
editor.commit();
} catch (Exception e) {
Log.e(TAG, "An error occured while writing crash file...", e);
}
}
private static void collectDeviceInfo(StringBuffer sb) {
try {
PackageManager pm = mContext.getPackageManager();
PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);
if (pi != null) {
String versionName = pi.versionName == null ? "null" : pi.versionName;
String versionCode = String.valueOf(pi.versionCode);
sb.append("======== PackageInfo ========\n");
sb.append("PackageName=" + pi.packageName + "\n");
sb.append("VersionName=" + versionName + "\n");
sb.append("VersionCode=" + versionCode + "\n");
sb.append("\n");
}
} catch (NameNotFoundException e) {
Log.e(TAG, "an error occured when collect package info", e);
}
sb.append("======== DeviceInfo ========\n");
sb.append("BOARD=" + Build.BOARD + "\n");
sb.append("BOOTLOADER=" + Build.BOOTLOADER + "\n");
sb.append("CPU_ABI=" + Build.CPU_ABI + "\n");
sb.append("CPU_ABI2=" + Build.CPU_ABI2 + "\n");
sb.append("DEVICE=" + Build.DEVICE + "\n");
sb.append("DISPLAY=" + Build.DISPLAY + "\n");
sb.append("FINGERPRINT=" + Build.FINGERPRINT + "\n");
sb.append("HARDWARE=" + Build.HARDWARE + "\n");
sb.append("HOST=" + Build.HOST + "\n");
sb.append("ID=" + Build.ID + "\n");
sb.append("MANUFACTURER=" + Build.MANUFACTURER + "\n");
sb.append("MODEL=" + Build.MODEL + "\n");
sb.append("PRODUCT=" + Build.PRODUCT + "\n");
sb.append("RADIO=" + Build.getRadioVersion() + "\n");
sb.append("SERIAL=" + Build.SERIAL + "\n");
sb.append("TAGS=" + Build.TAGS + "\n");
sb.append("TYPE=" + Build.TYPE + "\n");
sb.append("USER=" + Build.USER + "\n");
sb.append("CODENAME=" + Build.VERSION.CODENAME + "\n");
sb.append("INCREMENTAL=" + Build.VERSION.INCREMENTAL + "\n");
sb.append("RELEASE=" + Build.VERSION.RELEASE + "\n");
sb.append("SDK=" + Build.VERSION.SDK_INT + "\n");
sb.append("\n");
}
/**
* Check is there last crash
*
* @return Return the crash String or null if there is no
*/
public static String getLastCrash() {
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
if (!configPre.getBoolean(NEW_CRAHS, false))
return null;
boolean position = configPre.getBoolean(LAST_CRASH_POSITION, false);
String lastCrashName;
if ((lastCrashName = configPre.getString(LAST_CRASH_NAME, null)) == null)
return null;
File lastCrashFile;
if (position) {
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
return null;
lastCrashFile = new File(Environment.getExternalStorageDirectory() + externalCrashFilePath, lastCrashName);
}
else {
lastCrashFile = new File(mContext.getFilesDir() + internalCrashFilePath, lastCrashName);
}
if (!lastCrashFile.isFile())
return null;
try {
byte[] buffer = new byte[(int) lastCrashFile.length()];
DataInputStream din = new DataInputStream(new FileInputStream(lastCrashFile));
din.readFully(buffer);
din.close();
configPre.edit().putBoolean(NEW_CRAHS, false).commit();
return new String(buffer);
} catch (Exception e) {
Log.e(TAG, "An error occured while reading crash file...", e);
}
return null;
}
}
File diff suppressed because it is too large. Load diff
+59
View File
@@ -0,0 +1,59 @@
package com.hippo.ehviewer.util;
public class Log {
private static final String NULL = "null";
public static int v(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.v(tag, msg);
}
public static int v(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.v(tag, msg, tr);
}
public static int d(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.d(tag, msg);
}
public static int d(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.d(tag, msg, tr);
}
public static int i(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.i(tag, msg);
}
public static int i(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.i(tag, msg, tr);
}
public static int w(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.w(tag, msg);
}
public static int w(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.w(tag, msg, tr);
}
public static int w(String tag, Throwable tr) {
return android.util.Log.w(tag, tr);
}
public static int e(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.e(tag, msg);
}
public static int e(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.e(tag, msg, tr);
}
}
+1 -1
View File
@@ -16,7 +16,7 @@
package com.hippo.ehviewer.util;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
-2
View File
@@ -2,7 +2,6 @@ package com.hippo.ehviewer.util;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.view.OlImageView;
import android.annotation.SuppressLint;
import android.content.Context;
@@ -80,7 +79,6 @@ public class Ui {
BITMAP_LAUNCH = BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.ic_launcher), null, opt);
BITMAP_TOUCH = BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.ic_touch), null, opt);
OlImageView.setDefaultImage(BITMAP_LAUNCH, BITMAP_TOUCH);
}
/**
+17 -24
View File
@@ -1,45 +1,22 @@
package com.hippo.ehviewer.util;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.view.OlImageView;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.util.LruCache;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.ImageView;
public class Util {
@SuppressWarnings("unused")
private static String TAG = "Util";
/**
@@ -214,4 +191,20 @@ public class Util {
} catch (NumberFormatException e) {}
return time;
}
private static String[] SIZE_UNIT = {"%.2f B", "%.2f KB", "%.2f MB", "%.2f GB"};
public static String sizeToString(long size) {
int length = SIZE_UNIT.length;
float sizeFloat = (float)size;
for (int i = 0; i < length; i++) {
if (sizeFloat < 1024 || i == length - 1) {
return String.format(SIZE_UNIT[i], sizeFloat);
}
sizeFloat /= 1024;
}
return null;
}
}
+19 -19
View File
@@ -1,19 +1,19 @@
package com.hippo.ehviewer.view;
import android.content.Context;
import android.util.AttributeSet;
public class CoverImageView extends OlImageView{
public CoverImageView(Context context) {
super(context);
}
public CoverImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CoverImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
}
package com.hippo.ehviewer.view;
import android.content.Context;
import android.util.AttributeSet;
public class CoverImageView extends OlImageView{
public CoverImageView(Context context) {
super(context);
}
public CoverImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CoverImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
}
@@ -3,7 +3,7 @@ package com.hippo.ehviewer.view;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
-296
View File
@@ -1,296 +0,0 @@
package com.hippo.ehviewer.view;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;
// TODO point
// TODO when screen is locked and load image, image may not show
public class MangaImage extends OlImageView {
private static ArrayList<WeakReference<MangaImage>> mangaImageList = new ArrayList<WeakReference<MangaImage>>();
private static ArrayList<WeakReference<MangaImage>> delList = new ArrayList<WeakReference<MangaImage>>();
private static final String TAG = "MangaImage";
public static enum State {
NONE, ONE_DOWN, DRAG, ZOOM, POINT
};
public static enum Action {
ZOOM_IN, ZOOM_OUT
};
private static final Mode[] sModeArray = {
Mode.CENTER, Mode.FIT_WIDTH, Mode.FIT_HEIGHT, Mode.FIT, Mode.SHARED
};
public enum Mode {
CENTER(0),
FIT_WIDTH(1),
FIT_HEIGHT(2),
FIT(3),
SHARED(4);
Mode(int ni) {
nativeInt = ni;
}
final int nativeInt;
};
private State state;
private static Mode mMode = Mode.FIT;
private static Matrix sharedMatrix = new Matrix();
private Matrix matrix = new Matrix();
private Matrix preMatrix = new Matrix();
private float[] matrixValues = new float[9];
private PointF firstPoint = new PointF();
private PointF midPoint = new PointF();
private int aWidth;
private int aHeight;
private int viewWidth;
private int viewHeight;
public MangaImage(Context context) {
super(context);
cleanList();
mangaImageList.add(new WeakReference<MangaImage>(this));
setListener();
}
public MangaImage(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MangaImage(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
cleanList();
mangaImageList.add(new WeakReference<MangaImage>(this));
setListener();
}
public static void setMode(int mode) {
mMode = sModeArray[mode];
for (WeakReference<MangaImage> weakMangaImage : mangaImageList) {
MangaImage mangaImage = null;
if ((mangaImage = weakMangaImage.get()) != null) {
mangaImage.resetMatrix();
mangaImage.setImageMatrix();
}
}
}
private static void cleanList() {
for (WeakReference<MangaImage> weakMangaImage : mangaImageList) {
if (weakMangaImage.get() == null)
delList.add(weakMangaImage);
}
for (WeakReference<MangaImage> weakMangaImage : delList) {
mangaImageList.remove(weakMangaImage);
}
delList.clear();
}
private void setListener() {
setOnLoadListener(new OnLoadListener() {
@Override
public void onLoadCompleted(boolean ok) {
if (!ok)
return;
viewWidth = getWidth();
viewHeight = getHeight();
setScaleType(ScaleType.MATRIX);
resetMatrix();
matrix.getValues(matrixValues);
aWidth = (int) (getResourceWidth() * matrixValues[Matrix.MSCALE_X]);
aHeight = (int) (getResourceHeight() * matrixValues[Matrix.MSCALE_Y]);
setImageMatrix();
state = State.NONE;
setOnTouchListener(new MangaImageListener());
}
});
}
public void setImageMatrix() {
setImageMatrix(matrix);
}
private void resetMatrix() {
matrix.reset();
float scale;
int actWidth = getResourceWidth();
int actHeight = getResourceHeight();
switch (mMode) {
case CENTER:
matrix.preTranslate((viewWidth - actWidth) / 2f, (viewHeight - actHeight) / 2f);
break;
case FIT_WIDTH:
scale = (float)viewWidth/actWidth;
matrix.preScale(scale, scale);
matrix.preTranslate((viewWidth - actWidth*scale) / scale / 2f, (viewHeight - actHeight*scale) / scale / 2f);
break;
case FIT_HEIGHT:
scale = (float)viewHeight/actHeight;
matrix.preScale(scale, scale);
matrix.preTranslate((viewWidth - actWidth*scale) / scale / 2f, (viewHeight - actHeight*scale) / scale / 2f);
break;
case FIT:
float scaleX = (float)viewWidth/actWidth;
float scaleY = (float)viewHeight/actHeight;
scale = scaleX < scaleY ? scaleX : scaleY;
matrix.preScale(scale, scale);
matrix.preTranslate((viewWidth - actWidth*scale) / scale / 2f, (viewHeight - actHeight*scale) / scale / 2f);
break;
case SHARED:
break;
}
}
public boolean canScroll(int direction) {
matrix.getValues(matrixValues);
int xOffset = (int) matrixValues[Matrix.MTRANS_X];
if (state == State.ZOOM)
return true;
if (aWidth <= viewWidth) {
return false;
} else if (xOffset == 0 && direction > 0) {
return false;
} else if (xOffset == viewWidth - aWidth && direction < 0) {
return false;
}
return true;
}
private class MangaImageListener implements OnTouchListener {
float dist = 0f;
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
preMatrix.set(matrix);
firstPoint.set(event.getX(), event.getY());
state = State.ONE_DOWN;
break;
case MotionEvent.ACTION_POINTER_DOWN:
dist = spacing(event);
if (dist > 10f) {
preMatrix.set(matrix);
midPoint(event);
state = State.ZOOM;
}
break;
case MotionEvent.ACTION_MOVE:
if (state == State.ONE_DOWN)
state = State.DRAG;
if (state == State.DRAG) {
matrix.set(preMatrix);
matrix.postTranslate(event.getX() - firstPoint.x,
event.getY() - firstPoint.y);
} else if (state == State.ZOOM) {
float newDist = spacing(event);
if (newDist > 10f) {
matrix.set(preMatrix);
float tScale = newDist / dist;
matrix.postScale(tScale, tScale, midPoint.x, midPoint.y);
}
}
break;
case MotionEvent.ACTION_UP:
if (state == State.ONE_DOWN)
state = State.POINT;
else
state = State.NONE;
break;
case MotionEvent.ACTION_CANCEL:
state = State.NONE;
break;
case MotionEvent.ACTION_OUTSIDE:
state = State.NONE;
break;
case MotionEvent.ACTION_POINTER_UP:
if (event.getActionIndex() == 1) {
preMatrix.set(matrix);
firstPoint.set(event.getX(0), event.getY(0));
state = State.DRAG;
} else if (event.getActionIndex() == 0) {
preMatrix.set(matrix);
firstPoint.set(event.getX(1), event.getY(1));
state = State.DRAG;
}
break;
}
if (state == State.POINT) {
Toast.makeText(
MangaImage.this.getContext(),
"Point : x = " + firstPoint.x + ", y = " + firstPoint.y,
Toast.LENGTH_SHORT).show();
//int pointAction =
state = State.NONE;
} else if (state == State.DRAG || state == State.ZOOM) {
checkBorder();
MangaImage.this.setImageMatrix(matrix);
}
return true;
}
private float spacing(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return (float) Math.sqrt(x * x + y * y);
}
private void midPoint(MotionEvent event) {
float x = event.getX(0) + event.getX(1);
float y = event.getY(0) + event.getY(1);
midPoint.set(x / 2, y / 2);
}
private void checkBorder() {
matrix.getValues(matrixValues);
aWidth = (int) (MangaImage.this.getResourceWidth() * matrixValues[Matrix.MSCALE_X]);
aHeight = (int) (MangaImage.this.getResourceHeight() * matrixValues[Matrix.MSCALE_Y]);
viewWidth = MangaImage.this.getWidth();
viewHeight = MangaImage.this.getHeight();
if (aWidth > viewWidth) {
if (matrixValues[Matrix.MTRANS_X] > 0)
matrixValues[Matrix.MTRANS_X] = 0;
else if (matrixValues[Matrix.MTRANS_X] < viewWidth - aWidth)
matrixValues[Matrix.MTRANS_X] = viewWidth - aWidth;
} else {
matrixValues[Matrix.MTRANS_X] = (viewWidth - aWidth) / 2;
}
if (aHeight > viewHeight) {
if (matrixValues[Matrix.MTRANS_Y] > 0)
matrixValues[Matrix.MTRANS_Y] = 0;
else if (matrixValues[5] < viewHeight - aHeight)
matrixValues[Matrix.MTRANS_Y] = viewHeight - aHeight;
} else {
matrixValues[Matrix.MTRANS_Y] = (viewHeight - aHeight) / 2;
}
matrix.setValues(matrixValues);
}
}
}
@@ -1,51 +0,0 @@
package com.hippo.ehviewer.view;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
public class MangaViewPager extends ViewPager {
private GestureDetector mGestureDetector;
public float distanceX;
public MangaViewPager(Context context) {
super(context);
mGestureDetector = new GestureDetector(this.getContext()
, new OnScrollListener());
}
public MangaViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
mGestureDetector = new GestureDetector(this.getContext()
, new OnScrollListener());
}
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof MangaImage) {
return ((MangaImage) v).canScroll(dx);
} else {
return super.canScroll(v, checkV, dx, x, y);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean re = super.onTouchEvent(event);
mGestureDetector.onTouchEvent(event);
return re;
}
class OnScrollListener extends SimpleOnGestureListener {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY) {
MangaViewPager.this.distanceX = distanceX;
return true;
}
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ import android.graphics.Bitmap;
import android.graphics.Movie;
import android.support.v4.util.LruCache;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
public class OlImageView extends SuperImageView {
File diff suppressed because it is too large. Load diff
@@ -10,7 +10,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -132,8 +132,7 @@ public class AutoWrapLayout extends ViewGroup {
int maxRightNoPadding = rightBound;
int bottomBound;
int lastMaxBottom = paddingTop;
int maxBottom = lastMaxBottom; // maxBottom is maxBottomNoPadding
//int maxBottomNoPadding = maxBottom;
int maxBottom = lastMaxBottom;
int childWidth;
int childHeight;
@@ -1,266 +1,266 @@
package com.hippo.ehviewer.dialog;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.view.AlertButton;
import android.app.AlertDialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
public class DialogBuilder extends AlertDialog.Builder{
private View mView;
private Context mContext;
public DialogBuilder(Context context) {
super(context);
mContext = context;
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mView = inflater.inflate(R.layout.dialog, null);
super.setView(mView);
}
/**
* Set the title using the given resource id.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setTitle(int titleId) {
setTitle(mContext.getText(titleId));
return this;
}
/**
* Set the title displayed in the {@link Dialog}.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setTitle(CharSequence title) {
TextView titleView = (TextView)mView.findViewById(R.id.title);
titleView.setVisibility(View.VISIBLE);
titleView.setText(title);
return this;
}
/**
* Set the message to display using the given resource id.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setMessage(int messageId) {
setMessage(mContext.getText(messageId));
return this;
}
/**
* Set the message to display.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setMessage(CharSequence message) {
ScrollView scrollView = (ScrollView)mView.findViewById(R.id.scroll_view);
scrollView.setVisibility(View.VISIBLE);
TextView messageView = (TextView)mView.findViewById(R.id.message);
messageView.setVisibility(View.VISIBLE);
messageView.setText(message);
return this;
}
public DialogBuilder setLongMessage(int messageId) {
setLongMessage(mContext.getText(messageId));
return this;
}
public DialogBuilder setLongMessage(CharSequence message) {
ScrollView scrollView = (ScrollView)mView.findViewById(R.id.scroll_view);
scrollView.setVisibility(View.VISIBLE);
TextView messageView = (TextView)mView.findViewById(R.id.message);
messageView.setVisibility(View.VISIBLE);
messageView.setText(message);
LinearLayout.LayoutParams lp =
(LinearLayout.LayoutParams)messageView.getLayoutParams();
lp.setMargins(lp.leftMargin, lp.topMargin/3,
lp.rightMargin, lp.bottomMargin/3);
return this;
}
/**
* Set the view to display in that dialog.
* @return
*/
public DialogBuilder setView(View view, boolean center) {
ScrollView scrollView = (ScrollView)mView.findViewById(R.id.scroll_view);
scrollView.setVisibility(View.VISIBLE);
LinearLayout customLayout = (LinearLayout)mView.findViewById(R.id.custom);
customLayout.setVisibility(View.VISIBLE);
if (center) {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER;
customLayout.addView(view, lp);
} else {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
customLayout.addView(view, lp);
}
return this;
}
/**
* Set a listener to be invoked when the positive button of the dialog is pressed.
* @param textId The resource id of the text to display in the positive button
* @param listener The View.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setPositiveButton(int textId, final View.OnClickListener listener) {
setPositiveButton(mContext.getText(textId), listener);
return this;
}
/**
* Set a listener to be invoked when the positive button of the dialog is pressed.
* @param text The text to display in the positive button
* @param listener The View.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setPositiveButton(CharSequence text, final View.OnClickListener listener) {
Button button = (Button)mView.findViewById(R.id.positive_button);
button.setVisibility(View.VISIBLE);
button.setText(text);
button.setOnClickListener(listener);
return this;
}
/**
* Set a listener to be invoked when the negative button of the dialog is pressed.
* @param textId The resource id of the text to display in the negative button
* @param listener The DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNegativeButton(int textId, final View.OnClickListener listener) {
setNegativeButton(mContext.getText(textId), listener);
return this;
}
/**
* Set a listener to be invoked when the negative button of the dialog is pressed.
* @param text The text to display in the negative button
* @param listener The DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNegativeButton(CharSequence text, final View.OnClickListener listener) {
Button button = (Button)mView.findViewById(R.id.negative_button);
button.setVisibility(View.VISIBLE);
button.setText(text);
button.setOnClickListener(listener);
return this;
}
/**
* Set a listener to be invoked when the neutral button of the dialog is pressed.
* @param textId The resource id of the text to display in the neutral button
* @param listener The DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNeutralButton(int textId, final View.OnClickListener listener) {
setNeutralButton(mContext.getText(textId), listener);
return this;
}
/**
* Set a listener to be invoked when the neutral button of the dialog is pressed.
* @param text The text to display in the neutral button
* @param listener The View.DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNeutralButton(CharSequence text, final View.OnClickListener listener) {
Button button = (Button)mView.findViewById(R.id.neutral_button);
button.setVisibility(View.VISIBLE);
button.setText(text);
button.setOnClickListener(listener);
return this;
}
/**
* Sets whether the dialog is cancelable or not. Default is true.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setCancelable(boolean cancelable) {
super.setCancelable(cancelable);
return this;
}
/**
* Set a list of items to be displayed in the dialog as the content, you will be notified of the
* selected item via the supplied listener. This should be an array type i.e. R.array.foo
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setItems(int itemsId, AdapterView.OnItemClickListener listener) {
setItems(mContext.getResources().getTextArray(itemsId), listener);
return this;
}
/**
* Set a list of items to be displayed in the dialog as the content, you will be notified of the
* selected item via the supplied listener.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setItems(CharSequence[] items, AdapterView.OnItemClickListener listener) {
setAdapter(new ArrayAdapter<CharSequence>(mContext,
R.layout.list_item_text, items), listener);
return this;
}
/**
* Set a list of items, which are supplied by the given {@link ListAdapter}, to be
* displayed in the dialog as the content, you will be notified of the
* selected item via the supplied listener.
*
* @param adapter The {@link ListAdapter} to supply the list of items
* @param listener The listener that will be called when an item is clicked.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setAdapter(ListAdapter adapter, AdapterView.OnItemClickListener listener) {
ListView listView = (ListView)mView.findViewById(R.id.list);
listView.setVisibility(View.VISIBLE);
listView.setAdapter(adapter);
listView.setOnItemClickListener(listener);
return this;
}
public AlertDialog create() {
AlertDialog dialog = super.create();
AlertButton button = (AlertButton)mView.findViewById(R.id.positive_button);
button.dialog = dialog;
button = (AlertButton)mView.findViewById(R.id.negative_button);
button.dialog = dialog;
button = (AlertButton)mView.findViewById(R.id.neutral_button);
button.dialog = dialog;
return dialog;
}
}
package com.hippo.ehviewer.widget;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.view.AlertButton;
import android.app.AlertDialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ScrollView;
import android.widget.TextView;
public class DialogBuilder extends AlertDialog.Builder{
private View mView;
private Context mContext;
public DialogBuilder(Context context) {
super(context);
mContext = context;
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mView = inflater.inflate(R.layout.dialog, null);
super.setView(mView);
}
/**
* Set the title using the given resource id.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setTitle(int titleId) {
setTitle(mContext.getText(titleId));
return this;
}
/**
* Set the title displayed in the {@link Dialog}.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setTitle(CharSequence title) {
TextView titleView = (TextView)mView.findViewById(R.id.title);
titleView.setVisibility(View.VISIBLE);
titleView.setText(title);
return this;
}
/**
* Set the message to display using the given resource id.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setMessage(int messageId) {
setMessage(mContext.getText(messageId));
return this;
}
/**
* Set the message to display.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setMessage(CharSequence message) {
ScrollView scrollView = (ScrollView)mView.findViewById(R.id.scroll_view);
scrollView.setVisibility(View.VISIBLE);
TextView messageView = (TextView)mView.findViewById(R.id.message);
messageView.setVisibility(View.VISIBLE);
messageView.setText(message);
return this;
}
public DialogBuilder setLongMessage(int messageId) {
setLongMessage(mContext.getText(messageId));
return this;
}
public DialogBuilder setLongMessage(CharSequence message) {
ScrollView scrollView = (ScrollView)mView.findViewById(R.id.scroll_view);
scrollView.setVisibility(View.VISIBLE);
TextView messageView = (TextView)mView.findViewById(R.id.message);
messageView.setVisibility(View.VISIBLE);
messageView.setText(message);
LinearLayout.LayoutParams lp =
(LinearLayout.LayoutParams)messageView.getLayoutParams();
lp.setMargins(lp.leftMargin, lp.topMargin/3,
lp.rightMargin, lp.bottomMargin/3);
return this;
}
/**
* Set the view to display in that dialog.
* @return
*/
public DialogBuilder setView(View view, boolean center) {
ScrollView scrollView = (ScrollView)mView.findViewById(R.id.scroll_view);
scrollView.setVisibility(View.VISIBLE);
LinearLayout customLayout = (LinearLayout)mView.findViewById(R.id.custom);
customLayout.setVisibility(View.VISIBLE);
if (center) {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.CENTER;
customLayout.addView(view, lp);
} else {
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
customLayout.addView(view, lp);
}
return this;
}
/**
* Set a listener to be invoked when the positive button of the dialog is pressed.
* @param textId The resource id of the text to display in the positive button
* @param listener The View.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setPositiveButton(int textId, final View.OnClickListener listener) {
setPositiveButton(mContext.getText(textId), listener);
return this;
}
/**
* Set a listener to be invoked when the positive button of the dialog is pressed.
* @param text The text to display in the positive button
* @param listener The View.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setPositiveButton(CharSequence text, final View.OnClickListener listener) {
Button button = (Button)mView.findViewById(R.id.positive_button);
button.setVisibility(View.VISIBLE);
button.setText(text);
button.setOnClickListener(listener);
return this;
}
/**
* Set a listener to be invoked when the negative button of the dialog is pressed.
* @param textId The resource id of the text to display in the negative button
* @param listener The DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNegativeButton(int textId, final View.OnClickListener listener) {
setNegativeButton(mContext.getText(textId), listener);
return this;
}
/**
* Set a listener to be invoked when the negative button of the dialog is pressed.
* @param text The text to display in the negative button
* @param listener The DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNegativeButton(CharSequence text, final View.OnClickListener listener) {
Button button = (Button)mView.findViewById(R.id.negative_button);
button.setVisibility(View.VISIBLE);
button.setText(text);
button.setOnClickListener(listener);
return this;
}
/**
* Set a listener to be invoked when the neutral button of the dialog is pressed.
* @param textId The resource id of the text to display in the neutral button
* @param listener The DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNeutralButton(int textId, final View.OnClickListener listener) {
setNeutralButton(mContext.getText(textId), listener);
return this;
}
/**
* Set a listener to be invoked when the neutral button of the dialog is pressed.
* @param text The text to display in the neutral button
* @param listener The View.DialogInterface.OnClickListener to use.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setNeutralButton(CharSequence text, final View.OnClickListener listener) {
Button button = (Button)mView.findViewById(R.id.neutral_button);
button.setVisibility(View.VISIBLE);
button.setText(text);
button.setOnClickListener(listener);
return this;
}
/**
* Sets whether the dialog is cancelable or not. Default is true.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
@Override
public DialogBuilder setCancelable(boolean cancelable) {
super.setCancelable(cancelable);
return this;
}
/**
* Set a list of items to be displayed in the dialog as the content, you will be notified of the
* selected item via the supplied listener. This should be an array type i.e. R.array.foo
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setItems(int itemsId, AdapterView.OnItemClickListener listener) {
setItems(mContext.getResources().getTextArray(itemsId), listener);
return this;
}
/**
* Set a list of items to be displayed in the dialog as the content, you will be notified of the
* selected item via the supplied listener.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setItems(CharSequence[] items, AdapterView.OnItemClickListener listener) {
setAdapter(new ArrayAdapter<CharSequence>(mContext,
R.layout.list_item_text, items), listener);
return this;
}
/**
* Set a list of items, which are supplied by the given {@link ListAdapter}, to be
* displayed in the dialog as the content, you will be notified of the
* selected item via the supplied listener.
*
* @param adapter The {@link ListAdapter} to supply the list of items
* @param listener The listener that will be called when an item is clicked.
*
* @return This Builder object to allow for chaining of calls to set methods
*/
public DialogBuilder setAdapter(ListAdapter adapter, AdapterView.OnItemClickListener listener) {
ListView listView = (ListView)mView.findViewById(R.id.list);
listView.setVisibility(View.VISIBLE);
listView.setAdapter(adapter);
listView.setOnItemClickListener(listener);
return this;
}
public AlertDialog create() {
AlertDialog dialog = super.create();
AlertButton button = (AlertButton)mView.findViewById(R.id.positive_button);
button.dialog = dialog;
button = (AlertButton)mView.findViewById(R.id.negative_button);
button.dialog = dialog;
button = (AlertButton)mView.findViewById(R.id.neutral_button);
button.dialog = dialog;
return dialog;
}
}
@@ -35,7 +35,7 @@ import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewGroupCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -1,6 +1,5 @@
package com.hippo.ehviewer.widget;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
import android.content.Context;
@@ -8,7 +7,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
@@ -57,8 +55,6 @@ public class PullListView extends LinearLayout implements AbsListView.OnScrollLi
private boolean isHeaderRecored = false;
private boolean isFooterRecored = false;
private int mTouchSlop;
// Header String to show
private String mHeaderPullStr;
private String mHeaderReleaseStr;
@@ -228,14 +224,10 @@ public class PullListView extends LinearLayout implements AbsListView.OnScrollLi
mHeader.setPadding(headerOriginalLeftPadding, -headerHeight, headerOriginalRightPadding, headerOriginalBottomPadding);
mHeader.invalidate();
//mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
}
public void onScrollStateChanged(AbsListView view, int scrollState) {}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
@@ -0,0 +1,29 @@
package com.hippo.ehviewer.widget;
import com.hippo.ehviewer.R;
import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
public class SuperDialogUtil {
public static void setTitle(AlertDialog dialog, String title) {
TextView titleView = (TextView)dialog.findViewById(R.id.title);
titleView.setVisibility(View.VISIBLE);
titleView.setText(title);
}
public static AlertDialog createUpdateDialog(Context context, String version,
String size, String info, View.OnClickListener positiveListener,
View.OnClickListener negativeListener) {
return new DialogBuilder(context).setTitle(R.string.update).setCancelable(false)
.setMessage(String.format(context.getString(R.string.update_message), version, size, info))
.setPositiveButton(android.R.string.ok, positiveListener)
.setNegativeButton(android.R.string.cancel, negativeListener)
.create();
}
}
@@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
/**
* A cache that uses a bounded amount of space on a filesystem. Each cache entry