mirror of
https://github.com/seven332/EhViewer
synced 2026-12-04 12:59:01 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a7edf648b | ||
|
|
cfc9411223 | ||
|
|
05030e9bb6 | ||
|
|
ab3fc7d842 | ||
|
|
fb216a960b | ||
|
|
c0fbdee61f | ||
|
|
901c0ae3ec | ||
|
|
f727554afd | ||
|
|
b0a5666a6d |
No files matched your search
+6
-6
@@ -8,8 +8,8 @@ android {
|
||||
applicationId "com.hippo.ehviewer"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 23
|
||||
versionCode 63
|
||||
versionName "1.0.10"
|
||||
versionCode 64
|
||||
versionName "1.0.11"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW"
|
||||
|
||||
@@ -56,12 +56,12 @@ clean {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compile 'com.android.support:appcompat-v7:23.3.0'
|
||||
compile 'com.android.support:design:23.3.0'
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile 'com.android.support:design:23.4.0'
|
||||
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.4-eh'
|
||||
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:hotspot:0.1.0'
|
||||
@@ -74,7 +74,7 @@ dependencies {
|
||||
compile 'com.github.seven332:unifile:0.1.3'
|
||||
compile 'com.github.seven332:yorozuya:0.1.1'
|
||||
compile 'com.github.seven332:yorozuya-thread:0.1.1'
|
||||
compile 'com.github.seven332:yorozuya-collect:0.1.2'
|
||||
compile 'com.github.seven332:yorozuya-collect:0.1.4'
|
||||
compile 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.7'
|
||||
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
|
||||
compile 'org.greenrobot:greendao:2.2.0'
|
||||
|
||||
@@ -37,7 +37,7 @@ import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
public class AppCompatPreferenceActivity extends PreferenceActivity implements AppCompatCallback,
|
||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity implements AppCompatCallback,
|
||||
TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider {
|
||||
|
||||
private AppCompatDelegate mDelegate;
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Debug;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.hippo.scene.StageActivity;
|
||||
@@ -37,7 +38,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class Crash {
|
||||
public final class Crash {
|
||||
private Crash() {}
|
||||
|
||||
@NonNull
|
||||
private static String avoidNull(String str) {
|
||||
@@ -109,8 +111,10 @@ public class Crash {
|
||||
fw.write("INCREMENTAL=");fw.write(Build.VERSION.INCREMENTAL);fw.write("\r\n");
|
||||
fw.write("RELEASE=");fw.write(Build.VERSION.RELEASE);fw.write("\r\n");
|
||||
fw.write("SDK=");fw.write(Integer.toString(Build.VERSION.SDK_INT));fw.write("\r\n");
|
||||
fw.write("MEMORY=");fw.write(FileUtils.humanReadableByteCount(OSUtils.getAppAllocatedMemory(), false));
|
||||
fw.write("/");fw.write(FileUtils.humanReadableByteCount(OSUtils.getTotalMemory(), false));fw.write("\r\n");
|
||||
fw.write("MEMORY=");fw.write(FileUtils.humanReadableByteCount(OSUtils.getAppAllocatedMemory(), false));fw.write("\r\n");
|
||||
fw.write("MEMORY_NATIVE=");fw.write(FileUtils.humanReadableByteCount(Debug.getNativeHeapAllocatedSize(), false));fw.write("\r\n");
|
||||
fw.write("MEMORY_MAX=");fw.write(FileUtils.humanReadableByteCount(OSUtils.getAppMaxMemory(), false));fw.write("\r\n");
|
||||
fw.write("MEMORY_TOTAL=");fw.write(FileUtils.humanReadableByteCount(OSUtils.getTotalMemory(), false));fw.write("\r\n");
|
||||
fw.write("\r\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.EhEngine;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.download.DownloadManager;
|
||||
import com.hippo.ehviewer.spider.SpiderInfo;
|
||||
import com.hippo.ehviewer.spider.SpiderQueen;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.yorozuya.IOUtils;
|
||||
@@ -88,13 +89,12 @@ public class RestoreDownloadPreference extends TaskPreference {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = siFile.openInputStream();
|
||||
// Skip start page
|
||||
IOUtils.readAsciiLine(is);
|
||||
long gid = Long.parseLong(IOUtils.readAsciiLine(is));
|
||||
SpiderInfo spiderInfo = SpiderInfo.read(is);
|
||||
long gid = spiderInfo.gid;
|
||||
if (mManager.containDownloadInfo(gid)) {
|
||||
return null;
|
||||
}
|
||||
String token = IOUtils.readAsciiLine(is);
|
||||
String token = spiderInfo.token;
|
||||
RestoreItem restoreItem = new RestoreItem();
|
||||
restoreItem.gid = gid;
|
||||
restoreItem.token = token;
|
||||
|
||||
@@ -40,13 +40,13 @@ public class SpiderInfo {
|
||||
|
||||
static final String TOKEN_FAILED = "failed";
|
||||
|
||||
int startPage = 0;
|
||||
long gid = -1;
|
||||
String token = null;
|
||||
int pages = -1;
|
||||
int previewPages = -1;
|
||||
int previewPerPage = -1;
|
||||
SparseArray<String> pTokenMap = null;
|
||||
public int startPage = 0;
|
||||
public long gid = -1;
|
||||
public String token = null;
|
||||
public int pages = -1;
|
||||
public int previewPages = -1;
|
||||
public int previewPerPage = -1;
|
||||
public SparseArray<String> pTokenMap = null;
|
||||
|
||||
public static SpiderInfo read(@Nullable UniFile file) {
|
||||
if (file == null) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.analytics.tracking.android.EasyTracker;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
|
||||
public class EhActivity extends AppCompatActivity {
|
||||
public abstract class EhActivity extends AppCompatActivity {
|
||||
|
||||
private boolean mTrackStarted;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.hippo.app.AppCompatPreferenceActivity;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
|
||||
public class EhPreferenceActivity extends AppCompatPreferenceActivity {
|
||||
public abstract class EhPreferenceActivity extends AppCompatPreferenceActivity {
|
||||
|
||||
private boolean mTrackStarted;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class ToolbarActivity extends EhActivity {
|
||||
public abstract class ToolbarActivity extends EhActivity {
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
|
||||
@@ -16,10 +16,14 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.fragment;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.Analytics;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
@@ -75,6 +79,10 @@ public class AboutFragment extends PreferenceFragment
|
||||
AppHelper.sendEmail(getActivity(), EhApplication.getDeveloperEmail(),
|
||||
"About EhViewer", null);
|
||||
} else if (KEY_DONATE.equals(key)) {
|
||||
ClipboardManager cmb = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cmb.setPrimaryClip(ClipData.newPlainText(null, "seven332$163.com".replace('$', '@')));
|
||||
Toast.makeText(getActivity(), R.string.settings_about_donate_toast, Toast.LENGTH_SHORT).show();
|
||||
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.settings_about_donate)
|
||||
.setMessage(getString(R.string.settings_about_donate_message).replace('$', '@'))
|
||||
|
||||
@@ -1211,24 +1211,31 @@ public class DownloadsScene extends ToolbarScene
|
||||
private class ThumbDataContainer implements DataContainer {
|
||||
|
||||
private final DownloadInfo mInfo;
|
||||
@Nullable
|
||||
private UniFile mFile;
|
||||
|
||||
public ThumbDataContainer(@NonNull DownloadInfo info) {
|
||||
mInfo = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUrlMoved(String requestUrl, String responseUrl) {}
|
||||
|
||||
private void ensureFile() {
|
||||
if (mFile == null) {
|
||||
UniFile dir = SpiderDen.getGalleryDownloadDir(mInfo);
|
||||
if (dir != null && dir.ensureDir()) {
|
||||
if (dir != null && dir.isDirectory()) {
|
||||
mFile = dir.createFile(".thumb");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
ensureFile();
|
||||
return mFile != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUrlMoved(String requestUrl, String responseUrl) {}
|
||||
|
||||
@Override
|
||||
public boolean save(InputStream is, long length, String mediaType, ProgressNotifier notify) {
|
||||
ensureFile();
|
||||
@@ -1261,7 +1268,9 @@ public class DownloadsScene extends ToolbarScene
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
mFile.delete();
|
||||
if (mFile != null) {
|
||||
mFile.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ import com.hippo.widget.AutoWrapLayout;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.widget.ObservedTextView;
|
||||
import com.hippo.widget.ProgressView;
|
||||
import com.hippo.widget.ProgressiveRatingBar;
|
||||
import com.hippo.ehviewer.widget.GalleryRatingBar;
|
||||
import com.hippo.widget.SimpleGridAutoSpanLayout;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.IOUtils;
|
||||
@@ -1706,17 +1706,17 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
private class RateDialogHelper implements ProgressiveRatingBar.OnUserRateListener,
|
||||
private class RateDialogHelper implements GalleryRatingBar.OnUserRateListener,
|
||||
DialogInterface.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
private ProgressiveRatingBar mRatingBar;
|
||||
private GalleryRatingBar mRatingBar;
|
||||
@Nullable
|
||||
private TextView mRatingText;
|
||||
|
||||
public void setDialog(Dialog dialog, float rating) {
|
||||
mRatingText = (TextView) ViewUtils.$$(dialog, R.id.rating_text);
|
||||
mRatingBar = (ProgressiveRatingBar) ViewUtils.$$(dialog, R.id.rating_view);
|
||||
mRatingBar = (GalleryRatingBar) ViewUtils.$$(dialog, R.id.rating_view);
|
||||
mRatingText.setText(getRatingText(rating, getResources2()));
|
||||
mRatingBar.setRating(rating);
|
||||
mRatingBar.setOnUserRateListener(this);
|
||||
|
||||
@@ -1192,6 +1192,14 @@ public final class GalleryListScene extends BaseScene
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (newState == STATE_NORMAL || newState == STATE_SIMPLE_SEARCH) {
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.LEFT);
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT);
|
||||
} else {
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.LEFT);
|
||||
setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+26
-8
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Hippo Seven
|
||||
* Copyright 2014-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
|
||||
* 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,
|
||||
@@ -14,33 +14,44 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.widget;
|
||||
package com.hippo.ehviewer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.support.v7.widget.AppCompatRatingBar;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RatingBar;
|
||||
|
||||
public class ProgressiveRatingBar extends AppCompatRatingBar {
|
||||
public class GalleryRatingBar extends AppCompatRatingBar
|
||||
implements RatingBar.OnRatingBarChangeListener {
|
||||
|
||||
private OnUserRateListener mListener;
|
||||
|
||||
public ProgressiveRatingBar(Context context) {
|
||||
public GalleryRatingBar(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
public ProgressiveRatingBar(Context context, AttributeSet attrs) {
|
||||
|
||||
public GalleryRatingBar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
public ProgressiveRatingBar(Context context, AttributeSet attrs,
|
||||
|
||||
public GalleryRatingBar(Context context, AttributeSet attrs,
|
||||
int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setOnRatingBarChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
if (isPressed() && mListener != null) {
|
||||
if (mListener != null) {
|
||||
mListener.onUserRate(getRating());
|
||||
}
|
||||
}
|
||||
@@ -49,6 +60,13 @@ public class ProgressiveRatingBar extends AppCompatRatingBar {
|
||||
mListener = l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
|
||||
if (rating <= 0.0f) {
|
||||
setRating(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnUserRateListener {
|
||||
void onUserRate(float rating);
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
public class GLES20Canvas implements GLCanvas {
|
||||
// ************** Constants **********************
|
||||
@@ -885,7 +886,7 @@ public class GLES20Canvas implements GLCanvas {
|
||||
|
||||
@Override
|
||||
public void dumpStatisticsAndClear() {
|
||||
String line = String.format("MESH:%d, TEX_RECT:%d, FILL_RECT:%d, LINE:%d", mCountDrawMesh,
|
||||
String line = String.format(Locale.US, "MESH:%d, TEX_RECT:%d, FILL_RECT:%d, LINE:%d", mCountDrawMesh,
|
||||
mCountTextureRect, mCountFillRect, mCountDrawLine);
|
||||
mCountDrawMesh = 0;
|
||||
mCountTextureRect = 0;
|
||||
|
||||
@@ -21,7 +21,7 @@ import android.util.SparseArray;
|
||||
|
||||
import com.hippo.yorozuya.IntIdGenerator;
|
||||
|
||||
public class SceneApplication extends Application {
|
||||
public abstract class SceneApplication extends Application {
|
||||
|
||||
private final IntIdGenerator mIdGenerator = new IntIdGenerator();
|
||||
private final SparseArray<StageActivity> mStageMap = new SparseArray<>();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
android:textSize="@dimen/text_little_small"
|
||||
android:textColor="@color/primary_text_light"/>
|
||||
|
||||
<com.hippo.widget.ProgressiveRatingBar
|
||||
<com.hippo.ehviewer.widget.GalleryRatingBar
|
||||
android:id="@+id/rating_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -486,6 +486,7 @@
|
||||
<string name="settings_about_donate">捐赠</string>
|
||||
<string name="settings_about_donate_summary">支付宝:seven332$163.com</string>
|
||||
<string name="settings_about_donate_message">你的捐赠能帮助我开发更多更好的应用。\n\n支付宝:seven332$163.com</string>
|
||||
<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_check_for_updates">检查更新</string>
|
||||
|
||||
@@ -486,6 +486,7 @@
|
||||
<string name="settings_about_donate">捐贈</string>
|
||||
<string name="settings_about_donate_summary">支付寶:seven332$163.com</string>
|
||||
<string name="settings_about_donate_message">你的捐贈能幫助我開發更多更好的應用。\n\n支付寶:seven332$163.com</string>
|
||||
<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_check_for_updates">檢查更新</string>
|
||||
|
||||
@@ -486,6 +486,7 @@
|
||||
<string name="settings_about_donate">捐贈</string>
|
||||
<string name="settings_about_donate_summary">支付寶:seven332$163.com</string>
|
||||
<string name="settings_about_donate_message">你的捐贈能幫助我開發更多更好的應用。\n\n支付寶:seven332$163.com</string>
|
||||
<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_check_for_updates">檢查更新</string>
|
||||
|
||||
@@ -530,6 +530,7 @@
|
||||
<string name="settings_about_donate">Donate</string>
|
||||
<string name="settings_about_donate_summary">Alipay: seven332$163.com</string>
|
||||
<string name="settings_about_donate_message">Your donation can help me develop more and better applications.\n\nAlipay: seven332$163.com</string>
|
||||
<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_check_for_updates">Check for updates</string>
|
||||
|
||||
Reference in new issue
Block a user