添加启动界面,使用自己的滑动控件,完成一大半,明天继续。

This commit is contained in:
seven332 committed 2014-03-21 00:51:47 +08:00
1 parent c6109bd0d4
commit 89c7beda26
43 files changed
+1724 -682

No files matched your search

+12 -3
View File
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="6"
android:versionName="0.3.1" >
android:versionName="0.3.0" >
<uses-sdk
android:minSdkVersion="14"
@@ -21,15 +21,24 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.hippo.ehviewer.StartActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar.Fullscreen"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.hippo.ehviewer.activity.MangaListActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
+12 -3
View File
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="6"
android:versionName="0.3.1" >
android:versionName="0.3.0" >
<uses-sdk
android:minSdkVersion="14"
@@ -21,15 +21,24 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.hippo.ehviewer.StartActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar.Fullscreen"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.hippo.ehviewer.activity.MangaListActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
BIN
View File
Binary file not shown.
+404 -458
View File
@@ -1,279 +1,243 @@
int anim slide_in_from_bottom 0x7f040000
int anim slide_in_from_top 0x7f040001
int anim slide_out_to_bottom 0x7f040002
int anim slide_out_to_top 0x7f040003
int array download_item_long_click 0x7f0a0006
int array favourite_item_long_click 0x7f0a0005
int array is_exhentai 0x7f0a0009
int array list_item_long_click 0x7f0a0004
int array list_list_title 0x7f0a0000
int array min_rating 0x7f0a0001
int array page_scaling_entries 0x7f0a0002
int array page_scaling_entry_values 0x7f0a0003
int array preference_screen_ori_entries 0x7f0a0007
int array preference_screen_ori_entry_values 0x7f0a0008
int array pull_next 0x7f0a000c
int array pull_pre 0x7f0a000b
int array pull_refresh 0x7f0a000a
int attr adjustViewBounds 0x7f01002f
int attr alignmentMode 0x7f010025
int attr baseline 0x7f010035
int attr baselineAlignBottom 0x7f010033
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 0x7f01001c
int attr alignmentMode 0x7f010012
int attr baseline 0x7f010022
int attr baselineAlignBottom 0x7f010020
int attr behindOffset 0x7f010003
int attr behindScrollScale 0x7f010005
int attr behindWidth 0x7f010004
int attr columnCount 0x7f010023
int attr columnOrderPreserved 0x7f010027
int attr cropToPadding 0x7f010034
int attr drawableAlpha 0x7f010036
int attr columnCount 0x7f010010
int attr columnOrderPreserved 0x7f010014
int attr cropToPadding 0x7f010021
int attr drawableAlpha 0x7f010023
int attr fadeDegree 0x7f01000b
int attr fadeEnabled 0x7f01000a
int attr layout_column 0x7f01002a
int attr layout_columnSpan 0x7f01002b
int attr layout_gravity 0x7f01002c
int attr layout_row 0x7f010028
int attr layout_rowSpan 0x7f010029
int attr mask 0x7f010037
int attr maxHeight 0x7f010031
int attr maxWidth 0x7f010030
int attr layout_column 0x7f010017
int attr layout_columnSpan 0x7f010018
int attr layout_gravity 0x7f010019
int attr layout_row 0x7f010015
int attr layout_rowSpan 0x7f010016
int attr mask 0x7f010024
int attr maxHeight 0x7f01001e
int attr maxWidth 0x7f01001d
int attr mode 0x7f010000
int attr orientation 0x7f010021
int attr ptrAdapterViewBackground 0x7f01001e
int attr ptrAnimationStyle 0x7f01001a
int attr ptrDrawable 0x7f010014
int attr ptrDrawableBottom 0x7f010020
int attr ptrDrawableEnd 0x7f010016
int attr ptrDrawableStart 0x7f010015
int attr ptrDrawableTop 0x7f01001f
int attr ptrHeaderBackground 0x7f01000f
int attr ptrHeaderSubTextColor 0x7f010011
int attr ptrHeaderTextAppearance 0x7f010018
int attr ptrHeaderTextColor 0x7f010010
int attr ptrListViewExtrasEnabled 0x7f01001c
int attr ptrMode 0x7f010012
int attr ptrOverScroll 0x7f010017
int attr ptrRefreshableViewBackground 0x7f01000e
int attr ptrRotateDrawableWhilePulling 0x7f01001d
int attr ptrScrollingWhileRefreshingEnabled 0x7f01001b
int attr ptrShowIndicator 0x7f010013
int attr ptrSubHeaderTextAppearance 0x7f010019
int attr rowCount 0x7f010022
int attr rowOrderPreserved 0x7f010026
int attr scaleType 0x7f01002e
int attr orientation 0x7f01000e
int attr rowCount 0x7f01000f
int attr rowOrderPreserved 0x7f010013
int attr scaleType 0x7f01001b
int attr selectorDrawable 0x7f01000d
int attr selectorEnabled 0x7f01000c
int attr shadowDrawable 0x7f010008
int attr shadowWidth 0x7f010009
int attr src 0x7f01002d
int attr tint 0x7f010032
int attr src 0x7f01001a
int attr tint 0x7f01001f
int attr touchModeAbove 0x7f010006
int attr touchModeBehind 0x7f010007
int attr useDefaultMargins 0x7f010024
int attr useDefaultMargins 0x7f010011
int attr viewAbove 0x7f010001
int attr viewBehind 0x7f010002
int color blue_dark 0x7f0b0001
int color blue_light 0x7f0b0000
int dimen activity_horizontal_margin 0x7f080006
int dimen activity_vertical_margin 0x7f080007
int dimen default_gap 0x7f080005
int dimen header_footer_left_right_padding 0x7f080003
int dimen header_footer_top_bottom_padding 0x7f080004
int dimen indicator_corner_radius 0x7f080001
int dimen indicator_internal_padding 0x7f080002
int dimen indicator_right_padding 0x7f080000
int dimen menu_offset 0x7f08000a
int dimen shadow_width 0x7f080008
int dimen slidingmenu_offset 0x7f080009
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 default_ptr_flip 0x7f020004
int drawable default_ptr_rotate 0x7f020005
int drawable doujinshi 0x7f020006
int drawable front 0x7f020007
int drawable gamecg 0x7f020008
int drawable ic_action_action_search 0x7f020009
int drawable ic_action_completed 0x7f02000a
int drawable ic_action_core_overflow 0x7f02000b
int drawable ic_action_download 0x7f02000c
int drawable ic_action_favourite 0x7f02000d
int drawable ic_action_jump 0x7f02000e
int drawable ic_action_pause 0x7f02000f
int drawable ic_action_refresh 0x7f020010
int drawable ic_action_remove 0x7f020011
int drawable ic_action_search 0x7f020012
int drawable ic_action_settings 0x7f020013
int drawable ic_action_start 0x7f020014
int drawable ic_launcher 0x7f020015
int drawable ic_navigation_drawer 0x7f020016
int drawable 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 indicator_arrow 0x7f020018
int drawable indicator_bg_bottom 0x7f020019
int drawable indicator_bg_top 0x7f02001a
int drawable manga 0x7f02001b
int drawable mask 0x7f02001c
int drawable misc 0x7f02001d
int drawable non_h 0x7f02001e
int drawable refresh 0x7f02001f
int drawable sadpanda 0x7f020020
int drawable scrollbar_blue 0x7f020021
int drawable scrollbar_white 0x7f020022
int drawable star 0x7f020023
int drawable star_empty 0x7f020024
int drawable star_half 0x7f020025
int drawable textfield 0x7f020026
int drawable unknown 0x7f020027
int drawable wait 0x7f020028
int drawable western 0x7f020029
int id action 0x7f07004c
int id action_download 0x7f07008f
int id action_favourite 0x7f07008e
int id action_jump 0x7f070092
int id action_refresh 0x7f070091
int id action_search 0x7f070090
int id action_settings 0x7f070093
int id alignBounds 0x7f070013
int id alignMargins 0x7f070014
int id autoCompleteTextView1 0x7f070089
int id both 0x7f070008
int id bottom 0x7f070016
int id bottom_panel 0x7f070081
int id button_artistcg 0x7f070050
int id button_asianporn 0x7f070056
int id button_cosplay 0x7f070055
int id button_doujinshi 0x7f07004e
int id button_gamecg 0x7f070051
int id button_imageset 0x7f070054
int id button_login 0x7f07007a
int id button_manga 0x7f07004f
int id button_misc 0x7f070057
int id button_non_h 0x7f070053
int id button_read 0x7f07003a
int id button_western 0x7f070052
int id center 0x7f07001b
int id centerCrop 0x7f070026
int id centerInside 0x7f070027
int id center_horizontal 0x7f070019
int id center_vertical 0x7f070017
int id checkbox_advance 0x7f070059
int id checkbox_sdesc 0x7f07005d
int id checkbox_sdt1 0x7f070060
int id checkbox_sdt2 0x7f070061
int id checkbox_sh 0x7f070062
int id checkbox_sname 0x7f07005b
int id checkbox_sr 0x7f070063
int id checkbox_stags 0x7f07005c
int id checkbox_sto 0x7f07005f
int id checkbox_storr 0x7f07005e
int id clip_horizontal 0x7f07001e
int id clip_vertical 0x7f07001d
int id cover 0x7f07006e
int id custom 0x7f070043
int id detail_average 0x7f070038
int id detail_button_cancel 0x7f07003c
int id detail_button_every 0x7f07003e
int id detail_button_known 0x7f07003f
int id detail_button_once 0x7f07003d
int id detail_cover 0x7f07002a
int id detail_language 0x7f070036
int id detail_pages 0x7f070034
int id detail_people 0x7f070039
int id detail_posted 0x7f070033
int id detail_rate 0x7f070037
int id detail_refresh 0x7f070030
int id detail_size 0x7f070035
int id detail_title 0x7f07002b
int id detail_type 0x7f070031
int id detail_uploader 0x7f070032
int id detail_wait 0x7f07002f
int id disabled 0x7f070005
int id download 0x7f070048
int id drawer_login 0x7f070074
int id drawer_login_over 0x7f070075
int id end 0x7f070020
int id favourite 0x7f07004d
int id fill 0x7f07001c
int id fill_horizontal 0x7f07001a
int id fill_vertical 0x7f070018
int id filter_advance 0x7f07005a
int id fitCenter 0x7f070024
int id fitEnd 0x7f070025
int id fitStart 0x7f070023
int id fitXY 0x7f070022
int id fl_inner 0x7f070083
int id flip 0x7f07000d
int id fullscreen 0x7f070003
int id gridview 0x7f07000e
int id horizontal 0x7f070011
int id info 0x7f07004b
int id is_exhentai 0x7f070076
int id left 0x7f070000
int id list 0x7f070044
int id list_button_logout 0x7f07007c
int id list_jump_edit 0x7f070067
int id list_jump_sum 0x7f070065
int id list_jump_to 0x7f070066
int id list_list 0x7f070069
int id list_main 0x7f070068
int id list_menu_list 0x7f070072
int id list_menu_login 0x7f070073
int id list_no_found 0x7f07006d
int id list_refresh 0x7f07006b
int id list_wait_first 0x7f07006a
int id list_wait_logout 0x7f07007d
int id manga_detail 0x7f070029
int id manga_detail_normal 0x7f07002c
int id manga_detail_offensive 0x7f07002d
int id manga_detail_pining 0x7f07002e
int id manga_detail_scrollview 0x7f070028
int id manualOnly 0x7f070009
int id margin 0x7f070002
int id matrix 0x7f070021
int id message 0x7f070042
int id name 0x7f07006f
int id negative_button 0x7f070045
int id neutral_button 0x7f070046
int id page_list 0x7f07003b
int id pager 0x7f070079
int id paper_list_gridLayout 0x7f07007e
int id paper_list_wait 0x7f07007f
int id password 0x7f070078
int id positive_button 0x7f070047
int id preview_button_refresh 0x7f070080
int id preview_num 0x7f070082
int id progressBar 0x7f07004a
int id pullDownFromTop 0x7f07000a
int id pullFromEnd 0x7f070007
int id pullFromStart 0x7f070006
int id pullUpFromBottom 0x7f07000b
int id pull_to_refresh_image 0x7f070084
int id pull_to_refresh_progress 0x7f070085
int id pull_to_refresh_sub_text 0x7f070087
int id pull_to_refresh_text 0x7f070086
int id rate 0x7f070071
int id remove 0x7f07008a
int id right 0x7f070001
int id rotate 0x7f07000c
int id sadpanda 0x7f07006c
int id scroll_view 0x7f070041
int id scrollview 0x7f070010
int id search_bar 0x7f070088
int id search_text 0x7f070058
int id selected_view 0x7f070004
int id set_name_edit 0x7f07008b
int id slidingmenumain 0x7f07008c
int id spinner_min_rating 0x7f070064
int id start 0x7f07001f
int id text_username 0x7f07007b
int id thumb 0x7f070049
int id title 0x7f070040
int id top 0x7f070015
int id type 0x7f070070
int id username 0x7f070077
int id vertical 0x7f070012
int id wait_message 0x7f07008d
int id webview 0x7f07000f
int drawable manga 0x7f020018
int drawable mask 0x7f020019
int drawable misc 0x7f02001a
int drawable non_h 0x7f02001b
int drawable refresh 0x7f02001c
int drawable sadpanda 0x7f02001d
int drawable scrollbar_blue 0x7f02001e
int drawable scrollbar_white 0x7f02001f
int drawable star 0x7f020020
int drawable star_empty 0x7f020021
int drawable star_half 0x7f020022
int drawable textfield 0x7f020023
int drawable unknown 0x7f020024
int drawable wait 0x7f020025
int drawable welcome 0x7f020026
int drawable western 0x7f020027
int id action 0x7f060040
int id action_download 0x7f06008a
int id action_favourite 0x7f060089
int id action_jump 0x7f06008d
int id action_refresh 0x7f06008c
int id action_search 0x7f06008b
int id action_settings 0x7f06008e
int id alignBounds 0x7f060007
int id alignMargins 0x7f060008
int id app_start_view 0x7f060087
int id autoCompleteTextView1 0x7f060083
int id bottom 0x7f06000a
int id bottom_panel 0x7f060075
int id button_artistcg 0x7f060044
int id button_asianporn 0x7f06004a
int id button_cosplay 0x7f060049
int id button_doujinshi 0x7f060042
int id button_gamecg 0x7f060045
int id button_imageset 0x7f060048
int id button_login 0x7f06006e
int id button_manga 0x7f060043
int id button_misc 0x7f06004b
int id button_non_h 0x7f060047
int id button_read 0x7f06002e
int id button_western 0x7f060046
int id center 0x7f06000f
int id centerCrop 0x7f06001a
int id centerInside 0x7f06001b
int id center_horizontal 0x7f06000d
int id center_vertical 0x7f06000b
int id checkbox_advance 0x7f06004d
int id checkbox_sdesc 0x7f060051
int id checkbox_sdt1 0x7f060054
int id checkbox_sdt2 0x7f060055
int id checkbox_sh 0x7f060056
int id checkbox_sname 0x7f06004f
int id checkbox_sr 0x7f060057
int id checkbox_stags 0x7f060050
int id checkbox_sto 0x7f060053
int id checkbox_storr 0x7f060052
int id clip_horizontal 0x7f060012
int id clip_vertical 0x7f060011
int id cover 0x7f060062
int id custom 0x7f060037
int id detail_average 0x7f06002c
int id detail_button_cancel 0x7f060030
int id detail_button_every 0x7f060032
int id detail_button_known 0x7f060033
int id detail_button_once 0x7f060031
int id detail_cover 0x7f06001e
int id detail_language 0x7f06002a
int id detail_pages 0x7f060028
int id detail_people 0x7f06002d
int id detail_posted 0x7f060027
int id detail_rate 0x7f06002b
int id detail_refresh 0x7f060024
int id detail_size 0x7f060029
int id detail_title 0x7f06001f
int id detail_type 0x7f060025
int id detail_uploader 0x7f060026
int id detail_wait 0x7f060023
int id download 0x7f06003c
int id drawer_login 0x7f060068
int id drawer_login_over 0x7f060069
int id end 0x7f060014
int id favourite 0x7f060041
int id fill 0x7f060010
int id fill_horizontal 0x7f06000e
int id fill_vertical 0x7f06000c
int id filter_advance 0x7f06004e
int id fitCenter 0x7f060018
int id fitEnd 0x7f060019
int id fitStart 0x7f060017
int id fitXY 0x7f060016
int id footer_progressBar 0x7f060079
int id footer_tip_text 0x7f06007a
int id fullscreen 0x7f060003
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 0x7f060005
int id info 0x7f06003f
int id is_exhentai 0x7f06006a
int id left 0x7f060000
int id list 0x7f060038
int id list_button_logout 0x7f060070
int id list_jump_edit 0x7f06005b
int id list_jump_sum 0x7f060059
int id list_jump_to 0x7f06005a
int id list_list 0x7f06005d
int id list_main 0x7f06005c
int id list_menu_list 0x7f060066
int id list_menu_login 0x7f060067
int id list_no_found 0x7f060061
int id list_refresh 0x7f06005f
int id list_view 0x7f060078
int id list_wait_first 0x7f06005e
int id list_wait_logout 0x7f060071
int id manga_detail 0x7f06001d
int id manga_detail_normal 0x7f060020
int id manga_detail_offensive 0x7f060021
int id manga_detail_pining 0x7f060022
int id manga_detail_scrollview 0x7f06001c
int id margin 0x7f060002
int id matrix 0x7f060015
int id message 0x7f060036
int id name 0x7f060063
int id negative_button 0x7f060039
int id neutral_button 0x7f06003a
int id page_list 0x7f06002f
int id pager 0x7f06006d
int id paper_list_gridLayout 0x7f060072
int id paper_list_wait 0x7f060073
int id password 0x7f06006c
int id positive_button 0x7f06003b
int id preview_button_refresh 0x7f060074
int id preview_num 0x7f060076
int id progressBar 0x7f06003e
int id rate 0x7f060065
int id remove 0x7f060084
int id right 0x7f060001
int id sadpanda 0x7f060060
int id scroll_view 0x7f060035
int id search_bar 0x7f060082
int id search_text 0x7f06004c
int id selected_view 0x7f060004
int id set_name_edit 0x7f060085
int id slidingmenumain 0x7f060086
int id spinner_min_rating 0x7f060058
int id start 0x7f060013
int id text_username 0x7f06006f
int id thumb 0x7f06003d
int id title 0x7f060034
int id top 0x7f060009
int id type 0x7f060064
int id username 0x7f06006b
int id vertical 0x7f060006
int id wait_message 0x7f060088
int layout detail 0x7f030000
int layout detail_normal 0x7f030001
int layout detail_offensive 0x7f030002
@@ -296,184 +260,186 @@ 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_to_refresh_header_horizontal 0x7f030016
int layout pull_to_refresh_header_vertical 0x7f030017
int layout search_view 0x7f030018
int layout set_name 0x7f030019
int layout slidingmenumain 0x7f03001a
int layout wait 0x7f03001b
int menu detail 0x7f0d0000
int menu main 0x7f0d0001
int raw change_log 0x7f060000
int raw thanks 0x7f060001
int string _default 0x7f09008d
int string action_refresh 0x7f090051
int string action_settings 0x7f090052
int string actual_size 0x7f090095
int string add 0x7f090089
int string add_tag 0x7f09006a
int string add_to_favourite 0x7f090099
int string advance_search_left 0x7f09009d
int string app_name 0x7f090003
int string cache_large 0x7f090067
int string changelog 0x7f090083
int string checkbox_advance 0x7f090015
int string checkbox_sdesc 0x7f090018
int string checkbox_sdt1 0x7f09001b
int string checkbox_sdt2 0x7f09001c
int string checkbox_sh 0x7f09001d
int string checkbox_sname 0x7f090016
int string checkbox_sr 0x7f09001e
int string checkbox_stags 0x7f090017
int string checkbox_sto 0x7f09001a
int string checkbox_storr 0x7f090019
int string create_cache_error 0x7f090069
int string dailog_check_login 0x7f09000c
int string dailog_check_network 0x7f090008
int string dailog_network_error_no 0x7f09000a
int string dailog_network_error_yes 0x7f090009
int string dailog_waring_no 0x7f090007
int string dailog_waring_plain 0x7f090005
int string dailog_waring_title 0x7f090004
int string dailog_waring_yes 0x7f090006
int string detail_average 0x7f09002e
int string detail_button_cancel 0x7f090033
int string detail_button_every 0x7f090035
int string detail_button_known 0x7f090037
int string detail_button_once 0x7f090034
int string detail_button_read 0x7f090032
int string detail_language 0x7f09002d
int string detail_not_rated 0x7f090039
int string detail_offensive 0x7f090031
int string detail_offensive_title 0x7f090030
int string detail_pages 0x7f09002b
int string detail_people 0x7f09002f
int string detail_pining 0x7f090036
int string detail_posted 0x7f09002a
int string detail_preview_error 0x7f090038
int string detail_size 0x7f09002c
int string detail_uploader 0x7f090029
int string dialog_messgae_login_or_not 0x7f090010
int string dialog_send_crash_no 0x7f090025
int string dialog_send_crash_plain 0x7f090023
int string dialog_send_crash_title 0x7f090022
int string dialog_send_crash_yes 0x7f090024
int string dialog_title_login_or_not 0x7f09000f
int string download 0x7f090090
int string download_successfully 0x7f090079
int string download_task_finished 0x7f090077
int string download_unsuccessfully 0x7f09007a
int string downloading 0x7f090078
int string em_can_not_reach 0x7f09004f
int string em_check_login_error 0x7f090048
int string em_client_protocol 0x7f090045
int string em_logout_error 0x7f090049
int string em_network_error 0x7f09003f
int string em_no_network 0x7f09004e
int string em_no_network_2 0x7f090050
int string em_open_input_stream_error 0x7f090043
int string em_parser_error 0x7f090042
int string em_put_cache_error 0x7f090046
int string em_read_input_stream_error 0x7f090044
int string em_response_code_error 0x7f090041
int string em_retry 0x7f09004b
int string em_retry_times 0x7f09004c
int string em_timeout 0x7f090040
int string em_unknown_error 0x7f09004d
int string em_url_error 0x7f09004a
int string em_url_format_error 0x7f090047
int string error 0x7f090082
int string exit_tip 0x7f09000b
int string favourite 0x7f09008f
int string first_page 0x7f09003b
int string fit_to_height 0x7f090097
int string fit_to_screen 0x7f090098
int string fit_to_width 0x7f090096
int string hint_no_keyword 0x7f090014
int string homepage 0x7f09008e
int string input_error 0x7f090068
int string jump 0x7f09008b
int string jump_sum 0x7f09001f
int string jump_to 0x7f090020
int string landscape 0x7f090056
int string last_page 0x7f09007d
int string load_pre 0x7f09003a
int string login 0x7f090084
int string logout 0x7f090085
int string new_tag_name 0x7f09006f
int string no_found 0x7f090028
int string not_login 0x7f090011
int string not_started 0x7f09007b
int string password 0x7f090088
int string period 0x7f090080
int string portrait 0x7f090055
int string preference_author 0x7f090065
int string preference_author_summary 0x7f090066
int string preference_auto_page_cache 0x7f090060
int string preference_auto_page_cache_summary_off 0x7f090062
int string preference_auto_page_cache_summary_on 0x7f090061
int string preference_cache_summary 0x7f09005e
int string preference_cache_summary_no 0x7f09005f
int string preference_category_about 0x7f090064
int string preference_category_cache 0x7f090059
int string preference_category_display 0x7f090053
int string preference_clear_cp_cache 0x7f09005b
int string preference_clear_page_cache 0x7f09005d
int string preference_cp_cache 0x7f09005a
int string preference_download_path 0x7f090063
int string preference_page_cache 0x7f09005c
int string preference_page_scaling 0x7f090057
int string preference_screen_ori 0x7f090054
int string preference_settings_title 0x7f090058
int string pull_next_pull 0x7f090074
int string pull_next_release 0x7f090075
int string pull_pre_pull 0x7f090072
int string pull_pre_release 0x7f090073
int string pull_refresh_pull 0x7f090070
int string pull_refresh_release 0x7f090071
int string pull_to_refresh_pull_label 0x7f090000
int string pull_to_refresh_refreshing_label 0x7f090002
int string pull_to_refresh_release_label 0x7f090001
int string refresh 0x7f090081
int string remove 0x7f09009a
int string remove_info_data 0x7f09009b
int string retry_max_next 0x7f09003e
int string retry_max_pre 0x7f09003d
int string sadpanda 0x7f09007e
int string some_page 0x7f09008c
int string star_2 0x7f090091
int string star_3 0x7f090092
int string star_4 0x7f090093
int string star_5 0x7f090094
int string start_download_task 0x7f090076
int string start_reloading 0x7f09003c
int string tag_change_name 0x7f09006e
int string tag_name 0x7f09006b
int string tag_name_empty 0x7f09006c
int string tag_name_exist 0x7f09006d
int string thanks 0x7f09009c
int string toast_add_download 0x7f090027
int string toast_add_favourite 0x7f090026
int string toast_invalid_page 0x7f090021
int string toast_login_failed 0x7f09000e
int string toast_login_succeeded 0x7f09000d
int string toast_logout_failed 0x7f090013
int string toast_logout_succeeded 0x7f090012
int string unfinished 0x7f09007f
int string username 0x7f090087
int string wait 0x7f090086
int string waiting 0x7f09007c
int string what_to_do 0x7f09008a
int style ActionBar 0x7f0c0000
int style AppTheme 0x7f0c0006
int style Button 0x7f0c0003
int style Button_Blue 0x7f0c0004
int style Button_White 0x7f0c0005
int style OverFlow 0x7f0c0001
int style PopupMenu 0x7f0c0002
int[] styleable CheckImage { 0x7f010037 }
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 slidingmenumain 0x7f03001c
int layout start 0x7f03001d
int layout wait 0x7f03001e
int menu detail 0x7f0c0000
int menu main 0x7f0c0001
int raw change_log 0x7f050000
int raw thanks 0x7f050001
int string _default 0x7f0a008a
int string action_refresh 0x7f0a004e
int string action_settings 0x7f0a004f
int string actual_size 0x7f0a0092
int string add 0x7f0a0086
int string add_tag 0x7f0a0067
int string add_to_favourite 0x7f0a0096
int string advance_search_left 0x7f0a009a
int string app_name 0x7f0a0000
int string cache_large 0x7f0a0064
int string changelog 0x7f0a0080
int string checkbox_advance 0x7f0a0012
int string checkbox_sdesc 0x7f0a0015
int string checkbox_sdt1 0x7f0a0018
int string checkbox_sdt2 0x7f0a0019
int string checkbox_sh 0x7f0a001a
int string checkbox_sname 0x7f0a0013
int string checkbox_sr 0x7f0a001b
int string checkbox_stags 0x7f0a0014
int string checkbox_sto 0x7f0a0017
int string checkbox_storr 0x7f0a0016
int string create_cache_error 0x7f0a0066
int string dailog_check_login 0x7f0a0009
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 0x7f0a002b
int string detail_button_cancel 0x7f0a0030
int string detail_button_every 0x7f0a0032
int string detail_button_known 0x7f0a0034
int string detail_button_once 0x7f0a0031
int string detail_button_read 0x7f0a002f
int string detail_language 0x7f0a002a
int string detail_not_rated 0x7f0a0036
int string detail_offensive 0x7f0a002e
int string detail_offensive_title 0x7f0a002d
int string detail_pages 0x7f0a0028
int string detail_people 0x7f0a002c
int string detail_pining 0x7f0a0033
int string detail_posted 0x7f0a0027
int string detail_preview_error 0x7f0a0035
int string detail_size 0x7f0a0029
int string detail_uploader 0x7f0a0026
int string dialog_messgae_login_or_not 0x7f0a000d
int string dialog_send_crash_no 0x7f0a0022
int string dialog_send_crash_plain 0x7f0a0020
int string dialog_send_crash_title 0x7f0a001f
int string dialog_send_crash_yes 0x7f0a0021
int string dialog_title_login_or_not 0x7f0a000c
int string download 0x7f0a008d
int string download_successfully 0x7f0a0076
int string download_task_finished 0x7f0a0074
int string download_unsuccessfully 0x7f0a0077
int string downloading 0x7f0a0075
int string em_can_not_reach 0x7f0a004c
int string em_check_login_error 0x7f0a0045
int string em_client_protocol 0x7f0a0042
int string em_logout_error 0x7f0a0046
int string em_network_error 0x7f0a003c
int string em_no_network 0x7f0a004b
int string em_no_network_2 0x7f0a004d
int string em_open_input_stream_error 0x7f0a0040
int string em_parser_error 0x7f0a003f
int string em_put_cache_error 0x7f0a0043
int string em_read_input_stream_error 0x7f0a0041
int string em_response_code_error 0x7f0a003e
int string em_retry 0x7f0a0048
int string em_retry_times 0x7f0a0049
int string em_timeout 0x7f0a003d
int string em_unknown_error 0x7f0a004a
int string em_url_error 0x7f0a0047
int string em_url_format_error 0x7f0a0044
int string error 0x7f0a007f
int string exit_tip 0x7f0a0008
int string favourite 0x7f0a008c
int string first_page 0x7f0a0038
int string fit_to_height 0x7f0a0094
int string fit_to_screen 0x7f0a0095
int string fit_to_width 0x7f0a0093
int string hint_no_keyword 0x7f0a0011
int string homepage 0x7f0a008b
int string input_error 0x7f0a0065
int string jump 0x7f0a0088
int string jump_sum 0x7f0a001c
int string jump_to 0x7f0a001d
int string landscape 0x7f0a0053
int string last_page 0x7f0a007a
int string load_pre 0x7f0a0037
int string login 0x7f0a0081
int string logout 0x7f0a0082
int string new_tag_name 0x7f0a006c
int string no_found 0x7f0a0025
int string not_login 0x7f0a000e
int string not_started 0x7f0a0078
int string password 0x7f0a0085
int string period 0x7f0a007d
int string portrait 0x7f0a0052
int string preference_author 0x7f0a0062
int string preference_author_summary 0x7f0a0063
int string preference_auto_page_cache 0x7f0a005d
int string preference_auto_page_cache_summary_off 0x7f0a005f
int string preference_auto_page_cache_summary_on 0x7f0a005e
int string preference_cache_summary 0x7f0a005b
int string preference_cache_summary_no 0x7f0a005c
int string preference_category_about 0x7f0a0061
int string preference_category_cache 0x7f0a0056
int string preference_category_display 0x7f0a0050
int string preference_clear_cp_cache 0x7f0a0058
int string preference_clear_page_cache 0x7f0a005a
int string preference_cp_cache 0x7f0a0057
int string preference_download_path 0x7f0a0060
int string preference_page_cache 0x7f0a0059
int string preference_page_scaling 0x7f0a0054
int string preference_screen_ori 0x7f0a0051
int string preference_settings_title 0x7f0a0055
int string pull_next_pull 0x7f0a0071
int string pull_next_release 0x7f0a0072
int string pull_pre_pull 0x7f0a006f
int string pull_pre_release 0x7f0a0070
int string pull_refresh_pull 0x7f0a006d
int string pull_refresh_release 0x7f0a006e
int string refresh 0x7f0a007e
int string remove 0x7f0a0097
int string remove_info_data 0x7f0a0098
int string retry_max_next 0x7f0a003b
int string retry_max_pre 0x7f0a003a
int string sadpanda 0x7f0a007b
int string some_page 0x7f0a0089
int string star_2 0x7f0a008e
int string star_3 0x7f0a008f
int string star_4 0x7f0a0090
int string star_5 0x7f0a0091
int string start_download_task 0x7f0a0073
int string start_reloading 0x7f0a0039
int string tag_change_name 0x7f0a006b
int string tag_name 0x7f0a0068
int string tag_name_empty 0x7f0a0069
int string tag_name_exist 0x7f0a006a
int string thanks 0x7f0a0099
int string toast_add_download 0x7f0a0024
int string toast_add_favourite 0x7f0a0023
int string toast_invalid_page 0x7f0a001e
int string toast_login_failed 0x7f0a000b
int string toast_login_succeeded 0x7f0a000a
int string toast_logout_failed 0x7f0a0010
int string toast_logout_succeeded 0x7f0a000f
int string unfinished 0x7f0a007c
int string username 0x7f0a0084
int string wait 0x7f0a0083
int string waiting 0x7f0a0079
int string what_to_do 0x7f0a0087
int style ActionBar 0x7f0b0000
int style AppTheme 0x7f0b0006
int style AppTheme_NoActionBar 0x7f0b0007
int style AppTheme_NoActionBar_Fullscreen 0x7f0b0008
int style Button 0x7f0b0003
int style Button_Blue 0x7f0b0004
int style Button_White 0x7f0b0005
int style OverFlow 0x7f0b0001
int style PopupMenu 0x7f0b0002
int[] styleable CheckImage { 0x7f010024 }
int styleable CheckImage_mask 0
int[] styleable GridLayout { 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027 }
int[] styleable GridLayout { 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014 }
int styleable GridLayout_alignmentMode 4
int styleable GridLayout_columnCount 2
int styleable GridLayout_columnOrderPreserved 6
@@ -481,7 +447,7 @@ 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, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c }
int[] styleable GridLayout_Layout { 0x010100f4, 0x010100f5, 0x010100f6, 0x010100f7, 0x010100f8, 0x010100f9, 0x010100fa, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019 }
int styleable GridLayout_Layout_android_layout_height 1
int styleable GridLayout_Layout_android_layout_margin 2
int styleable GridLayout_Layout_android_layout_marginBottom 6
@@ -494,26 +460,6 @@ 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 PullToRefresh { 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020 }
int styleable PullToRefresh_ptrAdapterViewBackground 16
int styleable PullToRefresh_ptrAnimationStyle 12
int styleable PullToRefresh_ptrDrawable 6
int styleable PullToRefresh_ptrDrawableBottom 18
int styleable PullToRefresh_ptrDrawableEnd 8
int styleable PullToRefresh_ptrDrawableStart 7
int styleable PullToRefresh_ptrDrawableTop 17
int styleable PullToRefresh_ptrHeaderBackground 1
int styleable PullToRefresh_ptrHeaderSubTextColor 3
int styleable PullToRefresh_ptrHeaderTextAppearance 10
int styleable PullToRefresh_ptrHeaderTextColor 2
int styleable PullToRefresh_ptrListViewExtrasEnabled 14
int styleable PullToRefresh_ptrMode 4
int styleable PullToRefresh_ptrOverScroll 9
int styleable PullToRefresh_ptrRefreshableViewBackground 0
int styleable PullToRefresh_ptrRotateDrawableWhilePulling 15
int styleable PullToRefresh_ptrScrollingWhileRefreshingEnabled 13
int styleable PullToRefresh_ptrShowIndicator 5
int styleable PullToRefresh_ptrSubHeaderTextAppearance 11
int[] styleable SlidingMenu { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d }
int styleable SlidingMenu_behindOffset 3
int styleable SlidingMenu_behindScrollScale 5
@@ -529,7 +475,7 @@ int styleable SlidingMenu_touchModeAbove 6
int styleable SlidingMenu_touchModeBehind 7
int styleable SlidingMenu_viewAbove 1
int styleable SlidingMenu_viewBehind 2
int[] styleable SuperImageView { 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036 }
int[] styleable SuperImageView { 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023 }
int styleable SuperImageView_adjustViewBounds 2
int styleable SuperImageView_baseline 8
int styleable SuperImageView_baselineAlignBottom 6
@@ -540,5 +486,5 @@ int styleable SuperImageView_maxWidth 3
int styleable SuperImageView_scaleType 1
int styleable SuperImageView_src 0
int styleable SuperImageView_tint 5
int xml searchable 0x7f050000
int xml settings 0x7f050001
int xml searchable 0x7f040000
int xml settings 0x7f040001
BIN
View File
Binary file not shown.
+1
View File
@@ -1,2 +1,3 @@
/android
/com
/.gitignore
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
View File
Binary file not shown.
+1
View File
@@ -1,2 +1,3 @@
/android
/com
/.gitignore
+2 -3
View File
@@ -12,6 +12,5 @@
# Project target.
target=android-19
android.library.reference.3=../../../code/SlidingMenu/library
android.library.reference.1=../../../workspace/gridlayout_v7
android.library.reference.2=../../../code/Android-PullToRefresh/library
android.library.reference.1=..\\..\\..\\workspace\\gridlayout_v7
android.library.reference.2=..\\..\\..\\code\\SlidingMenu\\library
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

