Compare commits

...
10 Commits
Author SHA1 Message Date
seven332 c6c060b5e2 0.4.4 2014-04-06 13:49:54 +08:00
seven332 def283de08 添加 charset 识别 2014-04-06 13:45:52 +08:00
seven332 be3d3189ec 学习使用 ProGuard 2014-04-06 11:30:40 +08:00
seven332 0581b7cc53 使用更安全的 Log 2014-04-06 11:11:57 +08:00
seven332 79b75e5de1 0.4.3 2014-04-05 23:57:52 +08:00
seven332 f7be9dec18 添加更新服务器选择 2014-04-05 23:51:48 +08:00
seven332 566226958f 临时解决 endIndex 大于 size 的问题 2014-04-05 23:15:07 +08:00
seven332 e45db97a54 用 json 检查更新 2014-04-05 22:28:45 +08:00
seven332 ea58ffed74 用 json 检查更新 2014-04-05 22:28:11 +08:00
seven332 eb1e49e7c7 更丰富的错误提示 2014-04-05 00:08:10 +08:00
64 changed files with 211058 additions and 2519 deletions

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="12"
android:versionName="0.4.2" >
android:versionCode="14"
android:versionName="0.4.4" >
<uses-sdk
android:minSdkVersion="14"
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="12"
android:versionName="0.4.2" >
android:versionCode="14"
android:versionName="0.4.4" >
<uses-sdk
android:minSdkVersion="14"
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+122
View File
@@ -0,0 +1,122 @@
# view AndroidManifest.xml #generated:15
-keep class com.hippo.ehviewer.AppContext { <init>(...); }
# view AndroidManifest.xml #generated:24
-keep class com.hippo.ehviewer.StartActivity { <init>(...); }
# view AndroidManifest.xml #generated:77
-keep class com.hippo.ehviewer.activity.DownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:69
-keep class com.hippo.ehviewer.activity.FavouriteActivity { <init>(...); }
# view AndroidManifest.xml #generated:55
-keep class com.hippo.ehviewer.activity.MangaActivity { <init>(...); }
# view AndroidManifest.xml #generated:48
-keep class com.hippo.ehviewer.activity.MangaDetailActivity { <init>(...); }
# view AndroidManifest.xml #generated:86
-keep class com.hippo.ehviewer.activity.MangaDownloadActivity { <init>(...); }
# view AndroidManifest.xml #generated:35
-keep class com.hippo.ehviewer.activity.MangaListActivity { <init>(...); }
# view AndroidManifest.xml #generated:61
-keep class com.hippo.ehviewer.activity.SettingsActivity { <init>(...); }
# view res/layout/gl_root_group.xml #generated:7
-keep class com.hippo.ehviewer.gallery.ui.GLRootView { <init>(...); }
# view res/xml/settings.xml #generated:13
# view res/xml/settings.xml #generated:21
# view res/xml/settings.xml #generated:5
# view res/xml/settings.xml #generated:71
-keep class com.hippo.ehviewer.preference.AutoListPreference { <init>(...); }
# view AndroidManifest.xml #generated:94
-keep class com.hippo.ehviewer.service.DownloadService { <init>(...); }
# view res/layout/dialog.xml #generated:70
# view res/layout/dialog.xml #generated:77
# view res/layout/dialog.xml #generated:84
-keep class com.hippo.ehviewer.view.AlertButton { <init>(...); }
# view res/layout/filter.xml #generated:19
# view res/layout/filter.xml #generated:27
# view res/layout/filter.xml #generated:37
# view res/layout/filter.xml #generated:45
# view res/layout/filter.xml #generated:55
# view res/layout/filter.xml #generated:63
# view res/layout/filter.xml #generated:73
# view res/layout/filter.xml #generated:81
# view res/layout/filter.xml #generated:91
# view res/layout/filter.xml #generated:99
-keep class com.hippo.ehviewer.view.CheckImage { <init>(...); }
# view res/layout/download_item.xml #generated:1
-keep class com.hippo.ehviewer.view.DownloadItemLayout { <init>(...); }
# view res/layout/list.xml #generated:6
-keep class com.hippo.ehviewer.view.GetPaddingRelativeLayout { <init>(...); }
# view res/layout/manga.xml #generated:1
-keep class com.hippo.ehviewer.view.MangaViewPager { <init>(...); }
# view res/layout/detail.xml #generated:20
# view res/layout/download_item.xml #generated:8
-keep class com.hippo.ehviewer.view.OlImageView { <init>(...); }
# view res/layout/list_menu_list.xml #generated:1
-keep class com.hippo.ehviewer.view.TagListView { <init>(...); }
# view res/layout/page_list.xml #generated:13
-keep class com.hippo.ehviewer.widget.AutoWrapLayout { <init>(...); }
# view res/layout/list.xml #generated:1
-keep class com.hippo.ehviewer.widget.DrawerLayout { <init>(...); }
# view res/layout/list_item.xml #generated:6
-keep class com.hippo.ehviewer.widget.LoadImageView { <init>(...); }
# view res/layout/list.xml #generated:12
-keep class com.hippo.ehviewer.widget.PullListView { <init>(...); }
# onClick res/layout/page_list_panel.xml #generated:6
-keepclassmembers class * { *** ButtonBack(...); }
# onClick res/layout/page_list_panel.xml #generated:25
-keepclassmembers class * { *** ButtonFront(...); }
# onClick res/layout/page_list.xml #generated:28
-keepclassmembers class * { *** ButtonPreviewRefresh(...); }
# onClick res/layout/menu_login.xml #generated:17
-keepclassmembers class * { *** buttonCheckLogin(...); }
# onClick res/layout/detail_offensive.xml #generated:41
-keepclassmembers class * { *** buttonEvery(...); }
# onClick res/layout/detail_offensive.xml #generated:23
# onClick res/layout/detail_pining.xml #generated:15
-keepclassmembers class * { *** buttonFinsh(...); }
# onClick res/layout/menu_login.xml #generated:6
-keepclassmembers class * { *** buttonLogin(...); }
# onClick res/layout/menu_login_over.xml #generated:16
-keepclassmembers class * { *** buttonLogout(...); }
# onClick res/layout/detail_offensive.xml #generated:31
-keepclassmembers class * { *** buttonOnce(...); }
# onClick res/layout/detail_normal.xml #generated:73
-keepclassmembers class * { *** buttonRead(...); }
# onClick res/layout/detail.xml #generated:60
# onClick res/layout/list.xml #generated:25
-keepclassmembers class * { *** buttonRefresh(...); }
# onClick res/layout/page_list_panel.xml #generated:12
-keepclassmembers class * { *** goTo(...); }
BIN
View File
Binary file not shown.
+20 -20
View File
@@ -1,20 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
+199426
View File
File diff suppressed because it is too large. Load diff
+5196
View File
File diff suppressed because it is too large. Load diff
+700
View File
@@ -0,0 +1,700 @@
android.support.v4.app.BackStackState
android.support.v4.app.BackStackState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.Fragment$SavedState
android.support.v4.app.Fragment$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.FragmentManagerState
android.support.v4.app.FragmentManagerState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.FragmentState
android.support.v4.app.FragmentState: android.os.Parcelable$Creator CREATOR
android.support.v4.app.FragmentTabHost: void setOnTabChangedListener(android.widget.TabHost$OnTabChangeListener)
android.support.v4.app.FragmentTabHost$SavedState
android.support.v4.app.FragmentTabHost$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.content.ModernAsyncTask$Status: android.support.v4.content.ModernAsyncTask$Status[] values()
android.support.v4.content.ModernAsyncTask$Status: android.support.v4.content.ModernAsyncTask$Status valueOf(java.lang.String)
android.support.v4.view.PagerTabStrip: void setTabIndicatorColor(int)
android.support.v4.view.PagerTabStrip: void setTabIndicatorColorResource(int)
android.support.v4.view.PagerTabStrip: int getTabIndicatorColor()
android.support.v4.view.PagerTabStrip: void setTextSpacing(int)
android.support.v4.view.PagerTabStrip: void setBackgroundDrawable(android.graphics.drawable.Drawable)
android.support.v4.view.PagerTabStrip: void setBackgroundColor(int)
android.support.v4.view.PagerTabStrip: void setBackgroundResource(int)
android.support.v4.view.PagerTabStrip: void setDrawFullUnderline(boolean)
android.support.v4.view.PagerTabStrip: boolean getDrawFullUnderline()
android.support.v4.view.PagerTabStrip: int getMinHeight()
android.support.v4.view.PagerTitleStrip: void setSingleLineAllCaps(android.widget.TextView)
android.support.v4.view.PagerTitleStrip: void setTextSpacing(int)
android.support.v4.view.PagerTitleStrip: int getTextSpacing()
android.support.v4.view.PagerTitleStrip: void setNonPrimaryAlpha(float)
android.support.v4.view.PagerTitleStrip: void setTextColor(int)
android.support.v4.view.PagerTitleStrip: void setGravity(int)
android.support.v4.view.PagerTitleStrip: int getMinHeight()
android.support.v4.view.ViewPager: void setScrollState(int)
android.support.v4.view.ViewPager: void setAdapter(android.support.v4.view.PagerAdapter)
android.support.v4.view.ViewPager: android.support.v4.view.PagerAdapter getAdapter()
android.support.v4.view.ViewPager: void setOnAdapterChangeListener(android.support.v4.view.ViewPager$OnAdapterChangeListener)
android.support.v4.view.ViewPager: int getClientWidth()
android.support.v4.view.ViewPager: void setCurrentItem(int)
android.support.v4.view.ViewPager: int getCurrentItem()
android.support.v4.view.ViewPager: void setOnPageChangeListener(android.support.v4.view.ViewPager$OnPageChangeListener)
android.support.v4.view.ViewPager: void setChildrenDrawingOrderEnabledCompat(boolean)
android.support.v4.view.ViewPager: int getOffscreenPageLimit()
android.support.v4.view.ViewPager: void setOffscreenPageLimit(int)
android.support.v4.view.ViewPager: void setPageMargin(int)
android.support.v4.view.ViewPager: int getPageMargin()
android.support.v4.view.ViewPager: void setPageMarginDrawable(android.graphics.drawable.Drawable)
android.support.v4.view.ViewPager: void setPageMarginDrawable(int)
android.support.v4.view.ViewPager: void setScrollingCacheEnabled(boolean)
android.support.v4.view.ViewPager$SavedState
android.support.v4.view.ViewPager$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.widget.DrawerLayout: void setScrimColor(int)
android.support.v4.widget.DrawerLayout: void setDrawerListener(android.support.v4.widget.DrawerLayout$DrawerListener)
android.support.v4.widget.DrawerLayout: void setDrawerLockMode(int)
android.support.v4.widget.DrawerLayout$SavedState
android.support.v4.widget.DrawerLayout$SavedState: android.os.Parcelable$Creator CREATOR
android.support.v4.widget.SlidingPaneLayout: void setParallaxDistance(int)
android.support.v4.widget.SlidingPaneLayout: int getParallaxDistance()
android.support.v4.widget.SlidingPaneLayout: void setSliderFadeColor(int)
android.support.v4.widget.SlidingPaneLayout: int getSliderFadeColor()
android.support.v4.widget.SlidingPaneLayout: void setCoveredFadeColor(int)
android.support.v4.widget.SlidingPaneLayout: int getCoveredFadeColor()
android.support.v4.widget.SlidingPaneLayout: void setPanelSlideListener(android.support.v4.widget.SlidingPaneLayout$PanelSlideListener)
android.support.v4.widget.SlidingPaneLayout: void setShadowDrawable(android.graphics.drawable.Drawable)
android.support.v4.widget.SlidingPaneLayout: void setShadowResource(int)
android.support.v4.widget.SlidingPaneLayout$SavedState
android.support.v4.widget.SlidingPaneLayout$SavedState: android.os.Parcelable$Creator CREATOR
com.hippo.ehviewer.AppContext
com.hippo.ehviewer.AppContext: AppContext()
com.hippo.ehviewer.R$array: int download_item_long_click
com.hippo.ehviewer.R$array: int favourite_item_long_click
com.hippo.ehviewer.R$array: int is_exhentai
com.hippo.ehviewer.R$array: int list_item_long_click
com.hippo.ehviewer.R$array: int list_list_title
com.hippo.ehviewer.R$array: int min_rating
com.hippo.ehviewer.R$array: int page_scaling_entries
com.hippo.ehviewer.R$array: int page_scaling_entry_values
com.hippo.ehviewer.R$array: int preference_screen_ori_entries
com.hippo.ehviewer.R$array: int preference_screen_ori_entry_values
com.hippo.ehviewer.R$array: int preference_update_server_entries
com.hippo.ehviewer.R$array: int preference_update_server_entry_values
com.hippo.ehviewer.R$array: int start_position_entries
com.hippo.ehviewer.R$array: int start_position_values
com.hippo.ehviewer.R$attr: int adjustViewBounds
com.hippo.ehviewer.R$attr: int baseLine
com.hippo.ehviewer.R$attr: int baseline
com.hippo.ehviewer.R$attr: int baselineAlignBottom
com.hippo.ehviewer.R$attr: int cropToPadding
com.hippo.ehviewer.R$attr: int drawableAlpha
com.hippo.ehviewer.R$attr: int mask
com.hippo.ehviewer.R$attr: int maxHeight
com.hippo.ehviewer.R$attr: int maxWidth
com.hippo.ehviewer.R$attr: int scaleType
com.hippo.ehviewer.R$attr: int src
com.hippo.ehviewer.R$attr: int tint
com.hippo.ehviewer.R$color: int blue_dark
com.hippo.ehviewer.R$color: int blue_light
com.hippo.ehviewer.R$dimen: int activity_horizontal_margin
com.hippo.ehviewer.R$dimen: int activity_vertical_margin
com.hippo.ehviewer.R$dimen: int menu_offset
com.hippo.ehviewer.R$dimen: int shadow_width
com.hippo.ehviewer.R$drawable: int artistcg
com.hippo.ehviewer.R$drawable: int asianporn
com.hippo.ehviewer.R$drawable: int back
com.hippo.ehviewer.R$drawable: int cosplay
com.hippo.ehviewer.R$drawable: int doujinshi
com.hippo.ehviewer.R$drawable: int front
com.hippo.ehviewer.R$drawable: int gamecg
com.hippo.ehviewer.R$drawable: int ic_action_action_search
com.hippo.ehviewer.R$drawable: int ic_action_completed
com.hippo.ehviewer.R$drawable: int ic_action_core_overflow
com.hippo.ehviewer.R$drawable: int ic_action_download
com.hippo.ehviewer.R$drawable: int ic_action_favourite
com.hippo.ehviewer.R$drawable: int ic_action_jump
com.hippo.ehviewer.R$drawable: int ic_action_pause
com.hippo.ehviewer.R$drawable: int ic_action_refresh
com.hippo.ehviewer.R$drawable: int ic_action_remove
com.hippo.ehviewer.R$drawable: int ic_action_search
com.hippo.ehviewer.R$drawable: int ic_action_settings
com.hippo.ehviewer.R$drawable: int ic_action_start
com.hippo.ehviewer.R$drawable: int ic_launcher
com.hippo.ehviewer.R$drawable: int ic_navigation_drawer
com.hippo.ehviewer.R$drawable: int ic_pulltorefresh_arrow
com.hippo.ehviewer.R$drawable: int ic_touch
com.hippo.ehviewer.R$drawable: int imageset
com.hippo.ehviewer.R$drawable: int manga
com.hippo.ehviewer.R$drawable: int mask
com.hippo.ehviewer.R$drawable: int misc
com.hippo.ehviewer.R$drawable: int non_h
com.hippo.ehviewer.R$drawable: int progress_large
com.hippo.ehviewer.R$drawable: int progress_small
com.hippo.ehviewer.R$drawable: int sadpanda
com.hippo.ehviewer.R$drawable: int scrollbar_blue
com.hippo.ehviewer.R$drawable: int scrollbar_white
com.hippo.ehviewer.R$drawable: int spinner_16_inner
com.hippo.ehviewer.R$drawable: int spinner_16_outer
com.hippo.ehviewer.R$drawable: int spinner_76_inner
com.hippo.ehviewer.R$drawable: int spinner_76_outer
com.hippo.ehviewer.R$drawable: int star
com.hippo.ehviewer.R$drawable: int star_empty
com.hippo.ehviewer.R$drawable: int star_half
com.hippo.ehviewer.R$drawable: int unknown
com.hippo.ehviewer.R$drawable: int welcome
com.hippo.ehviewer.R$drawable: int western
com.hippo.ehviewer.R$id: int action
com.hippo.ehviewer.R$id: int action_download
com.hippo.ehviewer.R$id: int action_favourite
com.hippo.ehviewer.R$id: int action_jump
com.hippo.ehviewer.R$id: int action_refresh
com.hippo.ehviewer.R$id: int action_search
com.hippo.ehviewer.R$id: int action_settings
com.hippo.ehviewer.R$id: int app_start_view
com.hippo.ehviewer.R$id: int autoCompleteTextView1
com.hippo.ehviewer.R$id: int bottom
com.hippo.ehviewer.R$id: int bottom_panel
com.hippo.ehviewer.R$id: int button_artistcg
com.hippo.ehviewer.R$id: int button_asianporn
com.hippo.ehviewer.R$id: int button_check_login
com.hippo.ehviewer.R$id: int button_cosplay
com.hippo.ehviewer.R$id: int button_doujinshi
com.hippo.ehviewer.R$id: int button_gamecg
com.hippo.ehviewer.R$id: int button_imageset
com.hippo.ehviewer.R$id: int button_login
com.hippo.ehviewer.R$id: int button_manga
com.hippo.ehviewer.R$id: int button_misc
com.hippo.ehviewer.R$id: int button_non_h
com.hippo.ehviewer.R$id: int button_read
com.hippo.ehviewer.R$id: int button_western
com.hippo.ehviewer.R$id: int center
com.hippo.ehviewer.R$id: int centerCrop
com.hippo.ehviewer.R$id: int centerInside
com.hippo.ehviewer.R$id: int checkbox_advance
com.hippo.ehviewer.R$id: int checkbox_sdesc
com.hippo.ehviewer.R$id: int checkbox_sdt1
com.hippo.ehviewer.R$id: int checkbox_sdt2
com.hippo.ehviewer.R$id: int checkbox_sh
com.hippo.ehviewer.R$id: int checkbox_sname
com.hippo.ehviewer.R$id: int checkbox_sr
com.hippo.ehviewer.R$id: int checkbox_stags
com.hippo.ehviewer.R$id: int checkbox_sto
com.hippo.ehviewer.R$id: int checkbox_storr
com.hippo.ehviewer.R$id: int cover
com.hippo.ehviewer.R$id: int custom
com.hippo.ehviewer.R$id: int detail_average
com.hippo.ehviewer.R$id: int detail_button_cancel
com.hippo.ehviewer.R$id: int detail_button_every
com.hippo.ehviewer.R$id: int detail_button_known
com.hippo.ehviewer.R$id: int detail_button_once
com.hippo.ehviewer.R$id: int detail_cover
com.hippo.ehviewer.R$id: int detail_language
com.hippo.ehviewer.R$id: int detail_pages
com.hippo.ehviewer.R$id: int detail_people
com.hippo.ehviewer.R$id: int detail_posted
com.hippo.ehviewer.R$id: int detail_rate
com.hippo.ehviewer.R$id: int detail_refresh
com.hippo.ehviewer.R$id: int detail_size
com.hippo.ehviewer.R$id: int detail_title
com.hippo.ehviewer.R$id: int detail_type
com.hippo.ehviewer.R$id: int detail_uploader
com.hippo.ehviewer.R$id: int detail_wait
com.hippo.ehviewer.R$id: int download
com.hippo.ehviewer.R$id: int drawer_layout
com.hippo.ehviewer.R$id: int drawer_login
com.hippo.ehviewer.R$id: int drawer_login_over
com.hippo.ehviewer.R$id: int favourite
com.hippo.ehviewer.R$id: int filter_advance
com.hippo.ehviewer.R$id: int fitCenter
com.hippo.ehviewer.R$id: int fitEnd
com.hippo.ehviewer.R$id: int fitStart
com.hippo.ehviewer.R$id: int fitXY
com.hippo.ehviewer.R$id: int footer_progressBar
com.hippo.ehviewer.R$id: int footer_tip_text
com.hippo.ehviewer.R$id: int gl_root_view
com.hippo.ehviewer.R$id: int head_arrowImageView
com.hippo.ehviewer.R$id: int head_contentLayout
com.hippo.ehviewer.R$id: int head_progressBar
com.hippo.ehviewer.R$id: int head_tipsTextView
com.hippo.ehviewer.R$id: int header
com.hippo.ehviewer.R$id: int header_arrow_image
com.hippo.ehviewer.R$id: int header_progressBar
com.hippo.ehviewer.R$id: int header_tip_text
com.hippo.ehviewer.R$id: int info
com.hippo.ehviewer.R$id: int is_exhentai
com.hippo.ehviewer.R$id: int list
com.hippo.ehviewer.R$id: int list_button_logout
com.hippo.ehviewer.R$id: int list_jump_edit
com.hippo.ehviewer.R$id: int list_jump_sum
com.hippo.ehviewer.R$id: int list_jump_to
com.hippo.ehviewer.R$id: int list_list
com.hippo.ehviewer.R$id: int list_main
com.hippo.ehviewer.R$id: int list_menu_list
com.hippo.ehviewer.R$id: int list_menu_login
com.hippo.ehviewer.R$id: int list_no_found
com.hippo.ehviewer.R$id: int list_refresh
com.hippo.ehviewer.R$id: int list_view
com.hippo.ehviewer.R$id: int list_wait_first
com.hippo.ehviewer.R$id: int list_wait_login
com.hippo.ehviewer.R$id: int list_wait_logout
com.hippo.ehviewer.R$id: int main
com.hippo.ehviewer.R$id: int manga_detail
com.hippo.ehviewer.R$id: int manga_detail_normal
com.hippo.ehviewer.R$id: int manga_detail_offensive
com.hippo.ehviewer.R$id: int manga_detail_pining
com.hippo.ehviewer.R$id: int manga_detail_scrollview
com.hippo.ehviewer.R$id: int matrix
com.hippo.ehviewer.R$id: int message
com.hippo.ehviewer.R$id: int name
com.hippo.ehviewer.R$id: int negative_button
com.hippo.ehviewer.R$id: int neutral_button
com.hippo.ehviewer.R$id: int page_list
com.hippo.ehviewer.R$id: int pager
com.hippo.ehviewer.R$id: int paper_list_layout
com.hippo.ehviewer.R$id: int paper_list_wait
com.hippo.ehviewer.R$id: int password
com.hippo.ehviewer.R$id: int positive_button
com.hippo.ehviewer.R$id: int preview_button_refresh
com.hippo.ehviewer.R$id: int preview_num
com.hippo.ehviewer.R$id: int progressBar
com.hippo.ehviewer.R$id: int rate
com.hippo.ehviewer.R$id: int remove
com.hippo.ehviewer.R$id: int sadpanda
com.hippo.ehviewer.R$id: int scroll_view
com.hippo.ehviewer.R$id: int search_bar
com.hippo.ehviewer.R$id: int search_text
com.hippo.ehviewer.R$id: int set_name_edit
com.hippo.ehviewer.R$id: int spinner_min_rating
com.hippo.ehviewer.R$id: int tags_layout
com.hippo.ehviewer.R$id: int text_username
com.hippo.ehviewer.R$id: int thumb
com.hippo.ehviewer.R$id: int title
com.hippo.ehviewer.R$id: int top
com.hippo.ehviewer.R$id: int type
com.hippo.ehviewer.R$id: int username
com.hippo.ehviewer.R$id: int wait_message
com.hippo.ehviewer.R$layout: int detail
com.hippo.ehviewer.R$layout: int detail_normal
com.hippo.ehviewer.R$layout: int detail_offensive
com.hippo.ehviewer.R$layout: int detail_pining
com.hippo.ehviewer.R$layout: int dialog
com.hippo.ehviewer.R$layout: int download
com.hippo.ehviewer.R$layout: int download_item
com.hippo.ehviewer.R$layout: int favourite
com.hippo.ehviewer.R$layout: int filter
com.hippo.ehviewer.R$layout: int gl_root_group
com.hippo.ehviewer.R$layout: int jump
com.hippo.ehviewer.R$layout: int list
com.hippo.ehviewer.R$layout: int list_item
com.hippo.ehviewer.R$layout: int list_item_text
com.hippo.ehviewer.R$layout: int list_menu_list
com.hippo.ehviewer.R$layout: int list_menu_login
com.hippo.ehviewer.R$layout: int login
com.hippo.ehviewer.R$layout: int manga
com.hippo.ehviewer.R$layout: int menu_item
com.hippo.ehviewer.R$layout: int menu_login
com.hippo.ehviewer.R$layout: int menu_login_over
com.hippo.ehviewer.R$layout: int page_list
com.hippo.ehviewer.R$layout: int page_list_panel
com.hippo.ehviewer.R$layout: int pull_list_view
com.hippo.ehviewer.R$layout: int pull_list_view_footer
com.hippo.ehviewer.R$layout: int pull_list_view_header
com.hippo.ehviewer.R$layout: int pull_to_refresh_head
com.hippo.ehviewer.R$layout: int search_view
com.hippo.ehviewer.R$layout: int set_name
com.hippo.ehviewer.R$layout: int start
com.hippo.ehviewer.R$layout: int wait
com.hippo.ehviewer.R$menu: int detail
com.hippo.ehviewer.R$menu: int main
com.hippo.ehviewer.R$raw: int change_log
com.hippo.ehviewer.R$raw: int thanks
com.hippo.ehviewer.R$string: int _default
com.hippo.ehviewer.R$string: int action_refresh
com.hippo.ehviewer.R$string: int action_settings
com.hippo.ehviewer.R$string: int actual_size
com.hippo.ehviewer.R$string: int add
com.hippo.ehviewer.R$string: int add_tag
com.hippo.ehviewer.R$string: int add_to_favourite
com.hippo.ehviewer.R$string: int advance_search_left
com.hippo.ehviewer.R$string: int app_name
com.hippo.ehviewer.R$string: int bottom_left
com.hippo.ehviewer.R$string: int bottom_right
com.hippo.ehviewer.R$string: int cache_large
com.hippo.ehviewer.R$string: int center
com.hippo.ehviewer.R$string: int changelog
com.hippo.ehviewer.R$string: int check_login
com.hippo.ehviewer.R$string: int checkbox_advance
com.hippo.ehviewer.R$string: int checkbox_sdesc
com.hippo.ehviewer.R$string: int checkbox_sdt1
com.hippo.ehviewer.R$string: int checkbox_sdt2
com.hippo.ehviewer.R$string: int checkbox_sh
com.hippo.ehviewer.R$string: int checkbox_sname
com.hippo.ehviewer.R$string: int checkbox_sr
com.hippo.ehviewer.R$string: int checkbox_stags
com.hippo.ehviewer.R$string: int checkbox_sto
com.hippo.ehviewer.R$string: int checkbox_storr
com.hippo.ehviewer.R$string: int checking_update
com.hippo.ehviewer.R$string: int create_cache_error
com.hippo.ehviewer.R$string: int dailog_check_network
com.hippo.ehviewer.R$string: int dailog_network_error_no
com.hippo.ehviewer.R$string: int dailog_network_error_yes
com.hippo.ehviewer.R$string: int dailog_waring_no
com.hippo.ehviewer.R$string: int dailog_waring_plain
com.hippo.ehviewer.R$string: int dailog_waring_title
com.hippo.ehviewer.R$string: int dailog_waring_yes
com.hippo.ehviewer.R$string: int detail_average
com.hippo.ehviewer.R$string: int detail_button_cancel
com.hippo.ehviewer.R$string: int detail_button_every
com.hippo.ehviewer.R$string: int detail_button_known
com.hippo.ehviewer.R$string: int detail_button_once
com.hippo.ehviewer.R$string: int detail_language
com.hippo.ehviewer.R$string: int detail_not_rated
com.hippo.ehviewer.R$string: int detail_offensive
com.hippo.ehviewer.R$string: int detail_offensive_title
com.hippo.ehviewer.R$string: int detail_pages
com.hippo.ehviewer.R$string: int detail_people
com.hippo.ehviewer.R$string: int detail_pining
com.hippo.ehviewer.R$string: int detail_posted
com.hippo.ehviewer.R$string: int detail_preview_error
com.hippo.ehviewer.R$string: int detail_size
com.hippo.ehviewer.R$string: int detail_uploader
com.hippo.ehviewer.R$string: int develop
com.hippo.ehviewer.R$string: int dialog_messgae_login_or_not
com.hippo.ehviewer.R$string: int dialog_send_crash_no
com.hippo.ehviewer.R$string: int dialog_send_crash_plain
com.hippo.ehviewer.R$string: int dialog_send_crash_title
com.hippo.ehviewer.R$string: int dialog_send_crash_yes
com.hippo.ehviewer.R$string: int dialog_title_login_or_not
com.hippo.ehviewer.R$string: int dialog_wait_send_crash_msg
com.hippo.ehviewer.R$string: int download
com.hippo.ehviewer.R$string: int download_successfully
com.hippo.ehviewer.R$string: int download_task_finished
com.hippo.ehviewer.R$string: int download_unsuccessfully
com.hippo.ehviewer.R$string: int downloading
com.hippo.ehviewer.R$string: int em_can_not_reach
com.hippo.ehviewer.R$string: int em_check_login_error
com.hippo.ehviewer.R$string: int em_client_protocol
com.hippo.ehviewer.R$string: int em_host_error
com.hippo.ehviewer.R$string: int em_invalid_request
com.hippo.ehviewer.R$string: int em_login_error
com.hippo.ehviewer.R$string: int em_logout_error
com.hippo.ehviewer.R$string: int em_network_error
com.hippo.ehviewer.R$string: int em_no_network
com.hippo.ehviewer.R$string: int em_no_network_2
com.hippo.ehviewer.R$string: int em_no_sdcard
com.hippo.ehviewer.R$string: int em_open_input_stream_error
com.hippo.ehviewer.R$string: int em_parser_error
com.hippo.ehviewer.R$string: int em_put_cache_error
com.hippo.ehviewer.R$string: int em_read_input_stream_error
com.hippo.ehviewer.R$string: int em_redirection_error
com.hippo.ehviewer.R$string: int em_request_error
com.hippo.ehviewer.R$string: int em_response_code_error
com.hippo.ehviewer.R$string: int em_retry
com.hippo.ehviewer.R$string: int em_retry_times
com.hippo.ehviewer.R$string: int em_timeout
com.hippo.ehviewer.R$string: int em_unexpected_response_code
com.hippo.ehviewer.R$string: int em_unknown_error
com.hippo.ehviewer.R$string: int em_unknown_host
com.hippo.ehviewer.R$string: int em_url_error
com.hippo.ehviewer.R$string: int em_url_format_error
com.hippo.ehviewer.R$string: int error
com.hippo.ehviewer.R$string: int exit_tip
com.hippo.ehviewer.R$string: int favourite
com.hippo.ehviewer.R$string: int first_page
com.hippo.ehviewer.R$string: int fit_to_height
com.hippo.ehviewer.R$string: int fit_to_screen
com.hippo.ehviewer.R$string: int fit_to_width
com.hippo.ehviewer.R$string: int fixed_scale
com.hippo.ehviewer.R$string: int footer_fail
com.hippo.ehviewer.R$string: int footer_loaded
com.hippo.ehviewer.R$string: int footer_loading
com.hippo.ehviewer.R$string: int found_update
com.hippo.ehviewer.R$string: int hint_no_keyword
com.hippo.ehviewer.R$string: int homepage
com.hippo.ehviewer.R$string: int input_error
com.hippo.ehviewer.R$string: int jump
com.hippo.ehviewer.R$string: int jump_sum
com.hippo.ehviewer.R$string: int jump_to
com.hippo.ehviewer.R$string: int landscape
com.hippo.ehviewer.R$string: int last_page
com.hippo.ehviewer.R$string: int list_title
com.hippo.ehviewer.R$string: int load_pre
com.hippo.ehviewer.R$string: int login
com.hippo.ehviewer.R$string: int logout
com.hippo.ehviewer.R$string: int menu
com.hippo.ehviewer.R$string: int new_tag_name
com.hippo.ehviewer.R$string: int next_page
com.hippo.ehviewer.R$string: int no_found
com.hippo.ehviewer.R$string: int not_login
com.hippo.ehviewer.R$string: int not_started
com.hippo.ehviewer.R$string: int password
com.hippo.ehviewer.R$string: int period
com.hippo.ehviewer.R$string: int portrait
com.hippo.ehviewer.R$string: int pre_page
com.hippo.ehviewer.R$string: int preference_author
com.hippo.ehviewer.R$string: int preference_author_summary
com.hippo.ehviewer.R$string: int preference_auto_page_cache
com.hippo.ehviewer.R$string: int preference_auto_page_cache_summary_off
com.hippo.ehviewer.R$string: int preference_auto_page_cache_summary_on
com.hippo.ehviewer.R$string: int preference_cache
com.hippo.ehviewer.R$string: int preference_cache_summary
com.hippo.ehviewer.R$string: int preference_cache_summary_no
com.hippo.ehviewer.R$string: int preference_category_about
com.hippo.ehviewer.R$string: int preference_category_cache
com.hippo.ehviewer.R$string: int preference_category_display
com.hippo.ehviewer.R$string: int preference_clear_cache
com.hippo.ehviewer.R$string: int preference_download_path
com.hippo.ehviewer.R$string: int preference_page_scaling
com.hippo.ehviewer.R$string: int preference_screen_ori
com.hippo.ehviewer.R$string: int preference_settings_title
com.hippo.ehviewer.R$string: int preference_start_position
com.hippo.ehviewer.R$string: int preference_update_server
com.hippo.ehviewer.R$string: int pull_load_cancel
com.hippo.ehviewer.R$string: int pull_load_doing
com.hippo.ehviewer.R$string: int pull_load_done
com.hippo.ehviewer.R$string: int pull_load_pull
com.hippo.ehviewer.R$string: int pull_load_release
com.hippo.ehviewer.R$string: int pull_pre_cancel
com.hippo.ehviewer.R$string: int pull_pre_doing
com.hippo.ehviewer.R$string: int pull_pre_done
com.hippo.ehviewer.R$string: int pull_pre_pull
com.hippo.ehviewer.R$string: int pull_pre_release
com.hippo.ehviewer.R$string: int pull_refresh_cancel
com.hippo.ehviewer.R$string: int pull_refresh_doing
com.hippo.ehviewer.R$string: int pull_refresh_done
com.hippo.ehviewer.R$string: int pull_refresh_pull
com.hippo.ehviewer.R$string: int pull_refresh_release
com.hippo.ehviewer.R$string: int read
com.hippo.ehviewer.R$string: int refresh
com.hippo.ehviewer.R$string: int remove
com.hippo.ehviewer.R$string: int remove_info_data
com.hippo.ehviewer.R$string: int retry_max_next
com.hippo.ehviewer.R$string: int retry_max_pre
com.hippo.ehviewer.R$string: int sadpanda
com.hippo.ehviewer.R$string: int some_page
com.hippo.ehviewer.R$string: int star_2
com.hippo.ehviewer.R$string: int star_3
com.hippo.ehviewer.R$string: int star_4
com.hippo.ehviewer.R$string: int star_5
com.hippo.ehviewer.R$string: int start_download_task
com.hippo.ehviewer.R$string: int start_reloading
com.hippo.ehviewer.R$string: int tag_change_name
com.hippo.ehviewer.R$string: int tag_name
com.hippo.ehviewer.R$string: int tag_name_empty
com.hippo.ehviewer.R$string: int tag_name_exist
com.hippo.ehviewer.R$string: int tap_update
com.hippo.ehviewer.R$string: int thanks
com.hippo.ehviewer.R$string: int toast_add_download
com.hippo.ehviewer.R$string: int toast_add_favourite
com.hippo.ehviewer.R$string: int toast_invalid_page
com.hippo.ehviewer.R$string: int toast_login_failed
com.hippo.ehviewer.R$string: int toast_login_succeeded
com.hippo.ehviewer.R$string: int toast_logout_failed
com.hippo.ehviewer.R$string: int toast_logout_succeeded
com.hippo.ehviewer.R$string: int top_left
com.hippo.ehviewer.R$string: int top_right
com.hippo.ehviewer.R$string: int unfinished
com.hippo.ehviewer.R$string: int up_to_date
com.hippo.ehviewer.R$string: int update
com.hippo.ehviewer.R$string: int update_message
com.hippo.ehviewer.R$string: int update_server_google
com.hippo.ehviewer.R$string: int update_server_qiniu
com.hippo.ehviewer.R$string: int username
com.hippo.ehviewer.R$string: int wait
com.hippo.ehviewer.R$string: int waiting
com.hippo.ehviewer.R$string: int what_to_do
com.hippo.ehviewer.R$string: int zoom_in
com.hippo.ehviewer.R$string: int zoom_out
com.hippo.ehviewer.R$style: int ActionBar
com.hippo.ehviewer.R$style: int AppTheme
com.hippo.ehviewer.R$style: int AppTheme_NoActionBar
com.hippo.ehviewer.R$style: int AppTheme_NoActionBar_Transparent
com.hippo.ehviewer.R$style: int Button
com.hippo.ehviewer.R$style: int Button_Blue
com.hippo.ehviewer.R$style: int Button_White
com.hippo.ehviewer.R$style: int OverFlow
com.hippo.ehviewer.R$style: int PopupMenu
com.hippo.ehviewer.R$style: int ProgressBar
com.hippo.ehviewer.R$style: int ProgressBar_Large
com.hippo.ehviewer.R$style: int ProgressBar_Small
com.hippo.ehviewer.R$styleable: int[] AutoWrapLayout
com.hippo.ehviewer.R$styleable: int AutoWrapLayout_baseLine
com.hippo.ehviewer.R$styleable: int[] CheckImage
com.hippo.ehviewer.R$styleable: int CheckImage_mask
com.hippo.ehviewer.R$styleable: int[] SuperImageView
com.hippo.ehviewer.R$styleable: int SuperImageView_adjustViewBounds
com.hippo.ehviewer.R$styleable: int SuperImageView_baseline
com.hippo.ehviewer.R$styleable: int SuperImageView_baselineAlignBottom
com.hippo.ehviewer.R$styleable: int SuperImageView_cropToPadding
com.hippo.ehviewer.R$styleable: int SuperImageView_drawableAlpha
com.hippo.ehviewer.R$styleable: int SuperImageView_maxHeight
com.hippo.ehviewer.R$styleable: int SuperImageView_maxWidth
com.hippo.ehviewer.R$styleable: int SuperImageView_scaleType
com.hippo.ehviewer.R$styleable: int SuperImageView_src
com.hippo.ehviewer.R$styleable: int SuperImageView_tint
com.hippo.ehviewer.R$xml: int searchable
com.hippo.ehviewer.R$xml: int settings
com.hippo.ehviewer.StartActivity
com.hippo.ehviewer.StartActivity: StartActivity()
com.hippo.ehviewer.activity.DownloadActivity
com.hippo.ehviewer.activity.DownloadActivity: DownloadActivity()
com.hippo.ehviewer.activity.FavouriteActivity
com.hippo.ehviewer.activity.FavouriteActivity: FavouriteActivity()
com.hippo.ehviewer.activity.FavouriteActivity: void buttonListItemCancel(android.view.View)
com.hippo.ehviewer.activity.MangaActivity
com.hippo.ehviewer.activity.MangaActivity: MangaActivity()
com.hippo.ehviewer.activity.MangaDetailActivity
com.hippo.ehviewer.activity.MangaDetailActivity: MangaDetailActivity()
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonRefresh(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonFinsh(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonOnce(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonEvery(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void buttonRead(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void ButtonBack(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void ButtonFront(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void ButtonPreviewRefresh(android.view.View)
com.hippo.ehviewer.activity.MangaDetailActivity: void goTo(android.view.View)
com.hippo.ehviewer.activity.MangaDownloadActivity
com.hippo.ehviewer.activity.MangaDownloadActivity: MangaDownloadActivity()
com.hippo.ehviewer.activity.MangaListActivity
com.hippo.ehviewer.activity.MangaListActivity: MangaListActivity()
com.hippo.ehviewer.activity.MangaListActivity: void buttonRefresh(android.view.View)
com.hippo.ehviewer.activity.MangaListActivity: void buttonLogout(android.view.View)
com.hippo.ehviewer.activity.MangaListActivity: void buttonLogin(android.view.View)
com.hippo.ehviewer.activity.MangaListActivity: void buttonCheckLogin(android.view.View)
com.hippo.ehviewer.activity.SettingsActivity
com.hippo.ehviewer.activity.SettingsActivity: SettingsActivity()
com.hippo.ehviewer.gallery.ui.GLRootView
com.hippo.ehviewer.gallery.ui.GLRootView: GLRootView(android.content.Context)
com.hippo.ehviewer.gallery.ui.GLRootView: GLRootView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.gallery.ui.GLRootView: void setContentPane(com.hippo.ehviewer.gallery.ui.GLView)
com.hippo.ehviewer.gallery.ui.GLRootView: void setOrientationSource(com.hippo.ehviewer.gallery.ui.OrientationSource)
com.hippo.ehviewer.gallery.ui.GLRootView: int getDisplayRotation()
com.hippo.ehviewer.gallery.ui.GLRootView: int getCompensation()
com.hippo.ehviewer.gallery.ui.GLRootView: android.graphics.Matrix getCompensationMatrix()
com.hippo.ehviewer.gallery.ui.GLRootView: void setLightsOutMode(boolean)
com.hippo.ehviewer.preference.AutoListPreference
com.hippo.ehviewer.preference.AutoListPreference: AutoListPreference(android.content.Context)
com.hippo.ehviewer.preference.AutoListPreference: AutoListPreference(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.service.DownloadService
com.hippo.ehviewer.service.DownloadService: DownloadService()
com.hippo.ehviewer.view.AlertButton
com.hippo.ehviewer.view.AlertButton: AlertButton(android.content.Context)
com.hippo.ehviewer.view.AlertButton: AlertButton(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.AlertButton: AlertButton(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.CheckImage
com.hippo.ehviewer.view.CheckImage: CheckImage(android.content.Context)
com.hippo.ehviewer.view.CheckImage: CheckImage(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.CheckImage: CheckImage(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.DownloadItemLayout
com.hippo.ehviewer.view.DownloadItemLayout: DownloadItemLayout(android.content.Context)
com.hippo.ehviewer.view.DownloadItemLayout: DownloadItemLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.DownloadItemLayout: DownloadItemLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.GetPaddingRelativeLayout
com.hippo.ehviewer.view.GetPaddingRelativeLayout: GetPaddingRelativeLayout(android.content.Context)
com.hippo.ehviewer.view.GetPaddingRelativeLayout: GetPaddingRelativeLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.GetPaddingRelativeLayout: GetPaddingRelativeLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.OlImageView
com.hippo.ehviewer.view.OlImageView: void setOnLoadListener(com.hippo.ehviewer.view.OlImageView$OnLoadListener)
com.hippo.ehviewer.view.OlImageView: OlImageView(android.content.Context)
com.hippo.ehviewer.view.OlImageView: OlImageView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.OlImageView: OlImageView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.OlImageView: void setUrl(java.lang.String)
com.hippo.ehviewer.view.OlImageView: java.lang.String getUrl()
com.hippo.ehviewer.view.OlImageView: void setKey(java.lang.String)
com.hippo.ehviewer.view.OlImageView: java.lang.String getKey()
com.hippo.ehviewer.view.OlImageView: int getStatus()
com.hippo.ehviewer.view.SuperImageView: SuperImageView(android.content.Context)
com.hippo.ehviewer.view.SuperImageView: SuperImageView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.SuperImageView: SuperImageView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.SuperImageView: boolean getAdjustViewBounds()
com.hippo.ehviewer.view.SuperImageView: void setAdjustViewBounds(boolean)
com.hippo.ehviewer.view.SuperImageView: int getMaxWidth()
com.hippo.ehviewer.view.SuperImageView: void setMaxWidth(int)
com.hippo.ehviewer.view.SuperImageView: int getMaxHeight()
com.hippo.ehviewer.view.SuperImageView: void setMaxHeight(int)
com.hippo.ehviewer.view.SuperImageView: android.graphics.drawable.Drawable getDrawable()
com.hippo.ehviewer.view.SuperImageView: int getResourceWidth()
com.hippo.ehviewer.view.SuperImageView: int getResourceHeight()
com.hippo.ehviewer.view.SuperImageView: android.graphics.Movie getMovie()
com.hippo.ehviewer.view.SuperImageView: void setImageResource(int)
com.hippo.ehviewer.view.SuperImageView: void setImageURI(android.net.Uri)
com.hippo.ehviewer.view.SuperImageView: void setImageDrawable(android.graphics.drawable.Drawable)
com.hippo.ehviewer.view.SuperImageView: void setImageMovie(android.graphics.Movie)
com.hippo.ehviewer.view.SuperImageView: void setImageInputStream(java.io.InputStream)
com.hippo.ehviewer.view.SuperImageView: void setImageBitmap(android.graphics.Bitmap)
com.hippo.ehviewer.view.SuperImageView: void setSelected(boolean)
com.hippo.ehviewer.view.SuperImageView: void setImageLevel(int)
com.hippo.ehviewer.view.SuperImageView: void setScaleType(com.hippo.ehviewer.view.SuperImageView$ScaleType)
com.hippo.ehviewer.view.SuperImageView: com.hippo.ehviewer.view.SuperImageView$ScaleType getScaleType()
com.hippo.ehviewer.view.SuperImageView: android.graphics.Matrix getImageMatrix()
com.hippo.ehviewer.view.SuperImageView: void setImageMatrix(android.graphics.Matrix)
com.hippo.ehviewer.view.SuperImageView: boolean getCropToPadding()
com.hippo.ehviewer.view.SuperImageView: void setCropToPadding(boolean)
com.hippo.ehviewer.view.SuperImageView: int getBaseline()
com.hippo.ehviewer.view.SuperImageView: void setBaseline(int)
com.hippo.ehviewer.view.SuperImageView: void setBaselineAlignBottom(boolean)
com.hippo.ehviewer.view.SuperImageView: boolean getBaselineAlignBottom()
com.hippo.ehviewer.view.SuperImageView: void setColorFilter(int)
com.hippo.ehviewer.view.SuperImageView: void setXfermode(android.graphics.Xfermode)
com.hippo.ehviewer.view.SuperImageView: android.graphics.ColorFilter getColorFilter()
com.hippo.ehviewer.view.SuperImageView: void setColorFilter(android.graphics.ColorFilter)
com.hippo.ehviewer.view.SuperImageView: int getImageAlpha()
com.hippo.ehviewer.view.SuperImageView: void setImageAlpha(int)
com.hippo.ehviewer.view.SuperImageView: void setAlpha(int)
com.hippo.ehviewer.view.SuperImageView: void setVisibility(int)
com.hippo.ehviewer.view.SuperImageView$ScaleType: com.hippo.ehviewer.view.SuperImageView$ScaleType[] values()
com.hippo.ehviewer.view.SuperImageView$ScaleType: com.hippo.ehviewer.view.SuperImageView$ScaleType valueOf(java.lang.String)
com.hippo.ehviewer.view.TagListView
com.hippo.ehviewer.view.TagListView: TagListView(android.content.Context)
com.hippo.ehviewer.view.TagListView: TagListView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.view.TagListView: TagListView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.view.TagListView: void setStableItemCount(int)
com.hippo.ehviewer.view.TagListView: void setOnModifyListener(com.hippo.ehviewer.view.TagListView$OnModifyListener)
com.hippo.ehviewer.view.TagListView: void setOnMoveLister(com.hippo.ehviewer.view.TagListView$OnMoveLister)
com.hippo.ehviewer.view.TagListView: void setItemList(java.util.ArrayList)
com.hippo.ehviewer.widget.AutoWrapLayout
com.hippo.ehviewer.widget.AutoWrapLayout: AutoWrapLayout(android.content.Context)
com.hippo.ehviewer.widget.AutoWrapLayout: AutoWrapLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.AutoWrapLayout: AutoWrapLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.AutoWrapLayout: void setBaseLine(com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine)
com.hippo.ehviewer.widget.AutoWrapLayout: com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine getScaleType()
com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine: com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine[] values()
com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine: com.hippo.ehviewer.widget.AutoWrapLayout$BaseLine valueOf(java.lang.String)
com.hippo.ehviewer.widget.DrawerLayout
com.hippo.ehviewer.widget.DrawerLayout: DrawerLayout(android.content.Context)
com.hippo.ehviewer.widget.DrawerLayout: DrawerLayout(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.DrawerLayout: DrawerLayout(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.DrawerLayout: void setScrimColor(int)
com.hippo.ehviewer.widget.DrawerLayout: void setDrawerListener(com.hippo.ehviewer.widget.DrawerLayout$DrawerListener)
com.hippo.ehviewer.widget.DrawerLayout: void setDrawerLockMode(int)
com.hippo.ehviewer.widget.DrawerLayout: void setEnabled(boolean)
com.hippo.ehviewer.widget.DrawerLayout$SavedState
com.hippo.ehviewer.widget.DrawerLayout$SavedState: android.os.Parcelable$Creator CREATOR
com.hippo.ehviewer.widget.LoadImageView
com.hippo.ehviewer.widget.LoadImageView: LoadImageView(android.content.Context)
com.hippo.ehviewer.widget.LoadImageView: LoadImageView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.LoadImageView: LoadImageView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.LoadImageView: void setState(int)
com.hippo.ehviewer.widget.LoadImageView: void setOnClickListener(com.hippo.ehviewer.ImageLoadManager)
com.hippo.ehviewer.widget.LoadImageView: java.lang.String getUrl()
com.hippo.ehviewer.widget.LoadImageView: java.lang.String getKey()
com.hippo.ehviewer.widget.LoadImageView: int getState()
com.hippo.ehviewer.widget.PullListView
com.hippo.ehviewer.widget.PullListView: PullListView(android.content.Context)
com.hippo.ehviewer.widget.PullListView: PullListView(android.content.Context,android.util.AttributeSet)
com.hippo.ehviewer.widget.PullListView: PullListView(android.content.Context,android.util.AttributeSet,int)
com.hippo.ehviewer.widget.PullListView: android.widget.ListView getListView()
com.hippo.ehviewer.widget.PullListView: void setHeaderEnabled(boolean)
com.hippo.ehviewer.widget.PullListView: void setOnRefreshListener(com.hippo.ehviewer.widget.PullListView$OnHeaderRefreshListener)
com.hippo.ehviewer.widget.PullListView: void setFooterEnabled(boolean)
com.hippo.ehviewer.widget.PullListView: void setOnFooterRefreshListener(com.hippo.ehviewer.widget.PullListView$OnFooterRefreshListener)
com.hippo.ehviewer.widget.PullListView: void setActionWhenShow(boolean)
org.apache.commons.lang3.ClassUtils$Interfaces: org.apache.commons.lang3.ClassUtils$Interfaces[] values()
org.apache.commons.lang3.ClassUtils$Interfaces: org.apache.commons.lang3.ClassUtils$Interfaces valueOf(java.lang.String)
org.apache.commons.lang3.JavaVersion: org.apache.commons.lang3.JavaVersion[] values()
org.apache.commons.lang3.JavaVersion: org.apache.commons.lang3.JavaVersion valueOf(java.lang.String)
org.apache.commons.lang3.Range$ComparableComparator: org.apache.commons.lang3.Range$ComparableComparator[] values()
org.apache.commons.lang3.Range$ComparableComparator: org.apache.commons.lang3.Range$ComparableComparator valueOf(java.lang.String)
org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION: org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION[] values()
org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION: org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION valueOf(java.lang.String)
org.apache.commons.lang3.time.StopWatch$SplitState: org.apache.commons.lang3.time.StopWatch$SplitState[] values()
org.apache.commons.lang3.time.StopWatch$SplitState: org.apache.commons.lang3.time.StopWatch$SplitState valueOf(java.lang.String)
org.apache.commons.lang3.time.StopWatch$State: org.apache.commons.lang3.time.StopWatch$State[] values()
org.apache.commons.lang3.time.StopWatch$State: org.apache.commons.lang3.time.StopWatch$State valueOf(java.lang.String)
+2687
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -12,3 +12,4 @@
# Project target.
target=android-19
#proguard.config=E:/Android/android-sdk/tools/proguard/proguard-android.txt:proguard-project.txt
+9
View File
@@ -1,3 +1,12 @@
Version 0.4.4 (2014-04-06)
* 修复错误的日志输出导致的崩溃
Version 0.4.3 (2014-04-05)
* 更丰富的错误提示
* 禁止多次同时更新
* 修正由于版本之间数据不同导致的阅读时崩溃
* 添加更新服务器选择
Version 0.4.2 (2014-04-04)
* 添加内置存储空间或 Sd Card 检测
* 修正由于 gif 格式图片导致的崩溃
+9 -4
View File
@@ -116,6 +116,8 @@
<string name="em_unexpected_response_code">非预期的响应码:%d</string>
<string name="em_redirection_error">太多重定向</string>
<string name="em_host_error">主机错误</string>
<string name="em_invalid_request">无效的请求</string>
<string name="em_no_sdcard">未挂载 SD卡</string>
<!-- Action -->
<string name="action_refresh">刷新</string>
@@ -132,16 +134,15 @@
<string name="preference_settings_title">设置</string>
<string name="preference_category_cache">缓存</string>
<string name="preference_cp_cache">封面与预览缓存大小</string>
<string name="preference_clear_cp_cache">清除封面与预览缓存</string>
<string name="preference_page_cache">页面缓存大小</string>
<string name="preference_clear_page_cache">清除页面缓存</string>
<string name="preference_cache">缓存大小</string>
<string name="preference_clear_cache">清除缓存</string>
<string name="preference_cache_summary" formatted="false">大小 : %.2f / %d MB</string>
<string name="preference_cache_summary_no">无缓存</string>
<string name="preference_auto_page_cache">自动清理页面缓存</string>
<string name="preference_auto_page_cache_summary_on">当应用关闭时清除页面缓存</string>
<string name="preference_auto_page_cache_summary_off">啥都不做</string>
<string name="preference_download_path">下载路径</string>
<string name="preference_update_server">更新服务器</string>
<string name="preference_category_about">关于</string>
@@ -151,6 +152,10 @@
<string name="input_error">输入错误</string>
<string name="create_cache_error">创建缓存错误</string>
<!-- server -->
<string name="update_server_google">国外服务器</string>
<string name="update_server_qiniu">国内服务器</string>
<!-- Tag -->
<string name="add_tag">添加标签</string>
<string name="tag_name">标签名称:</string>
+12 -1
View File
@@ -75,9 +75,20 @@
<item>2</item>
</string-array>
<string-array name="preference_update_server_entries">
<item>@string/update_server_google</item>
<item>@string/update_server_qiniu</item>
</string-array>
<string-array name="preference_update_server_entry_values" translatable="false">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="is_exhentai" translatable="false">
<item>g.e-hentai.org</item>
<item>exhentai.org</item>
</string-array>
</resources>
+9 -4
View File
@@ -121,6 +121,8 @@
<string name="em_unexpected_response_code">Unexpected response code : %d</string>
<string name="em_redirection_error">Too many redirects</string>
<string name="em_host_error">Host error</string>
<string name="em_invalid_request">Invalid request</string>
<string name="em_no_sdcard">SD card is Unmounted</string>
<!-- Action -->
<string name="action_refresh">Refresh</string>
@@ -136,16 +138,15 @@
<string name="preference_settings_title">Settings</string>
<string name="preference_category_cache">Cache</string>
<string name="preference_cp_cache">Cover and preview cache size</string>
<string name="preference_clear_cp_cache">Clear cover and preview cache</string>
<string name="preference_page_cache">Page cache size</string>
<string name="preference_clear_page_cache">Clear page cache</string>
<string name="preference_cache">Cache size</string>
<string name="preference_clear_cache">Clear cache</string>
<string name="preference_cache_summary" formatted="false">Size : %.2f / %d MB</string>
<string name="preference_cache_summary_no">No cache</string>
<string name="preference_auto_page_cache">Auto clear page cache</string>
<string name="preference_auto_page_cache_summary_on">Clean page cache when the application close</string>
<string name="preference_auto_page_cache_summary_off">Leave page cache alone</string>
<string name="preference_download_path">Download path</string>
<string name="preference_update_server">Update server</string>
<string name="preference_category_about">About</string>
@@ -158,6 +159,10 @@
<string name="create_cache_error">Create cache error</string>
<!-- server -->
<string name="update_server_google">Google</string>
<string name="update_server_qiniu">Qiniu</string>
<!-- Tag -->
<string name="add_tag">Add tag</string>
<string name="tag_name">Tag name : </string>
+12 -4
View File
@@ -31,12 +31,12 @@
<EditTextPreference
android:defaultValue="25"
android:inputType="number"
android:key="preference_cp_cache"
android:title="@string/preference_cp_cache" />
android:key="preference_cache"
android:title="@string/preference_cache" />
<Preference
android:key="preference_clear_cp_cache"
android:title="@string/preference_clear_cp_cache" />
android:key="preference_clear_cache"
android:title="@string/preference_clear_cache" />
</PreferenceCategory>
@@ -68,6 +68,14 @@
android:title="@string/update"
android:summary="@string/tap_update" />
<com.hippo.ehviewer.preference.AutoListPreference
android:defaultValue="1"
android:entries="@array/preference_update_server_entries"
android:entryValues="@array/preference_update_server_entry_values"
android:key="preference_update_server"
android:summary="%s"
android:title="@string/preference_update_server" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/develop" >
+111 -111
View File
@@ -1,111 +1,111 @@
package com.hippo.ehviewer;
import com.hippo.ehviewer.util.Ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout.LayoutParams;
@SuppressLint("NewApi")
public class BeautifyScreen {
private static final String TAG = "BeautifyScreen";
private static Context mContext;
private static int mStatusBarHeight = 0;
private static int mNavigationBarHeight = 0;
private static int sbbId = 0;
private static int nbbId = 1;
private BeautifyScreen(){}
public static void init(Context context) {
mContext = context;
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = context.getResources();
int sbhResourceId = resources.getIdentifier("status_bar_height",
"dimen", "android");
if (sbhResourceId > 0)
mStatusBarHeight = resources
.getDimensionPixelSize(sbhResourceId);
int nbhResourceId = resources.getIdentifier(
"navigation_bar_height", "dimen", "android");
if (nbhResourceId > 0)
mNavigationBarHeight = resources
.getDimensionPixelSize(nbhResourceId);
}
}
public static void ColourfyScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = activity.getResources();
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
win.setAttributes(winParams);
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
// Add status bar background
if (mStatusBarHeight > 0) {
View statusBarView = new View(mContext);
LayoutParams params1 = new LayoutParams(
LayoutParams.MATCH_PARENT, mStatusBarHeight);
params1.gravity = Gravity.TOP;
statusBarView.setLayoutParams(params1);
statusBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
statusBarView.setId(sbbId);
decorViewGroup.addView(statusBarView);
}
// Add navigation bar background
if (Ui.hasNavigationBar() && mNavigationBarHeight > 0 &&
isPortrait(activity)) {
View navigationBarView = new View(mContext);
LayoutParams params2 = new LayoutParams(
LayoutParams.MATCH_PARENT, mNavigationBarHeight);
params2.gravity = Gravity.BOTTOM;
navigationBarView.setLayoutParams(params2);
navigationBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
navigationBarView.setId(nbbId);
decorViewGroup.addView(navigationBarView);
}
}
}
private static boolean isPortrait(Activity activity) {
DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.heightPixels > dm.widthPixels;
}
public static void fixColour(Activity activity) {
if (Build.VERSION.SDK_INT < 19)
return;
Window win = activity.getWindow();
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
View navigationBarView = decorViewGroup.findViewById(nbbId);
if (navigationBarView == null)
return;
if (!isPortrait(activity))
navigationBarView.setVisibility(View.GONE);
else
navigationBarView.setVisibility(View.VISIBLE);
}
}
package com.hippo.ehviewer;
import com.hippo.ehviewer.util.Ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import com.hippo.ehviewer.util.Log;
import android.view.Gravity;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout.LayoutParams;
@SuppressLint("NewApi")
public class BeautifyScreen {
private static final String TAG = "BeautifyScreen";
private static Context mContext;
private static int mStatusBarHeight = 0;
private static int mNavigationBarHeight = 0;
private static int sbbId = 0;
private static int nbbId = 1;
private BeautifyScreen(){}
public static void init(Context context) {
mContext = context;
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = context.getResources();
int sbhResourceId = resources.getIdentifier("status_bar_height",
"dimen", "android");
if (sbhResourceId > 0)
mStatusBarHeight = resources
.getDimensionPixelSize(sbhResourceId);
int nbhResourceId = resources.getIdentifier(
"navigation_bar_height", "dimen", "android");
if (nbhResourceId > 0)
mNavigationBarHeight = resources
.getDimensionPixelSize(nbhResourceId);
}
}
public static void ColourfyScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= 19) {
Resources resources = activity.getResources();
Window win = activity.getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
win.setAttributes(winParams);
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
// Add status bar background
if (mStatusBarHeight > 0) {
View statusBarView = new View(mContext);
LayoutParams params1 = new LayoutParams(
LayoutParams.MATCH_PARENT, mStatusBarHeight);
params1.gravity = Gravity.TOP;
statusBarView.setLayoutParams(params1);
statusBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
statusBarView.setId(sbbId);
decorViewGroup.addView(statusBarView);
}
// Add navigation bar background
if (Ui.hasNavigationBar() && mNavigationBarHeight > 0 &&
isPortrait(activity)) {
View navigationBarView = new View(mContext);
LayoutParams params2 = new LayoutParams(
LayoutParams.MATCH_PARENT, mNavigationBarHeight);
params2.gravity = Gravity.BOTTOM;
navigationBarView.setLayoutParams(params2);
navigationBarView.setBackgroundColor(resources
.getColor(R.color.blue_dark));
navigationBarView.setId(nbbId);
decorViewGroup.addView(navigationBarView);
}
}
}
private static boolean isPortrait(Activity activity) {
DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
return dm.heightPixels > dm.widthPixels;
}
public static void fixColour(Activity activity) {
if (Build.VERSION.SDK_INT < 19)
return;
Window win = activity.getWindow();
ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();
View navigationBarView = decorViewGroup.findViewById(nbbId);
if (navigationBarView == null)
return;
if (!isPortrait(activity))
navigationBarView.setVisibility(View.GONE);
else
navigationBarView.setVisibility(View.VISIBLE);
}
}
+306 -306
View File
@@ -1,306 +1,306 @@
package com.hippo.ehviewer;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.jakewharton.disklrucache.DiskLruCache;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.os.Environment;
import android.util.Log;
// For Gallery cover key is gid,
// for example , gid is 618395, token is 0439fa3666,
// so key is 618395
// For Gallery preview key is gid-preview-num-row,
// for example , gid is 618395, token is 0439fa3666, page2
// so key is 618395-preview-2-0
// For Gallery image key is gid-preview-num,
// for example , gid is 618395, token is 0439fa3666, image2
// so key is 618395-image-2
public class DiskCache {
private static String TAG = "ImageDiskCache";
private static final int VALUE_IDX = 0;
private Context mContext;
private BitmapFactory.Options opt;
private final DiskLruCache diskLruCache;
public DiskCache(Context context, String path, long maxSize) throws NameNotFoundException, IOException {
this.mContext = context;
opt = Ui.getBitmapOpt();
if (!Cache.hasSdCard()) {
throw new IllegalStateException("Has no SdCard.");
}
File dir = new File(Environment.getExternalStorageDirectory() + path);
int version = mContext.getPackageManager().getPackageInfo(
mContext.getPackageName(), 0).versionCode;
version = 1;
diskLruCache = DiskLruCache.open(dir, version, 1, maxSize);
}
public long size() {
return diskLruCache.size();
}
public long maxSize() {
return diskLruCache.getMaxSize();
}
public void setMaxSize(long maxSize) {
diskLruCache.setMaxSize(maxSize);
}
public void close() {
try {
diskLruCache.close();
} catch (IOException e) {
Log.d(TAG, "diskLruCache close error !");
}
}
public boolean hasKey(String key) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if(snapshot==null)
return false;
snapshot.close();
return true;
}
public Object get(String key, int type) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if (snapshot == null)
return null;
InputStream is = snapshot.getInputStream(VALUE_IDX);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
return null;
}
public boolean put(String key, InputStream is) throws IOException {
DiskLruCache.Editor editor = diskLruCache.edit(key);
if (editor == null)
return false;
BufferedOutputStream bos = new BufferedOutputStream(editor.newOutputStream(VALUE_IDX));
OutputStream os = new CacheOutputStream(bos, editor);
Util.copy(is, os);
return true;
}
public void clear() {
try {
diskLruCache.delete();
} catch (IOException e) {
}
}
private class CacheOutputStream extends FilterOutputStream {
private final DiskLruCache.Editor editor;
private boolean failed = false;
private CacheOutputStream(OutputStream os, DiskLruCache.Editor editor) {
super(os);
this.editor = editor;
}
@Override
public void close() throws IOException {
IOException closeException = null;
try {
super.close();
} catch (IOException e) {
closeException = e;
}
if (failed) {
editor.abort();
} else {
editor.commit();
}
if (closeException != null) throw closeException;
}
@Override
public void flush() throws IOException {
try {
super.flush();
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(int oneByte) throws IOException {
try {
super.write(oneByte);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer) throws IOException {
try {
super.write(buffer);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer, int offset, int length) throws IOException {
try {
super.write(buffer, offset, length);
} catch (IOException e) {
failed = true;
throw e;
}
}
}
/*
private Context context = null;
private File dir = null;
int maxSize = 1024 * 10;
public DiskCache(Context context, String path, int maxSize) {
this.context = context;
this.maxSize = maxSize;
if (maxSize <= 0)
maxSize = 1024 * 10;
File rootdir = Environment.getExternalStorageDirectory();
dir = new File(rootdir + path);
dir.mkdirs();
}
public boolean hasKey(String key) {
synchronized (key) {
File file = new File(dir, key);
if (file.exists()) {
if (file.isDirectory())
file.delete();
else
return true;
}
return false;
}
}
public Object get(String key, int type) {
synchronized (key) {
File file = new File(dir, key);
if (!file.isFile())
return null;
try {
InputStream is = new FileInputStream(file);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, Util.opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
} catch (FileNotFoundException e) {
Log.d(TAG, "WTF, I have checked that the file does exists.");
e.printStackTrace();
}
return null;
}
}
public boolean put(String key, InputStream is) throws IOException {
synchronized (key) {
File file = new File(dir, key);
try {
file.delete();
file.createNewFile();
} catch (IOException e) {
dir.mkdirs();
file.delete();
try {
file.createNewFile();
} catch (IOException e1) {
Log.d(TAG, "WTF, mkdirs didn't work? Path is " + file.getPath());
e1.printStackTrace();
return false;
}
}
try {
Util.inputStream2File(is, file);
return true;
} catch (IOException e) {
Log.d(TAG, "Put " + key + " error.");
throw e;
}
}
}
public void clear() {
clearDirectory(dir);
}
private void clearDirectory(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) clearDirectory(file);
file.delete();
}
}*/
/*
* private static String getStingMD5(String s) { String re = null; try {
* MessageDigest messageDigest =MessageDigest.getInstance(Algorithm); byte[]
* inputByteArray = s.getBytes(); messageDigest.update(inputByteArray);
* byte[] resultByteArray = messageDigest.digest(); re =
* byteArrayToHex(resultByteArray); } catch (NoSuchAlgorithmException e) {
* e.printStackTrace(); Log.d(TAG, e.getMessage()); } return re; }
*
* private static String byteArrayToHex(byte[] byteArray) { char[] hexDigits
* = {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F' };
* char[] resultCharArray =new char[byteArray.length * 2]; int index = 0;
* for (byte b : byteArray) { resultCharArray[index++] = hexDigits[b>>> 4 &
* 0xf]; resultCharArray[index++] = hexDigits[b& 0xf]; } return new
* String(resultCharArray); }
*/
}
package com.hippo.ehviewer;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.jakewharton.disklrucache.DiskLruCache;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.os.Environment;
import com.hippo.ehviewer.util.Log;
// For Gallery cover key is gid,
// for example , gid is 618395, token is 0439fa3666,
// so key is 618395
// For Gallery preview key is gid-preview-num-row,
// for example , gid is 618395, token is 0439fa3666, page2
// so key is 618395-preview-2-0
// For Gallery image key is gid-preview-num,
// for example , gid is 618395, token is 0439fa3666, image2
// so key is 618395-image-2
public class DiskCache {
private static String TAG = "ImageDiskCache";
private static final int VALUE_IDX = 0;
private Context mContext;
private BitmapFactory.Options opt;
private final DiskLruCache diskLruCache;
public DiskCache(Context context, String path, long maxSize) throws NameNotFoundException, IOException {
this.mContext = context;
opt = Ui.getBitmapOpt();
if (!Cache.hasSdCard()) {
throw new IllegalStateException("Has no SdCard.");
}
File dir = new File(Environment.getExternalStorageDirectory() + path);
int version = mContext.getPackageManager().getPackageInfo(
mContext.getPackageName(), 0).versionCode;
version = 1;
diskLruCache = DiskLruCache.open(dir, version, 1, maxSize);
}
public long size() {
return diskLruCache.size();
}
public long maxSize() {
return diskLruCache.getMaxSize();
}
public void setMaxSize(long maxSize) {
diskLruCache.setMaxSize(maxSize);
}
public void close() {
try {
diskLruCache.close();
} catch (IOException e) {
Log.d(TAG, "diskLruCache close error !");
}
}
public boolean hasKey(String key) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if(snapshot==null)
return false;
snapshot.close();
return true;
}
public Object get(String key, int type) {
DiskLruCache.Snapshot snapshot = null;
try {
snapshot = diskLruCache.get(key);
} catch (IOException e) {
}
if (snapshot == null)
return null;
InputStream is = snapshot.getInputStream(VALUE_IDX);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
return null;
}
public boolean put(String key, InputStream is) throws IOException {
DiskLruCache.Editor editor = diskLruCache.edit(key);
if (editor == null)
return false;
BufferedOutputStream bos = new BufferedOutputStream(editor.newOutputStream(VALUE_IDX));
OutputStream os = new CacheOutputStream(bos, editor);
Util.copy(is, os);
return true;
}
public void clear() {
try {
diskLruCache.delete();
} catch (IOException e) {
}
}
private class CacheOutputStream extends FilterOutputStream {
private final DiskLruCache.Editor editor;
private boolean failed = false;
private CacheOutputStream(OutputStream os, DiskLruCache.Editor editor) {
super(os);
this.editor = editor;
}
@Override
public void close() throws IOException {
IOException closeException = null;
try {
super.close();
} catch (IOException e) {
closeException = e;
}
if (failed) {
editor.abort();
} else {
editor.commit();
}
if (closeException != null) throw closeException;
}
@Override
public void flush() throws IOException {
try {
super.flush();
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(int oneByte) throws IOException {
try {
super.write(oneByte);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer) throws IOException {
try {
super.write(buffer);
} catch (IOException e) {
failed = true;
throw e;
}
}
@Override
public void write(byte[] buffer, int offset, int length) throws IOException {
try {
super.write(buffer, offset, length);
} catch (IOException e) {
failed = true;
throw e;
}
}
}
/*
private Context context = null;
private File dir = null;
int maxSize = 1024 * 10;
public DiskCache(Context context, String path, int maxSize) {
this.context = context;
this.maxSize = maxSize;
if (maxSize <= 0)
maxSize = 1024 * 10;
File rootdir = Environment.getExternalStorageDirectory();
dir = new File(rootdir + path);
dir.mkdirs();
}
public boolean hasKey(String key) {
synchronized (key) {
File file = new File(dir, key);
if (file.exists()) {
if (file.isDirectory())
file.delete();
else
return true;
}
return false;
}
}
public Object get(String key, int type) {
synchronized (key) {
File file = new File(dir, key);
if (!file.isFile())
return null;
try {
InputStream is = new FileInputStream(file);
if (type == Util.BITMAP) {
Bitmap bitmap = BitmapFactory.decodeStream(is, null, Util.opt);
return bitmap;
} else if (type == Util.MOVIE) {
is = new BufferedInputStream(is, 16 * 1024);
is.mark(16 * 1024);
Movie movie = Movie.decodeStream(is);
return movie;
}
} catch (FileNotFoundException e) {
Log.d(TAG, "WTF, I have checked that the file does exists.");
e.printStackTrace();
}
return null;
}
}
public boolean put(String key, InputStream is) throws IOException {
synchronized (key) {
File file = new File(dir, key);
try {
file.delete();
file.createNewFile();
} catch (IOException e) {
dir.mkdirs();
file.delete();
try {
file.createNewFile();
} catch (IOException e1) {
Log.d(TAG, "WTF, mkdirs didn't work? Path is " + file.getPath());
e1.printStackTrace();
return false;
}
}
try {
Util.inputStream2File(is, file);
return true;
} catch (IOException e) {
Log.d(TAG, "Put " + key + " error.");
throw e;
}
}
}
public void clear() {
clearDirectory(dir);
}
private void clearDirectory(File dir) {
for (File file: dir.listFiles()) {
if (file.isDirectory()) clearDirectory(file);
file.delete();
}
}*/
/*
* private static String getStingMD5(String s) { String re = null; try {
* MessageDigest messageDigest =MessageDigest.getInstance(Algorithm); byte[]
* inputByteArray = s.getBytes(); messageDigest.update(inputByteArray);
* byte[] resultByteArray = messageDigest.digest(); re =
* byteArrayToHex(resultByteArray); } catch (NoSuchAlgorithmException e) {
* e.printStackTrace(); Log.d(TAG, e.getMessage()); } return re; }
*
* private static String byteArrayToHex(byte[] byteArray) { char[] hexDigits
* = {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F' };
* char[] resultCharArray =new char[byteArray.length * 2]; int index = 0;
* for (byte b : byteArray) { resultCharArray[index++] = hexDigits[b>>> 4 &
* 0xf]; resultCharArray[index++] = hexDigits[b& 0xf]; } return new
* String(resultCharArray); }
*/
}
+1 -1
View File
@@ -12,7 +12,7 @@ import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
public class ImageLoadManager {
private static final String TAG = "ImageLoadManager";
+111 -113
View File
@@ -1,10 +1,10 @@
package com.hippo.ehviewer;
import java.io.File;
import java.net.MalformedURLException;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
@@ -15,22 +15,19 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.NotificationCompat;
import android.view.View;
import com.hippo.ehviewer.network.Downloader;
import com.hippo.ehviewer.network.HttpHelper;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Future;
import com.hippo.ehviewer.util.FutureListener;
import com.hippo.ehviewer.util.ThreadPool;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.util.ThreadPool.Job;
import com.hippo.ehviewer.util.ThreadPool.JobContext;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.widget.DialogBuilder;
// TODO return onFailure when downloading update or check update
// TODO add disable to achieve
public class UpdateHelper {
@SuppressWarnings("unused")
@@ -39,21 +36,19 @@ public class UpdateHelper {
public static final String UPDATE_API = "http://ehviewersu.appsp0t.com/API";
// Update host
private static final int GOOGLE = 0;
private static final int QINIU = 1;
private static boolean isWorking = false;
private Activity mActivity;
private String updateFileName;
private AppContext mAppContext;
private OnCheckUpdateListener mListener;
private static boolean mEnabled = true;
private int downloadHost = QINIU;
public interface OnCheckUpdateListener {
public void onSuccess(String version, long size, String url, String info);
public void onNoUpdate();
public void onFailure(String eMsg);
}
public UpdateHelper(Activity activity) {
mActivity = activity;
public UpdateHelper(AppContext appContext) {
mAppContext = appContext;
}
public UpdateHelper SetOnCheckUpdateListener(OnCheckUpdateListener listener) {
@@ -66,46 +61,60 @@ public class UpdateHelper {
checkUpdate();
}
public static void setEnabled(boolean enabled) {
mEnabled = enabled;
}
class CheckUpdatePackage {
public OnCheckUpdateListener listener;
public Activity activity;
public AppContext appContext;
public String pageContext;
public HttpHelper hp;
}
public void checkUpdate() {
if (isWorking) {
if (mListener != null)
mListener.onFailure("正在检查更新"); // TODO
return;
} else {
isWorking = true;
}
final AppContext appContext = (AppContext)(mActivity.getApplicationContext());
final HttpHelper hp = new HttpHelper(mActivity.getApplicationContext());
ThreadPool threadPool = appContext.getNetworkThreadPool();
final HttpHelper hp = new HttpHelper(mAppContext);
ThreadPool threadPool = mAppContext.getNetworkThreadPool();
threadPool.submit(new Job<String>() {
@Override
public String run(JobContext jc) {
PackageManager pm = appContext.getPackageManager();
if (!mEnabled) {
return "working";
}
mEnabled = false;
PackageManager pm = mAppContext.getPackageManager();
PackageInfo pi = null;
try {
pi = pm.getPackageInfo(appContext.getPackageName(), PackageManager.GET_ACTIVITIES);
pi = pm.getPackageInfo(mAppContext.getPackageName(), PackageManager.GET_ACTIVITIES);
JSONObject jo = new JSONObject();
jo.put("method", "update");
JSONObject detailJO = new JSONObject();
detailJO.put("version", pi.versionName);
detailJO.put("server", Config.getUpdateServer());
jo.put("detail", detailJO);
return hp.postJson(UPDATE_API, jo.toString());
} catch (NameNotFoundException e) {
e.printStackTrace();
return "NameNotFound";
} catch (JSONException e) {
e.printStackTrace();
return "JSONException";
}
return hp.post(UPDATE_API, "last\n" + pi.versionName);
}
}, new FutureListener<String>() {
@Override
public void onFutureDone(Future<String> future) {
String pageContext = future.get();
CheckUpdatePackage checkUpdatePackage = new CheckUpdatePackage();
checkUpdatePackage.appContext = mAppContext;
checkUpdatePackage.listener = mListener;
checkUpdatePackage.activity = mActivity;
checkUpdatePackage.pageContext = pageContext;
checkUpdatePackage.hp = hp;
Message msg = new Message();
@@ -117,111 +126,98 @@ public class UpdateHelper {
}
// TODO move dialog into listener
// TODO
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
private static Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
CheckUpdatePackage checkUpdatePackage = (CheckUpdatePackage)msg.obj;
OnCheckUpdateListener listener = checkUpdatePackage.listener;
Activity activity = checkUpdatePackage.activity;
AppContext appContext = checkUpdatePackage.appContext;
String pageContext = checkUpdatePackage.pageContext;
if (pageContext != null) {
Config.setUpdateDate();
String[] items = pageContext.split("\n");
if (items.length > 3) {
String newVer = items[0];
String tempUrl = "";
switch (downloadHost) {
case GOOGLE:
tempUrl = EhClient.UPDATE_URL + items[1];
break;
case QINIU:
tempUrl = EhClient.UPDATE_URI_QINIU + Util.getFileForUrl(items[1]);
break;
}
final String url = tempUrl;
final String name = url.substring(url.lastIndexOf('/')+1);
updateFileName = name;
String size = items[2];
String info = items[3];
AlertDialog dialog = new DialogBuilder(activity).setTitle(R.string.update)
.setMessage(String.format(activity.getString(R.string.update_message), newVer, size, info))
.setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
}
}).setPositiveButton(android.R.string.ok, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
Downloader d = new Downloader();
try {
d.resetData(Config.getDownloadPath(), name, url);
d.setOnDownloadListener(new UpdateListener());
new Thread(d).start();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}).create();
dialog.show();
if (pageContext.equals("working")) {
if (listener != null)
listener.onSuccess(pageContext);
listener.onFailure("正在检查更新或者下载更新"); // TODO
}
else if (pageContext.equals("NameNotFound")) {
if (listener != null)
listener.onFailure("NameNotFound"); // TODO
} else if (pageContext.equals("JSONException")) {
if (listener != null)
listener.onFailure("JSONException"); // TODO
} else {
if(pageContext.equals("none")) {
try {
JSONObject jo = new JSONObject(pageContext);
JSONObject updateJO = jo.getJSONObject("update");
String version = updateJO.getString("version");
if (version.equals("error")) {
if (listener != null)
listener.onFailure(appContext.getString(R.string.em_invalid_request));
} else if (version.equals("none")) {
if (listener != null)
listener.onNoUpdate();
} else {
long size = updateJO.getLong("size");
String url = updateJO.getString("url");
String info = updateJO.getString("info");
if (listener != null)
listener.onSuccess(version, size, url, info);
}
} catch (JSONException e) {
e.printStackTrace();
if (listener != null)
listener.onNoUpdate();
} else if(pageContext.equals("error")){
if (listener != null)
listener.onFailure(activity.getString(R.string.em_request_error));
} else if (pageContext.equals("NameNotFound")){
if (listener != null)
listener.onFailure("NameNotFound"); // TODO
}else {
if (listener != null)
listener.onFailure(activity.getString(R.string.em_host_error));
listener.onFailure(appContext.getString(R.string.em_host_error));
}
}
} else {
if (listener != null)
listener.onFailure(checkUpdatePackage.hp.getEMsg());
}
isWorking = false;
}
};
public interface OnCheckUpdateListener {
public void onSuccess(String pageContext);
public void onNoUpdate();
public void onFailure(String eMsg);
}
private class UpdateListener implements Downloader.OnDownloadListener {
public static class UpdateListener implements Downloader.OnDownloadListener {
private Context mContext;
private String mFileName;
private NotificationManager mNotifyManager;
private NotificationCompat.Builder mBuilder;
public UpdateListener() {
public UpdateListener(Context context, String fileName) {
mContext = context;
mFileName = fileName;
mNotifyManager = (NotificationManager)
mActivity.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(mActivity.getApplicationContext());
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(mContext);
mBuilder.setSmallIcon(R.drawable.ic_launcher);
}
@Override
public void onDownloadStart(int totalSize) {
mBuilder.setContentTitle("正在下载更新") // TODO
public void onDownloadStartConnect() {
mBuilder.setContentTitle("开始下载更新") // TODO
.setContentText(null)
.setProgress(0, 0, true).setOngoing(true);
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
@Override
public void onDownloadStartDownload(int totalSize) {
mBuilder.setContentTitle("正在下载更新")
.setContentText(String.format("%.2f / %.2f KB", 0/1024.0f, totalSize/1024.0f))
.setProgress(totalSize, 0, false).setOngoing(true);
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
@Override
public void onDownloadStatusUpdate(
int downloadSize, int totalSize) {
@@ -232,20 +228,22 @@ public class UpdateHelper {
}
@Override
public void onDownloadOver(boolean ok, int eMesgId) {
if (ok) {
public void onDownloadOver(int status) {
if (status == Downloader.COMPLETED) {
mNotifyManager.cancel(NOTIFICATION_ID);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Config.getDownloadPath(), updateFileName)),
intent.setDataAndType(Uri.fromFile(new File(Config.getDownloadPath(), mFileName)),
"application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mActivity.getApplicationContext().startActivity(intent);
mContext.startActivity(intent);
} else {
mBuilder.setContentTitle("下载更新失败")
.setContentText(null)
.setProgress(0, 0, false).setOngoing(false);
mNotifyManager.notify(NOTIFICATION_ID, mBuilder.build());
}
setEnabled(true);
}
}
}
@@ -33,7 +33,7 @@ import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
@@ -8,7 +8,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@@ -37,7 +37,7 @@ import android.os.Build;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -120,7 +120,7 @@ public class MangaActivity extends Activity {
final String imageName = String.format("%05d", index + 1) + "." + Util.getExtension(imageUrl);
final Downloader downloader = new Downloader();
final Downloader downloader = new Downloader(MangaActivity.this);
try {
downloader.resetData(mFolder.getPath(),
imageName,
@@ -33,7 +33,7 @@ import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -30,7 +30,7 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -1,5 +1,6 @@
package com.hippo.ehviewer.activity;
import java.net.MalformedURLException;
import java.util.ArrayList;
import com.hippo.ehviewer.AppContext;
@@ -9,6 +10,7 @@ import com.hippo.ehviewer.ListMangaDetail;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.UpdateHelper;
import com.hippo.ehviewer.network.Downloader;
import com.hippo.ehviewer.service.DownloadService;
import com.hippo.ehviewer.service.DownloadServiceConnection;
import com.hippo.ehviewer.util.Cache;
@@ -17,6 +19,7 @@ import com.hippo.ehviewer.util.EhClient;
import com.hippo.ehviewer.util.Favourite;
import com.hippo.ehviewer.util.Tag;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.view.CheckImage;
import com.hippo.ehviewer.view.GetPaddingRelativeLayout;
@@ -1414,7 +1417,50 @@ public class MangaListActivity extends Activity {
}
private void checkUpdate() {
new UpdateHelper(this).autoCheckUpdate();
new UpdateHelper((AppContext)getApplication())
.SetOnCheckUpdateListener(new UpdateHelper.OnCheckUpdateListener() {
@Override
public void onSuccess(String version, long size,
final String url, String info) {
String sizeStr = Util.sizeToString(size);
AlertDialog dialog = SuperDialogUtil.createUpdateDialog(MangaListActivity.this,
version, sizeStr, info,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
// TODO
try {
Downloader downloader = new Downloader(MangaListActivity.this);
String fileName = Util.getFileForUrl(url);
downloader.resetData(Config.getDownloadPath(), fileName, url);
downloader.setOnDownloadListener(
new UpdateHelper.UpdateListener(MangaListActivity.this,
fileName));
new Thread(downloader).start();
} catch (MalformedURLException e) {
UpdateHelper.setEnabled(true);
}
}
}, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
UpdateHelper.setEnabled(true);
}
});
if (!MangaListActivity.this.isFinishing())
dialog.show();
}
@Override
public void onNoUpdate() {
UpdateHelper.setEnabled(true);
}
@Override
public void onFailure(String eMsg) {
UpdateHelper.setEnabled(true);
}
}).autoCheckUpdate();
}
private void checkLogin(boolean force) {
@@ -1,7 +1,9 @@
package com.hippo.ehviewer.activity;
import java.io.InputStream;
import java.net.MalformedURLException;
import com.hippo.ehviewer.AppContext;
import com.hippo.ehviewer.BeautifyScreen;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.R;
@@ -9,10 +11,14 @@ import com.hippo.ehviewer.UpdateHelper;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Util;
import com.hippo.ehviewer.view.AlertButton;
import com.hippo.ehviewer.widget.DialogBuilder;
import com.hippo.ehviewer.widget.SuperDialogUtil;
import com.hippo.ehviewer.network.Downloader;
import com.hippo.ehviewer.preference.AutoListPreference;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
@@ -28,9 +34,13 @@ import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.support.v4.util.LruCache;
import android.view.View;
import android.webkit.WebView;
import android.widget.Toast;
// TODO 添加服务器选择
public class SettingsActivity extends PreferenceActivity {
@SuppressWarnings("unused")
private static String TAG = "Settings";
@@ -39,9 +49,8 @@ public class SettingsActivity extends PreferenceActivity {
public LruCache<String, Bitmap> memoryCache;
private static final String CP_CACHE = "preference_cp_cache";
private static final String CLEAR_CP_CACHE = "preference_clear_cp_cache";
private static final String PAGE_SCALING = "preference_page_scaling";
private static final String CACHE = "preference_cache";
private static final String CLEAR_CACHE = "preference_clear_cache";
private static final String AUTHOR = "preference_author";
private static final String SCREEN_ORI = "preference_screen_ori";
private static final String CHANGELOG = "preference_changelog";
@@ -49,11 +58,8 @@ public class SettingsActivity extends PreferenceActivity {
private static final String UPDATE = "preference_update";
private static final String RAN = "preference_remove_all_noification";
private EditTextPreference cpCachePre;
private Preference clearCpCachePre;
private EditTextPreference pageCachePre;
private Preference clearPageCachePre;
private AutoListPreference pageScalingListPre;
private EditTextPreference cachePre;
private Preference clearCachePre;
private Preference authorPer;
private AutoListPreference screenOriPer;
private Preference changelogPer;
@@ -97,8 +103,8 @@ public class SettingsActivity extends PreferenceActivity {
// Set PreferenceActivity
PreferenceScreen screen = getPreferenceScreen();
cpCachePre = (EditTextPreference) screen.findPreference(CP_CACHE);
cpCachePre
cachePre = (EditTextPreference) screen.findPreference(CACHE);
cachePre
.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference,
@@ -141,9 +147,9 @@ public class SettingsActivity extends PreferenceActivity {
}
});
clearCpCachePre = (Preference) screen.findPreference(CLEAR_CP_CACHE);
clearCachePre = (Preference) screen.findPreference(CLEAR_CACHE);
updateCpCacheSummary();
clearCpCachePre
clearCachePre
.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
@@ -213,24 +219,60 @@ public class SettingsActivity extends PreferenceActivity {
@Override
public boolean onPreferenceClick(Preference preference) {
update.setSummary(R.string.checking_update);
new UpdateHelper(SettingsActivity.this)
new UpdateHelper((AppContext)SettingsActivity.this.getApplication())
.SetOnCheckUpdateListener(new UpdateHelper.OnCheckUpdateListener() {
@Override
public void onSuccess(String pageContext) {
public void onSuccess(String version, long size,
final String url, String info) {
update.setSummary(R.string.found_update);
update.setEnabled(true);
String sizeStr = Util.sizeToString(size);
AlertDialog dialog = SuperDialogUtil.createUpdateDialog(SettingsActivity.this,
version, sizeStr, info,
new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
// TODO
try {
Downloader downloader = new Downloader(SettingsActivity.this);
String fileName = Util.getFileForUrl(url);
downloader.resetData(Config.getDownloadPath(), fileName, url);
downloader.setOnDownloadListener(
new UpdateHelper.UpdateListener(SettingsActivity.this,
fileName));
new Thread(downloader).start();
} catch (MalformedURLException e) {
update.setSummary(R.string.em_url_format_error);
UpdateHelper.setEnabled(true);
}
update.setEnabled(true);
}
}, new View.OnClickListener() {
@Override
public void onClick(View v) {
((AlertButton)v).dialog.dismiss();
update.setEnabled(true);
UpdateHelper.setEnabled(true);
}
});
if (!SettingsActivity.this.isFinishing())
dialog.show();
}
@Override
public void onNoUpdate() {
update.setSummary(R.string.up_to_date);
update.setEnabled(true);
UpdateHelper.setEnabled(true);
}
@Override
public void onFailure(String eMsg) {
update.setSummary(eMsg);
update.setEnabled(true);
UpdateHelper.setEnabled(true);
}
}).checkUpdate();
update.setEnabled(false);
return true;
}
@@ -250,15 +292,15 @@ public class SettingsActivity extends PreferenceActivity {
private void updateCpCacheSummary() {
if (Cache.cpCache != null) {
clearCpCachePre.setSummary(String.format(
clearCachePre.setSummary(String.format(
getString(R.string.preference_cache_summary),
Cache.cpCache.size() / 1024 / 1024f,
Cache.cpCache.maxSize() / 1024 / 1024));
clearCpCachePre.setEnabled(true);
clearCachePre.setEnabled(true);
} else {
clearCpCachePre
clearCachePre
.setSummary(getString(R.string.preference_cache_summary_no));
clearCpCachePre.setEnabled(false);
clearCachePre.setEnabled(false);
}
}
}
@@ -0,0 +1,48 @@
package com.hippo.ehviewer.exception;
public class FileException extends Exception {
public static final int MKDIR_ERROR = 0x0;
public static final int CREATE_FILE_ERROR = 0x1;
public static final int NOT_DIR = 0x2;
public static final int NOT_FILE = 0x3;
public static final int CANNOT_EXECUTE = 0x4;
public static final int CANNOT_READ = 0x5;
public static final int CANNOT_WRITE = 0x6;
private int mErrorCode;
private static final long serialVersionUID = 1L;
public FileException(int errorCode) {
mErrorCode = errorCode;
}
public int getErrorCode() {
return mErrorCode;
}
// TODO
public String getMessage() {
switch (mErrorCode) {
case MKDIR_ERROR:
return "mkdir error";
case CREATE_FILE_ERROR:
return "create file error";
case NOT_DIR:
return "it is not a dir";
case NOT_FILE:
return "it is not a file";
case CANNOT_EXECUTE:
return "can not execute";
case CANNOT_READ:
return "can not read";
case CANNOT_WRITE:
return "can not write";
default:
return "unknown error";
}
}
}
@@ -0,0 +1,5 @@
package com.hippo.ehviewer.exception;
public class NoSdCardException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -1,8 +1,5 @@
package com.hippo.ehviewer.network;
package com.hippo.ehviewer.exception;
public class RedirectionException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -1,4 +1,4 @@
package com.hippo.ehviewer.network;
package com.hippo.ehviewer.exception;
public class ResponseCodeException extends Exception {
@@ -0,0 +1,5 @@
package com.hippo.ehviewer.exception;
public class StopRequestException extends Exception {
private static final long serialVersionUID = 1L;
}
@@ -6,7 +6,9 @@ import android.graphics.Color;
import android.graphics.Movie;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.MotionEvent;
import com.hippo.ehviewer.R;
@@ -293,8 +295,23 @@ public class GalleryView extends GLView {
// TODO Mask to reduce brightness
//canvas.fillRect(0, 0, mWidth, mHeight, MASK_COLOR);
if (hasMovie)
invalidate();
// TODO
if (hasMovie) {
Log.d(TAG, "hasMovie");
new Thread() {
@Override
public void run() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
invalidate();
}
}
}.start();
}
}
private void resetSizePosition() {
@@ -23,7 +23,7 @@ import android.database.Cursor;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import java.io.Closeable;
import java.io.IOException;
@@ -18,7 +18,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.util.SparseArray;
// TODO 初期建立一个线程检索文件夹中所有文件以寻找到所有图片文件
@@ -89,15 +89,36 @@ public class ImageSet {
// [startIndex, endIndex)
public ImageSet(Context context, String gid, File folder, int size, int startIndex, int endIndex,
Set<Integer> failIndexSet) {
if (folder == null || !folder.isDirectory())
size = 0;
// TODO
/*
if (folder == null)
throw new IllegalArgumentException("Folder is null");
if (!folder.isDirectory())
throw new IllegalArgumentException("Folder is not directory, path is " + folder.getPath());
*/
if (size < 0)
size = 0;
if (endIndex > size)
endIndex = size;
if (startIndex < 0)
startIndex = 0;
if (startIndex > endIndex)
startIndex = endIndex;
// TODO
/*
if (size < 0 || startIndex < 0
|| startIndex > endIndex || endIndex > size)
throw new IllegalArgumentException("size or index value error, size = "
+ size + ", startIndex = " + startIndex
+ ", endIndex = " + endIndex + ", path is " + folder.getPath());
*/
mContext = context;
mGid = gid;
@@ -17,7 +17,7 @@
package com.hippo.ehviewer.gallery.glrenderer;
import android.graphics.RectF;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.gallery.common.Utils;
@@ -22,7 +22,7 @@ import android.graphics.RectF;
import android.opengl.GLU;
import android.opengl.GLUtils;
import android.opengl.Matrix;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.gallery.common.Utils;
import com.hippo.ehviewer.util.IntArray;
@@ -21,7 +21,7 @@ import android.graphics.RectF;
import android.opengl.GLES20;
import android.opengl.GLUtils;
import android.opengl.Matrix;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.util.IntArray;
@@ -4,7 +4,7 @@ import junit.framework.Assert;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Movie;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
public class MovieTexture extends CanvasTexture {
private static final int DEFAULT_MOVIE_DURATION = 1000;
@@ -16,7 +16,7 @@
package com.hippo.ehviewer.gallery.glrenderer;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import javax.microedition.khronos.opengles.GL11;
@@ -19,7 +19,7 @@ package com.hippo.ehviewer.gallery.glrenderer;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.opengl.GLUtils;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import junit.framework.Assert;
import java.util.HashMap;
@@ -26,7 +26,7 @@ import android.os.Build;
import android.os.Process;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.View;
@@ -19,7 +19,7 @@ package com.hippo.ehviewer.gallery.ui;
import android.annotation.SuppressLint;
import android.graphics.Rect;
import android.os.SystemClock;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.MotionEvent;
import com.hippo.ehviewer.gallery.anim.CanvasAnimation;
@@ -27,7 +27,7 @@ import android.os.Environment;
import android.os.StatFs;
import android.provider.MediaStore;
import android.util.DisplayMetrics;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.WindowManager;
import com.hippo.ehviewer.util.ThreadPool.CancelListener;
@@ -0,0 +1,14 @@
package com.hippo.ehviewer.network;
public class Constant {
public static final int HTTP_TEMP_REDIRECT = 307;
public static String defaultUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36";
public static String userAgent = System.getProperty("http.agent", defaultUserAgent);
public static final int DEFAULT_TIMEOUT = 5 * 1000;
public static final int MAX_REDIRECTS = 5;
public static final int BUFFER_SIZE = 4096;
}
+157 -79
View File
@@ -7,14 +7,25 @@ import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.UnknownHostException;
import android.util.Log;
import org.apache.http.conn.ConnectTimeoutException;
import android.content.Context;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.exception.FileException;
import com.hippo.ehviewer.exception.NoSdCardException;
import com.hippo.ehviewer.exception.RedirectionException;
import com.hippo.ehviewer.exception.ResponseCodeException;
import com.hippo.ehviewer.exception.StopRequestException;
import com.hippo.ehviewer.util.Cache;
import com.hippo.ehviewer.util.Util;
// TODO 添加断点续传
// TODO 添加检查次磁盘空间
/**
@@ -26,21 +37,19 @@ import com.hippo.ehviewer.util.Util;
public class Downloader implements Runnable {
private static final String TAG = "Downloader";
public static final int HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
public static final int HTTP_TEMP_REDIRECT = 307;
public static final int COMPLETED = 0;
public static final int STOP = -1;
public static final int NO_SDCARD = -2;
public static final int STATUS_HTTP_DATA_ERROR = -3;
public static final int STATUS_TOO_MANY_REDIRECTS = -4;
public static final int STATUS_FILE_ERROR = -5;
public static final int NONE = 0x0;
public static final int READY = 0x1;
public static final int CONNECTING = 0x2;
public static final int DOWNLOADING = 0x3;
public static final int FAILED = 0x4;
public static final int COMPLETED = 0x5;
public static final int STOPED = 0x6;
private static final int BUFFER_SIZE = 4096;
private static final int MAX_RETRY = 3;
private static final int MAX_REDIRECTS = 5;
private static final int MAX_RETRY = 5;
private static final int DEFAULT_TIMEOUT = 5 * 1000;
private Context mContext;
private File mFolder;
private String mPath;
private String mFileName;
private URL mUrl;
@@ -51,13 +60,16 @@ public class Downloader implements Runnable {
private int mDownloadSize = 0;
private int mRedirectionCount = 0;
private int status;
private int status = NONE;
private OnDownloadListener mListener;
private Exception mException;
public interface OnDownloadListener {
public void onDownloadStart(int totalSize);
public void onDownloadStartConnect();
public void onDownloadStartDownload(int totalSize);
public void onDownloadStatusUpdate(int downloadSize, int totalSize);
public void onDownloadOver(boolean ok, int eMesgId);
public void onDownloadOver(int status);
}
public class Controlor {
@@ -80,10 +92,11 @@ public class Downloader implements Runnable {
mPath = path;
mFileName = fileName;
mUrl = new URL(urlStr);
mException = null;
mDownloadSize = 0;
mRedirectionCount = 0;
status = COMPLETED;
status = READY;
mContorlor.reset();
return mContorlor;
@@ -93,86 +106,154 @@ public class Downloader implements Runnable {
mListener = listener;
}
public Downloader() {
public Downloader(Context context) {
mContext = context;
mContorlor = new Controlor();
}
public String getEMsg() {
if (mException == null)
return mContext.getString(R.string.em_unknown_error);
else if (mException instanceof MalformedURLException)
return mContext.getString(R.string.em_url_format_error);
else if (mException instanceof ConnectTimeoutException ||
mException instanceof SocketTimeoutException)
return mContext.getString(R.string.em_timeout);
else if (mException instanceof UnknownHostException)
return mContext.getString(R.string.em_unknown_host);
else if (mException instanceof ResponseCodeException)
return String.format(mContext.getString(R.string.em_unexpected_response_code),
((ResponseCodeException)mException).getResponseCode());
else if (mException instanceof RedirectionException)
return mContext.getString(R.string.em_redirection_error);
else if (mException instanceof SocketException)
return "SocketException : " + mException.getMessage();
else if (mException instanceof NoSdCardException)
return mContext.getString(R.string.em_no_sdcard);
else if (mException instanceof FileException)
return ((FileException)mException).getMessage();
else
return mException.getMessage();
}
@Override
public void run() {
boolean ok = false;
int retryTimes = 0;
if (Cache.hasSdCard())
while(true) {
if (Cache.hasSdCard()) {
boolean checkFolder = false;
try {
initFolder();
checkFolder = true;
} catch (Exception e) {
mException = e;
e.printStackTrace();
}
while(checkFolder) {
try {
if (mContorlor.isStop())
throw new StopRequestException(STOP, "Download is stopped");
throw new StopRequestException();
mRedirectionCount = 0;
status = COMPLETED;
status = READY;
executeDownload();
ok = true;
status = COMPLETED;
break;
} catch (StopRequestException e) {
} catch (Exception e) {
mException = e;
e.printStackTrace();
status = e.getFinalStatus();
if (status == STOP || retryTimes > MAX_RETRY)
if (mContorlor.isStop() || retryTimes > MAX_RETRY) {
status = FAILED;
break;
}
retryTimes++;
}
}
else
status = NO_SDCARD;
} else
mException = new NoSdCardException();
if (mContorlor.isStop())
status = STOPED;
if (mListener != null)
mListener.onDownloadOver(ok, status);
mListener.onDownloadOver(status);
}
public int getStatus() {
return status;
}
private void executeDownload() throws StopRequestException {
while (mRedirectionCount++ < MAX_REDIRECTS) {
private void initFolder() throws Exception {
mFolder = new File(mPath);
if (!mFolder.exists()) {
if (!mFolder.mkdirs())
throw new FileException(FileException.MKDIR_ERROR);
} else if (!mFolder.isDirectory()){
throw new FileException(FileException.NOT_DIR);
}
if (!mFolder.canWrite())
throw new FileException(FileException.CANNOT_WRITE);
}
private void executeDownload() throws Exception {
while (mRedirectionCount++ < Constant.MAX_REDIRECTS) {
HttpURLConnection conn = null;
try {
Log.d(TAG, "Get file " + mUrl.toString());
status = CONNECTING;
if (mListener != null)
mListener.onDownloadStartConnect();
conn = (HttpURLConnection)mUrl.openConnection();
conn.setInstanceFollowRedirects(false);
conn.addRequestProperty("Range", "bytes=" + mDownloadSize + "-"); // TODO
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.addRequestProperty("Range", "bytes=" + mDownloadSize + "-");
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.connect();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
processResponseHeaders(conn);
status = DOWNLOADING;
if (mListener != null)
mListener.onDownloadStart(mTotalSize);
mListener.onDownloadStartDownload(mTotalSize);
transferData(conn);
return;
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
mUrl = new URL(mUrl, location);
continue;
default:
StopRequestException.throwUnhandledHttpError(
responseCode, conn.getResponseMessage());
throw new ResponseCodeException(responseCode);
}
} catch (IOException e) {
// Trouble with low-level sockets
throw new StopRequestException(STATUS_HTTP_DATA_ERROR, e);
} catch (Exception e) {
throw e;
} finally {
if (conn != null) conn.disconnect();
if (conn != null)
conn.disconnect();
}
}
throw new StopRequestException(STATUS_TOO_MANY_REDIRECTS, "Too many redirects");
throw new RedirectionException();
}
/**
@@ -220,20 +301,19 @@ public class Downloader implements Runnable {
/**
* Transfer data from the given connection to the destination file.
*/
private void transferData(HttpURLConnection conn) throws StopRequestException {
private void transferData(HttpURLConnection conn) throws Exception {
InputStream in = null;
RandomAccessFile raf = null;
File file = null;
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
throw new StopRequestException();
try {
try {
in = conn.getInputStream();
} catch (IOException e) {
throw new StopRequestException(STATUS_HTTP_DATA_ERROR, e);
throw e; // TODO
}
try {
@@ -241,14 +321,15 @@ public class Downloader implements Runnable {
raf = new RandomAccessFile(file, "rw");
raf.seek(mDownloadSize);
} catch (IOException e) {
throw new StopRequestException(STATUS_FILE_ERROR, e);
throw new FileException(FileException.CREATE_FILE_ERROR);
}
// Start streaming data, periodically watch for pause/cancel
// commands and checking disk space as needed.
transferData(in, raf);
} finally {
Util.closeStreamQuietly(in);
if (in != null)
Util.closeStreamQuietly(in);
if (raf != null)
try {
raf.close();
@@ -265,9 +346,13 @@ public class Downloader implements Runnable {
*/
@SuppressWarnings("unused")
private void transferData(InputStream in, OutputStream out)
throws StopRequestException {
final byte data[] = new byte[BUFFER_SIZE];
for (;;) {
throws Exception {
final byte data[] = new byte[Constant.BUFFER_SIZE];
while (true) {
if (mContorlor.isStop())
throw new StopRequestException();
int bytesRead = readFromResponse(data, in);
if (bytesRead == -1) { // success, end of stream already reached
return;
@@ -277,10 +362,7 @@ public class Downloader implements Runnable {
mDownloadSize += bytesRead;
if (mListener != null)
mListener.onDownloadStatusUpdate(mDownloadSize, mTotalSize);
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
}
}
@@ -289,9 +371,12 @@ public class Downloader implements Runnable {
* destination file.
*/
private void transferData(InputStream in, RandomAccessFile raf)
throws StopRequestException {
final byte data[] = new byte[BUFFER_SIZE];
for (;;) {
throws Exception {
final byte data[] = new byte[Constant.BUFFER_SIZE];
while (true) {
if (mContorlor.isStop())
throw new StopRequestException();
int bytesRead = readFromResponse(data, in);
if (bytesRead == -1) { // success, end of stream already reached
return;
@@ -301,10 +386,6 @@ public class Downloader implements Runnable {
mDownloadSize += bytesRead;
if (mListener != null)
mListener.onDownloadStatusUpdate(mDownloadSize, mTotalSize);
if (mContorlor.isStop())
throw new StopRequestException(STOP,
"Download is stopped");
}
}
@@ -315,13 +396,12 @@ public class Downloader implements Runnable {
* @return the number of bytes actually read or -1 if the end of the stream has been reached
*/
private int readFromResponse(byte[] data, InputStream entityStream)
throws StopRequestException {
throws Exception {
try {
return entityStream.read(data);
} catch (IOException ex) {
} catch (IOException e) {
// TODO: handle stream errors the same as other retries
throw new StopRequestException(STATUS_HTTP_DATA_ERROR,
"Failed reading response: " + ex, ex);
throw e;
}
}
@@ -332,15 +412,14 @@ public class Downloader implements Runnable {
* @param bytesRead how many bytes to write from the buffer
*/
private void writeDataToDestination(byte[] data, int bytesRead, OutputStream out)
throws StopRequestException {
throws Exception {
try {
out.write(data, 0, bytesRead);
return;
} catch (IOException ex) {
} catch (IOException e) {
// TODO: better differentiate between DRM and disk failures
// TODO: check disk is full
throw new StopRequestException(STATUS_FILE_ERROR,
"Failed to write data: " + ex);
throw e;
}
}
@@ -350,15 +429,14 @@ public class Downloader implements Runnable {
* @param bytesRead how many bytes to write from the buffer
*/
private void writeDataToDestination(byte[] data, int bytesRead, RandomAccessFile raf)
throws StopRequestException {
throws Exception {
try {
raf.write(data, 0, bytesRead);
return;
} catch (IOException ex) {
} catch (IOException e) {
// TODO: better differentiate between DRM and disk failures
// TODO: check disk is full
throw new StopRequestException(STATUS_FILE_ERROR,
"Failed to write data: " + ex);
throw e;
}
}
}
+92 -55
View File
@@ -7,16 +7,21 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import org.apache.http.conn.ConnectTimeoutException;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.R;
import com.hippo.ehviewer.exception.RedirectionException;
import com.hippo.ehviewer.exception.ResponseCodeException;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.Util;
@@ -24,7 +29,8 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
/**
* It is not thread safe
@@ -35,15 +41,10 @@ import android.util.Log;
public class HttpHelper {
private static final String TAG = "HttpHelper";
public static final int HTTP_TEMP_REDIRECT = 307;
private static String defaultUserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36";
private static String userAgent = System.getProperty("http.agent", defaultUserAgent);
private static final int DEFAULT_TIMEOUT = 5 * 1000;
private static final int MAX_REDIRECTS = 5;
private static String DEFAULT_CHARSET = "utf-8";
private static String CHARSET_KEY = "charset=";
private Context mContext;
private int responseCode;
private Exception mException;
public HttpHelper(Context context) {
@@ -69,15 +70,17 @@ public class HttpHelper {
return mContext.getString(R.string.em_unknown_host);
else if (mException instanceof ResponseCodeException)
return String.format(mContext.getString(R.string.em_unexpected_response_code), responseCode);
return String.format(mContext.getString(R.string.em_unexpected_response_code),
((ResponseCodeException)mException).getResponseCode());
else if (mException instanceof RedirectionException)
return mContext.getString(R.string.em_redirection_error);
else if (mException instanceof IOException)
return mContext.getString(R.string.em_network_error);
else if (mException instanceof SocketException)
return "SocketException : " + mException.getMessage();
return mContext.getString(R.string.em_unknown_error);
else
return mException.getMessage();
}
private String getPageContext(HttpURLConnection conn)
@@ -91,9 +94,28 @@ public class HttpHelper {
if (encoding != null && encoding.equals("gzip"))
is = new GZIPInputStream(is);
baos = new ByteArrayOutputStream();
Util.copy(is, baos, 1024);
// TODO charset
pageContext = baos.toString("utf-8");
Util.copy(is, baos, Constant.BUFFER_SIZE);
// Get charset
String charset = null;
List<String> contentType = conn.getHeaderFields().get("Content-Type");
if (contentType != null) {
for (String item : contentType) {
if (item == null)
continue;
int index = -1;
if ((index = item.indexOf(CHARSET_KEY)) != -1) {
charset = item.substring(index + CHARSET_KEY.length());
break;
}
}
}
// Use default charset
if (charset == null) {
charset = DEFAULT_CHARSET;
}
pageContext = baos.toString(charset);
} catch (IOException e) {
throw e;
} finally {
@@ -111,16 +133,19 @@ public class HttpHelper {
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http get " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < MAX_REDIRECTS) {
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.connect();
responseCode = conn.getResponseCode();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
@@ -129,7 +154,7 @@ public class HttpHelper {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
@@ -138,16 +163,16 @@ public class HttpHelper {
throw new ResponseCodeException(responseCode);
}
}
if (redirectionCount > MAX_REDIRECTS)
throw new RedirectionException();
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
@@ -159,13 +184,16 @@ public class HttpHelper {
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http post " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < MAX_REDIRECTS) {
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
@@ -191,7 +219,7 @@ public class HttpHelper {
conn.connect();
responseCode = conn.getResponseCode();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
@@ -200,7 +228,7 @@ public class HttpHelper {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
@@ -209,16 +237,16 @@ public class HttpHelper {
throw new ResponseCodeException(responseCode);
}
}
if (redirectionCount > MAX_REDIRECTS)
throw new RedirectionException();
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
@@ -230,13 +258,16 @@ public class HttpHelper {
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http post " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < MAX_REDIRECTS) {
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
@@ -250,7 +281,7 @@ public class HttpHelper {
conn.connect();
responseCode = conn.getResponseCode();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
@@ -259,7 +290,7 @@ public class HttpHelper {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
@@ -268,16 +299,16 @@ public class HttpHelper {
throw new ResponseCodeException(responseCode);
}
}
if (redirectionCount > MAX_REDIRECTS)
throw new RedirectionException();
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
@@ -290,13 +321,16 @@ public class HttpHelper {
HttpURLConnection conn = null;
try {
Log.d(TAG, "Http post " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < MAX_REDIRECTS) {
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection) url.openConnection();
conn.addRequestProperty("Accept-Encoding", "gzip");
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
@@ -312,7 +346,7 @@ public class HttpHelper {
conn.connect();
responseCode = conn.getResponseCode();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
@@ -321,7 +355,7 @@ public class HttpHelper {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
@@ -330,16 +364,16 @@ public class HttpHelper {
throw new ResponseCodeException(responseCode);
}
}
if (redirectionCount > MAX_REDIRECTS)
throw new RedirectionException();
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
@@ -356,15 +390,18 @@ public class HttpHelper {
InputStream is = null;
try {
Log.d(TAG, "Http get bitmap " + urlStr);
url = new URL(urlStr);
while (redirectionCount++ < MAX_REDIRECTS) {
while (redirectionCount++ < Constant.MAX_REDIRECTS) {
conn = (HttpURLConnection)url.openConnection();
conn.setRequestProperty("User-Agent", userAgent);
conn.setConnectTimeout(DEFAULT_TIMEOUT);
conn.setReadTimeout(DEFAULT_TIMEOUT);
conn.setRequestProperty("User-Agent", Constant.userAgent);
conn.setConnectTimeout(Constant.DEFAULT_TIMEOUT);
conn.setReadTimeout(Constant.DEFAULT_TIMEOUT);
conn.connect();
responseCode = conn.getResponseCode();
final int responseCode = conn.getResponseCode();
switch (responseCode) {
case HttpURLConnection.HTTP_OK:
case HttpURLConnection.HTTP_PARTIAL:
@@ -406,7 +443,7 @@ public class HttpHelper {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
case HttpURLConnection.HTTP_SEE_OTHER:
case HTTP_TEMP_REDIRECT:
case Constant.HTTP_TEMP_REDIRECT:
final String location = conn.getHeaderField("Location");
url = new URL(url, location);
continue;
@@ -415,11 +452,10 @@ public class HttpHelper {
throw new ResponseCodeException(responseCode);
}
}
if (redirectionCount > MAX_REDIRECTS)
throw new RedirectionException();
} catch (Exception e) {
mException = e;
e.printStackTrace();
return null;
} finally {
if (baos != null)
Util.closeStreamQuietly(baos);
@@ -428,6 +464,7 @@ public class HttpHelper {
if (conn != null)
conn.disconnect();
}
mException = new RedirectionException();
return null;
}
}
@@ -1,31 +0,0 @@
package com.hippo.ehviewer.network;
class StopRequestException extends Exception {
private final int mFinalStatus;
public StopRequestException(int finalStatus, String message) {
super(message);
mFinalStatus = finalStatus;
}
public StopRequestException(int finalStatus, Throwable t) {
super(t);
mFinalStatus = finalStatus;
}
public StopRequestException(int finalStatus, String message, Throwable t) {
super(message, t);
mFinalStatus = finalStatus;
}
public int getFinalStatus() {
return mFinalStatus;
}
public static StopRequestException throwUnhandledHttpError(int code, String message)
throws StopRequestException {
final String error = "Unhandled HTTP response: " + code + " " + message;
throw new StopRequestException(code, error);
}
}
@@ -19,7 +19,7 @@ import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
public class DownloadService extends Service {
private static final int DOWNLOAD_NOTIFY_ID = -1;
+1 -1
View File
@@ -6,7 +6,7 @@ import android.graphics.Bitmap;
import android.os.Build;
import android.os.Environment;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.MangaDetail;
+22
View File
@@ -27,6 +27,9 @@ public class Config {
private static final String DOWNLOAD_PATH = "preference_download_path";
private static final String DOWNLOAD_PATH_DEFAULT = Environment.getExternalStorageDirectory() + "/EhViewer/download/";
private static final String UPDATE_SERVER = "preference_update_server";
private static final String UPDATE_SERVER_DEFAULT = "1";
private static boolean mInit = false;
private static Context mContext;
@@ -190,4 +193,23 @@ public class Config {
mConfigPre.edit().putInt(KEY_UPDATE_DATE, date).apply();
}
public static String getUpdateServer() {
int value = 1;
try {
value = Integer.parseInt(mConfigPre.getString(UPDATE_SERVER, null));
} catch (Exception e) {
mConfigPre.edit().putString(UPDATE_SERVER, UPDATE_SERVER_DEFAULT)
.apply();
}
switch (value) {
case 1:
return "qiniu";
case 0:
default:
return "google";
}
}
}
+196 -196
View File
@@ -1,196 +1,196 @@
package com.hippo.ehviewer.util;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
public class Crash {
private static final String TAG = "Crash";
private static Context mContext;
private static String externalCrashFilePath = "/EhViewer/crash";
private static String internalCrashFilePath = "/crash";
private static final String NEW_CRAHS = "new_crash";
private static final String LAST_CRASH_POSITION = "last_crash_position";
private static final String LAST_CRASH_NAME = "last_crash_name";
private static DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
private static boolean mInit = false;
/**
* Init Crash
*
* @param context Application context
*/
public static void init(Context context) {
if (mInit)
return;
mInit = true;
mContext = context;
}
/**
* Is init
* @return True if init
*/
public static boolean isInit() {
return mInit;
}
/**
* Save throwable infomation to file
*
* @param ex The throwable to store
*/
public static void saveCrashInfo2File(Throwable ex) {
StringBuffer sb = new StringBuffer();
collectDeviceInfo(sb);
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
Throwable cause = ex.getCause();
while (cause != null) {
cause.printStackTrace(printWriter);
cause = cause.getCause();
}
printWriter.close();
String result = writer.toString();
Log.e(TAG, result);
sb.append("======== CrashInfo ========\n");
sb.append(result);
try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "crash-" + time + "-" + timestamp + ".log";
String path = null;
boolean position = false;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
path = Environment.getExternalStorageDirectory() + externalCrashFilePath;
position = true;
}
else {
path = mContext.getFilesDir() + internalCrashFilePath;
position = false;
}
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
FileOutputStream fos = new FileOutputStream(new File(path, fileName));
fos.write(sb.toString().getBytes());
fos.close();
// Record info for next time upload
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
SharedPreferences.Editor editor = configPre.edit();
editor.putBoolean(NEW_CRAHS, true);
editor.putBoolean(LAST_CRASH_POSITION, position);
editor.putString(LAST_CRASH_NAME, fileName);
editor.commit();
} catch (Exception e) {
Log.e(TAG, "An error occured while writing crash file...", e);
}
}
private static void collectDeviceInfo(StringBuffer sb) {
try {
PackageManager pm = mContext.getPackageManager();
PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);
if (pi != null) {
String versionName = pi.versionName == null ? "null" : pi.versionName;
String versionCode = String.valueOf(pi.versionCode);
sb.append("======== PackageInfo ========\n");
sb.append("PackageName=" + pi.packageName + "\n");
sb.append("VersionName=" + versionName + "\n");
sb.append("VersionCode=" + versionCode + "\n");
sb.append("\n");
}
} catch (NameNotFoundException e) {
Log.e(TAG, "an error occured when collect package info", e);
}
sb.append("======== DeviceInfo ========\n");
sb.append("BOARD=" + Build.BOARD + "\n");
sb.append("BOOTLOADER=" + Build.BOOTLOADER + "\n");
sb.append("CPU_ABI=" + Build.CPU_ABI + "\n");
sb.append("CPU_ABI2=" + Build.CPU_ABI2 + "\n");
sb.append("DEVICE=" + Build.DEVICE + "\n");
sb.append("DISPLAY=" + Build.DISPLAY + "\n");
sb.append("FINGERPRINT=" + Build.FINGERPRINT + "\n");
sb.append("HARDWARE=" + Build.HARDWARE + "\n");
sb.append("HOST=" + Build.HOST + "\n");
sb.append("ID=" + Build.ID + "\n");
sb.append("MANUFACTURER=" + Build.MANUFACTURER + "\n");
sb.append("MODEL=" + Build.MODEL + "\n");
sb.append("PRODUCT=" + Build.PRODUCT + "\n");
sb.append("RADIO=" + Build.getRadioVersion() + "\n");
sb.append("SERIAL=" + Build.SERIAL + "\n");
sb.append("TAGS=" + Build.TAGS + "\n");
sb.append("TYPE=" + Build.TYPE + "\n");
sb.append("USER=" + Build.USER + "\n");
sb.append("CODENAME=" + Build.VERSION.CODENAME + "\n");
sb.append("INCREMENTAL=" + Build.VERSION.INCREMENTAL + "\n");
sb.append("RELEASE=" + Build.VERSION.RELEASE + "\n");
sb.append("SDK=" + Build.VERSION.SDK_INT + "\n");
sb.append("\n");
}
/**
* Check is there last crash
*
* @return Return the crash String or null if there is no
*/
public static String getLastCrash() {
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
if (!configPre.getBoolean(NEW_CRAHS, false))
return null;
boolean position = configPre.getBoolean(LAST_CRASH_POSITION, false);
String lastCrashName;
if ((lastCrashName = configPre.getString(LAST_CRASH_NAME, null)) == null)
return null;
File lastCrashFile;
if (position) {
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
return null;
lastCrashFile = new File(Environment.getExternalStorageDirectory() + externalCrashFilePath, lastCrashName);
}
else {
lastCrashFile = new File(mContext.getFilesDir() + internalCrashFilePath, lastCrashName);
}
if (!lastCrashFile.isFile())
return null;
try {
byte[] buffer = new byte[(int) lastCrashFile.length()];
DataInputStream din = new DataInputStream(new FileInputStream(lastCrashFile));
din.readFully(buffer);
din.close();
configPre.edit().putBoolean(NEW_CRAHS, false).commit();
return new String(buffer);
} catch (Exception e) {
Log.e(TAG, "An error occured while reading crash file...", e);
}
return null;
}
}
package com.hippo.ehviewer.util;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Environment;
import com.hippo.ehviewer.util.Log;
public class Crash {
private static final String TAG = "Crash";
private static Context mContext;
private static String externalCrashFilePath = "/EhViewer/crash";
private static String internalCrashFilePath = "/crash";
private static final String NEW_CRAHS = "new_crash";
private static final String LAST_CRASH_POSITION = "last_crash_position";
private static final String LAST_CRASH_NAME = "last_crash_name";
private static DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
private static boolean mInit = false;
/**
* Init Crash
*
* @param context Application context
*/
public static void init(Context context) {
if (mInit)
return;
mInit = true;
mContext = context;
}
/**
* Is init
* @return True if init
*/
public static boolean isInit() {
return mInit;
}
/**
* Save throwable infomation to file
*
* @param ex The throwable to store
*/
public static void saveCrashInfo2File(Throwable ex) {
StringBuffer sb = new StringBuffer();
collectDeviceInfo(sb);
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
Throwable cause = ex.getCause();
while (cause != null) {
cause.printStackTrace(printWriter);
cause = cause.getCause();
}
printWriter.close();
String result = writer.toString();
Log.e(TAG, result);
sb.append("======== CrashInfo ========\n");
sb.append(result);
try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "crash-" + time + "-" + timestamp + ".log";
String path = null;
boolean position = false;
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
path = Environment.getExternalStorageDirectory() + externalCrashFilePath;
position = true;
}
else {
path = mContext.getFilesDir() + internalCrashFilePath;
position = false;
}
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
FileOutputStream fos = new FileOutputStream(new File(path, fileName));
fos.write(sb.toString().getBytes());
fos.close();
// Record info for next time upload
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
SharedPreferences.Editor editor = configPre.edit();
editor.putBoolean(NEW_CRAHS, true);
editor.putBoolean(LAST_CRASH_POSITION, position);
editor.putString(LAST_CRASH_NAME, fileName);
editor.commit();
} catch (Exception e) {
Log.e(TAG, "An error occured while writing crash file...", e);
}
}
private static void collectDeviceInfo(StringBuffer sb) {
try {
PackageManager pm = mContext.getPackageManager();
PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(), PackageManager.GET_ACTIVITIES);
if (pi != null) {
String versionName = pi.versionName == null ? "null" : pi.versionName;
String versionCode = String.valueOf(pi.versionCode);
sb.append("======== PackageInfo ========\n");
sb.append("PackageName=" + pi.packageName + "\n");
sb.append("VersionName=" + versionName + "\n");
sb.append("VersionCode=" + versionCode + "\n");
sb.append("\n");
}
} catch (NameNotFoundException e) {
Log.e(TAG, "an error occured when collect package info", e);
}
sb.append("======== DeviceInfo ========\n");
sb.append("BOARD=" + Build.BOARD + "\n");
sb.append("BOOTLOADER=" + Build.BOOTLOADER + "\n");
sb.append("CPU_ABI=" + Build.CPU_ABI + "\n");
sb.append("CPU_ABI2=" + Build.CPU_ABI2 + "\n");
sb.append("DEVICE=" + Build.DEVICE + "\n");
sb.append("DISPLAY=" + Build.DISPLAY + "\n");
sb.append("FINGERPRINT=" + Build.FINGERPRINT + "\n");
sb.append("HARDWARE=" + Build.HARDWARE + "\n");
sb.append("HOST=" + Build.HOST + "\n");
sb.append("ID=" + Build.ID + "\n");
sb.append("MANUFACTURER=" + Build.MANUFACTURER + "\n");
sb.append("MODEL=" + Build.MODEL + "\n");
sb.append("PRODUCT=" + Build.PRODUCT + "\n");
sb.append("RADIO=" + Build.getRadioVersion() + "\n");
sb.append("SERIAL=" + Build.SERIAL + "\n");
sb.append("TAGS=" + Build.TAGS + "\n");
sb.append("TYPE=" + Build.TYPE + "\n");
sb.append("USER=" + Build.USER + "\n");
sb.append("CODENAME=" + Build.VERSION.CODENAME + "\n");
sb.append("INCREMENTAL=" + Build.VERSION.INCREMENTAL + "\n");
sb.append("RELEASE=" + Build.VERSION.RELEASE + "\n");
sb.append("SDK=" + Build.VERSION.SDK_INT + "\n");
sb.append("\n");
}
/**
* Check is there last crash
*
* @return Return the crash String or null if there is no
*/
public static String getLastCrash() {
SharedPreferences configPre = mContext.getSharedPreferences("config", 0);
if (!configPre.getBoolean(NEW_CRAHS, false))
return null;
boolean position = configPre.getBoolean(LAST_CRASH_POSITION, false);
String lastCrashName;
if ((lastCrashName = configPre.getString(LAST_CRASH_NAME, null)) == null)
return null;
File lastCrashFile;
if (position) {
if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
return null;
lastCrashFile = new File(Environment.getExternalStorageDirectory() + externalCrashFilePath, lastCrashName);
}
else {
lastCrashFile = new File(mContext.getFilesDir() + internalCrashFilePath, lastCrashName);
}
if (!lastCrashFile.isFile())
return null;
try {
byte[] buffer = new byte[(int) lastCrashFile.length()];
DataInputStream din = new DataInputStream(new FileInputStream(lastCrashFile));
din.readFully(buffer);
din.close();
configPre.edit().putBoolean(NEW_CRAHS, false).commit();
return new String(buffer);
} catch (Exception e) {
Log.e(TAG, "An error occured while reading crash file...", e);
}
return null;
}
}
+12 -6
View File
@@ -43,7 +43,7 @@ import android.graphics.Movie;
import android.os.Handler;
import android.os.Message;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
// TODO Stringbuffer to StringBuild
@@ -1179,10 +1179,16 @@ public class EhClient {
listener.onDownloadMangaAllStart();
Parser parser = new Parser();
Downloader imageDownloader = new Downloader();
Downloader imageDownloader = new Downloader(mAppContext);
imageDownloader.setOnDownloadListener(new Downloader.OnDownloadListener() {
@Override
public void onDownloadStart(int totalSize) {
public void onDownloadStartConnect() {
}
@Override
public void onDownloadStartDownload(int totalSize) {
if (curDownloadInfo != null) {
curDownloadInfo.downloadSize = 0;
curDownloadInfo.totalSize = totalSize/1024.0f;
@@ -1199,8 +1205,8 @@ public class EhClient {
}
@Override
public void onDownloadOver(boolean ok, int eMesgId) {
if (ok)
public void onDownloadOver(int status) {
if (status == Downloader.COMPLETED)
mService.notifyUpdate(curDownloadInfo.gid, curDownloadInfo.lastStartIndex, ImageSet.STATE_LOADED);
else
mService.notifyUpdate(curDownloadInfo.gid, curDownloadInfo.lastStartIndex, ImageSet.STATE_FAIL);
@@ -1280,7 +1286,7 @@ public class EhClient {
curDownloadInfo.totalSize = 0;
int downloadStatus = imageDownloader.getStatus();
if (downloadStatus == Downloader.STOP) { // If stop by user
if (downloadStatus == Downloader.STOPED) { // If stop by user
listener.onDownloadMangaStop(curDownloadInfo.gid);
mService.notifyUpdate();
Download.notify(String.valueOf(curDownloadInfo.gid));
+59
View File
@@ -0,0 +1,59 @@
package com.hippo.ehviewer.util;
public class Log {
private static final String NULL = "null";
public static int v(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.v(tag, msg);
}
public static int v(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.v(tag, msg, tr);
}
public static int d(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.d(tag, msg);
}
public static int d(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.d(tag, msg, tr);
}
public static int i(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.i(tag, msg);
}
public static int i(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.i(tag, msg, tr);
}
public static int w(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.w(tag, msg);
}
public static int w(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.w(tag, msg, tr);
}
public static int w(String tag, Throwable tr) {
return android.util.Log.w(tag, tr);
}
public static int e(String tag, String msg) {
if (msg == null)
msg = NULL;
return android.util.Log.e(tag, msg);
}
public static int e(String tag, String msg, Throwable tr) {
if (msg == null)
msg = NULL;
return android.util.Log.e(tag, msg, tr);
}
}
+1 -1
View File
@@ -16,7 +16,7 @@
package com.hippo.ehviewer.util;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
+17 -23
View File
@@ -1,44 +1,22 @@
package com.hippo.ehviewer.util;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import com.hippo.ehviewer.DiskCache;
import com.hippo.ehviewer.ListUrls;
import com.hippo.ehviewer.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Movie;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.support.v4.util.LruCache;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.ImageView;
public class Util {
@SuppressWarnings("unused")
private static String TAG = "Util";
/**
@@ -213,4 +191,20 @@ public class Util {
} catch (NumberFormatException e) {}
return time;
}
private static String[] SIZE_UNIT = {"%.2f B", "%.2f KB", "%.2f MB", "%.2f GB"};
public static String sizeToString(long size) {
int length = SIZE_UNIT.length;
float sizeFloat = (float)size;
for (int i = 0; i < length; i++) {
if (sizeFloat < 1024 || i == length - 1) {
return String.format(SIZE_UNIT[i], sizeFloat);
}
sizeFloat /= 1024;
}
return null;
}
}
@@ -3,7 +3,7 @@ package com.hippo.ehviewer.view;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
+1 -1
View File
@@ -9,7 +9,7 @@ import android.graphics.Bitmap;
import android.graphics.Movie;
import android.support.v4.util.LruCache;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
public class OlImageView extends SuperImageView {
File diff suppressed because it is too large. Load diff
@@ -10,7 +10,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -35,7 +35,7 @@ import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewGroupCompat;
import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
import android.util.AttributeSet;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -15,4 +15,15 @@ public class SuperDialogUtil {
titleView.setText(title);
}
public static AlertDialog createUpdateDialog(Context context, String version,
String size, String info, View.OnClickListener positiveListener,
View.OnClickListener negativeListener) {
return new DialogBuilder(context).setTitle(R.string.update).setCancelable(false)
.setMessage(String.format(context.getString(R.string.update_message), version, size, info))
.setPositiveButton(android.R.string.ok, positiveListener)
.setNegativeButton(android.R.string.cancel, negativeListener)
.create();
}
}
@@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.util.Log;
import com.hippo.ehviewer.util.Log;
/**
* A cache that uses a bounded amount of space on a filesystem. Each cache entry