Compare commits

...
10 Commits
Author SHA1 Message Date
seven332 47d28beddd 1.0.13 2016-07-28 00:17:39 +08:00
seven332 8d39829e54 Update libraries 2016-07-28 00:17:06 +08:00
seven332 2cb8319c91 Check download image size 2016-07-27 23:34:09 +08:00
seven332 27ca88f0c2 Use https for ex and forums 2016-07-27 23:32:31 +08:00
seven332 9aa033c31b Add https support for url parser 2016-07-27 23:27:27 +08:00
seven332 1f1d968766 Make error message different 2016-07-27 23:24:53 +08:00
seven332 3b8ba148dc Save temp share image to internal folder 2016-06-20 23:27:03 +08:00
seven332 5448bdf7bb Use FileProvider to share image
For apps targeting Android N, file:// URIs outside app is not supported any more.
2016-06-18 22:08:29 +08:00
seven332 e7cfd8831e Set targetSdkVersion to 24, upgrade libraries 2016-06-18 21:04:26 +08:00
seven332 148588e53a Show version name in about 2016-06-10 20:37:27 +08:00
15 changed files with 142 additions and 26 deletions

No files matched your search

+11 -11
View File
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc4"
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.hippo.ehviewer"
minSdkVersion 14
targetSdkVersion 23
versionCode 65
versionName "1.0.12"
targetSdkVersion 24
versionCode 66
versionName "1.0.13"
vectorDrawables.useSupportLibrary = true
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW"
@@ -58,20 +58,20 @@ clean {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.github.seven332:animator:0.1.0'
compile 'com.github.seven332:beerbelly:0.1.4'
compile 'com.github.seven332:conaco:0.1.5-eh'
compile 'com.github.seven332:drawerlayout:0.1.0'
compile 'com.github.seven332:easyrecyclerview:0.1.0'
compile 'com.github.seven332:easyrecyclerview:0.1.1'
compile 'com.github.seven332:glgallery:0.1.2'
compile 'com.github.seven332:glview:0.1.0'
compile 'com.github.seven332:glview-image:0.1.0'
compile 'com.github.seven332:hotspot:0.1.0'
compile 'com.github.seven332:image:0.1.9-jpeg-png-gif'
compile 'com.github.seven332:okhttp:3.3.1-eh'
compile 'com.github.seven332:image:0.1.12'
compile 'com.github.seven332:okhttp:3.4.1-eh'
compile 'com.github.seven332:refreshlayout:0.1.0'
compile 'com.github.seven332:ripple:0.1.1'
compile 'com.github.seven332:streampipe:0.1.0'
@@ -80,7 +80,7 @@ dependencies {
compile 'com.github.seven332:yorozuya:0.1.2'
compile 'com.github.seven332:yorozuya-thread:0.1.1'
compile 'com.github.seven332:yorozuya-collect:0.1.4'
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.9.1'
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.9.2'
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
compile 'org.greenrobot:greendao:2.2.0'
compile 'org.jsoup:jsoup:1.9.2'
+11 -1
View File
@@ -130,8 +130,18 @@
<service
android:name="com.hippo.ehviewer.download.DownloadService"
android:icon="@mipmap/ic_launcher"
android:label="@string/download_service_label"/>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.hippo.ehviewer.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths"/>
</provider>
</application>
</manifest>
@@ -32,16 +32,16 @@ public class EhUrl {
public static final String DOMAIN_LOFI = "lofi.e-hentai.org";
public static final String HOST_E = "http://" + DOMAIN_E + "/";
public static final String HOST_EX = "http://" + DOMAIN_EX + "/";
public static final String HOST_EX = "https://" + DOMAIN_EX + "/";
public static final String HOST_G = "http://" + DOMAIN_G + "/";
public static final String API_SIGN_IN = "http://forums.e-hentai.org/index.php?act=Login&CODE=01";
public static final String API_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login&CODE=01";
public static final String API_G = HOST_G + "api.php";
public static final String API_EX = HOST_EX + "api.php";
public static final String URL_SIGN_IN = "http://forums.e-hentai.org/index.php?act=Login";
public static final String URL_REGISTER = "http://forums.e-hentai.org/index.php?act=Reg&CODE=00";
public static final String URL_SIGN_IN = "https://forums.e-hentai.org/index.php?act=Login";
public static final String URL_REGISTER = "https://forums.e-hentai.org/index.php?act=Reg&CODE=00";
public static final String URL_FAVORITES_G = HOST_G + "favorites.php";
public static final String URL_FAVORITES_EX = HOST_EX + "favorites.php";
public static final String URL_FORUMS = "https://forums.e-hentai.org/";
@@ -29,7 +29,7 @@ import java.util.regex.Pattern;
*/
public final class GalleryDetailUrlParser {
public static final Pattern URL_PATTERN = Pattern.compile("http://(?:" +
public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/g/(\\d+)/(\\w+)");
@Nullable
@@ -143,18 +143,18 @@ public class GalleryListParser {
// Title (required)
Element it5 = JsoupUtils.getElementByClass(e, "it5");
if (null == it5) {
Log.e(TAG, "Can't parse gallery info title");
Log.e(TAG, "Can't parse gallery info title, step 1");
return null;
}
Elements es = it5.children();
if (null == es || es.size() <= 0) {
Log.e(TAG, "Can't parse gallery info title");
Log.e(TAG, "Can't parse gallery info title, step 2");
return null;
}
Element a = es.get(0);
GalleryDetailUrlParser.Result result = GalleryDetailUrlParser.parse(a.attr("href"));
if (null == result) {
Log.e(TAG, "Can't parse gallery info title");
Log.e(TAG, "Can't parse gallery info title, step 3");
return null;
}
gi.gid = result.gid;
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
*/
public final class GalleryPageUrlParser {
public static final Pattern URL_PATTERN = Pattern.compile("http://(?:" +
public static final Pattern URL_PATTERN = Pattern.compile("https?://(?:" +
EhUrl.DOMAIN_EX + "|" + EhUrl.DOMAIN_G + "|" + EhUrl.DOMAIN_LOFI + ")/s/(\\w+)/(\\d+)-(\\d+)");
public static Result parse(String url) {
@@ -0,0 +1,57 @@
/*
* Copyright 2016 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.
*/
package com.hippo.ehviewer.preference;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.preference.Preference;
import android.util.AttributeSet;
import com.hippo.ehviewer.R;
public class VersionPreference extends Preference {
public VersionPreference(Context context) {
super(context);
init(context);
}
public VersionPreference(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public VersionPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
}
private void init(Context context) {
setTitle(R.string.settings_about_version);
String version;
try {
PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
version = pInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
version = context.getString(R.string.error_unknown);
}
setSummary(version);
}
}
@@ -1132,6 +1132,16 @@ public final class SpiderQueen implements Runnable {
}
os.flush();
// check download size
if (contentLength >= 0) {
if (receivedSize < contentLength) {
Log.e(TAG, "Can't download all of image data");
continue;
} else if (receivedSize > contentLength) {
Log.w(TAG, "Received data is more than contentLength");
}
}
// Check interrupted
if (Thread.currentThread().isInterrupted()) {
interrupt = true;
@@ -20,6 +20,7 @@ import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -234,7 +235,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
}
@Override
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "WrongConstant"})
protected void onCreate(@Nullable Bundle savedInstanceState) {
if (Settings.getReadingFullscreen() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window w = getWindow();
@@ -828,7 +829,7 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
return;
}
File dir = AppConfig.getExternalTempDir();
File dir = AppConfig.getTempDir();
if (null == dir) {
Toast.makeText(this, R.string.error_cant_create_temp_file, Toast.LENGTH_SHORT).show();
return;
@@ -838,14 +839,23 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
return;
}
String filename = file.getName();
if (filename == null) {
Toast.makeText(this, R.string.error_cant_save_image, Toast.LENGTH_SHORT).show();
}
// TODO Create ContentProvider for some app are not grand storage write permission
Uri uri = file.getUri();
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
MimeTypeMap.getFileExtensionFromUrl(uri.toString()));
MimeTypeMap.getFileExtensionFromUrl(filename));
if (TextUtils.isEmpty(mimeType)) {
mimeType = "image/jpeg";
}
Uri uri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority("com.hippo.ehviewer.fileprovider")
.appendPath("temp")
.appendPath(filename)
.build();
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM, uri);
@@ -489,6 +489,7 @@
<string name="settings_about_donate_toast">邮箱地址已复制到剪切板</string>
<string name="settings_about_enable_analytics">启用数据统计</string>
<string name="settings_about_about_analytics">关于数据统计</string>
<string name="settings_about_version">版本号</string>
<string name="settings_about_check_for_updates">检查更新</string>
<string name="settings_about_beta_update_channel">更新测试版</string>
<string name="settings_about_beta_update_channel_summary">测试版可能在你的设备上出现不可预知的错误</string>
@@ -489,6 +489,7 @@
<string name="settings_about_donate_toast">郵箱地址已複製到剪切板</string>
<string name="settings_about_enable_analytics">啟用數據統計</string>
<string name="settings_about_about_analytics">關於數據統計</string>
<string name="settings_about_version">版本號</string>
<string name="settings_about_check_for_updates">檢查更新</string>
<string name="settings_about_beta_update_channel">更新測試版</string>
<string name="settings_about_beta_update_channel_summary">測試版可能在你的設備上出現不可預知的錯誤</string>
@@ -489,6 +489,7 @@
<string name="settings_about_donate_toast">郵箱地址已複製到剪下板</string>
<string name="settings_about_enable_analytics">啟用資料統計</string>
<string name="settings_about_about_analytics">關於資料統計</string>
<string name="settings_about_version">版本號</string>
<string name="settings_about_check_for_updates">檢查更新</string>
<string name="settings_about_beta_update_channel">更新測試版</string>
<string name="settings_about_beta_update_channel_summary">測試版可能在你的裝置上出現不可預知的錯誤</string>
+1
View File
@@ -533,6 +533,7 @@
<string name="settings_about_donate_toast">Email address copied to clipboard</string>
<string name="settings_about_enable_analytics">Enable analytics</string>
<string name="settings_about_about_analytics">About analytics</string>
<string name="settings_about_version">Build version</string>
<string name="settings_about_check_for_updates">Check for updates</string>
<string name="settings_about_beta_update_channel">Beta update channel</string>
<string name="settings_about_beta_update_channel_summary">Beta release might be broken on your devices</string>
+3
View File
@@ -54,6 +54,9 @@
android:summary="@string/settings_about_license_summary"
app:activity="com.hippo.ehviewer.ui.LicenseActivity"/>
<com.hippo.ehviewer.preference.VersionPreference
android:key="version"/>
<Preference
android:key="check_for_updates"
android:title="@string/settings_about_check_for_updates"/>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2016 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.
-->
<path xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="temp" path="temp/"/>
</path>