mirror of
https://github.com/seven332/EhViewer
synced 2026-12-02 03:58:03 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09229546c6 | ||
|
|
03582eb9da | ||
|
|
e2e794b85c | ||
|
|
ab949d5567 | ||
|
|
f340279e57 | ||
|
|
ddb1edb7d1 | ||
|
|
a7f29a3cd5 | ||
|
|
d09e4a9215 | ||
|
|
07335ba49c | ||
|
|
b55d5a1538 | ||
|
|
97fc40a69c | ||
|
|
cc73666475 | ||
|
|
0ed34f2eca | ||
|
|
a7a3d56c91 | ||
|
|
748c5cb812 |
No files matched your search
@@ -9,6 +9,54 @@
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?children?</key>
|
||||
<value>?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|?name?=outputEntries\||</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value>NDK_DEBUG=0</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>ndk-build</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.hippo.ehviewer"
|
||||
android:versionCode="26"
|
||||
android:versionName="0.6.5" >
|
||||
android:versionCode="28"
|
||||
android:versionName="0.6.7" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="14"
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 Hippo Seven
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/CardTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploader"
|
||||
style="@style/CardMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp" />
|
||||
|
||||
<com.hippo.ehviewer.widget.RatingView
|
||||
android:id="@+id/rate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category"
|
||||
style="@style/CardMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,3 +1,16 @@
|
||||
Version 0.6.7 (2014-10-14)
|
||||
* 修正部分设置修改无效
|
||||
* 完善网络状态检查
|
||||
* 移除不和谐字符串
|
||||
* 调整界面
|
||||
|
||||
Version 0.6.6 (2014-10-13)
|
||||
* 下载目录命名方式恢复为 gid-title,以前的目录名称可在 设置->高级->其他->修正下载文件夹名 处修改
|
||||
* 避免大量通知
|
||||
* 添加 Twitter 信息
|
||||
* 修正阅读边界提示过于敏感
|
||||
* 修正一处可能的崩溃
|
||||
|
||||
Version 0.6.5 (2014-10-07)
|
||||
* 调整界面
|
||||
* 调整阅读滑动效果
|
||||
|
||||
@@ -19,16 +19,14 @@
|
||||
<!-- Warning -->
|
||||
<string name="dailog_waring_title">警告</string>
|
||||
<string name="dailog_waring_plain">该应用内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。该应用作者不会对由该应用造成的后果负责。您是否愿意继续使用该应用?</string>
|
||||
<string name="dailog_waring_yes">我愿意</string>
|
||||
<string name="dailog_waring_no">不!</string>
|
||||
|
||||
<!-- Analyics -->
|
||||
<string name="dailog_analyics_title">数据统计</string>
|
||||
<string name="dailog_analyics_plain">您是否愿意将使用情况发送给开发者?这对开发者维护该应用有很大帮助。在发送使用情况的同时也会发送部分设备信息(譬如设备型号、系统版本)。开发者承诺不收集任何个人身份信息数据(譬如姓名、电话号码、电邮地址)。\n\n数据收集过程采用 Google Analytics。\nGOOGLE ANALYTICS(分析)服务条款:http://www.google.com/analytics/terms/cn.html\nGoogle隐私权和条款:http://www.google.com/intl/zh-CN/policies\n\n您以后可以在设置中修改选择</string>
|
||||
|
||||
<!-- Network -->
|
||||
<string name="dailog_network_error_yes">我不在意</string>
|
||||
<string name="dailog_network_error_no">成</string>
|
||||
<string name="dailog_network_mobile_title">您正在使用移动网络,可能会消耗大量的资费,是否继续使用?</string>
|
||||
<string name="dailog_network_none_title">未检测到网络连接,是否继续使用?</string>
|
||||
|
||||
<!-- Exit -->
|
||||
<string name="exit_tip">再按一次退出</string>
|
||||
@@ -62,8 +60,6 @@
|
||||
<!-- Send Crash -->
|
||||
<string name="dialog_send_crash_title">这很重要</string>
|
||||
<string name="dialog_send_crash_plain">上次该应用崩溃了。你愿意把错误日志发送给开发者以便以后得到更好的用户体验么?(以电子邮件的形式发送)</string>
|
||||
<string name="dialog_send_crash_yes">我愿意</string>
|
||||
<string name="dialog_send_crash_no">门儿都没有</string>
|
||||
<string name="dialog_wait_send_crash_msg">请在发送完日志后关闭该窗口</string>
|
||||
|
||||
<!-- List item long click -->
|
||||
@@ -77,6 +73,8 @@
|
||||
<string name="no_avatar">无头像</string>
|
||||
<string name="get_avatar_error">获取头像失败</string>
|
||||
<string name="image_search">图像搜索</string>
|
||||
<string name="image_not_exist">图像不存在</string>
|
||||
<string name="image_not_readable">图像不可读</string>
|
||||
|
||||
<!-- Update -->
|
||||
<string name="update_message" formatted="false">发现新版本:%s\n大小:%s\n%s\n\n是否更新?</string>
|
||||
@@ -101,6 +99,12 @@
|
||||
<string name="legacy_pages">%d 页未下载</string>
|
||||
<string name="download_over">下载结束</string>
|
||||
<string name="start_download">开始下载</string>
|
||||
<string name="download_1">下载成功 %d</string>
|
||||
<string name="download_2">下载成功 %d 项</string>
|
||||
<string name="download_3">下载失败 %d</string>
|
||||
<string name="download_4">下载失败 %d 项</string>
|
||||
<string name="download_5" formatted="false">下载成功 %d, 下载失败 %d</string>
|
||||
<string name="download_6" formatted="false">下载成功 %d 项, 下载失败 %d 项</string>
|
||||
|
||||
<!-- ErrorMessage -->
|
||||
<string name="em_network_error">网络错误</string>
|
||||
@@ -133,6 +137,9 @@
|
||||
<string name="em_index_error">索引错误</string>
|
||||
<string name="em_requst_null">请求内容为空</string>
|
||||
|
||||
<!-- GalleryActivity -->
|
||||
<string name="ga_data_error">数据错误!</string>
|
||||
|
||||
<!-- Gallery -->
|
||||
<string name="gallery_tip">长按屏幕,可使下载从当前页面开始。若该项正在下载,则仅优先加载当前页面。</string>
|
||||
<string name="read_image_error">读取图片错误</string>
|
||||
@@ -231,9 +238,14 @@
|
||||
<string name="http_read_timeout_title">读取超时 (ms)</string>
|
||||
<string name="eh_advanced_settings_title">EH</string>
|
||||
<string name="eh_min_interval_title">EH 站点最小连接间隔 (ms)</string>
|
||||
<string name="eh_others_settings_title">其他</string>
|
||||
<string name="fix_dirname_title">修正下载文件夹名</string>
|
||||
<string name="fix_dirname_title_summary">将下载文件夹名由 gid 改为 gid-title,不进行修正不会影响使用</string>
|
||||
|
||||
<string name="about_settings_title">关于</string>
|
||||
<string name="author_title">作者</string>
|
||||
<string name="twitter_title">Twitter</string>
|
||||
<string name="twitter_summary">目前由 @jkjvinn 管理更新</string>
|
||||
<string name="changelog_title">日志</string>
|
||||
<string name="thanks_title">感谢</string>
|
||||
<string name="website_title">网站</string>
|
||||
@@ -325,6 +337,8 @@
|
||||
<string name="rating0">…</string>
|
||||
|
||||
<!-- Utils -->
|
||||
<string name="warning">警告</string>
|
||||
<string name="close">关闭</string>
|
||||
<string name="select">选择</string>
|
||||
<string name="click_more">点击查看更多</string>
|
||||
<string name="similar_content">相似内容</string>
|
||||
|
||||
@@ -7,16 +7,14 @@
|
||||
<!-- Warning -->
|
||||
<string name="dailog_waring_title">警告</string>
|
||||
<string name="dailog_waring_plain">該應用內容來自互聯網,部分內容可能對您的生理及心理造成難以恢復的傷害。該應用作者不會對由該應用造成的後果負責。您是否願意繼續使用該應用?</string>
|
||||
<string name="dailog_waring_yes">我願意</string>
|
||||
<string name="dailog_waring_no">不!</string>
|
||||
|
||||
<!-- Analyics -->
|
||||
<string name="dailog_analyics_title">數據統計</string>
|
||||
<string name="dailog_analyics_plain">您是否願意將使用情況發送給開發者?這對開發者維護該應用有很大幫助。在發送使用情況的同時也會發送部分設備信息(譬如設備型號、系統版本)。開發者承諾不收集任何個人身份信息數據(譬如姓名、電話號碼、電郵地址)。\n\n數據收集過程採用 Google Analytics。\nGOOGLE ANALYTICS(分析)服務條款:http://www.google.com/analytics/terms/cn.html\nGoogle隱私權和條款:http://www.google.com/intl/zh-CN/policies\n\n您以後可以在設置中修改選擇</string>
|
||||
|
||||
<!-- Network -->
|
||||
<string name="dailog_network_error_yes">我不在意</string>
|
||||
<string name="dailog_network_error_no">成</string>
|
||||
<string name="dailog_network_mobile_title">您正在使用移動網絡,可能會消耗大量的資費,是否繼續使用?</string>
|
||||
<string name="dailog_network_none_title">未檢測到網絡連接,是否繼續使用?</string>
|
||||
|
||||
<!-- Exit -->
|
||||
<string name="exit_tip">再按一次退出</string>
|
||||
@@ -50,8 +48,6 @@
|
||||
<!-- Send Crash -->
|
||||
<string name="dialog_send_crash_title">這很重要</string>
|
||||
<string name="dialog_send_crash_plain">上次該應用崩潰了。你願意把錯誤日誌發送給開發者以便以後得到更好的用戶體驗麼?(以電子郵件的形式發送)</string>
|
||||
<string name="dialog_send_crash_yes">我願意</string>
|
||||
<string name="dialog_send_crash_no">門兒都沒有</string>
|
||||
<string name="dialog_wait_send_crash_msg">請在發送完日誌後關閉該窗口</string>
|
||||
|
||||
<!-- List item long click -->
|
||||
@@ -65,6 +61,8 @@
|
||||
<string name="no_avatar">無頭像</string>
|
||||
<string name="get_avatar_error">獲取頭像失敗</string>
|
||||
<string name="image_search">圖像搜索</string>
|
||||
<string name="image_not_exist">圖像不存在</string>
|
||||
<string name="image_not_readable">圖像不可讀</string>
|
||||
|
||||
<!-- Update -->
|
||||
<string name="update_message" formatted="false">發現新版本:%s\n大小:%s\n%s\n\n是否更新?</string>
|
||||
@@ -89,6 +87,12 @@
|
||||
<string name="legacy_pages">%d 頁未下載</string>
|
||||
<string name="download_over">下載結束</string>
|
||||
<string name="start_download">開始下載</string>
|
||||
<string name="download_1">下載成功 %d</string>
|
||||
<string name="download_2">下載成功 %d 項</string>
|
||||
<string name="download_3">下載失敗 %d</string>
|
||||
<string name="download_4">下載失敗 %d 項</string>
|
||||
<string name="download_5" formatted="false">下載成功 %d, 下載失敗 %d</string>
|
||||
<string name="download_6" formatted="false">下載成功 %d 項, 下載失敗 %d 項</string>
|
||||
|
||||
<!-- ErrorMessage -->
|
||||
<string name="em_network_error">網絡錯誤</string>
|
||||
@@ -121,6 +125,9 @@
|
||||
<string name="em_index_error">索引錯誤</string>
|
||||
<string name="em_requst_null">請求內容爲空</string>
|
||||
|
||||
<!-- GalleryActivity -->
|
||||
<string name="ga_data_error">數據錯誤!</string>
|
||||
|
||||
<!-- Gallery -->
|
||||
<string name="gallery_tip">長按屏幕,可使下載從當前頁面開始。若該項正在下載,則僅優先加載當前頁面。</string>
|
||||
<string name="read_image_error">讀取圖片錯誤</string>
|
||||
@@ -194,6 +201,15 @@
|
||||
<string name="custom_codec_title">自定義解碼</string>
|
||||
<string name="custom_codec_summary">自定義解碼可能會更使用更少內存,解碼更快</string>
|
||||
<string name="custom_codec_summary_not">自定義解碼暫不支持 x86, mips</string>
|
||||
<string name="clean_redundancy_title">清理閱讀冗餘</string>
|
||||
<string name="no_redundancy">未發現冗餘</string>
|
||||
<string name="clean_redundancy">完成冗餘清理,共清理 %d 項</string>
|
||||
<string name="decode_format_title">解碼格式</string>
|
||||
<string name="decode_format_auto">自動</string>
|
||||
<string name="decode_format_gray">黑白</string>
|
||||
<string name="decode_format_gray_alpha">黑白(透明)</string>
|
||||
<string name="decode_format_rgb">彩色</string>
|
||||
<string name="decode_format_rgba">彩色(透明)</string>
|
||||
|
||||
<string name="download_settings_title">下載</string>
|
||||
<string name="download_path_title">下載路徑</string>
|
||||
@@ -210,9 +226,14 @@
|
||||
<string name="http_read_timeout_title">讀取超時 (ms)</string>
|
||||
<string name="eh_advanced_settings_title">EH</string>
|
||||
<string name="eh_min_interval_title">EH 站點最小連接間隔 (ms)</string>
|
||||
<string name="eh_others_settings_title">其他</string>
|
||||
<string name="fix_dirname_title">修正下載文件夾名</string>
|
||||
<string name="fix_dirname_title_summary">將下載文件夾名由 gid 改爲 gid-title,不進行修正不會影響使用</string>
|
||||
|
||||
<string name="about_settings_title">關於</string>
|
||||
<string name="author_title">作者</string>
|
||||
<string name="twitter_title">Twitter</string>
|
||||
<string name="twitter_summary">目前由 @jkjvinn 管理更新</string>
|
||||
<string name="changelog_title">日誌</string>
|
||||
<string name="thanks_title">感謝</string>
|
||||
<string name="website_title">網站</string>
|
||||
@@ -304,6 +325,8 @@
|
||||
<string name="rating0">…</string>
|
||||
|
||||
<!-- Utils -->
|
||||
<string name="warning">警告</string>
|
||||
<string name="close">關閉</string>
|
||||
<string name="select">選擇</string>
|
||||
<string name="click_more">點擊查看更多</string>
|
||||
<string name="similar_content">相似內容</string>
|
||||
|
||||
@@ -7,16 +7,14 @@
|
||||
<!-- Warning -->
|
||||
<string name="dailog_waring_title">警告</string>
|
||||
<string name="dailog_waring_plain">該應用內容來自網際網路,部分內容可能對您的生理及心理造成難以恢復的傷害。該應用作者不會對由該應用造成的後果負責。您是否願意繼續使用該應用?</string>
|
||||
<string name="dailog_waring_yes">我願意</string>
|
||||
<string name="dailog_waring_no">不!</string>
|
||||
|
||||
<!-- Analyics -->
|
||||
<string name="dailog_analyics_title">資料統計</string>
|
||||
<string name="dailog_analyics_plain">您是否願意將使用情況發送給開發者?這對開發者維護該應用有很大幫助。在發送使用情況的同時也會發送部分裝置資訊(譬如裝置型號、系統版本)。開發者承諾不收集任何個人身份資訊資料(譬如姓名、電話號碼、電郵地址)。\n\n資料收集過程採用 Google Analytics。\nGOOGLE ANALYTICS(分析)服務條款:http://www.google.com/analytics/terms/cn.html\nGoogle隱私權和條款:http://www.google.com/intl/zh-CN/policies\n\n您以後可以在設定中修改選擇</string>
|
||||
|
||||
<!-- Network -->
|
||||
<string name="dailog_network_error_yes">我不在意</string>
|
||||
<string name="dailog_network_error_no">成</string>
|
||||
<string name="dailog_network_mobile_title">您正在使用移動網路,可能會消耗大量的資費,是否繼續使用?</string>
|
||||
<string name="dailog_network_none_title">未檢測到網路連線,是否繼續使用?</string>
|
||||
|
||||
<!-- Exit -->
|
||||
<string name="exit_tip">再按一次退出</string>
|
||||
@@ -50,8 +48,6 @@
|
||||
<!-- Send Crash -->
|
||||
<string name="dialog_send_crash_title">這很重要</string>
|
||||
<string name="dialog_send_crash_plain">上次該應用崩潰了。你願意把錯誤日誌發送給開發者以便以後得到更好的使用者體驗麼?(以電子郵件的形式發送)</string>
|
||||
<string name="dialog_send_crash_yes">我願意</string>
|
||||
<string name="dialog_send_crash_no">門兒都沒有</string>
|
||||
<string name="dialog_wait_send_crash_msg">請在發送完日誌後關閉該視窗</string>
|
||||
|
||||
<!-- List item long click -->
|
||||
@@ -65,6 +61,8 @@
|
||||
<string name="no_avatar">無頭像</string>
|
||||
<string name="get_avatar_error">獲取頭像失敗</string>
|
||||
<string name="image_search">影象搜索</string>
|
||||
<string name="image_not_exist">影象不存在</string>
|
||||
<string name="image_not_readable">影象不可讀</string>
|
||||
|
||||
<!-- Update -->
|
||||
<string name="update_message" formatted="false">發現新版本:%s\n大小:%s\n%s\n\n是否更新?</string>
|
||||
@@ -89,6 +87,12 @@
|
||||
<string name="legacy_pages">%d 頁未下載</string>
|
||||
<string name="download_over">下載結束</string>
|
||||
<string name="start_download">開始下載</string>
|
||||
<string name="download_1">下載成功 %d</string>
|
||||
<string name="download_2">下載成功 %d 項</string>
|
||||
<string name="download_3">下載失敗 %d</string>
|
||||
<string name="download_4">下載失敗 %d 項</string>
|
||||
<string name="download_5" formatted="false">下載成功 %d, 下載失敗 %d</string>
|
||||
<string name="download_6" formatted="false">下載成功 %d 項, 下載失敗 %d 項</string>
|
||||
|
||||
<!-- ErrorMessage -->
|
||||
<string name="em_network_error">網路錯誤</string>
|
||||
@@ -121,6 +125,9 @@
|
||||
<string name="em_index_error">索引錯誤</string>
|
||||
<string name="em_requst_null">請求內容為空</string>
|
||||
|
||||
<!-- GalleryActivity -->
|
||||
<string name="ga_data_error">資料錯誤!</string>
|
||||
|
||||
<!-- Gallery -->
|
||||
<string name="gallery_tip">長按螢幕,可使下載從當前頁面開始。若該項正在下載,則僅優先載入當前頁面。</string>
|
||||
<string name="read_image_error">讀取圖片錯誤</string>
|
||||
@@ -194,6 +201,15 @@
|
||||
<string name="custom_codec_title">自定義解碼</string>
|
||||
<string name="custom_codec_summary">自定義解碼可能會更使用更少內存,解碼更快</string>
|
||||
<string name="custom_codec_summary_not">自定義解碼暫不支援 x86, mips</string>
|
||||
<string name="clean_redundancy_title">清理閱讀冗餘</string>
|
||||
<string name="no_redundancy">未發現冗餘</string>
|
||||
<string name="clean_redundancy">完成冗餘清理,共清理 %d 項</string>
|
||||
<string name="decode_format_title">解碼格式</string>
|
||||
<string name="decode_format_auto">自動</string>
|
||||
<string name="decode_format_gray">黑白</string>
|
||||
<string name="decode_format_gray_alpha">黑白(透明)</string>
|
||||
<string name="decode_format_rgb">彩色</string>
|
||||
<string name="decode_format_rgba">彩色(透明)</string>
|
||||
|
||||
<string name="download_settings_title">下載</string>
|
||||
<string name="download_path_title">下載路徑</string>
|
||||
@@ -210,9 +226,14 @@
|
||||
<string name="http_read_timeout_title">讀取超時 (ms)</string>
|
||||
<string name="eh_advanced_settings_title">EH</string>
|
||||
<string name="eh_min_interval_title">EH 站點最小連線間隔 (ms)</string>
|
||||
<string name="eh_others_settings_title">其他</string>
|
||||
<string name="fix_dirname_title">修正下載資料夾名</string>
|
||||
<string name="fix_dirname_title_summary">將下載資料夾名由 gid 改為 gid-title,不進行修正不會影響使用</string>
|
||||
|
||||
<string name="about_settings_title">關於</string>
|
||||
<string name="author_title">作者</string>
|
||||
<string name="twitter_title">Twitter</string>
|
||||
<string name="twitter_summary">目前由 @jkjvinn 管理更新</string>
|
||||
<string name="changelog_title">日誌</string>
|
||||
<string name="thanks_title">感謝</string>
|
||||
<string name="website_title">網站</string>
|
||||
@@ -304,6 +325,8 @@
|
||||
<string name="rating0">…</string>
|
||||
|
||||
<!-- Utils -->
|
||||
<string name="warning">警告</string>
|
||||
<string name="close">關閉</string>
|
||||
<string name="select">選擇</string>
|
||||
<string name="click_more">點選檢視更多</string>
|
||||
<string name="similar_content">相似內容</string>
|
||||
|
||||
+30
-7
@@ -20,17 +20,15 @@
|
||||
|
||||
<!-- Warning -->
|
||||
<string name="dailog_waring_title">Waring</string>
|
||||
<string name="dailog_waring_plain">该应用内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。该应用作者不会对由该应用造成的后果负责。您是否愿意继续使用该应用?</string>
|
||||
<string name="dailog_waring_yes">Yes, I would</string>
|
||||
<string name="dailog_waring_no">NO !</string>
|
||||
<string name="dailog_waring_plain">本应用中内容来自互联网,部分内容可能对您的生理及心理造成难以恢复的伤害。该应用作者不会对由本应用造成的后果负责。您是否愿意继续使用该应用?</string>
|
||||
|
||||
<!-- Analyics -->
|
||||
<string name="dailog_analyics_title">Usage statistics</string>
|
||||
<string name="dailog_analyics_plain">您是否愿意将使用情况发送给开发者?这对开发者维护该应用有很大帮助。在发送使用情况的同时也会发送部分设备信息(譬如设备型号、系统版本)。开发者承诺不收集任何个人身份信息数据(譬如姓名、电话号码、电邮地址)。\n\n数据收集过程采用 Google Analytics。\nGOOGLE ANALYTICS(分析)服务条款:http://www.google.com/analytics/terms/us.html\nGoogle隐私权和条款:http://www.google.com/intl/us/policies\n\n您以后可以在设置中修改选择</string>
|
||||
|
||||
<!-- Network -->
|
||||
<string name="dailog_network_error_yes">I don\'t care</string>
|
||||
<string name="dailog_network_error_no">Fine</string>
|
||||
<string name="dailog_network_mobile_title">You are using the mobile network, it may consume a large amount of charges, whether to continue to use ?</string>
|
||||
<string name="dailog_network_none_title">Does not detect a network connection, whether to continue to use ?</string>
|
||||
|
||||
<!-- Exit -->
|
||||
<string name="exit_tip">Click again to exit</string>
|
||||
@@ -65,8 +63,6 @@
|
||||
<!-- Send Crash -->
|
||||
<string name="dialog_send_crash_title">It is important</string>
|
||||
<string name="dialog_send_crash_plain">This application crashed last time. Would you mind to send logcat to the developer for a better user experience in future ? (via e-mail)</string>
|
||||
<string name="dialog_send_crash_yes">Never mind</string>
|
||||
<string name="dialog_send_crash_no">Yes, I would</string>
|
||||
<string name="dialog_wait_send_crash_msg">Please close the dialog after sending logcat</string>
|
||||
|
||||
<!-- List item long click -->
|
||||
@@ -80,6 +76,8 @@
|
||||
<string name="no_avatar">No avatar</string>
|
||||
<string name="get_avatar_error">Get avatar error</string>
|
||||
<string name="image_search">Image search</string>
|
||||
<string name="image_not_exist">Image does not exist</string>
|
||||
<string name="image_not_readable">Image is not readable</string>
|
||||
|
||||
<!-- Update -->
|
||||
<string name="update_message" formatted="false">Found new version : %s\nSize : %s\n%s\n\nUpdate ?</string>
|
||||
@@ -104,6 +102,12 @@
|
||||
<string name="legacy_pages">%d pages leaved</string>
|
||||
<string name="download_over">Download over</string>
|
||||
<string name="start_download">Start downloading</string>
|
||||
<string name="download_1">Download OK %d</string>
|
||||
<string name="download_2">Download OK %d items</string>
|
||||
<string name="download_3">Download failed %d</string>
|
||||
<string name="download_4">Download failed %d items</string>
|
||||
<string name="download_5" formatted="false">Download OK %d, Download failed %d</string>
|
||||
<string name="download_6" formatted="false">Download OK %d items, Download failed %d items</string>
|
||||
|
||||
<!-- ErrorMessage -->
|
||||
<string name="em_network_error">Network Error</string>
|
||||
@@ -136,6 +140,9 @@
|
||||
<string name="em_index_error">Index error</string>
|
||||
<string name="em_requst_null">Requst content is null</string>
|
||||
|
||||
<!-- GalleryActivity -->
|
||||
<string name="ga_data_error">Data Error !</string>
|
||||
|
||||
<!-- Gallery -->
|
||||
<string name="gallery_tip">Long press the screen to download from the current page. If the item is being downloaded, just load current page first.</string>
|
||||
<string name="read_image_error">Read image error</string>
|
||||
@@ -209,6 +216,15 @@
|
||||
<string name="custom_codec_title">Custom codec</string>
|
||||
<string name="custom_codec_summary">Custom codec may cost less memory, decode faster</string>
|
||||
<string name="custom_codec_summary_not">Custom codec do not support x86, mips</string>
|
||||
<string name="clean_redundancy_title">Clean redundancy</string>
|
||||
<string name="no_redundancy">No redundancy</string>
|
||||
<string name="clean_redundancy">Redundancy cleaning completed, clean-up %d items totally</string>
|
||||
<string name="decode_format_title">Decode format</string>
|
||||
<string name="decode_format_auto">Auto</string>
|
||||
<string name="decode_format_gray">Gray</string>
|
||||
<string name="decode_format_gray_alpha">Gray (alpha)</string>
|
||||
<string name="decode_format_rgb">RGB</string>
|
||||
<string name="decode_format_rgba">RGB (alpha)</string>
|
||||
|
||||
<string name="download_settings_title">Download</string>
|
||||
<string name="download_path_title">Download path</string>
|
||||
@@ -225,10 +241,15 @@
|
||||
<string name="http_read_timeout_title">Read timeout (ms)</string>
|
||||
<string name="eh_advanced_settings_title">EH</string>
|
||||
<string name="eh_min_interval_title">The minimum connection interval of EH site (ms)</string>
|
||||
<string name="eh_others_settings_title">Others</string>
|
||||
<string name="fix_dirname_title">Fix download folder name</string>
|
||||
<string name="fix_dirname_title_summary">Download folder name will be human readable. It is OK to leave me alone.</string>
|
||||
|
||||
<string name="about_settings_title">About</string>
|
||||
<string name="author_title">Author</string>
|
||||
<string name="author_summary" translatable="false">Hippo <ehviewersu@gmail.com></string>
|
||||
<string name="twitter_title">Twitter</string>
|
||||
<string name="twitter_summary">\@jkjvinn is in charge</string>
|
||||
<string name="changelog_title">Changelog</string>
|
||||
<string name="thanks_title">Thanks</string>
|
||||
<string name="website_title">Website</string>
|
||||
@@ -338,6 +359,8 @@
|
||||
<string name="rating0">DISASTER</string>
|
||||
|
||||
<!-- Util -->
|
||||
<string name="warning">Warning</string>
|
||||
<string name="close">Close</string>
|
||||
<string name="select">Select</string>
|
||||
<string name="click_more">Click for more</string>
|
||||
<string name="similar_content">Similar content</string>
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
android:title="@string/author_title"
|
||||
android:summary="@string/author_summary" />
|
||||
|
||||
<Preference
|
||||
android:key="twitter"
|
||||
android:title="@string/twitter_title"
|
||||
android:summary="@string/twitter_summary" />
|
||||
|
||||
<Preference
|
||||
android:key="changelog"
|
||||
android:title="@string/changelog_title" />
|
||||
|
||||
@@ -59,5 +59,14 @@
|
||||
android:defaultValue="0" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/eh_others_settings_title">
|
||||
|
||||
<Preference
|
||||
android:key="fix_dirname"
|
||||
android:title="@string/fix_dirname_title"
|
||||
android:summary="@string/fix_dirname_title_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
@@ -107,23 +107,14 @@ public class AppContext extends Application implements UncaughtExceptionHandler
|
||||
String[] list = downloadDir.list();
|
||||
if (list != null && list.length != 0) {
|
||||
for (String str : list) {
|
||||
// Change download dir name from gid-title to gid
|
||||
File oldDir = new File(downloadDir, str);
|
||||
if (!new File(oldDir, EhUtils.EH_DOWNLOAD_FILENAME).exists())
|
||||
continue;
|
||||
int index = str.indexOf('-');
|
||||
if (index == -1)
|
||||
continue;
|
||||
String gid = str.substring(0, index);
|
||||
File newDir = new File(downloadDir, gid);
|
||||
if (!oldDir.renameTo(newDir)) {
|
||||
// if delete error, might same gid and different title
|
||||
Utils.deleteDirInThread(oldDir);
|
||||
continue;
|
||||
}
|
||||
File gDir = new File(downloadDir, str);
|
||||
// Move download info file
|
||||
File oldInfoFile = new File(oldEdInfoDir, gid);
|
||||
File newInfoFile = new File(newDir, EhUtils.EH_DOWNLOAD_FILENAME);
|
||||
File newInfoFile = new File(gDir, EhUtils.EH_DOWNLOAD_FILENAME);
|
||||
try {
|
||||
FileOutputStream fos = new FileOutputStream(newInfoFile);
|
||||
// Add last page
|
||||
@@ -139,7 +130,6 @@ public class AppContext extends Application implements UncaughtExceptionHandler
|
||||
Utils.deleteDirInThread(oldEdInfoDir);
|
||||
}
|
||||
|
||||
|
||||
// Update version code
|
||||
try {
|
||||
PackageInfo pi= getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
|
||||
@@ -42,6 +42,10 @@ public class StartActivity extends Activity {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = StartActivity.class.getSimpleName();
|
||||
|
||||
private static final int NETWORK_STATE_NONE = 0x0;
|
||||
private static final int NETWORK_STATE_MOBILE = 0x1;
|
||||
private static final int NETWORK_STATE_WIFI = 0x2;
|
||||
|
||||
private static final int CHECK_WARING = 0;
|
||||
private static final int CHECK_ANALYTICS = 1;
|
||||
private static final int CHECK_NETWORK = 2;
|
||||
@@ -55,8 +59,8 @@ public class StartActivity extends Activity {
|
||||
return new MaterialAlertDialog.Builder(this).setCancelable(false)
|
||||
.setTitle(R.string.dailog_waring_title)
|
||||
.setMessage(R.string.dailog_waring_plain)
|
||||
.setPositiveButton(R.string.dailog_waring_yes)
|
||||
.setNegativeButton(R.string.dailog_waring_no)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
@@ -99,11 +103,22 @@ public class StartActivity extends Activity {
|
||||
}).create();
|
||||
}
|
||||
|
||||
private AlertDialog createNetworkErrorDialog() {
|
||||
private AlertDialog createNetworkDialog(int state) {
|
||||
int mesgId;
|
||||
switch (state) {
|
||||
case NETWORK_STATE_MOBILE:
|
||||
mesgId = R.string.dailog_network_mobile_title;
|
||||
break;
|
||||
case NETWORK_STATE_NONE:
|
||||
default:
|
||||
mesgId = R.string.dailog_network_none_title;
|
||||
break;
|
||||
}
|
||||
|
||||
return new MaterialAlertDialog.Builder(this).setCancelable(false)
|
||||
.setTitle(R.string.error).setMessage(R.string.em_no_network)
|
||||
.setPositiveButton(R.string.dailog_network_error_yes)
|
||||
.setNegativeButton(R.string.dailog_network_error_no)
|
||||
.setTitle(R.string.warning).setMessage(mesgId)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
@@ -124,28 +139,34 @@ public class StartActivity extends Activity {
|
||||
return new MaterialAlertDialog.Builder(this).setCancelable(false)
|
||||
.setTitle(R.string.dialog_send_crash_title)
|
||||
.setMessage(R.string.dialog_send_crash_plain)
|
||||
.setPositiveButton(R.string.dialog_send_crash_yes)
|
||||
.setNegativeButton(R.string.dialog_send_crash_no)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
switch (which) {
|
||||
case MaterialAlertDialog.POSITIVE:
|
||||
// A wait dialog
|
||||
new MaterialAlertDialog.Builder(StartActivity.this).setCancelable(false)
|
||||
new MaterialAlertDialog.Builder(StartActivity.this)
|
||||
.setCancelable(false)
|
||||
.setTitle(R.string.wait)
|
||||
.setMessage(R.string.dialog_wait_send_crash_msg)
|
||||
.setMessage(
|
||||
R.string.dialog_wait_send_crash_msg)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
checkOver();
|
||||
return true;
|
||||
}
|
||||
}).show();
|
||||
.setButtonListener(
|
||||
new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(
|
||||
MaterialAlertDialog dialog,
|
||||
int which) {
|
||||
checkOver();
|
||||
return true;
|
||||
}
|
||||
}).show();
|
||||
Intent i = new Intent(Intent.ACTION_SENDTO);
|
||||
i.setData(Uri.parse("mailto:ehviewersu@gmail.com"));
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, "I found a bug in EhViewer !");
|
||||
i.putExtra(Intent.EXTRA_SUBJECT,
|
||||
"I found a bug in EhViewer !");
|
||||
i.putExtra(Intent.EXTRA_TEXT, lastCrash);
|
||||
startActivity(i);
|
||||
lastCrash = null;
|
||||
@@ -166,13 +187,13 @@ public class StartActivity extends Activity {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
View wellcome = new View(this);
|
||||
wellcome.setBackgroundDrawable(getResources().getDrawable(R.drawable.welcome));
|
||||
wellcome.setBackgroundDrawable(getResources().getDrawable(
|
||||
R.drawable.welcome));
|
||||
setContentView(wellcome);
|
||||
|
||||
// For fullscreen
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
wellcome.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
wellcome.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
@@ -181,7 +202,7 @@ public class StartActivity extends Activity {
|
||||
}
|
||||
|
||||
// Show welcome in progress
|
||||
AlphaAnimation aa = new AlphaAnimation(0.3f,1.0f);
|
||||
AlphaAnimation aa = new AlphaAnimation(0.3f, 1.0f);
|
||||
aa.setDuration(2000);
|
||||
aa.setAnimationListener(new AnimationListener() {
|
||||
@Override
|
||||
@@ -190,22 +211,22 @@ public class StartActivity extends Activity {
|
||||
redirectTo();
|
||||
isAnimationOver = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
});
|
||||
wellcome.startAnimation(aa);
|
||||
check(CHECK_WARING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order is
|
||||
* 1. check waring
|
||||
* 2. check analyics
|
||||
* 3. check network
|
||||
* 4. check crash
|
||||
* 5. check external storage
|
||||
* Order is 1. check waring 2. check analyics 3. check network 4. check
|
||||
* crash 5. check external storage
|
||||
*
|
||||
* @param order
|
||||
*/
|
||||
@@ -223,8 +244,9 @@ public class StartActivity extends Activity {
|
||||
return;
|
||||
}
|
||||
case CHECK_NETWORK:
|
||||
if (!isNetworkAvailable()) {
|
||||
createNetworkErrorDialog().show();
|
||||
int state = getNetworkState();
|
||||
if (state != NETWORK_STATE_WIFI) {
|
||||
createNetworkDialog(state).show();
|
||||
return;
|
||||
}
|
||||
case CHECK_CRASH:
|
||||
@@ -242,16 +264,21 @@ public class StartActivity extends Activity {
|
||||
isCheckOver = true;
|
||||
}
|
||||
|
||||
private boolean isNetworkAvailable() {
|
||||
ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo mNetworkInfo = cm.getActiveNetworkInfo();
|
||||
if (mNetworkInfo == null || !mNetworkInfo.isAvailable())
|
||||
return false;
|
||||
private int getNetworkState() {
|
||||
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo mWifi = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||
NetworkInfo mMobile = cm
|
||||
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||
|
||||
if (mWifi != null && mWifi.isConnected())
|
||||
return NETWORK_STATE_WIFI;
|
||||
else if (mMobile != null && mMobile.isConnected())
|
||||
return NETWORK_STATE_MOBILE;
|
||||
else
|
||||
return true;
|
||||
return NETWORK_STATE_NONE;
|
||||
}
|
||||
|
||||
private void redirectTo(){
|
||||
private void redirectTo() {
|
||||
Intent intent = new Intent(this, GalleryListActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
@@ -33,7 +33,8 @@ import android.widget.TextView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class MaterialAlertDialog extends AlertDialog implements View.OnClickListener, AdapterView.OnItemClickListener {
|
||||
public class MaterialAlertDialog extends AlertDialog implements
|
||||
View.OnClickListener, AdapterView.OnItemClickListener {
|
||||
|
||||
public final static int ACTION = 0;
|
||||
public final static int POSITIVE = 1;
|
||||
@@ -52,7 +53,7 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
private Button mNeutralButton;
|
||||
|
||||
private MaterialAlertDialog(Builder builder) {
|
||||
//super(builder.mContext);
|
||||
// super(builder.mContext);
|
||||
super(new ContextThemeWrapper(builder.mContext, R.style.AppTheme_Main));
|
||||
mContext = builder.mContext;
|
||||
mBuilder = builder;
|
||||
@@ -78,14 +79,16 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
TextView message = null;
|
||||
ListView list = null;
|
||||
if (inScrollView) {
|
||||
mRootView.findViewById(R.id.top_panel_noscroll).setVisibility(View.GONE);
|
||||
mRootView.findViewById(R.id.top_panel_noscroll).setVisibility(
|
||||
View.GONE);
|
||||
mTitle = (TextView) mRootView.findViewById(R.id.title);
|
||||
topPanel = (LinearLayout) mRootView.findViewById(R.id.top_panel);
|
||||
message = (TextView) mRootView.findViewById(R.id.message);
|
||||
} else {
|
||||
mRootView.findViewById(R.id.scroll_view).setVisibility(View.GONE);
|
||||
mTitle = (TextView) mRootView.findViewById(R.id.title2);
|
||||
topPanel = (LinearLayout) mRootView.findViewById(R.id.top_panel_noscroll);
|
||||
topPanel = (LinearLayout) mRootView
|
||||
.findViewById(R.id.top_panel_noscroll);
|
||||
list = (ListView) mRootView.findViewById(R.id.list);
|
||||
}
|
||||
// Title
|
||||
@@ -96,8 +99,10 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
// Content
|
||||
if (mBuilder.mCustomView != null) {
|
||||
// CustomView
|
||||
if (message != null) message.setVisibility(View.GONE);
|
||||
if (list != null) list.setVisibility(View.GONE);
|
||||
if (message != null)
|
||||
message.setVisibility(View.GONE);
|
||||
if (list != null)
|
||||
list.setVisibility(View.GONE);
|
||||
LinearLayout.LayoutParams lp = mBuilder.mCustomLp;
|
||||
if (lp == null)
|
||||
lp = new LinearLayout.LayoutParams(
|
||||
@@ -107,7 +112,8 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
topPanel.addView(mBuilder.mCustomView, lp);
|
||||
} else if (mBuilder.mAdapter != null) {
|
||||
// List
|
||||
if (message != null) message.setVisibility(View.GONE);
|
||||
if (message != null)
|
||||
message.setVisibility(View.GONE);
|
||||
list.setAdapter(mBuilder.mAdapter);
|
||||
list.setOnItemClickListener(this);
|
||||
if (mBuilder.mIsSingleChoice) {
|
||||
@@ -119,7 +125,8 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
}
|
||||
} else {
|
||||
// Message
|
||||
if (list != null) list.setVisibility(View.GONE);
|
||||
if (list != null)
|
||||
list.setVisibility(View.GONE);
|
||||
if (mBuilder.mAutoLinkMask != -1)
|
||||
message.setAutoLinkMask(mBuilder.mAutoLinkMask);
|
||||
message.setText(mBuilder.mMessage);
|
||||
@@ -222,7 +229,6 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
public static interface OnClickListener {
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which);
|
||||
}
|
||||
@@ -314,13 +320,29 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom view id will be R.id.custom
|
||||
*
|
||||
* @param view
|
||||
* @param inScrollView
|
||||
* @return
|
||||
*/
|
||||
public Builder setView(View view, boolean inScrollView) {
|
||||
mCustomView = view;
|
||||
mInScrollView = inScrollView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setView(View view, boolean inScrollView, LinearLayout.LayoutParams lp) {
|
||||
/**
|
||||
* Custom view id will be R.id.custom
|
||||
*
|
||||
* @param view
|
||||
* @param inScrollView
|
||||
* @param lp
|
||||
* @return
|
||||
*/
|
||||
public Builder setView(View view, boolean inScrollView,
|
||||
LinearLayout.LayoutParams lp) {
|
||||
mCustomView = view;
|
||||
mInScrollView = inScrollView;
|
||||
mCustomLp = lp;
|
||||
@@ -339,14 +361,15 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
|
||||
public Builder setItems(int itemsId, final OnClickListener listener) {
|
||||
mAdapter = new ArrayAdapter<CharSequence>(mContext,
|
||||
R.layout.select_dialog_item, android.R.id.text1,
|
||||
mContext.getResources().getTextArray(itemsId));
|
||||
R.layout.select_dialog_item, android.R.id.text1, mContext
|
||||
.getResources().getTextArray(itemsId));
|
||||
mOnClickListener = listener;
|
||||
mIsSingleChoice = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setItems(CharSequence[] items, final OnClickListener listener) {
|
||||
public Builder setItems(CharSequence[] items,
|
||||
final OnClickListener listener) {
|
||||
mAdapter = new ArrayAdapter<CharSequence>(mContext,
|
||||
R.layout.select_dialog_item, android.R.id.text1, items);
|
||||
mOnClickListener = listener;
|
||||
@@ -354,7 +377,8 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAdapter(final ListAdapter adapter, final OnClickListener listener) {
|
||||
public Builder setAdapter(final ListAdapter adapter,
|
||||
final OnClickListener listener) {
|
||||
mAdapter = adapter;
|
||||
mOnClickListener = listener;
|
||||
mIsSingleChoice = false;
|
||||
@@ -372,16 +396,19 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSingleChoiceItems(CharSequence[] items, int checkedItem, final OnClickListener listener) {
|
||||
public Builder setSingleChoiceItems(CharSequence[] items,
|
||||
int checkedItem, final OnClickListener listener) {
|
||||
mAdapter = new ArrayAdapter<CharSequence>(mContext,
|
||||
R.layout.select_dialog_singlechoice, android.R.id.text1, items);
|
||||
R.layout.select_dialog_singlechoice, android.R.id.text1,
|
||||
items);
|
||||
mOnClickListener = listener;
|
||||
mCheckedItem = checkedItem;
|
||||
mIsSingleChoice = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setSingleChoiceItems(ListAdapter adapter, int checkedItem, final OnClickListener listener) {
|
||||
public Builder setSingleChoiceItems(ListAdapter adapter,
|
||||
int checkedItem, final OnClickListener listener) {
|
||||
mAdapter = adapter;
|
||||
mOnClickListener = listener;
|
||||
mCheckedItem = checkedItem;
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.hippo.ehviewer.data.Comment;
|
||||
import com.hippo.ehviewer.data.LargePreviewList;
|
||||
import com.hippo.ehviewer.data.NormalPreviewList;
|
||||
import com.hippo.ehviewer.data.PreviewList;
|
||||
import com.hippo.ehviewer.util.EhUtils;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
|
||||
public class DetailParser {
|
||||
@@ -153,7 +154,7 @@ public class DetailParser {
|
||||
thumb = Utils.unescapeXml(m.group(1));
|
||||
title = Utils.unescapeXml(m.group(2));
|
||||
title_jpn = Utils.unescapeXml(m.group(3));
|
||||
category = EhClient.getType(m.group(4));
|
||||
category = EhUtils.getCategory(m.group(4));
|
||||
uploader = m.group(5);
|
||||
posted = m.group(6);
|
||||
pages = Integer.parseInt(m.group(7));
|
||||
|
||||
@@ -36,15 +36,17 @@ import android.os.Process;
|
||||
import com.hippo.ehviewer.Analytics;
|
||||
import com.hippo.ehviewer.AppHandler;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.data.ApiGalleryInfo;
|
||||
import com.hippo.ehviewer.data.Comment;
|
||||
import com.hippo.ehviewer.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.data.GalleryPopular;
|
||||
import com.hippo.ehviewer.data.ListUrls;
|
||||
import com.hippo.ehviewer.data.LofiGalleryDetail;
|
||||
import com.hippo.ehviewer.data.PreviewList;
|
||||
import com.hippo.ehviewer.network.HttpHelper;
|
||||
import com.hippo.ehviewer.util.BgThread;
|
||||
import com.hippo.ehviewer.util.Config;
|
||||
import com.hippo.ehviewer.util.EhUtils;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
|
||||
public class EhClient {
|
||||
@@ -885,7 +887,7 @@ public class EhClient {
|
||||
|
||||
public void comment(final String detailUrl, final String comment,
|
||||
final OnCommentListener listener) {
|
||||
new Thread(new Runnable() {
|
||||
new BgThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HttpHelper hp = new HttpHelper(mContext);
|
||||
@@ -1090,56 +1092,6 @@ public class EhClient {
|
||||
}).start();
|
||||
}
|
||||
|
||||
private static final int[] CATEGORY_VALUES = {
|
||||
ListUrls.MISC,
|
||||
ListUrls.DOUJINSHI,
|
||||
ListUrls.MANGA,
|
||||
ListUrls.ARTIST_CG,
|
||||
ListUrls.GAME_CG,
|
||||
ListUrls.IMAGE_SET,
|
||||
ListUrls.COSPLAY,
|
||||
ListUrls.ASIAN_PORN,
|
||||
ListUrls.NON_H,
|
||||
ListUrls.WESTERN,
|
||||
ListUrls.UNKNOWN
|
||||
};
|
||||
|
||||
// TODO How about "Private"
|
||||
private static final String[][] CATEGORY_STRINGS = {
|
||||
new String[]{"misc"},
|
||||
new String[]{"doujinshi"},
|
||||
new String[]{"manga"},
|
||||
new String[]{"artistcg", "Artist CG Sets"},
|
||||
new String[]{"gamecg", "Game CG Sets"},
|
||||
new String[]{"imageset", "Image Sets"},
|
||||
new String[]{"cosplay"},
|
||||
new String[]{"asianporn", "Asian Porn"},
|
||||
new String[]{"non-h"},
|
||||
new String[]{"western"},
|
||||
new String[]{"unknown"}
|
||||
};
|
||||
|
||||
public static int getType(String type) {
|
||||
int i;
|
||||
for (i = 0; i < CATEGORY_STRINGS.length - 1; i++) {
|
||||
for (String str : CATEGORY_STRINGS[i])
|
||||
if (str.equalsIgnoreCase(type))
|
||||
return CATEGORY_VALUES[i];
|
||||
}
|
||||
|
||||
return CATEGORY_VALUES[i];
|
||||
}
|
||||
|
||||
public static String getType(int type) {
|
||||
int i;
|
||||
for (i = 0; i < CATEGORY_VALUES.length - 1; i++) {
|
||||
if (CATEGORY_VALUES[i] == type)
|
||||
break;
|
||||
}
|
||||
return CATEGORY_STRINGS[i][0];
|
||||
}
|
||||
|
||||
|
||||
// modifyFavorite
|
||||
public interface OnModifyFavoriteListener {
|
||||
void onSuccess(List<GalleryInfo> gis, int pageNum);
|
||||
@@ -1173,7 +1125,7 @@ public class EhClient {
|
||||
*/
|
||||
public void modifyFavorite(final int[] gids, final int dstCat, final int srcCat,
|
||||
final OnModifyFavoriteListener listener) {
|
||||
new Thread(new Runnable() {
|
||||
new BgThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int i;
|
||||
@@ -1231,7 +1183,7 @@ public class EhClient {
|
||||
listener.onFailure(e.getMessage());
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
new BgThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
HttpHelper hp = new HttpHelper(mContext);
|
||||
@@ -1262,7 +1214,7 @@ public class EhClient {
|
||||
gi.title = Utils.unescapeXml(j.getString("title"));
|
||||
gi.posted = Utils.sDate.format(Long.parseLong(j.getString("posted")) * 1000);
|
||||
gi.thumb = j.getString("thumb");
|
||||
gi.category = getType(j.getString("category"));
|
||||
gi.category = EhUtils.getCategory(j.getString("category"));
|
||||
gi.uploader = j.getString("uploader");
|
||||
gi.rating = Float.parseFloat(j.getString("rating"));
|
||||
gi.generateSLang();
|
||||
@@ -1290,183 +1242,163 @@ public class EhClient {
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private static class GetGalleryMetadataPackage {
|
||||
public Map<String, ListMangaDetail> lmds;
|
||||
public OnGetGalleryMetadataListener listener;
|
||||
|
||||
public GetGalleryMetadataPackage(Map<String, ListMangaDetail> lmds,
|
||||
OnGetGalleryMetadataListener listener) {
|
||||
this.lmds = lmds;
|
||||
this.listener = listener;
|
||||
}
|
||||
public interface OnGetApiGalleryInfoListener {
|
||||
public void onSuccess(Object checkFlag, ApiGalleryInfo[] agiArray);
|
||||
public void onFailure(Object checkFlag, String eMsg);
|
||||
}
|
||||
|
||||
private static Handler getGalleryMetadataHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
OnGetGalleryMetadataListener listener =
|
||||
((GetGalleryMetadataPackage) msg.obj).listener;
|
||||
Map<String, ListMangaDetail> lmds =
|
||||
((GetGalleryMetadataPackage) msg.obj).lmds;
|
||||
if (lmds == null || lmds.size() == 0)
|
||||
listener.onFailure(msg.what);
|
||||
else
|
||||
listener.onSuccess(lmds);
|
||||
};
|
||||
};
|
||||
private class GetApiGalleryInfoResponder implements Runnable {
|
||||
private final boolean isOk;
|
||||
private final OnGetApiGalleryInfoListener listener;
|
||||
private final Object checkFlag;
|
||||
private final ApiGalleryInfo[] agiArray;
|
||||
private final String eMesg;
|
||||
|
||||
private static class GetGalleryMetadataRunnable implements Runnable {
|
||||
private String[][] gidTokens;
|
||||
private OnGetGalleryMetadataListener listener;
|
||||
|
||||
public GetGalleryMetadataRunnable(String[][] gidTokens,
|
||||
OnGetGalleryMetadataListener listener) {
|
||||
this.gidTokens = gidTokens;
|
||||
public GetApiGalleryInfoResponder(OnGetApiGalleryInfoListener listener,
|
||||
Object checkFlag, ApiGalleryInfo[] agiArray) {
|
||||
this.isOk = true;
|
||||
this.listener = listener;
|
||||
this.checkFlag = checkFlag;
|
||||
this.agiArray = agiArray;
|
||||
this.eMesg = null;
|
||||
}
|
||||
|
||||
public GetApiGalleryInfoResponder(OnGetApiGalleryInfoListener listener,
|
||||
Object checkFlag, String eMsg) {
|
||||
this.isOk = false;
|
||||
this.listener = listener;
|
||||
this.checkFlag = checkFlag;
|
||||
this.agiArray = null;
|
||||
this.eMesg = eMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int errorMessageId = R.string.em_unknown_error;
|
||||
Map<String, ListMangaDetail> lmds = new HashMap<String, ListMangaDetail>();
|
||||
if (isOk)
|
||||
listener.onSuccess(checkFlag, agiArray);
|
||||
else
|
||||
listener.onFailure(checkFlag, eMesg);
|
||||
}
|
||||
}
|
||||
|
||||
// Create post string
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
strBuf.append("{\"method\": \"gdata\",\"gidlist\": [");
|
||||
for (String[] item: gidTokens)
|
||||
strBuf.append("[" + item[0] + ",\"" + item[1] + "\"],");
|
||||
strBuf.delete(strBuf.length()-1, strBuf.length());
|
||||
strBuf.append("]}");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
errorMessageId = postJson(API_URL, strBuf.toString(),sb);
|
||||
if (sb.length() != 0) {
|
||||
String pageContent = sb.toString();
|
||||
private ApiGalleryInfo Json2Agi(JSONObject js) throws JSONException {
|
||||
ApiGalleryInfo agi = new ApiGalleryInfo();
|
||||
agi.gid = js.getInt("gid");
|
||||
agi.token = js.getString("token");
|
||||
agi.archiver_key = js.getString("archiver_key");
|
||||
agi.title = js.getString("title");
|
||||
agi.title_jpn = js.getString("title_jpn");
|
||||
agi.category = EhUtils.getCategory(js.getString("category"));
|
||||
agi.thumb = js.getString("thumb");
|
||||
agi.uploader = js.getString("uploader");
|
||||
agi.posted = Utils.sDate.format(Long.parseLong(js.getString("posted")) * 1000);
|
||||
agi.filecount = js.getString("filecount");
|
||||
agi.filesize = js.getLong("filesize");
|
||||
agi.expunged = js.getBoolean("expunged");
|
||||
agi.rating = Float.parseFloat(js.getString("rating"));
|
||||
agi.torrentcount = js.getString("torrentcount");
|
||||
JSONArray tags = js.getJSONArray("tags");
|
||||
agi.apiTags = new String[tags.length()];
|
||||
for (int j = 0; j < tags.length(); j++)
|
||||
agi.apiTags[j] = tags.getString(j);
|
||||
return agi;
|
||||
}
|
||||
|
||||
public void getApiGalleryInfo(final Object checkFlag, final int[] gids, final String[] tokens, final OnGetApiGalleryInfoListener l) {
|
||||
new BgThread() {
|
||||
@Override
|
||||
public void run() {
|
||||
GetApiGalleryInfoResponder responder;
|
||||
ApiGalleryInfo[] agiArray;
|
||||
int requstLen;
|
||||
// Create json
|
||||
JSONObject json = new JSONObject();
|
||||
try {
|
||||
SimpleDateFormat fm = new SimpleDateFormat("yyyy-MM-dd hh:mm");
|
||||
JSONObject jsonObject = new JSONObject(pageContent);
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("gmetadata");
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject jo = jsonArray.getJSONObject(i);
|
||||
if (jo.getString("error") != null)
|
||||
continue;
|
||||
ListMangaDetail lmd = new ListMangaDetail();
|
||||
lmd.gid = Long.toString(jo.getLong("gid"));
|
||||
lmd.token = jo.getString("token");
|
||||
lmd.archiver_key = jo.getString("archiver_key");
|
||||
lmd.title = jo.getString("title");
|
||||
lmd.title_jpn = jo.getString("title_jpn");
|
||||
lmd.category = getType(jo.getString("category"));
|
||||
lmd.thumb = jo.getString("thumb");
|
||||
lmd.uploader = jo.getString("uploader");
|
||||
lmd.posted = fm.format(Long.parseLong(jo.getString("posted")) * 1000);
|
||||
lmd.filecount = jo.getString("filecount");
|
||||
lmd.filesize = jo.getLong("filesize");
|
||||
lmd.expunged = jo.getBoolean("expunged");
|
||||
lmd.rating = jo.getString("rating");
|
||||
lmd.torrentcount = jo.getString("torrentcount");
|
||||
JSONArray ja = jo.getJSONArray("tags");
|
||||
int length = ja.length();
|
||||
lmd.tags = new String[1][length+1];
|
||||
lmd.tags[0][0] = "all";
|
||||
for (int j = 1; j < length+1; j++)
|
||||
lmd.tags[0][j] = ja.getString(j);
|
||||
|
||||
lmds.put(lmd.gid, lmd);
|
||||
json.put("method", "gdata");
|
||||
JSONArray jsonA = new JSONArray();
|
||||
requstLen = Math.min(gids.length, tokens.length);
|
||||
agiArray = new ApiGalleryInfo[requstLen];
|
||||
for (int i = 0; i < requstLen; i++) {
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(gids[i]);
|
||||
ja.put(tokens[i]);
|
||||
jsonA.put(ja);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
errorMessageId = R.string.em_parser_error;
|
||||
json.put("gidlist", jsonA);
|
||||
} catch (Throwable e) {
|
||||
responder = new GetApiGalleryInfoResponder(l, null, "Create json error");
|
||||
mHandler.post(responder);
|
||||
return;
|
||||
}
|
||||
// Post
|
||||
HttpHelper hh = new HttpHelper(mContext);
|
||||
String body = hh.postJson(getApiUrl(), json);
|
||||
if (body != null) {
|
||||
try {
|
||||
json = new JSONObject(body);
|
||||
JSONArray jsonA = (JSONArray) json.get("gmetadata");
|
||||
for (int i = 0; i < jsonA.length(); i++) {
|
||||
ApiGalleryInfo agi = Json2Agi(jsonA.getJSONObject(i));
|
||||
// Add to agiArray
|
||||
for (int j = 0; j < requstLen; j++) {
|
||||
if (agi.gid == gids[j])
|
||||
agiArray[j] = agi;
|
||||
}
|
||||
}
|
||||
responder = new GetApiGalleryInfoResponder(l, checkFlag, agiArray);
|
||||
} catch (Throwable e) {
|
||||
responder = new GetApiGalleryInfoResponder(l, checkFlag, "Json error");
|
||||
}
|
||||
} else {
|
||||
responder = new GetApiGalleryInfoResponder(l, checkFlag, hh.getEMsg());
|
||||
}
|
||||
mHandler.post(responder);
|
||||
}
|
||||
Message msg = new Message();
|
||||
msg.what = errorMessageId;
|
||||
msg.obj = new GetGalleryMetadataPackage(lmds, listener);
|
||||
getGalleryMetadataHandler.sendMessage(msg);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
public static void getGalleryMetadata(String[][] gidTokens,
|
||||
OnGetGalleryMetadataListener listener) {
|
||||
new Thread(new GetGalleryMetadataRunnable(gidTokens,
|
||||
listener)).start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class GetGalleryTokensPackage {
|
||||
public Map<String, String> tokens;
|
||||
public OnGetGalleryTokensListener listener;
|
||||
|
||||
public GetGalleryTokensPackage(Map<String, String> tokens,
|
||||
OnGetGalleryTokensListener listener) {
|
||||
this.tokens = tokens;
|
||||
this.listener = listener;
|
||||
public ApiGalleryInfo[] getApiGalleryInfo(int[] gids, String[] tokens) {
|
||||
ApiGalleryInfo[] agiArray;
|
||||
int requstLen;
|
||||
// Create json
|
||||
JSONObject json = new JSONObject();
|
||||
try {
|
||||
json.put("method", "gdata");
|
||||
JSONArray jsonA = new JSONArray();
|
||||
requstLen = Math.min(gids.length, tokens.length);
|
||||
agiArray = new ApiGalleryInfo[requstLen];
|
||||
for (int i = 0; i < requstLen; i++) {
|
||||
JSONArray ja = new JSONArray();
|
||||
ja.put(gids[i]);
|
||||
ja.put(tokens[i]);
|
||||
jsonA.put(ja);
|
||||
}
|
||||
json.put("gidlist", jsonA);
|
||||
} catch (Throwable e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Handler getGalleryTokensHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
OnGetGalleryTokensListener listener =
|
||||
((GetGalleryTokensPackage) msg.obj).listener;
|
||||
Map<String, String> tokens =
|
||||
((GetGalleryTokensPackage) msg.obj).tokens;
|
||||
if (tokens == null || tokens.size() == 0)
|
||||
listener.onFailure(msg.what);
|
||||
else
|
||||
listener.onSuccess(tokens);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
private static class GetGalleryTokensRunnable implements Runnable {
|
||||
private String gid;
|
||||
private String token;
|
||||
private String[] pages;
|
||||
private OnGetGalleryMetadataListener listener;
|
||||
|
||||
public GetGalleryTokensRunnable(String gid, String token, String[] pages,
|
||||
OnGetGalleryMetadataListener listener) {
|
||||
this.gid = gid;
|
||||
this.token = token;
|
||||
this.pages = pages;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int errorMessageId = R.string.em_unknown_error;
|
||||
Map<String, String> tokens = new HashMap<String, String>();
|
||||
|
||||
// Create post string
|
||||
StringBuffer strBuf = new StringBuffer();
|
||||
strBuf.append("{\"method\": \"gtoken\",\"pagelist\": [");
|
||||
for (String item: pages)
|
||||
strBuf.append("[" + gid + ",\"" + token + "\"," + item + "],");
|
||||
strBuf.delete(strBuf.length()-1, strBuf.length());
|
||||
strBuf.append("]}");
|
||||
|
||||
Log.i(TAG, strBuf.toString());
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
errorMessageId = postJson(API_URL, strBuf.toString(),sb);
|
||||
if (sb.length() != 0) {
|
||||
String pageContent = sb.toString();
|
||||
Log.d(TAG, pageContent);
|
||||
// Post api
|
||||
HttpHelper hh = new HttpHelper(mContext);
|
||||
String body = hh.postJson(getApiUrl(), json);
|
||||
if (body == null) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
json = new JSONObject(body);
|
||||
JSONArray jsonA = (JSONArray) json.get("gmetadata");
|
||||
for (int i = 0; i < jsonA.length(); i++) {
|
||||
ApiGalleryInfo agi = Json2Agi(jsonA.getJSONObject(i));
|
||||
// Add to agiArray
|
||||
for (int j = 0; j < requstLen; j++) {
|
||||
if (agi.gid == gids[j])
|
||||
agiArray[j] = agi;
|
||||
}
|
||||
}
|
||||
return agiArray;
|
||||
} catch (Throwable e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
private static void getGalleryTokens(String gid, String token, String[] pages,
|
||||
OnGetGalleryMetadataListener listener) {
|
||||
new Thread(new GetGalleryTokensRunnable(gid, token, pages,
|
||||
listener)).start();
|
||||
}*/
|
||||
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class ExDownloader implements Runnable {
|
||||
mControlorArray = new HttpHelper.DownloadControlor[mWorkerNum];
|
||||
|
||||
// Make sure dir
|
||||
mDir = EhUtils.getGalleryDir(mGid);
|
||||
mDir = EhUtils.getGalleryDir(mGid, mTitle);
|
||||
Utils.ensureDir(mDir, true);
|
||||
}
|
||||
|
||||
@@ -427,9 +427,9 @@ public class ExDownloader implements Runnable {
|
||||
} catch (Throwable e) {}
|
||||
}
|
||||
|
||||
public static int readCurReadIndex(int gid) {
|
||||
public static int readCurReadIndex(int gid, String title) {
|
||||
try {
|
||||
RandomAccessFile raf = new RandomAccessFile(new File(EhUtils.getGalleryDir(gid),
|
||||
RandomAccessFile raf = new RandomAccessFile(new File(EhUtils.getGalleryDir(gid, title),
|
||||
EhUtils.EH_DOWNLOAD_FILENAME), "r");
|
||||
int index = Integer.parseInt(raf.readLine(), 16);
|
||||
raf.close();
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.data.LofiGalleryInfo;
|
||||
import com.hippo.ehviewer.util.EhUtils;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
|
||||
public class ListParser {
|
||||
@@ -84,7 +85,7 @@ public class ListParser {
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
lgi.category = EhClient.getType(m.group(5));
|
||||
lgi.category = EhUtils.getCategory(m.group(5));
|
||||
String tags = m.group(6);
|
||||
if (tags.equals("-"))
|
||||
lgi.lofiTags = null;
|
||||
@@ -147,7 +148,7 @@ public class ListParser {
|
||||
while (m.find()) {
|
||||
GalleryInfo gi = new GalleryInfo();
|
||||
|
||||
gi.category = EhClient.getType(m.group(1));
|
||||
gi.category = EhUtils.getCategory(m.group(1));
|
||||
gi.posted = m.group(2);
|
||||
if (m.group(3) == null) {
|
||||
gi.thumb = Utils.unescapeXml("http://"
|
||||
|
||||
@@ -94,6 +94,7 @@ public class GalleryView extends GLView
|
||||
private static final float MILLSEC_PER_DIX = 0.2f;
|
||||
private static final float CHANGE_PAGE_PROPORTION = 0.1f;
|
||||
private static final float SLIDE_SENSITIVITY = 0;
|
||||
private static final float BORDER_TIP_SENSITIVITY = Ui.dp2pix(48);
|
||||
|
||||
private static final int ANIMATE_MIN = 200;
|
||||
|
||||
@@ -1157,38 +1158,40 @@ public class GalleryView extends GLView
|
||||
case SCROLL_ANIME_RIGHT:
|
||||
return false;
|
||||
case SCROLL_NONE:
|
||||
boolean changePage = false;
|
||||
// If it is true, page will move
|
||||
boolean movePage = false;
|
||||
Rect rect = curShowItem.mRect;
|
||||
|
||||
// Check change page or not
|
||||
if (curShowItem == null || !(curShowItem instanceof BasicItem))
|
||||
changePage = true;
|
||||
else{
|
||||
if ( Math.abs(totalX/totalY) > 1 && ((totalX > SLIDE_SENSITIVITY && dx < 0 && rect.left >= 0)
|
||||
|| (totalX < -SLIDE_SENSITIVITY && dx > 0 && rect.right <= mScreenWidth)))
|
||||
changePage = true;
|
||||
// If show item is null or TextItem, just move
|
||||
// Check finger move left or right
|
||||
// Check min sensitivity
|
||||
if (curShowItem == null || !(curShowItem instanceof BasicItem) ||
|
||||
(Math.abs(totalX/totalY) > 1 && ((totalX > SLIDE_SENSITIVITY && dx < 0 && rect.left >= 0)
|
||||
|| (totalX < -SLIDE_SENSITIVITY && dx > 0 && rect.right <= mScreenWidth)))) {
|
||||
movePage = true;
|
||||
}
|
||||
if (changePage) { // If change page
|
||||
if (movePage) { // If change page
|
||||
if (dx < 0) { // Go to left
|
||||
if (!isFirstPage()) { // Not first page
|
||||
scrollXOffset = 0;
|
||||
mScrollState = SCROLL_LEFT;
|
||||
// Prepare previous show item
|
||||
resetSizePosition(PRE_TARGET_INDEX);
|
||||
} else {
|
||||
changePage = false;
|
||||
movePage = false;
|
||||
}
|
||||
}
|
||||
else { // Go to righ
|
||||
} else { // Go to righ
|
||||
if (!isLastPage()) { // Not last page
|
||||
scrollXOffset = 0;
|
||||
mScrollState = SCROLL_RIGHT;
|
||||
// Prepare next show item
|
||||
resetSizePosition(NEXT_TARGET_INDEX);
|
||||
} else {
|
||||
changePage = false;
|
||||
movePage = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!changePage){ // Move cur image
|
||||
if (!movePage) { // Move cur image
|
||||
int actDx = -(int)dx;
|
||||
int actDy = -(int)dy;
|
||||
if (rect.width() <= mScreenWidth)
|
||||
@@ -1224,7 +1227,7 @@ public class GalleryView extends GLView
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrollEnd() {
|
||||
public boolean onScrollEnd(float totalX, float totalY) {
|
||||
|
||||
if (isScale)
|
||||
return false;
|
||||
@@ -1264,7 +1267,7 @@ public class GalleryView extends GLView
|
||||
break;
|
||||
case SCROLL_NONE:
|
||||
ShowItem showItem = showItems[CUR_TARGET_INDEX];
|
||||
if (showItem != null) {
|
||||
if (showItem != null && Math.abs(totalX) - BORDER_TIP_SENSITIVITY > 0) {
|
||||
if (isFirstPage() && showItem.mRect.left >= 0)
|
||||
MaterialToast.showToast(mContext.getString(R.string.first_page));
|
||||
else if (isLastPage() && showItem.mRect.right <= mScreenWidth)
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ImageSet implements ExDownloader.ListenerForImageSet {
|
||||
|
||||
public ImageSet(int gid, String token, String title, int startIndex) {
|
||||
|
||||
mDir = EhUtils.getGalleryDir(gid);
|
||||
mDir = EhUtils.getGalleryDir(gid, title);
|
||||
Utils.ensureDir(mDir, true);
|
||||
|
||||
// Init ExDownloader
|
||||
|
||||
@@ -35,7 +35,7 @@ public class GestureRecognizer {
|
||||
void onLongPress(MotionEvent e);
|
||||
boolean onScrollBegin(float dx, float dy, float totalX, float totalY);
|
||||
boolean onScroll(float dx, float dy, float totalX, float totalY);
|
||||
boolean onScrollEnd();
|
||||
boolean onScrollEnd(float totalX, float totalY);
|
||||
boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);
|
||||
boolean onScaleBegin(float focusX, float focusY);
|
||||
boolean onScale(float focusX, float focusY, float scale);
|
||||
@@ -149,9 +149,13 @@ public class GestureRecognizer {
|
||||
}
|
||||
|
||||
private class MyDownUpListener implements DownUpDetector.DownUpListener {
|
||||
|
||||
private float mFirstX;
|
||||
private float mFirstY;
|
||||
|
||||
@Override
|
||||
public void onDown(MotionEvent e) {
|
||||
mListener.onDown(e.getX(), e.getY());
|
||||
mListener.onDown(mFirstX = e.getX(), mFirstY = e.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +163,7 @@ public class GestureRecognizer {
|
||||
mListener.onUp();
|
||||
if (mStillScroll) {
|
||||
mStillScroll = false;
|
||||
mListener.onScrollEnd();
|
||||
mListener.onScrollEnd(e.getX() - mFirstX, e.getY() - mFirstY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ public class EditTextPreference extends DialogPreference {
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
EditText et = new EditText(getContext());
|
||||
et.setId(R.id.edittextpreference_edittext);
|
||||
et.setTextColor(getContext().getResources().getColor(R.color.secondary_text_dark));
|
||||
et.setTextColor(getContext().getResources().getColor(
|
||||
R.color.secondary_text_dark));
|
||||
return et;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,10 @@ public class EditTextPreference extends DialogPreference {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) {
|
||||
setSummary(restorePersistedValue ? getPersistedString((String) defaultValue) : (String) defaultValue);
|
||||
protected void onSetInitialValue(boolean restorePersistedValue,
|
||||
Object defaultValue) {
|
||||
setSummary(restorePersistedValue ? getPersistedString((String) defaultValue)
|
||||
: (String) defaultValue);
|
||||
if (!restorePersistedValue)
|
||||
persistString((String) defaultValue);
|
||||
}
|
||||
@@ -74,7 +76,8 @@ public class EditTextPreference extends DialogPreference {
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
super.onClick(dialog, which);
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
String value = ((EditText) dialog.findViewById(R.id.edittextpreference_edittext)).getText().toString();
|
||||
String value = ((EditText) dialog.findViewById(R.id.custom))
|
||||
.getText().toString();
|
||||
if (callChangeListener(value)) {
|
||||
persistString(value);
|
||||
setSummary(value);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.hippo.ehviewer.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
@@ -39,11 +42,14 @@ public class DownloadService extends Service
|
||||
implements ExDownloader.ListenerForDownload {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = DownloadService.class.getSimpleName();
|
||||
private static final int DOWNLOAD_NOTIFY_ID = -1;
|
||||
private static final int DOWNLOADING_NOTIFY_ID = -1;
|
||||
private static final int DOWNLOAD_NOTIFY_ID = -2;
|
||||
//private static final int DOWNLOAD_FAILED_NOTIFY_ID = -3;
|
||||
|
||||
public static final String ACTION_UPDATE = "com.hippo.ehviewer.service.DownloadService.UPDATE";
|
||||
public static final String ACTION_STOP = "com.hippo.ehviewer.service.DownloadService.STOP";
|
||||
public static final String ACTION_STOP_ALL = "com.hippo.ehviewer.service.DownloadService.STOP_ALL";
|
||||
public static final String ACTION_CLEAR = "com.hippo.ehviewer.service.DownloadService.ACTION_CLEAR";
|
||||
|
||||
private Context mContext;
|
||||
private Data mData;
|
||||
@@ -55,6 +61,9 @@ public class DownloadService extends Service
|
||||
private NotificationCompat.Builder mBuilder;
|
||||
private String mSpeedStr = null;
|
||||
|
||||
private final List<Integer> mDownloadOk = new ArrayList<Integer>();
|
||||
private final List<Integer> mDownloadFailed = new ArrayList<Integer>();
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@@ -68,16 +77,20 @@ public class DownloadService extends Service
|
||||
getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
private void handleIntent(Intent intent) {
|
||||
private synchronized void handleIntent(Intent intent) {
|
||||
if (intent == null)
|
||||
return;
|
||||
|
||||
if (ACTION_STOP.equals(intent.getAction())) {
|
||||
String action = intent.getAction();
|
||||
if (ACTION_STOP.equals(action)) {
|
||||
stopCurrentTask();
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
} else if (ACTION_STOP_ALL.equals(intent.getAction())) {
|
||||
mNotifyManager.cancel(DOWNLOADING_NOTIFY_ID);
|
||||
} else if (ACTION_STOP_ALL.equals(action)) {
|
||||
stopAll();
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
mNotifyManager.cancel(DOWNLOADING_NOTIFY_ID);
|
||||
} else if (ACTION_CLEAR.equals(action)) {
|
||||
mDownloadOk.clear();
|
||||
mDownloadFailed.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +111,7 @@ public class DownloadService extends Service
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
mNotifyManager.cancel(DOWNLOADING_NOTIFY_ID);
|
||||
|
||||
mBinder = null;
|
||||
mNotifyManager = null;
|
||||
@@ -154,7 +167,7 @@ public class DownloadService extends Service
|
||||
public synchronized void stop(DownloadInfo di) {
|
||||
if (mCurDownloadInfo == di) {
|
||||
// Cancel download notification
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
mNotifyManager.cancel(DOWNLOADING_NOTIFY_ID);
|
||||
|
||||
// Target downloadinfo is downloading
|
||||
mCurDownloadInfo.state = DownloadInfo.STATE_NONE;
|
||||
@@ -195,7 +208,7 @@ public class DownloadService extends Service
|
||||
di.state == DownloadInfo.STATE_DOWNLOAD) {
|
||||
if (mCurDownloadInfo == di) {
|
||||
// Cancel download notification
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
mNotifyManager.cancel(DOWNLOADING_NOTIFY_ID);
|
||||
|
||||
// Target downloadinfo is downloading
|
||||
mCurDownloadInfo.state = DownloadInfo.STATE_NONE;
|
||||
@@ -269,7 +282,7 @@ public class DownloadService extends Service
|
||||
mBuilder.setContentTitle(getString(R.string.start_download) + " " + gid)
|
||||
.setContentText(null)
|
||||
.setProgress(0, 0, true);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
|
||||
mNotifyManager.notify(DOWNLOADING_NOTIFY_ID, mBuilder.build());
|
||||
mNotifyManager.cancel(gid);
|
||||
|
||||
notifyUpdate();
|
||||
@@ -288,7 +301,7 @@ public class DownloadService extends Service
|
||||
mBuilder.setContentTitle(getString(R.string.downloading) + " " + gid)
|
||||
.setContentText(mSpeedStr)
|
||||
.setProgress(totalSize, downloadSize, false);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
|
||||
mNotifyManager.notify(DOWNLOADING_NOTIFY_ID, mBuilder.build());
|
||||
|
||||
notifyUpdate();
|
||||
}
|
||||
@@ -307,28 +320,66 @@ public class DownloadService extends Service
|
||||
.setContentText(mSpeedStr)
|
||||
.setProgress(mCurDownloadInfo.total, mCurDownloadInfo.download,
|
||||
mCurDownloadInfo.total == -1 ? true :false);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, mBuilder.build());
|
||||
mNotifyManager.notify(DOWNLOADING_NOTIFY_ID, mBuilder.build());
|
||||
|
||||
notifyUpdate();
|
||||
}
|
||||
|
||||
private synchronized String getDownloadNotificationText() {
|
||||
|
||||
int ok = mDownloadOk.size();
|
||||
int failed = mDownloadFailed.size();
|
||||
|
||||
if (ok == 0 && failed == 0) {
|
||||
return "null";
|
||||
} else if (ok == 1 && failed == 0) {
|
||||
return String.format(getString(R.string.download_1), mDownloadOk.get(0));
|
||||
} else if (failed == 0) {
|
||||
return String.format(getString(R.string.download_2), mDownloadOk.size());
|
||||
} else if (ok == 0 && failed == 1) {
|
||||
return String.format(getString(R.string.download_3), mDownloadFailed.get(0));
|
||||
} else if (ok == 0) {
|
||||
return String.format(getString(R.string.download_4), mDownloadFailed.size());
|
||||
} else if (ok == 1 && failed == 1){
|
||||
return String.format(getString(R.string.download_5), mDownloadOk.get(0), mDownloadFailed.get(0));
|
||||
} else {
|
||||
return String.format(getString(R.string.download_6), mDownloadOk.size(), mDownloadFailed.size());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void onDownloadOver(int gid, int legacy) {
|
||||
if (mCurDownloadInfo == null)
|
||||
return;
|
||||
|
||||
mCurDownloadInfo.legacy = legacy;
|
||||
if (mCurDownloadInfo.legacy == 0) {
|
||||
// Download ok
|
||||
if (!mDownloadOk.contains(gid))
|
||||
mDownloadOk.add(gid);
|
||||
mDownloadFailed.remove((Integer) gid);
|
||||
} else {
|
||||
// Download failed
|
||||
if (!mDownloadFailed.contains(gid))
|
||||
mDownloadFailed.add(gid);
|
||||
mDownloadOk.remove((Integer) gid);
|
||||
}
|
||||
|
||||
Intent clearIntent = new Intent(this, DownloadService.class);
|
||||
clearIntent.setAction(ACTION_CLEAR);
|
||||
PendingIntent piClear = PendingIntent.getService(this, 0, clearIntent, 0);
|
||||
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);
|
||||
builder.setSmallIcon(android.R.drawable.stat_sys_download_done);
|
||||
Intent intent = new Intent(DownloadService.this,DownloadActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(DownloadService.this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
builder.setContentIntent(pendingIntent);
|
||||
builder.setContentTitle(getString(R.string.download_over) + " " + gid)
|
||||
.setContentText(legacy == 0 ? getString(R.string.done) :
|
||||
String.format(getString(R.string.legacy_pages), legacy))
|
||||
builder.setContentTitle(getString(R.string.download_over))
|
||||
.setContentText(getDownloadNotificationText())
|
||||
.setDeleteIntent(piClear)
|
||||
.setOngoing(false).setAutoCancel(true);
|
||||
mNotifyManager.notify(gid, builder.build());
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
mNotifyManager.notify(DOWNLOAD_NOTIFY_ID, builder.build());
|
||||
mNotifyManager.cancel(DOWNLOADING_NOTIFY_ID);
|
||||
|
||||
mCurDownloadInfo.legacy = legacy;
|
||||
mCurDownloadInfo.state = DownloadInfo.STATE_FINISH;
|
||||
|
||||
@@ -360,7 +360,7 @@ public class DownloadActivity extends AbsActivity {
|
||||
mServiceConn.getService().delete(mDownloadInfo);
|
||||
// Delete dir
|
||||
GalleryInfo gi = mDownloadInfo.galleryInfo;
|
||||
Utils.deleteDirInThread(EhUtils.getGalleryDir(gi.gid));
|
||||
Utils.deleteDirInThread(EhUtils.getGalleryDir(gi.gid, gi.title));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -201,12 +201,12 @@ public class GalleryActivity extends AbsActivity
|
||||
mTitle = intent.getStringExtra(KEY_TITLE);
|
||||
int startIndex = intent.getIntExtra(KEY_START_INDEX, 0);
|
||||
if (startIndex == -1)
|
||||
startIndex = ExDownloader.readCurReadIndex(mGid);
|
||||
startIndex = ExDownloader.readCurReadIndex(mGid, mTitle);
|
||||
|
||||
if (mGid == -1 || token == null || mTitle == null) {
|
||||
new MaterialAlertDialog.Builder(this).setTitle(R.string.error)
|
||||
.setMessage("数据错误!") // TODO
|
||||
.setPositiveButton("关闭")
|
||||
.setMessage(R.string.ga_data_error)
|
||||
.setPositiveButton(R.string.close)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -16,7 +16,9 @@
|
||||
|
||||
package com.hippo.ehviewer.ui;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -56,8 +58,10 @@ import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.SimpleSuggestionProvider;
|
||||
import com.hippo.ehviewer.UpdateHelper;
|
||||
import com.hippo.ehviewer.app.MaterialAlertDialog;
|
||||
import com.hippo.ehviewer.data.ApiGalleryInfo;
|
||||
import com.hippo.ehviewer.data.Data;
|
||||
import com.hippo.ehviewer.data.DownloadInfo;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.ehclient.EhInfo;
|
||||
import com.hippo.ehviewer.network.HttpHelper;
|
||||
import com.hippo.ehviewer.preference.ListPreference;
|
||||
@@ -772,17 +776,20 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
}
|
||||
|
||||
public static class AdvancedFragment extends TranslucentPreferenceFragment
|
||||
implements Preference.OnPreferenceChangeListener {
|
||||
implements Preference.OnPreferenceChangeListener,
|
||||
Preference.OnPreferenceClickListener {
|
||||
|
||||
private static final String KEY_HTTP_RETRY = "http_retry";
|
||||
private static final String KEY_HTTP_CONNECT_TIMEOUT = "http_connect_timeout";
|
||||
private static final String KEY_HTTP_READ_TIMEOUT = "http_read_timeout";
|
||||
private static final String KEY_EH_MIN_INTERVAL = "eh_min_interval";
|
||||
private static final String KEY_FIX_DIRNAME = "fix_dirname";
|
||||
|
||||
private Preference mHttpRetry;
|
||||
private Preference mHttpConnectTimeout;
|
||||
private Preference mHttpReadTimeout;
|
||||
private Preference mEhMinInterval;
|
||||
private Preference mFixDirname;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -797,6 +804,8 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
mHttpReadTimeout.setOnPreferenceChangeListener(this);
|
||||
mEhMinInterval = findPreference(KEY_EH_MIN_INTERVAL);
|
||||
mEhMinInterval.setOnPreferenceChangeListener(this);
|
||||
mFixDirname = findPreference(KEY_FIX_DIRNAME);
|
||||
mFixDirname.setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -846,6 +855,106 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
final String key = preference.getKey();
|
||||
if (KEY_FIX_DIRNAME.equals(key)) {
|
||||
mFixDirname.setEnabled(false);
|
||||
new BgThread() {
|
||||
@Override
|
||||
public void run() {
|
||||
File downloadDir = new File(Config.getDownloadPath());
|
||||
List<File> targetDirList = new ArrayList<File>();
|
||||
|
||||
String[] list = downloadDir.list();
|
||||
if (list != null) {
|
||||
for (String str: list) {
|
||||
if (str.contains("-")) continue;
|
||||
File dir = new File(downloadDir, str);
|
||||
if (new File(dir, EhUtils.EH_DOWNLOAD_FILENAME).exists())
|
||||
targetDirList.add(dir);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetDirList.size() == 0) {
|
||||
AppHandler.getInstance().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mFixDirname.setEnabled(true);
|
||||
MaterialToast.showToast("未发现可修正项"); // TODO
|
||||
}
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
AppHandler.getInstance().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MaterialToast.showToast("开始修正"); // TODO
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int handleNum = 0;
|
||||
List<File> dirs = new ArrayList<File>();
|
||||
List<Integer> gids = new ArrayList<Integer>();
|
||||
List<String> tokens = new ArrayList<String>();
|
||||
// Do get title from api
|
||||
for (int i = 0; i < targetDirList.size(); i++) {
|
||||
File dir = targetDirList.get(i);
|
||||
File info = new File(dir, EhUtils.EH_DOWNLOAD_FILENAME);
|
||||
InputStream is = null;
|
||||
int gid;
|
||||
String token;
|
||||
try {
|
||||
is = new BufferedInputStream(new FileInputStream(info),
|
||||
128);
|
||||
// skip read index
|
||||
Utils.readAsciiLine(is);
|
||||
gid = Integer.parseInt(Utils.readAsciiLine(is));
|
||||
token = Utils.readAsciiLine(is);
|
||||
Utils.closeQuietly(is);
|
||||
dirs.add(dir);
|
||||
gids.add(gid);
|
||||
tokens.add(token);
|
||||
// Post api when to 25 or the end
|
||||
if (gids.size() == 25 || i == targetDirList.size() - 1) {
|
||||
ApiGalleryInfo[] agiArray = EhClient.getInstance().getApiGalleryInfo(
|
||||
Utils.toIntArray(gids), tokens.toArray(new String[tokens.size()]));
|
||||
// Change dirname
|
||||
if (agiArray != null) {
|
||||
for (int j = 0; j < agiArray.length; j++) {
|
||||
ApiGalleryInfo agi = agiArray[j];
|
||||
if (agi != null) {
|
||||
handleNum++;
|
||||
dirs.get(j).renameTo(EhUtils.generateGalleryDir(agi.gid, agi.title));
|
||||
}
|
||||
}
|
||||
}
|
||||
dirs.clear();
|
||||
gids.clear();
|
||||
tokens.clear();
|
||||
// Wait for CD, if not last
|
||||
if (i != targetDirList.size() - 1)
|
||||
Thread.sleep(3000);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
final int _handleNum = handleNum;
|
||||
AppHandler.getInstance().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mFixDirname.setEnabled(true);
|
||||
MaterialToast.showToast("共修正 " + _handleNum + " 项"); // TODO
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class AboutFragment extends TranslucentPreferenceFragment
|
||||
@@ -853,6 +962,7 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String KEY_AUTHOR = "author";
|
||||
private static final String KEY_TWITTER = "twitter";
|
||||
private static final String KEY_CHANGELOG = "changelog";
|
||||
private static final String KEY_THANKS = "thanks";
|
||||
private static final String KEY_WEBSITE = "website";
|
||||
@@ -863,6 +973,7 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
private static final String KEY_ABOUT_ANALYICS = "about_analyics";
|
||||
|
||||
private Preference mAuthor;
|
||||
private Preference mTwitter;
|
||||
private Preference mChangelog;
|
||||
private Preference mThanks;
|
||||
private Preference mWebsite;
|
||||
@@ -879,6 +990,8 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
|
||||
mAuthor = findPreference(KEY_AUTHOR);
|
||||
mAuthor.setOnPreferenceClickListener(this);
|
||||
mTwitter = findPreference(KEY_TWITTER);
|
||||
mTwitter.setOnPreferenceClickListener(this);
|
||||
mChangelog = findPreference(KEY_CHANGELOG);
|
||||
mChangelog.setOnPreferenceClickListener(this);
|
||||
mThanks = findPreference(KEY_THANKS);
|
||||
@@ -906,6 +1019,28 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
i.putExtra(Intent.EXTRA_SUBJECT, "About EhViewer");
|
||||
startActivity(i);
|
||||
|
||||
} else if (KEY_TWITTER.equals(key)) {
|
||||
new MaterialAlertDialog.Builder(mActivity).setTitle(R.string.twitter_title)
|
||||
.setItems(new CharSequence[]{"@EhViewer", "@jkjvinn"}, new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
Uri uri = null;
|
||||
switch (which) {
|
||||
case 0:
|
||||
uri = Uri.parse("https://twitter.com/EhViewer");
|
||||
break;
|
||||
case 1:
|
||||
uri = Uri.parse("https://twitter.com/jkjvinn");
|
||||
break;
|
||||
}
|
||||
if (uri != null) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
||||
startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel).show();
|
||||
|
||||
} else if (KEY_CHANGELOG.equals(key)) {
|
||||
InputStream is = mActivity.getResources()
|
||||
.openRawResource(R.raw.change_log);
|
||||
|
||||
@@ -111,6 +111,14 @@ public class Config {
|
||||
mConfigPre.edit().putInt(key, value).apply();
|
||||
}
|
||||
|
||||
public static boolean getBoolean(String key, boolean defValue) {
|
||||
return mConfigPre.getBoolean(key, defValue);
|
||||
}
|
||||
|
||||
public static void setBoolean(String key, boolean value) {
|
||||
mConfigPre.edit().putBoolean(key, value).apply();
|
||||
}
|
||||
|
||||
|
||||
/****** For Normal Config ******/
|
||||
private static final String KEY_ALLOWED = "allowed";
|
||||
|
||||
@@ -18,19 +18,93 @@ package com.hippo.ehviewer.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.hippo.ehviewer.data.ListUrls;
|
||||
|
||||
public final class EhUtils {
|
||||
|
||||
public static final String EH_DOWNLOAD_FILENAME = ".ehviewer";
|
||||
|
||||
private static final int[] CATEGORY_VALUES = {
|
||||
ListUrls.MISC,
|
||||
ListUrls.DOUJINSHI,
|
||||
ListUrls.MANGA,
|
||||
ListUrls.ARTIST_CG,
|
||||
ListUrls.GAME_CG,
|
||||
ListUrls.IMAGE_SET,
|
||||
ListUrls.COSPLAY,
|
||||
ListUrls.ASIAN_PORN,
|
||||
ListUrls.NON_H,
|
||||
ListUrls.WESTERN,
|
||||
ListUrls.UNKNOWN
|
||||
};
|
||||
|
||||
// TODO How about "Private"
|
||||
private static final String[][] CATEGORY_STRINGS = {
|
||||
new String[]{"misc"},
|
||||
new String[]{"doujinshi"},
|
||||
new String[]{"manga"},
|
||||
new String[]{"artistcg", "Artist CG Sets"},
|
||||
new String[]{"gamecg", "Game CG Sets"},
|
||||
new String[]{"imageset", "Image Sets"},
|
||||
new String[]{"cosplay"},
|
||||
new String[]{"asianporn", "Asian Porn"},
|
||||
new String[]{"non-h"},
|
||||
new String[]{"western"},
|
||||
new String[]{"unknown"}
|
||||
};
|
||||
|
||||
public static int getCategory(String type) {
|
||||
int i;
|
||||
for (i = 0; i < CATEGORY_STRINGS.length - 1; i++) {
|
||||
for (String str : CATEGORY_STRINGS[i])
|
||||
if (str.equalsIgnoreCase(type))
|
||||
return CATEGORY_VALUES[i];
|
||||
}
|
||||
|
||||
return CATEGORY_VALUES[i];
|
||||
}
|
||||
|
||||
public static String getCategory(int type) {
|
||||
int i;
|
||||
for (i = 0; i < CATEGORY_VALUES.length - 1; i++) {
|
||||
if (CATEGORY_VALUES[i] == type)
|
||||
break;
|
||||
}
|
||||
return CATEGORY_STRINGS[i][0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gallery for read and download
|
||||
* Gid is constant, but title may be changed
|
||||
* 非要标题,记一下 gid 不行么
|
||||
*
|
||||
* @param gid
|
||||
* @param title
|
||||
* @return
|
||||
*/
|
||||
public static File getGalleryDir(int gid) {
|
||||
return new File(Config.getDownloadPath(),
|
||||
public static File getGalleryDir(int gid, String title) {
|
||||
|
||||
File downloadDir = new File(Config.getDownloadPath());
|
||||
File gDir = new File(downloadDir,
|
||||
Utils.standardizeFilename(Integer.toString(gid)));
|
||||
File defaultDir = generateGalleryDir(gid, title);
|
||||
|
||||
if (gDir.exists()) {
|
||||
if (gDir.renameTo(defaultDir))
|
||||
return defaultDir;
|
||||
else
|
||||
return gDir;
|
||||
} else {
|
||||
return defaultDir;
|
||||
}
|
||||
|
||||
// TODO check a dir start with the gid, but it may take a long time
|
||||
// Create a map to record all ?
|
||||
}
|
||||
|
||||
public static File generateGalleryDir(int gid, String title) {
|
||||
return new File(Config.getDownloadPath(),
|
||||
Utils.standardizeFilename(gid + "-" + title));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -634,4 +635,15 @@ public final class Utils {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static int[] toIntArray(Collection<? extends Number> collection) {
|
||||
Object[] boxedArray = collection.toArray();
|
||||
int len = boxedArray.length;
|
||||
int[] array = new int[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
// checkNotNull for GWT (do not optimize)
|
||||
array[i] = ((Number) (boxedArray[i])).intValue();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.MeasureSpec;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
@@ -45,7 +46,8 @@ public final class ViewUtils {
|
||||
*/
|
||||
public static void getLocationInWindow(View view, int[] location) {
|
||||
if (location == null || location.length < 2) {
|
||||
throw new IllegalArgumentException("location must be an array of two integers");
|
||||
throw new IllegalArgumentException(
|
||||
"location must be an array of two integers");
|
||||
}
|
||||
|
||||
float[] position = new float[2];
|
||||
@@ -55,7 +57,7 @@ public final class ViewUtils {
|
||||
|
||||
ViewParent viewParent = view.getParent();
|
||||
while (viewParent instanceof View) {
|
||||
view = (View)viewParent;
|
||||
view = (View) viewParent;
|
||||
if (view.getId() == android.R.id.content) {
|
||||
break;
|
||||
}
|
||||
@@ -67,7 +69,7 @@ public final class ViewUtils {
|
||||
position[1] += view.getTop();
|
||||
|
||||
viewParent = view.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
location[0] = (int) (position[0] + 0.5f);
|
||||
location[1] = (int) (position[1] + 0.5f);
|
||||
@@ -86,11 +88,13 @@ public final class ViewUtils {
|
||||
|
||||
/**
|
||||
* Returns a bitmap showing a screenshot of the view passed in.
|
||||
*
|
||||
* @param v
|
||||
* @return
|
||||
*/
|
||||
public static Bitmap getBitmapFromView(View v) {
|
||||
Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Bitmap bitmap = Bitmap.createBitmap(v.getWidth(), v.getHeight(),
|
||||
Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
// TODO I need to know why I need it, when ScrollView
|
||||
canvas.translate(-v.getScrollX(), -v.getScrollY());
|
||||
@@ -100,32 +104,49 @@ public final class ViewUtils {
|
||||
|
||||
public static boolean isClickAction(MotionEvent event) {
|
||||
// TODO bad idea to check click
|
||||
return event.getAction() == MotionEvent.ACTION_UP &&
|
||||
System.nanoTime() / 1000000 - event.getDownTime() < 200;
|
||||
return event.getAction() == MotionEvent.ACTION_UP
|
||||
&& System.nanoTime() / 1000000 - event.getDownTime() < 200;
|
||||
}
|
||||
|
||||
public static void removeFromParent(View view) {
|
||||
ViewParent vp = view.getParent();
|
||||
if (vp instanceof ViewGroup)
|
||||
((ViewGroup)vp).removeView(view);
|
||||
((ViewGroup) vp).removeView(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that removes the support for HardwareAcceleration from a {@link View}.<br/>
|
||||
* Method that removes the support for HardwareAcceleration from a
|
||||
* {@link View}.<br/>
|
||||
* <br/>
|
||||
* Check AOSP notice:<br/>
|
||||
*
|
||||
* <pre>
|
||||
* 'ComposeShader can only contain shaders of different types (a BitmapShader and a
|
||||
* LinearGradient for instance, but not two instances of BitmapShader)'. But, 'If your
|
||||
* application is affected by any of these missing features or limitations, you can turn
|
||||
* off hardware acceleration for just the affected portion of your application by calling
|
||||
* setLayerType(View.LAYER_TYPE_SOFTWARE, null).'</pre>
|
||||
* setLayerType(View.LAYER_TYPE_SOFTWARE, null).'
|
||||
* </pre>
|
||||
*
|
||||
* @param v The view
|
||||
* @param v
|
||||
* The view
|
||||
*/
|
||||
public static void removeHardwareAccelerationSupport(View v) {
|
||||
if (v.getLayerType() != View.LAYER_TYPE_SOFTWARE) {
|
||||
v.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void measureView(View v) {
|
||||
ViewGroup.LayoutParams oldLp = v.getLayoutParams();
|
||||
ViewGroup.LayoutParams newLp = new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
v.setLayoutParams(newLp);
|
||||
int measureSpec = MeasureSpec.makeMeasureSpec(0,
|
||||
MeasureSpec.UNSPECIFIED);
|
||||
v.measure(measureSpec, measureSpec);
|
||||
if (oldLp != null)
|
||||
v.setLayoutParams(oldLp);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.Layout;
|
||||
import android.text.Spannable;
|
||||
@@ -27,43 +28,44 @@ import android.view.MotionEvent;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class LinkifyTextView extends TextView {
|
||||
|
||||
|
||||
private String mUrl;
|
||||
|
||||
|
||||
public LinkifyTextView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
public LinkifyTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
public LinkifyTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
public void init() {
|
||||
// Just make urls striking
|
||||
// LinkifyTextView itself should not handle touch url event
|
||||
setAutoLinkMask(Linkify.WEB_URLS);
|
||||
setLinksClickable(false);
|
||||
}
|
||||
|
||||
|
||||
public String getTouchedUrl() {
|
||||
return mUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call it when you do not need the url any more
|
||||
*/
|
||||
public void clearTouchedUrl() {
|
||||
mUrl = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (getText() instanceof Spannable) {
|
||||
// Get this code from android.text.method.LinkMovementMethod.
|
||||
@@ -71,19 +73,19 @@ public class LinkifyTextView extends TextView {
|
||||
int x = (int) event.getX();
|
||||
int y = (int) event.getY();
|
||||
boolean isGetUrl = false;
|
||||
|
||||
|
||||
x -= getTotalPaddingLeft();
|
||||
y -= getTotalPaddingTop();
|
||||
|
||||
|
||||
x += getScrollX();
|
||||
y += getScrollY();
|
||||
|
||||
|
||||
Layout layout = getLayout();
|
||||
int line = layout.getLineForVertical(y);
|
||||
int off = layout.getOffsetForHorizontal(line, x);
|
||||
|
||||
|
||||
ClickableSpan[] links = ((Spannable)getText()).getSpans(off, off, ClickableSpan.class);
|
||||
|
||||
|
||||
for (ClickableSpan link : links) {
|
||||
if (link instanceof URLSpan) {
|
||||
mUrl = ((URLSpan)link).getURL();
|
||||
@@ -96,7 +98,7 @@ public class LinkifyTextView extends TextView {
|
||||
} else {
|
||||
mUrl = null;
|
||||
}
|
||||
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user