+4 -7
View File
@@ -4,14 +4,11 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true" >
<com.handmark.pulltorefresh.library.PullToRefreshListView
<com.hippo.ehviewer.widget.PullListView
android:id="@+id/list_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
ptr:ptrMode="both" />
android:layout_height="fill_parent" />
<ProgressBar
android:id="@+id/list_wait_first"
@@ -37,7 +34,7 @@
android:layout_centerInParent="true"
android:src="@drawable/sadpanda"
android:visibility="gone" />
<TextView
android:id="@+id/list_no_found"
android:layout_width="wrap_content"
+18
View File
@@ -0,0 +1,18 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<include
android:id="@+id/header"
layout="@layout/pull_list_view_header" />
<ListView
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" >
</ListView>
</LinearLayout>
+36
View File
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="horizontal" >
<ProgressBar
android:id="@+id/footer_progressBar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="20dp"
android:visibility="gone" />
<TextView
android:id="@+id/footer_tip_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
+44
View File
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp" >
<ImageView
android:id="@+id/header_arrow_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:src="@drawable/ic_pulltorefresh_arrow" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="horizontal" >
<ProgressBar
android:id="@+id/header_progressBar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="20dp"
android:visibility="gone" />
<TextView
android:id="@+id/header_tip_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
+63
View File
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/head_contentLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="15dip"
android:paddingTop="10dip" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="30dip"
android:layout_marginRight="20dip" >
<ImageView
android:id="@+id/head_arrowImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_pulltorefresh_arrow" />
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="100dip"
android:layout_marginRight="10dip"
android:paddingBottom="15dip"
android:paddingTop="10dip" >
<ProgressBar
android:id="@+id/head_progressBar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:id="@+id/head_tipsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
+7
View File
@@ -0,0 +1,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app_start_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/welcome" >
</LinearLayout>
-1
View File
@@ -3,7 +3,6 @@
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="shadow_width">15dp</dimen>
<dimen name="slidingmenu_offset">120dp</dimen>
<dimen name="menu_offset">150dp</dimen>
+9
View File
@@ -15,4 +15,13 @@
<item name="@android:scrollbarThumbVertical">@drawable/scrollbar_blue</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="AppTheme.NoActionBar.Fullscreen">
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
+174
View File
@@ -0,0 +1,174 @@
package com.hippo.ehviewer;
import com.hippo.ehviewer.activity.MangaListActivity;
import com.hippo.ehviewer.dialog.DialogBuilder;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Crash;
import com.hippo.ehviewer.view.AlertButton;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.LinearLayout;
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 String lastCrash;
private boolean isAnimationOver = false;
private boolean isCheckOver = false;
private AlertDialog createWarningDialog() {
return new DialogBuilder(this).setCancelable(false)
.setTitle(R.string.dailog_waring_title)
.setMessage(R.string.dailog_waring_plain)
.setPositiveButton(R.string.dailog_waring_yes,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
Config.allowed();
check(CHECK_CRESH);
}
}).setNegativeButton(R.string.dailog_waring_no,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
finish();
}
}).create();
}
private AlertDialog createSendCrashDialog() {
return new DialogBuilder(this).setCancelable(false)
.setTitle(R.string.dialog_send_crash_title)
.setMessage(R.string.dialog_send_crash_plain)
.setPositiveButton(R.string.dialog_send_crash_yes, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
Intent i = new Intent(Intent.ACTION_SENDTO);
i.setData(Uri.parse("mailto:ehviewersu@gmail.com"));
i.putExtra(Intent.EXTRA_SUBJECT, "I found a bug in EhViewer !");
i.putExtra(Intent.EXTRA_TEXT, lastCrash);
startActivity(i);
lastCrash = null;
check(CHECK_NETWORK);
}
}).setNegativeButton(R.string.dialog_send_crash_no, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
lastCrash = null;
check(CHECK_NETWORK);
}
}).create();
}
private AlertDialog createNetworkErrorDialog() {
return new DialogBuilder(this).setCancelable(false)
.setTitle(R.string.error).setMessage(R.string.em_no_network)
.setPositiveButton(R.string.dailog_network_error_yes,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
checkOver();
}
})
.setNegativeButton(R.string.dailog_network_error_no,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
finish();
}
}).create();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start);
LinearLayout wellcome = (LinearLayout)findViewById(R.id.app_start_view);
// Show welcome in progress
AlphaAnimation aa = new AlphaAnimation(0.3f,1.0f);
aa.setDuration(3000);
aa.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(Animation arg0) {
synchronized (StartActivity.this) {
if (isCheckOver)
redirectTo();
isAnimationOver = true;
}
}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationStart(Animation animation) {}
});
wellcome.startAnimation(aa);
check(CHECK_WARING);
}
private void check(int order) {
switch (order) {
case CHECK_WARING:
if (!Config.isAllowed()) {
createWarningDialog().show();
return;
}
case CHECK_CRESH:
if ((lastCrash = Crash.getLastCrash()) != null) {
createSendCrashDialog().show();
return;
}
case CHECK_NETWORK:
if (!isNetworkAvailable()) {
createNetworkErrorDialog().show();
return;
}
}
checkOver();
}
private synchronized void checkOver() {
if (isAnimationOver)
redirectTo();
isCheckOver = true;
}
private boolean isNetworkAvailable() {
ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mNetworkInfo = cm.getActiveNetworkInfo();
if (mNetworkInfo == null || !mNetworkInfo.isAvailable())
return false;
else
return true;
}
private void redirectTo(){
Intent intent = new Intent(this, MangaListActivity.class);
startActivity(intent);
finish();
}
}
@@ -1,19 +1,15 @@
package com.hippo.ehviewer.activity;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import com.handmark.pulltorefresh.library.LoadingLayoutProxy;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener2;
import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.ListMangaDetail;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
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;
@@ -28,36 +24,34 @@ import com.hippo.ehviewer.view.CheckImage;
import com.hippo.ehviewer.view.OlImageView;
import com.hippo.ehviewer.view.TagListView;
import com.hippo.ehviewer.view.TagsAdapter;
import com.hippo.ehviewer.widget.PullListView;
import com.hippo.ehviewer.widget.PullListView.OnFooterRefreshListener;
import com.hippo.ehviewer.widget.PullListView.OnHeaderRefreshListener;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.R.color;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.app.SearchManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.Button;
@@ -70,7 +64,6 @@ import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SearchView;
import android.widget.Spinner;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -82,12 +75,16 @@ import android.widget.Toast;
public class MangaListActivity extends SlidingActivity {
private static String TAG = "MangaListActivity";
// How to get manga list
private static final int OTHER = 0;
private static final int PULL_HEADER = 1;
private static final int ACTION_FOOTER = 2;
private RelativeLayout mainView;
private TagListView listMenu;
private ListView isExhentaiList;
//private LinearLayout loginMenu;
private PullToRefreshListView pullListView;
private PullListView pullListView;
private ListView listView;
private View waitView;
private Button freshButton;
@@ -250,7 +247,7 @@ public class MangaListActivity extends SlidingActivity {
if (isChecked)
advance.setVisibility(View.VISIBLE);
else
advance.setVisibility(View.GONE);
advance.setVisibility(View.INVISIBLE);
}
});
@@ -262,7 +259,7 @@ public class MangaListActivity extends SlidingActivity {
((AlertButton)v).dialog.dismiss();
MangaListActivity.this.showContent();
lus = getLus(filterDialog);
refresh();
refresh(OTHER);
}
}).setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
@Override
@@ -561,13 +558,12 @@ public class MangaListActivity extends SlidingActivity {
mLoadListOver = false;
waitView.setVisibility(View.VISIBLE);
pullListView.setMode(Mode.DISABLED);
freshButton.setVisibility(View.GONE);
noFoundView.setVisibility(View.GONE);
sadpanda.setVisibility(View.GONE);
freshButton.setVisibility(View.INVISIBLE);
noFoundView.setVisibility(View.INVISIBLE);
sadpanda.setVisibility(View.INVISIBLE);
EhClient.getManagaList(lus.getUrl(),
new MangaListGetPackage(lus.clone(), new Integer[]{lus.getPage(), 1}),
new MangaListGetPackage(lus.clone(), true, OTHER),
new MangaListGetListener());
} else {
Toast.makeText(MangaListActivity.this,
@@ -651,7 +647,7 @@ public class MangaListActivity extends SlidingActivity {
if (isChecked)
advance.setVisibility(View.VISIBLE);
else
advance.setVisibility(View.GONE);
advance.setVisibility(View.INVISIBLE);
}
});
if (cb.isChecked())
@@ -863,44 +859,41 @@ public class MangaListActivity extends SlidingActivity {
}
private class MangaListGetPackage {
public ListUrls listUrls;
public Integer[] flag;
public MangaListGetPackage(ListUrls listUrls, Integer[] flag) {
this.listUrls = listUrls;
this.flag = flag;
public ListUrls targetListUrls;
public boolean isSetPosition;
public int getType;
public MangaListGetPackage(ListUrls targetListUrls, boolean isSetPosition, int getType) {
this.targetListUrls = targetListUrls;
this.isSetPosition = isSetPosition;
this.getType = getType;
}
}
private class MangaListGetListener implements
EhClient.OnGetManagaListListener {
@Override
public void onSuccess(Object checkFlag, ArrayList<ListMangaDetail> newLmdArray,
int indexPerPage, int maxPage) {
MangaListGetPackage getPackage = (MangaListGetPackage)checkFlag;
if (!getPackage.listUrls.equals(lus))
if (!getPackage.targetListUrls.equals(lus))
return;
pullListView.onRefreshComplete();
// Check no Found view later
waitView.setVisibility(View.GONE);
freshButton.setVisibility(View.GONE);
waitView.setVisibility(View.INVISIBLE);
freshButton.setVisibility(View.INVISIBLE);
if (maxPage == 0) { // If No hits found
mLoadListOver = false;
pullListView.setMode(Mode.DISABLED);
noFoundView.setVisibility(View.VISIBLE);
sadpanda.setVisibility(View.GONE);
sadpanda.setVisibility(View.INVISIBLE);
setTitle(R.string.no_found);
lmdArray.clear();
gmlAdapter.notifyDataSetChanged();
} else if (maxPage == -1) { //panda
mLoadListOver = false;
pullListView.setMode(Mode.DISABLED);
noFoundView.setVisibility(View.GONE);
noFoundView.setVisibility(View.INVISIBLE);
sadpanda.setVisibility(View.VISIBLE);
setTitle(R.string.sadpanda);
lmdArray.clear();
@@ -908,17 +901,16 @@ public class MangaListActivity extends SlidingActivity {
} else {
mLoadListOver = true;
pullListView.setMode(Mode.BOTH);
noFoundView.setVisibility(View.GONE);
sadpanda.setVisibility(View.GONE);
pullListView.setVisibility(View.VISIBLE);
noFoundView.setVisibility(View.INVISIBLE);
sadpanda.setVisibility(View.INVISIBLE);
// Set indexPerPage and maxPage
lus.setNumPerPage(indexPerPage);
lus.setMax(maxPage);
// Check refresh or get more
Integer[] flag = getPackage.flag;
int getPageIndex = flag[0];
boolean setPositon = flag[1] != 0;
int getPageIndex = getPackage.targetListUrls.getPage();
boolean setPositon = getPackage.isSetPosition;
if (getPageIndex == 0 && firstPage == 0) { // Refresh
firstPage = 0;
lastPage = 0;
@@ -989,6 +981,11 @@ public class MangaListActivity extends SlidingActivity {
}
}
}
//handlePullList
if (getPackage.getType == PULL_HEADER)
pullListView.onHeaderRefreshComplete();
else if (getPackage.getType == ACTION_FOOTER)
pullListView.onFooterRefreshComplete(true);
// Reset pull string
setHeaderPullString();
}
@@ -996,25 +993,21 @@ public class MangaListActivity extends SlidingActivity {
@Override
public void onFailure(Object checkFlag, int errorMessageId) {
MangaListGetPackage getPackage = (MangaListGetPackage)checkFlag;
if (!getPackage.listUrls.equals(lus))
if (!getPackage.targetListUrls.equals(lus))
return;
pullListView.onRefreshComplete();
// Check pull list view later
// Check fresh view later
waitView.setVisibility(View.GONE);
noFoundView.setVisibility(View.GONE);
sadpanda.setVisibility(View.GONE);
waitView.setVisibility(View.INVISIBLE);
noFoundView.setVisibility(View.INVISIBLE);
sadpanda.setVisibility(View.INVISIBLE);
Integer[] flag = getPackage.flag;
int getPageIndex = flag[0];
int getPageIndex = getPackage.targetListUrls.getPage();
if (getPageIndex == 0 && firstPage == 0) { // Refresh
mLoadListOver = false;
// Only show freshButton
pullListView.setMode(Mode.DISABLED);
freshButton.setVisibility(View.VISIBLE);
Toast.makeText(MangaListActivity.this,
getString(errorMessageId), Toast.LENGTH_SHORT)
@@ -1023,13 +1016,18 @@ public class MangaListActivity extends SlidingActivity {
gmlAdapter.notifyDataSetChanged();
} else {// List is not empty
// Only show freshButton
pullListView.setMode(Mode.BOTH);
freshButton.setVisibility(View.GONE);
freshButton.setVisibility(View.INVISIBLE);
Toast.makeText(
MangaListActivity.this,
getString(errorMessageId) + " "
+ getString(R.string.em_retry), Toast.LENGTH_SHORT).show();
}
//handlePullList
if (getPackage.getType == PULL_HEADER)
pullListView.onHeaderRefreshComplete();
else if (getPackage.getType == ACTION_FOOTER)
pullListView.onFooterRefreshComplete(false);
}
}
@@ -1038,7 +1036,7 @@ public class MangaListActivity extends SlidingActivity {
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
pullListView.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
// First time when list is created
if (mListFirst && mLoadListOver) {
// load image
@@ -1073,7 +1071,6 @@ public class MangaListActivity extends SlidingActivity {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// When srcoll over load image in view
int getChildCount;
if (scrollState == SCROLL_STATE_IDLE
@@ -1140,18 +1137,24 @@ public class MangaListActivity extends SlidingActivity {
}
private void setHeaderPullString() {
LoadingLayoutProxy ill = (LoadingLayoutProxy)pullListView.getLoadingLayoutProxy();
if (firstPage == 0)
ill.setHeaderLabels(getResources().getTextArray(R.array.pull_refresh));
pullListView.setHeaderString("下拉刷新...",
"释放刷新...",
"正在刷新...",
"刷新完成",
"取消刷新"); // TODO
else
ill.setHeaderLabels(getResources().getTextArray(R.array.pull_pre));
pullListView.setHeaderString("下拉读取上一页...",
"释放读取上一页...",
"正在读取上一页...",
"读取上一页完成",
"读取上一页刷新"); // TODO
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
int menuWidth = (int)getResources().getDimension(R.dimen.menu_offset);
mSlidingMenu.setBehindOffset(menuWidth);
mSlidingMenu.setBehindOffsetRes(R.dimen.menu_offset);
if (Build.VERSION.SDK_INT >= 19) {
BeautifyScreen.fixColour(this);
}
@@ -1185,7 +1188,7 @@ public class MangaListActivity extends SlidingActivity {
int page = intent.getIntExtra("page", 0);
lus = new ListUrls(type, search, page);
visiblePage = lus.getPage();
// Init dialog
checkLoginDialog = createCheckLoginDialog();
loginDialog = createLoginDialog();
@@ -1196,22 +1199,19 @@ public class MangaListActivity extends SlidingActivity {
mSlidingMenu = getSlidingMenu();
mSlidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
mSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
mSlidingMenu.setFadeDegree(0.35f);
int menuWidth = (int)getResources().getDimension(R.dimen.menu_offset);
mSlidingMenu.setBehindOffset(menuWidth);
setSlidingActionBarEnabled(false);
mSlidingMenu.setBehindOffsetRes(R.dimen.menu_offset);
setBehindContentView(R.layout.list_menu_list);
mSlidingMenu.setSecondaryMenu(R.layout.list_menu_login);
getActionBar().setDisplayHomeAsUpEnabled(true);
// Get View
mainView = (RelativeLayout) findViewById(R.id.list_main);
listMenu = (TagListView) findViewById(R.id.list_menu_list);
isExhentaiList = (ListView)findViewById(R.id.is_exhentai);
//loginMenu = (LinearLayout) findViewById(R.id.list_menu_login);
pullListView = (PullToRefreshListView) findViewById(R.id.list_list);
listView = pullListView.getRefreshableView();
pullListView = ((PullListView)findViewById(R.id.list_list));
listView = pullListView.getListView();
waitView = (View) findViewById(R.id.list_wait_first);
freshButton = (Button) findViewById(R.id.list_refresh);
noFoundView = (View) findViewById(R.id.list_no_found);
@@ -1246,7 +1246,7 @@ public class MangaListActivity extends SlidingActivity {
int position, long arg3) {
if (position == 0) { // Home page
lus = new ListUrls(ListUrls.ALL_TYPE, null, 0);
refresh();
refresh(OTHER);
showContent();
} else if (position == 1) { // Favourite
Intent intent = new Intent(MangaListActivity.this,
@@ -1264,7 +1264,7 @@ public class MangaListActivity extends SlidingActivity {
ListUrls listUrls = Tag.get(listMenuTitle.get(position));
if (listUrls != null) {
lus = listUrls;
refresh();
refresh(OTHER);
}
showContent();
}
@@ -1333,7 +1333,7 @@ public class MangaListActivity extends SlidingActivity {
if (isChanged) {
isExhentaiListAdapter.notifyDataSetChanged();
lus = new ListUrls(ListUrls.ALL_TYPE, null, 0);
refresh();
refresh(OTHER);
MangaListActivity.this.showContent();
}
}
@@ -1341,44 +1341,35 @@ public class MangaListActivity extends SlidingActivity {
// Pull list view
pullListView.setOnRefreshListener(new OnRefreshListener2<ListView>() {
pullListView.setOnRefreshListener(new OnHeaderRefreshListener() {
@Override
public void onPullDownToRefresh(
PullToRefreshBase<ListView> refreshView) {
public void onHeaderRefresh() {
if (firstPage == 0)
refresh();
refresh(PULL_HEADER);
else {
mListFirst = true;
mLoadListOver = false;
lus.setPage(firstPage - 1);
EhClient.getManagaList(lus.getUrl(),
new MangaListGetPackage(lus.clone(), new Integer[]{lus.getPage(), 0}),
new MangaListGetPackage(lus.clone(), false, PULL_HEADER),
new MangaListGetListener());
}
}
@Override
public void onPullUpToRefresh(
PullToRefreshBase<ListView> refreshView) {
if (lastPage >= lus.getMax() - 1) {
Toast.makeText(MangaListActivity.this, getString(R.string.last_page), Toast.LENGTH_SHORT).show();
pullListView.onRefreshComplete();
} else {
mListFirst = true;
mLoadListOver = false;
lus.setPage(lastPage + 1);
EhClient.getManagaList(lus.getUrl(),
new MangaListGetPackage(lus.clone(), new Integer[]{lus.getPage(), 0}),
new MangaListGetListener());
}
}
});
LoadingLayoutProxy ill = (LoadingLayoutProxy)pullListView.getLoadingLayoutProxy();
ill.setHeaderLabels(getResources().getTextArray(R.array.pull_refresh));
ill.setFooterLabels(getResources().getTextArray(R.array.pull_next));
pullListView.setMode(Mode.DISABLED);
pullListView.setOnFooterRefreshListener(new OnFooterRefreshListener() {
@Override
public void onFooterRefresh() {
mListFirst = true;
mLoadListOver = false;
if (lus.setPage(lastPage + 1))
EhClient.getManagaList(lus.getUrl(),
new MangaListGetPackage(lus.clone(), false, ACTION_FOOTER),
new MangaListGetListener());
else
pullListView.onFooterRefreshComplete(true, false);
}
});
pullListView.setFooterString("正在加载更多", "已全部加载完成,点击尝试加载更多", "加载失败,点击继续加载"); // TODO
// Listview
gmlAdapter = new GmlAdapter();
listView.setAdapter(gmlAdapter);
@@ -1387,10 +1378,6 @@ public class MangaListActivity extends SlidingActivity {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
if (position > 0)
position = position-1;
else
position = 0;
Intent intent = new Intent(MangaListActivity.this,
MangaDetailActivity.class);
ListMangaDetail lmd = lmdArray.get(position);
@@ -1418,10 +1405,7 @@ public class MangaListActivity extends SlidingActivity {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
if (position > 0)
longClickItemIndex = position-1;
else
longClickItemIndex = 0;
longClickItemIndex = position;
longClickDialog.show();
return true;
}
@@ -1457,7 +1441,7 @@ public class MangaListActivity extends SlidingActivity {
public boolean onQueryTextSubmit(String query) {
searchView.clearFocus();
lus = new ListUrls(ListUrls.ALL_TYPE, query);
refresh();
refresh(OTHER);
return true;
}
});
@@ -1509,7 +1493,7 @@ public class MangaListActivity extends SlidingActivity {
return true;
case R.id.action_refresh:
lus.setPage(0);
refresh();
refresh(OTHER);
return true;
case R.id.action_jump:
if (mLoadListOver)
@@ -1539,33 +1523,103 @@ public class MangaListActivity extends SlidingActivity {
setTitle(String.format(getString(R.string.some_page), visiblePage + 1));
layoutDrawRight();
pullListView.setVisibility(View.INVISIBLE);
waitView.setVisibility(View.VISIBLE);
pullListView.setMode(Mode.DISABLED);
freshButton.setVisibility(View.GONE);
noFoundView.setVisibility(View.GONE);
sadpanda.setVisibility(View.GONE);
freshButton.setVisibility(View.INVISIBLE);
noFoundView.setVisibility(View.INVISIBLE);
sadpanda.setVisibility(View.INVISIBLE);
// Check update
//checkupdate();
// get MangeList
lus.setPage(0);
EhClient.getManagaList(lus.getUrl(),
new MangaListGetPackage(lus.clone(), new Integer[]{lus.getPage(), 1}),
new MangaListGetPackage(lus.clone(), true, OTHER),
new MangaListGetListener());
}
private class UpdateListener implements Downloader.OnDownloadListener {
private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;
public UpdateListener() {
mNotifyManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(MangaListActivity.this.getApplication());
mBuilder.setSmallIcon(R.drawable.ic_launcher);
}
@Override
public void onDownloadStart(int totalSize) {
mBuilder.setContentTitle("正在下载更新")
.setContentText(null)
.setProgress(0, 0, true).setOngoing(true).setAutoCancel(false);
mNotifyManager.notify(233, mBuilder.build());
}
@Override
public void onDownloadStatusUpdate(
int downloadSize, int totalSize) {
mBuilder.setContentTitle("正在下载更新")
.setContentText(String.format("%.2f / %.2f KB", downloadSize/1024.0f, totalSize/1024.0f))
.setProgress(totalSize, downloadSize, false).setOngoing(true).setAutoCancel(false);
mNotifyManager.notify(233, mBuilder.build());
}
@Override
public void onDownloadOver(boolean ok, int eMesgId) {
mBuilder.setContentTitle("更新下载完成")
.setContentText("点击更新")
.setProgress(0, 0, false).setOngoing(false).setAutoCancel(true);
mNotifyManager.notify(233, mBuilder.build());
}
}
private void checkupdate() {
EhClient.checkUpdate(new EhClient.OnCheckUpdateListener() {
@Override
public void onSuccess(String pageContext) {
String[] items = pageContext.split("\n");
if (items.length == 2) {
String newVer = items[0];
String url = EhClient.UPDATE_URL + items[1];
String name = url.substring(url.lastIndexOf('/')+1);
Downloader d = new Downloader();
try {
Downloader.Controlor controlor = d.resetData(Config.getDownloadPath(), name, url);
d.setOnDownloadListener(new UpdateListener());
new Thread(d).start();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
@Override
public void onFailure(int errorMessageId) {
Log.d(TAG, getString(errorMessageId));
}
});
}
private void layoutDrawRight() {
if (EhClient.isLogin()) { // If have login
loginView.setVisibility(View.GONE);
loginView.setVisibility(View.INVISIBLE);
loginOverView.setVisibility(View.VISIBLE);
usernameText.setText(EhClient.getUsername());
} else {
loginView.setVisibility(View.VISIBLE);
loginOverView.setVisibility(View.GONE);
loginOverView.setVisibility(View.INVISIBLE);
}
}
private void refresh() {
private void refresh(int getType) {
mListFirst = true;
mLoadListOver = false;
@@ -1573,21 +1627,15 @@ public class MangaListActivity extends SlidingActivity {
lastPage = 0;
// Only ProgressBar in center
if (pullListView.isRefreshing()) {
waitView.setVisibility(View.GONE);
pullListView.setMode(Mode.BOTH);
} else {
waitView.setVisibility(View.VISIBLE);
pullListView.setMode(Mode.DISABLED);
}
freshButton.setVisibility(View.GONE);
noFoundView.setVisibility(View.GONE);
sadpanda.setVisibility(View.GONE);
waitView.setVisibility(View.VISIBLE);
freshButton.setVisibility(View.INVISIBLE);
noFoundView.setVisibility(View.INVISIBLE);
sadpanda.setVisibility(View.INVISIBLE);
// Get MangeList
lus.setPage(0);
EhClient.getManagaList(lus.getUrl(),
new MangaListGetPackage(lus.clone(), new Integer[]{lus.getPage(), 1}),
new MangaListGetPackage(lus.clone(), true, getType),
new MangaListGetListener());
}
@@ -1622,11 +1670,11 @@ public class MangaListActivity extends SlidingActivity {
// *** Button onclick ***//
public void buttonRefresh(View arg0) {
refresh();
refresh(OTHER);
}
public void buttonLogout(View paramView) {
logoutButton.setVisibility(View.GONE);
logoutButton.setVisibility(View.INVISIBLE);
waitlogoutView.setVisibility(View.VISIBLE);
EhClient.logout(new EhClient.OnLogoutListener() {
@Override
@@ -1635,7 +1683,7 @@ public class MangaListActivity extends SlidingActivity {
getString(R.string.toast_logout_succeeded),
Toast.LENGTH_SHORT).show();
logoutButton.setVisibility(View.VISIBLE);
waitlogoutView.setVisibility(View.GONE);
waitlogoutView.setVisibility(View.INVISIBLE);
Config.logoutNow();
layoutDrawRight();
}
@@ -1646,7 +1694,7 @@ public class MangaListActivity extends SlidingActivity {
getString(errorMessageId),
Toast.LENGTH_SHORT).show();
logoutButton.setVisibility(View.VISIBLE);
waitlogoutView.setVisibility(View.GONE);
waitlogoutView.setVisibility(View.INVISIBLE);
}
});
}
+49 -38
View File
@@ -8,6 +8,8 @@ import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Map;
import android.util.Log;
@@ -36,7 +38,7 @@ public class Downloader implements Runnable {
private String mPath;
private String mFileName;
private URL mUrl;
private DownloadInfo mDi;
private Controlor mContorlor;
private int mTotalSize;
private int mDownloadSize = 0;
@@ -48,46 +50,60 @@ public class Downloader implements Runnable {
public interface OnDownloadListener {
public void onDownloadStart(int totalSize);
public void onDownloadStatusUpdate(int downloadSize, int totalSize);
public void onDownloadOver(boolean ok, int eMesgId);
}
public void resetData(String path, String fileName, String urlStr, DownloadInfo di) throws MalformedURLException {
public class Controlor {
private boolean mStop = false;
public synchronized void stop() {
mStop = true;
}
public synchronized void reset() {
mStop = false;
}
public synchronized boolean isStop() {
return mStop;
}
}
public Controlor resetData(String path, String fileName, String urlStr) throws MalformedURLException {
mPath = path;
mFileName = fileName;
mUrl = new URL(urlStr);
mDi = di;
mDownloadSize = 0;
mRedirectionCount = 0;
status = COMPLETED;
mContorlor.reset();
return mContorlor;
}
public void setOnDownloadListener(OnDownloadListener listener) {
mListener = listener;
}
public Downloader(){}
public Downloader(String path, String fileName, String urlStr, DownloadInfo di) throws MalformedURLException {
mPath = path;
mFileName = fileName;
mUrl = new URL(urlStr);
mDi = di;
public Downloader() {
mContorlor = new Controlor();
}
@Override
public void run() {
boolean ok = false;
int retryTimes = 0;
if (Cache.hasSdCard())
while(true) {
try {
if (mDi.status == DownloadInfo.STOP)
throw new StopRequestException(STOP,
"Download is stopped");
if (mContorlor.isStop())
throw new StopRequestException(STOP, "Download is stopped");
mDownloadSize = 0;
mRedirectionCount = 0;
status = COMPLETED;
executeDownload();
ok = true;
break;
} catch (StopRequestException e) {
e.printStackTrace();
@@ -99,6 +115,9 @@ public class Downloader implements Runnable {
}
else
status = NO_SDCARD;
if (mListener != null)
mListener.onDownloadOver(ok, status);
}
public int getStatus() {
@@ -112,22 +131,20 @@ public class Downloader implements Runnable {
Log.d(TAG, "Get file " + mUrl.toString());
conn = (HttpURLConnection)mUrl.openConnection();
conn.setInstanceFollowRedirects(false);
conn.addRequestProperty("Range", "bytes=0-"); // TODO
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
processResponseHeaders(conn);
if (mListener != null)
mListener.onDownloadStart(mTotalSize);
transferData(conn);
return;
case HttpURLConnection.HTTP_PARTIAL:
transferData(conn);
return;
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
@@ -159,6 +176,17 @@ public class Downloader implements Runnable {
*/
private void processResponseHeaders(HttpURLConnection conn) {
mTotalSize = conn.getContentLength();
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();
}
}
}
/**
@@ -169,7 +197,7 @@ public class Downloader implements Runnable {
OutputStream out = null;
File file = null;
if (mDi.status == DownloadInfo.STOP)
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
@@ -211,7 +239,6 @@ public class Downloader implements Runnable {
for (;;) {
int bytesRead = readFromResponse(data, in);
if (bytesRead == -1) { // success, end of stream already reached
handleEndOfStream();
return;
}
@@ -220,7 +247,7 @@ public class Downloader implements Runnable {
if (mListener != null)
mListener.onDownloadStatusUpdate(mDownloadSize, mTotalSize);
if (mDi.status == DownloadInfo.STOP)
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
}
@@ -238,9 +265,6 @@ public class Downloader implements Runnable {
return entityStream.read(data);
} catch (IOException ex) {
// TODO: handle stream errors the same as other retries
if ("unexpected end of stream".equals(ex.getMessage())) {
return -1;
}
throw new StopRequestException(STATUS_HTTP_DATA_ERROR,
"Failed reading response: " + ex, ex);
}
@@ -263,17 +287,4 @@ public class Downloader implements Runnable {
"Failed to write data: " + ex);
}
}
/**
* Called when we've reached the end of the HTTP response stream, to update the database and
* check for consistency.
*/
private void handleEndOfStream() throws StopRequestException {
final boolean lengthMismatched = (mTotalSize != -1)
&& (mDownloadSize != mTotalSize);
if (lengthMismatched) {
throw new StopRequestException(STATUS_HTTP_DATA_ERROR,
"mismatched content length; unable to resume");
}
}
}
@@ -88,12 +88,16 @@ public class DownloadService extends Service {
@Override
public void onDownloadMangaOver(String id, boolean ok) {
String mesg = null;
if (ok)
mBuilder.setContentTitle(getString(R.string.download_successfully) + " " + Download.get(id).title);
mesg = getString(R.string.download_successfully) + " ";
else
mBuilder.setContentTitle(getString(R.string.download_unsuccessfully) + " " + Download.get(id).title);
mBuilder.setContentText(null).setProgress(0, 0, false).setOngoing(false)
.setAutoCancel(true);
mesg = getString(R.string.download_unsuccessfully) + " ";
DownloadInfo di = Download.get(id);
if (di != null)
mesg += Download.get(id).title;
mBuilder.setContentTitle(mesg);
mBuilder.setContentText(null).setProgress(0, 0, false).setOngoing(false);
mNotifyManager.notify(Integer.parseInt(id), mBuilder.build());
}
+118 -13
View File
@@ -48,6 +48,9 @@ import com.hippo.ehviewer.service.DownloadService;
import android.app.NotificationManager;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
@@ -60,6 +63,8 @@ import android.support.v4.app.NotificationCompat;
import android.support.v4.util.LruCache;
import android.util.Log;
// TODO Stringbuffer to StringBuild
public class EhClient {
private static final String TAG = "EhClient";
@@ -73,6 +78,9 @@ public class EhClient {
public static final String E_HENTAI_DETAIL_HEADER = "http://g.e-hentai.org/g/";
public static final String EXHENTAI_DETAIL_HEADER = "http://exhentai.org/g/";
public static final String UPDATE_URL = "http://ehviewersu.appsp0t.com/";
public static final String UPDATE_API = "http://ehviewersu.appsp0t.com/API";
public static String listHeader;
public static String detailHeader;
@@ -93,6 +101,11 @@ public class EhClient {
public void onFailure(int errorMessageId);
}
public interface OnCheckUpdateListener {
public void onSuccess(String pageContext);
public void onFailure(int errorMessageId);
}
public interface OnLogoutListener {
public void onSuccess();
public void onFailure(int errorMessageId);
@@ -173,17 +186,6 @@ public class EhClient {
return mInit;
}
private static Handler checkNetworkHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
OnCheckNetworkListener listener = (OnCheckNetworkListener) msg.obj;
if (msg.arg1 == 0)
listener.onFailure(msg.what);
else
listener.onSuccess();
};
};
public static void setHeader(boolean isExhentai) {
Config.exhentai(isExhentai);
if (isExhentai) {
@@ -195,6 +197,102 @@ public class EhClient {
}
}
private static Handler checkUpdateHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
String pageContext = ((CheckUpdatePackage)msg.obj).pageContext;
OnCheckUpdateListener listener = ((CheckUpdatePackage)msg.obj).listener;
if (msg.arg1 == 0)
listener.onFailure(msg.what);
else
listener.onSuccess(pageContext);
};
};
// Get Manga List
private static class CheckUpdatePackage {
public String pageContext;
public OnCheckUpdateListener listener;
public CheckUpdatePackage(String pageContext, OnCheckUpdateListener listener) {
this.pageContext = pageContext;
this.listener = listener;
}
}
public static void checkUpdate(final OnCheckUpdateListener listener) {
new Thread(new Runnable() {
@Override
public void run() {
int mOK = 0;
int emsgId = R.string.em_unknown_error;
StringBuffer sb = new StringBuffer();
HttpURLConnection conn = null;
try {
URL url = new URL(UPDATE_API);
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(TIMEOUT);
conn.setReadTimeout(TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setUseCaches(false);
conn.setInstanceFollowRedirects(true);
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
StringBuffer StrBuf = new StringBuffer();
PackageManager pm = mContext.getPackageManager();
PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);
StrBuf.append("last\n").append(pi.versionName);
out.writeBytes(StrBuf.toString());
out.flush();
out.close();
conn.connect();
getStringHUC(conn, sb);
mOK = 1;
} catch (MalformedURLException e) {
emsgId = R.string.em_url_format_error;
e.printStackTrace();
} catch (ConnectTimeoutException e) {
emsgId = R.string.em_timeout;
e.printStackTrace();
} catch (UnknownHostException e) {
emsgId = R.string.em_no_network_2;
e.printStackTrace();
} catch (IOException e) {
emsgId = R.string.em_network_error;
e.printStackTrace();
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (conn != null)
conn.disconnect();
}
Message msg = new Message();
msg.what = emsgId;
msg.arg1 = mOK;
msg.obj = new CheckUpdatePackage(sb.toString(), listener);
checkUpdateHandler.sendMessage(msg);
}
}).start();
}
private static Handler checkNetworkHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
OnCheckNetworkListener listener = (OnCheckNetworkListener) msg.obj;
if (msg.arg1 == 0)
listener.onFailure(msg.what);
else
listener.onSuccess();
};
};
/**
* Is network available and can reach host
* @return Error message id or 0
@@ -1190,6 +1288,7 @@ public class EhClient {
/****** DownloadMangaManager ******/
public static class DownloadMangaManager {
private static DownloadInfo curDownloadInfo = null;
private static Downloader.Controlor curControlor = null;
private static ArrayList<DownloadInfo> mDownloadQueue = new ArrayList<DownloadInfo>();
private static Object taskLock = new Object();
@@ -1232,6 +1331,8 @@ public class EhClient {
di.status = DownloadInfo.STOP;
mDownloadQueue.remove(di);
if (!id.equals(getCurDownloadId())) {
if (curControlor != null)
curControlor.stop();
mService.notifyUpdate();
Download.notify(id);
}
@@ -1287,6 +1388,9 @@ public class EhClient {
curDownloadInfo.totalSize = totalSize/1024.0f;
mService.notifyUpdate();
}
@Override
public void onDownloadOver(boolean ok, int eMesgId) {}
});
while(mDownloadQueue.size() > 0){
synchronized (taskLock) {
@@ -1354,9 +1458,10 @@ public class EhClient {
}
try {
imageDownloader.resetData(folder.toString(),
// TODO
curControlor = imageDownloader.resetData(folder.toString(),
String.format("%05d", curDownloadInfo.lastStartIndex) + "." + Util.getExtension(imageUrlStr),
imageUrlStr, curDownloadInfo);
imageUrlStr);
imageDownloader.run();
curDownloadInfo.downloadSize = 0;
+2 -2
View File
@@ -74,8 +74,8 @@ public class Ui {
BITMAP_START_HALF = BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.star_half), null, opt);
BITMAP_START_EMPTY = BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.star_empty), null, opt);
OlImageView.setDefaultImage(Movie.decodeStream(mContext.getResources().openRawResource(R.drawable.wait))
, BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.refresh), null, opt));
OlImageView.setDefaultImage(BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.ic_launcher))
, BitmapFactory.decodeStream(mContext.getResources().openRawResource(R.drawable.ic_touch), null, opt));
}
/**
+9 -11
View File
@@ -30,7 +30,7 @@ public class OlImageView extends SuperImageView {
private LruCache<String, Bitmap> memoryCache = null;
private DiskCache diskCache = null;
private static Movie waitMovie;
private static Bitmap waitBitmap;
private static Bitmap refreshBitmap;
private OnLoadListener onLoadListener = null;
@@ -56,7 +56,7 @@ public class OlImageView extends SuperImageView {
}
public void setWaitMovie() {
setImageMovie(waitMovie);
setImageBitmap(waitBitmap);
}
public void setUrl(String s) {
@@ -115,8 +115,7 @@ public class OlImageView extends SuperImageView {
OlImageView.this.setImageMovie((Movie) res);
return true;
}
if(!verifyMovie(waitMovie))
setImageMovie(waitMovie);
setImageBitmap(waitBitmap);
return false;
}
}
@@ -154,8 +153,7 @@ public class OlImageView extends SuperImageView {
private void load() {
status = STATUS_LOADING;
if(!verifyMovie(waitMovie))
setImageMovie(waitMovie);
setImageBitmap(waitBitmap);
int type = Util.getResourcesType(url);
synchronized (this) {
@@ -179,9 +177,9 @@ public class OlImageView extends SuperImageView {
OlImageView.this.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
OlImageView.this.setImageMovie(waitMovie);
OlImageView.this.loadImage(true);
OlImageView.this.setClickable(false);
setImageBitmap(waitBitmap);
loadImage(true);
setClickable(false);
}
});
OlImageView.this.status = STATUS_LOAD_FAIL;
@@ -192,8 +190,8 @@ public class OlImageView extends SuperImageView {
}
}
public static void setDefaultImage(Movie waitMovie, Bitmap refreshBitmap) {
OlImageView.waitMovie = waitMovie;
public static void setDefaultImage(Bitmap waitBitmap, Bitmap refreshBitmap) {
OlImageView.waitBitmap = waitBitmap;
OlImageView.refreshBitmap = refreshBitmap;
}
@@ -0,0 +1,564 @@
package com.hippo.ehviewer.widget;
import com.hippo.ehviewer.R;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.view.animation.Transformation;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
public class PullListView extends LinearLayout implements AbsListView.OnScrollListener{
@SuppressWarnings("unused")
private static final String TAG = "PullListView";
private final static int HEADER_PULL_TO_REFRESH = 0;
private final static int HEADER_RELEASE_TO_REFRESH = 1;
private final static int HEADER_REFRESHING = 2;
private final static int HEADER_DONE = 3;
private final static int HEADER_CANCEL = 4;
private final static int FOOTER_REFRESHING = 0;
private final static int FOOTER_SUCCESS = 1;
private final static int FOOTER_FAIL = 2;
// arrow animation
private RotateAnimation mAnimation;
private RotateAnimation mReverseAnimation;
// Header animation
private Animation mRefreshAnimation;
private Animation mOverAnimation;
private ListView mListView;
private LinearLayout mHeader;
private LinearLayout mFooter;
private TextView mTipTextView;
private ImageView mArrowImageView;
private ProgressBar mProgressBar;
private TextView mFooterTipTextView;
private ProgressBar mFooterProgressBar;
// Make sure only one pull event
private boolean isHeaderRecored = false;
private boolean isFooterRecored = false;
// Header String to show
private String mHeaderPullStr;
private String mHeaderReleaseStr;
private String mHeaderRefreshStr;
private String mHeaderDoneStr;
private String mHeaderCancelStr;
// Footer String to show
private String mFooterRefreshStr;
private String mFooterSuccessStr;
private String mFooterFailStr;
// Header
private int headerHeight;
private int headerOriginalLeftPadding;
private int headerOriginalTopPadding;
private int headerOriginalRightPadding;
private int headerOriginalBottomPadding;
private int releaseTopPadding;
private int doneTopPadding;
private int pullThreshold;
private int pullOffestMax;
// Footer
private boolean isActionWhenShow = true;
private int startY;
private int headerState = HEADER_DONE;
private boolean isBack;
private int footerState = FOOTER_SUCCESS;
private OnHeaderRefreshListener headerRefreshListener;
private OnFooterRefreshListener footerRefreshListener;
// To Check scroll to top
// Store y of last point
private int lastY;
private boolean mHeaderEnabled = true;
private boolean mFooterEnabled = true;
public interface OnHeaderRefreshListener {
public void onHeaderRefresh();
}
public interface OnFooterRefreshListener {
public void onFooterRefresh();
}
public PullListView(Context context) {
super(context);
init(context);
}
public PullListView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public PullListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
private void init(Context context) {
// Set arrow animation
mAnimation = new RotateAnimation(0, -180,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mAnimation.setInterpolator(new LinearInterpolator());
mAnimation.setDuration(100);
mAnimation.setFillAfter(true);
mReverseAnimation = new RotateAnimation(-180, 0,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
mReverseAnimation.setInterpolator(new LinearInterpolator());
mReverseAnimation.setDuration(100);
mReverseAnimation.setFillAfter(true);
// Set header animation
mRefreshAnimation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
mHeader.setPadding(headerOriginalLeftPadding,
(int)((1 - interpolatedTime) * releaseTopPadding + (interpolatedTime * headerOriginalTopPadding)),
headerOriginalRightPadding, headerOriginalBottomPadding);
mHeader.invalidate();
}
};
mRefreshAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
setEnabled(false);
}
@Override
public void onAnimationEnd(Animation animation) {
setEnabled(true);
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
mRefreshAnimation.setDuration(100);
mOverAnimation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
mHeader.setPadding(headerOriginalLeftPadding,
(int)((1 - interpolatedTime) * doneTopPadding - (interpolatedTime * headerHeight)),
headerOriginalRightPadding, headerOriginalBottomPadding);
mHeader.invalidate();
}
};
mOverAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
setEnabled(false);
}
@Override
public void onAnimationEnd(Animation animation) {
setEnabled(true);
if (headerState == HEADER_CANCEL) {
headerState = HEADER_DONE;
isHeaderRecored = false;
isBack = false;
}
}
@Override
public void onAnimationRepeat(Animation animation) {}
});
mOverAnimation.setDuration(200);
View view = LayoutInflater.from(context).inflate(R.layout.pull_list_view, this);
mFooter = (LinearLayout)LayoutInflater.from(context).inflate(R.layout.pull_list_view_footer, null);
mFooter.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
footerRefresh();
}
});
mListView = (ListView)view.findViewById(R.id.list_view);
mListView.setOnScrollListener(this);
mListView.addFooterView(mFooter);
mFooterTipTextView = (TextView)mFooter.findViewById(R.id.footer_tip_text);
mFooterProgressBar = (ProgressBar)mFooter.findViewById(R.id.footer_progressBar);
mHeader = (LinearLayout)view.findViewById(R.id.header);
mArrowImageView = (ImageView) mHeader.findViewById(R.id.header_arrow_image);
mArrowImageView.setMinimumWidth(50);
mArrowImageView.setMinimumHeight(50);
mProgressBar = (ProgressBar)mHeader.findViewById(R.id.header_progressBar);
mTipTextView = (TextView)mHeader.findViewById(R.id.header_tip_text);
headerOriginalLeftPadding = mHeader.getPaddingLeft();
headerOriginalTopPadding = mHeader.getPaddingTop();
headerOriginalRightPadding = mHeader.getPaddingRight();
headerOriginalBottomPadding = mHeader.getPaddingBottom();
measureView(mHeader);
headerHeight = mHeader.getMeasuredHeight();
pullThreshold = headerHeight;
pullOffestMax = (int)(headerHeight * 2.3f);
mHeader.setPadding(headerOriginalLeftPadding, -headerHeight, headerOriginalRightPadding, headerOriginalBottomPadding);
mHeader.invalidate();
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
// TODO Auto-generated method stub
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if (firstVisibleItem + visibleItemCount == totalItemCount
&& isActionWhenShow && totalItemCount > 1)
footerRefresh();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (!mHeaderEnabled || isHeaderRecored || isFooterRecored)
return false;
final int action = event.getAction() & MotionEvent.ACTION_MASK;
switch (action) {
case MotionEvent.ACTION_DOWN:
lastY = (int)event.getY();
return false;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
return false;
case MotionEvent.ACTION_MOVE:
int y = (int)event.getY();
int offsetY = y - lastY;
lastY = y;
if (offsetY > 0 && isListAtTop())
return true;
else
return false;
default:
return false;
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
final int action = event.getAction() & MotionEvent.ACTION_MASK;
switch (action) {
case MotionEvent.ACTION_DOWN:
if (mHeaderEnabled && !isHeaderRecored && !isFooterRecored) {
isHeaderRecored = true;
startY = (int) event.getY();
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (headerState == HEADER_PULL_TO_REFRESH) {
headerState = HEADER_CANCEL;
changeHeaderViewByState();
}
else if (headerState == HEADER_RELEASE_TO_REFRESH) {
headerState = HEADER_REFRESHING;
changeHeaderViewByState();
onHeaderRefresh();
} else if (headerState == HEADER_DONE) {
isHeaderRecored = false;
isBack = false;
changeHeaderViewByState();
}
break;
case MotionEvent.ACTION_MOVE:
int tempY = (int)event.getY();
if (mHeaderEnabled && !isHeaderRecored && !isFooterRecored) {
isHeaderRecored = true;
startY = tempY;
}
if (headerState != HEADER_REFRESHING && isHeaderRecored) {
int offsetY = getShowOffset(tempY - startY, pullOffestMax);
if (headerState == HEADER_RELEASE_TO_REFRESH) {
// 往上推,推到屏幕足够掩盖head的程度,但还没有全部掩盖
if (offsetY < pullThreshold && offsetY > 0) {
headerState = HEADER_PULL_TO_REFRESH;
changeHeaderViewByState();
}
// 一下子推到顶
else if (offsetY <= 0) {
headerState = HEADER_DONE;
startY = tempY;
}
} else if (headerState == HEADER_PULL_TO_REFRESH) {
// 下拉到可以进入RELEASE_TO_REFRESH的状态
if (offsetY >= pullThreshold) {
headerState = HEADER_RELEASE_TO_REFRESH;
isBack = true;
changeHeaderViewByState();
}
// 上推到顶了
else if (offsetY <= 0) {
headerState = HEADER_DONE;
startY = tempY;
}
} else if (headerState == HEADER_DONE) {
if (offsetY > 0) {
headerState = HEADER_PULL_TO_REFRESH;
changeHeaderViewByState();
} else {
startY = tempY;
}
}
// 更新headView的size
if (headerState == HEADER_PULL_TO_REFRESH) {
int topPadding = (int)(offsetY - headerHeight);
mHeader.setPadding(headerOriginalLeftPadding, topPadding, headerOriginalRightPadding, headerOriginalBottomPadding);
mHeader.invalidate();
}
// 更新headView的paddingTop
if (headerState == HEADER_RELEASE_TO_REFRESH) {
int topPadding = (int)(offsetY - headerHeight);
mHeader.setPadding(headerOriginalLeftPadding, topPadding, headerOriginalRightPadding, headerOriginalBottomPadding);
mHeader.invalidate();
}
}
break;
}
return true;
}
private int getShowOffset(int eventOffset, int target) {
if (eventOffset <= 0) // avoid divide zero
return 0;
else
return (target * eventOffset) / (eventOffset + target);
}
// Refresh header UI
private void changeHeaderViewByState() {
switch (headerState) {
case HEADER_RELEASE_TO_REFRESH:
mArrowImageView.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
mTipTextView.setVisibility(View.VISIBLE);
mArrowImageView.clearAnimation();
mArrowImageView.startAnimation(mAnimation);
mTipTextView.setText(mHeaderReleaseStr);
break;
case HEADER_PULL_TO_REFRESH:
mProgressBar.setVisibility(View.GONE);
mTipTextView.setVisibility(View.VISIBLE);
mArrowImageView.clearAnimation();
mArrowImageView.setVisibility(View.VISIBLE);
if (isBack) {
isBack = false;
mArrowImageView.clearAnimation();
mArrowImageView.startAnimation(mReverseAnimation);
}
mTipTextView.setText(mHeaderPullStr);
break;
case HEADER_REFRESHING:
releaseTopPadding = mHeader.getPaddingTop();
mHeader.startAnimation(mRefreshAnimation);
mProgressBar.setVisibility(View.VISIBLE);
mArrowImageView.clearAnimation();
mArrowImageView.setVisibility(View.GONE);
mTipTextView.setText(mHeaderRefreshStr);
break;
case HEADER_DONE:
case HEADER_CANCEL:
doneTopPadding = mHeader.getPaddingTop();
mHeader.startAnimation(mOverAnimation);
mProgressBar.setVisibility(View.GONE);
mArrowImageView.setVisibility(View.GONE);
mArrowImageView.clearAnimation();
// 此处更换图标
mArrowImageView.setImageResource(R.drawable.ic_pulltorefresh_arrow);
if (headerState == HEADER_DONE)
mTipTextView.setText(mHeaderDoneStr);
else
mTipTextView.setText(mHeaderCancelStr);
break;
}
}
// Refresh footer UI
private void changeFooterViewByState() {
switch (footerState) {
case FOOTER_REFRESHING:
mFooterTipTextView.setText(mFooterRefreshStr);
mFooterProgressBar.setVisibility(View.VISIBLE);
break;
case FOOTER_SUCCESS:
mFooterTipTextView.setText(mFooterSuccessStr);
mFooterProgressBar.setVisibility(View.GONE);
break;
case FOOTER_FAIL:
mFooterTipTextView.setText(mFooterFailStr);
mFooterProgressBar.setVisibility(View.GONE);
break;
}
}
public ListView getListView() {
return mListView;
}
// Header
public void setHeaderEnabled(boolean enabled) {
mHeaderEnabled = enabled;
}
public void setHeaderString(String pullStr, String releaseStr, String refreshStr, String doneStr, String cancelStr) {
mHeaderPullStr = pullStr;
mHeaderReleaseStr = releaseStr;
mHeaderRefreshStr = refreshStr;
mHeaderDoneStr = doneStr;
mHeaderCancelStr = cancelStr;
}
public void clickHeaderRefresh() {
if (!mHeaderEnabled || isHeaderRecored || isFooterRecored)
return;
isHeaderRecored = true;
headerState = HEADER_REFRESHING;
//mListView.setSelection(0);
changeHeaderViewByState();
onHeaderRefresh();
}
public void setOnRefreshListener(OnHeaderRefreshListener refreshListener) {
this.headerRefreshListener = refreshListener;
}
private void onHeaderRefresh() {
if (headerRefreshListener != null) {
headerRefreshListener.onHeaderRefresh();
}
}
public boolean isHeaderRefreshing() {
return headerState == HEADER_REFRESHING;
}
public void onHeaderRefreshComplete() {
headerState = HEADER_DONE;
isHeaderRecored = false;
isBack = false;
changeHeaderViewByState();
}
// Footer
public void setFooterEnabled(boolean enabled) {
// TODO Remove footer if false
mFooterEnabled = enabled;
}
public void setFooterString(String refreshStr, String successStr, String failStr) {
mFooterRefreshStr = refreshStr;
mFooterSuccessStr = successStr;
mFooterFailStr = failStr;
changeFooterViewByState();
}
public void footerRefresh() {
if (!mHeaderEnabled || isHeaderRecored || isFooterRecored)
return;
isFooterRecored = true;
footerState = FOOTER_REFRESHING;
changeFooterViewByState();
if (footerRefreshListener != null) {
footerRefreshListener.onFooterRefresh();
}
}
public void setOnFooterRefreshListener(OnFooterRefreshListener footerRefreshListener) {
this.footerRefreshListener = footerRefreshListener;
}
public void onFooterRefreshComplete(boolean isSuccess) {
if (isSuccess) {
footerState = FOOTER_SUCCESS;
isActionWhenShow = true;
}
else {
footerState = FOOTER_FAIL;
isActionWhenShow = false;
}
isFooterRecored = false;
changeFooterViewByState();
}
public void onFooterRefreshComplete(boolean isSuccess, boolean actionWhenShow) {
if (isSuccess)
footerState = FOOTER_SUCCESS;
else
footerState = FOOTER_FAIL;
isActionWhenShow = actionWhenShow;
isFooterRecored = false;
changeFooterViewByState();
}
public void setActionWhenShow(boolean actionWhenShow) {
isActionWhenShow = actionWhenShow;
}
private boolean isListAtTop() {
if(mListView.getChildCount() == 0)
return true;
return mListView.getChildAt(0).getTop() == 0;
}
// Get header width and height
private void measureView(View child) {
ViewGroup.LayoutParams p = child.getLayoutParams();
if (p == null) {
p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width);
int lpHeight = p.height;
int childHeightSpec;
if (lpHeight > 0) {
childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight,
MeasureSpec.EXACTLY);
} else {
childHeightSpec = MeasureSpec.makeMeasureSpec(0,
MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthSpec, childHeightSpec);
}
}