mirror of
https://github.com/seven332/EhViewer
synced 2026-11-30 02:58:04 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e721a6da1f | ||
|
|
9eeba868d5 | ||
|
|
8f3247bac4 | ||
|
|
e5a375c3fe | ||
|
|
8d75752835 | ||
|
|
8af786e687 | ||
|
|
4b1c516b3e | ||
|
|
f32b79ba72 | ||
|
|
92b5f2d766 | ||
|
|
a5767e0fe6 | ||
|
|
2fc48bb726 |
No files matched your search
+5
-5
@@ -10,8 +10,8 @@ android {
|
||||
applicationId "com.hippo.ehviewer"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 89
|
||||
versionName "1.3.2"
|
||||
versionCode 90
|
||||
versionName "1.3.3"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
|
||||
"es", "ja", "ko", "fr", "de"
|
||||
@@ -88,7 +88,7 @@ dependencies {
|
||||
implementation 'com.github.seven332:ripple:0.1.2'
|
||||
implementation 'com.github.seven332:streampipe:0.1.0'
|
||||
implementation 'com.github.seven332:tuxiang:0.1.2'
|
||||
implementation 'com.github.seven332:unifile:a3571536be'
|
||||
implementation 'com.github.seven332:unifile:9ec57bcd8f'
|
||||
implementation 'com.github.seven332:yorozuya:0.1.2'
|
||||
implementation 'com.github.seven332:yorozuya-thread:0.1.1'
|
||||
implementation 'com.github.seven332:yorozuya-collect:0.1.4'
|
||||
@@ -105,8 +105,8 @@ dependencies {
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force 'com.github.seven332:glgallery:c56b14c6fa'
|
||||
force 'com.github.seven332:glview-image:4c744db'
|
||||
force 'com.github.seven332:image:29266a3c7b'
|
||||
force 'com.github.seven332:glview-image:e5034da8bd'
|
||||
force 'com.github.seven332:image:c56f357682'
|
||||
|
||||
exclude group: 'com.github.seven332', module: 'okhttp'
|
||||
exclude group: 'com.squareup.okio', module: 'okio'
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.util.LruCache;
|
||||
import android.util.Log;
|
||||
import com.facebook.soloader.SoLoader;
|
||||
import com.hippo.beerbelly.SimpleDiskCache;
|
||||
import com.hippo.conaco.Conaco;
|
||||
import com.hippo.content.RecordingApplication;
|
||||
@@ -50,7 +49,6 @@ import com.hippo.yorozuya.IntIdGenerator;
|
||||
import com.hippo.yorozuya.OSUtils;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -61,6 +59,7 @@ import okhttp3.OkHttpClient;
|
||||
public class EhApplication extends RecordingApplication {
|
||||
|
||||
private static final String TAG = EhApplication.class.getSimpleName();
|
||||
private static final String KEY_GLOBAL_STUFF_NEXT_ID = "global_stuff_next_id";
|
||||
|
||||
public static final boolean BETA = false;
|
||||
|
||||
@@ -87,12 +86,6 @@ public class EhApplication extends RecordingApplication {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
try {
|
||||
SoLoader.init(this, 0);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Could not initialize SoLoader", e);
|
||||
}
|
||||
|
||||
GetText.initialize(this);
|
||||
StatusCodeException.initialize(this);
|
||||
Settings.initialize(this);
|
||||
@@ -103,6 +96,7 @@ public class EhApplication extends RecordingApplication {
|
||||
EhDB.initialize(this);
|
||||
EhEngine.initialize();
|
||||
BitmapUtils.initialize(this);
|
||||
Image.initialize(this);
|
||||
|
||||
if (EhDB.needMerge()) {
|
||||
EhDB.mergeOldDB(this);
|
||||
@@ -135,6 +129,8 @@ public class EhApplication extends RecordingApplication {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
mIdGenerator.setNextId(Settings.getInt(KEY_GLOBAL_STUFF_NEXT_ID, 0));
|
||||
|
||||
if (DEBUG_PRINT_NATIVE_MEMORY || DEBUG_PRINT_IMAGE_COUNT) {
|
||||
debugPrint();
|
||||
}
|
||||
@@ -198,6 +194,7 @@ public class EhApplication extends RecordingApplication {
|
||||
public int putGlobalStuff(@NonNull Object o) {
|
||||
int id = mIdGenerator.nextId();
|
||||
mGlobalStuffMap.put(id, o);
|
||||
Settings.putInt(KEY_GLOBAL_STUFF_NEXT_ID, mIdGenerator.nextId());
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.hippo.ehviewer;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -24,11 +23,11 @@ import android.provider.Browser;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.client.EhUrlOpener;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.scene.Announcer;
|
||||
import com.hippo.scene.StageActivity;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
|
||||
public final class UrlOpener {
|
||||
|
||||
@@ -61,7 +60,8 @@ public final class UrlOpener {
|
||||
intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(context, R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.hippo.ehviewer.download.DownloadService;
|
||||
import com.hippo.ehviewer.ui.scene.BaseScene;
|
||||
import com.hippo.text.Html;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
import com.hippo.yorozuya.FileUtils;
|
||||
import com.hippo.yorozuya.IOUtils;
|
||||
|
||||
@@ -80,23 +81,39 @@ public final class CommonOperations {
|
||||
mFeedback = feedback;
|
||||
}
|
||||
|
||||
private JSONObject fetchUpdateInfo(String url) throws IOException, JSONException {
|
||||
Log.d(TAG, url);
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
Response response = mHttpClient.newCall(request).execute();
|
||||
return new JSONObject(response.body().string());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject doInBackground(Void... params) {
|
||||
String url;
|
||||
if (Settings.getBetaUpdateChannel()) {
|
||||
url = "http://www.ehviewer.com/update_beta.json";
|
||||
} else {
|
||||
url = "http://www.ehviewer.com/update.json";
|
||||
}
|
||||
|
||||
try {
|
||||
String url;
|
||||
return fetchUpdateInfo(url);
|
||||
} catch (Throwable e1) {
|
||||
ExceptionUtils.throwIfFatal(e1);
|
||||
|
||||
if (Settings.getBetaUpdateChannel()) {
|
||||
url = "http://www.ehviewer.com/update_beta.json";
|
||||
url = "https://raw.githubusercontent.com/seven332/EhViewer/api/update_beta.json";
|
||||
} else {
|
||||
url = "http://www.ehviewer.com/update.json";
|
||||
url = "https://raw.githubusercontent.com/seven332/EhViewer/api/update.json";
|
||||
}
|
||||
|
||||
try {
|
||||
return fetchUpdateInfo(url);
|
||||
} catch (Throwable e2) {
|
||||
ExceptionUtils.throwIfFatal(e2);
|
||||
return null;
|
||||
}
|
||||
Log.d(TAG, url);
|
||||
Request request = new Request.Builder().url(url).build();
|
||||
Response response = mHttpClient.newCall(request).execute();
|
||||
return new JSONObject(response.body().string());
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
} catch (JSONException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +170,8 @@ public final class CommonOperations {
|
||||
size = FileUtils.humanReadableByteCount(jo.getLong("size"), false);
|
||||
info = Html.fromHtml(jo.getString("info"));
|
||||
url = jo.getString("url");
|
||||
} catch (PackageManager.NameNotFoundException | JSONException e) {
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ import com.hippo.glgallery.GalleryView;
|
||||
import com.hippo.glgallery.SimpleAdapter;
|
||||
import com.hippo.glview.view.GLRootView;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
import com.hippo.util.SystemUiHelper;
|
||||
import com.hippo.widget.ColorView;
|
||||
import com.hippo.yorozuya.AnimationUtils;
|
||||
@@ -895,7 +896,13 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
intent.setAction(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
intent.setType(mimeType);
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.share_image)));
|
||||
|
||||
try {
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.share_image)));
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(this, R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveImage(int page) {
|
||||
@@ -940,7 +947,12 @@ public class GalleryActivity extends EhActivity implements SeekBar.OnSeekBarChan
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("image/*");
|
||||
intent.putExtra(Intent.EXTRA_TITLE, filename);
|
||||
startActivityForResult(intent, WRITE_REQUEST_CODE);
|
||||
try {
|
||||
startActivityForResult(intent, WRITE_REQUEST_CODE);
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(this, R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.hippo.ehviewer.ui.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -28,12 +27,12 @@ import android.preference.PreferenceFragment;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
import com.hippo.ehviewer.ui.DirPickerActivity;
|
||||
import com.hippo.unifile.UniFile;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
|
||||
public class DownloadFragment extends PreferenceFragment implements
|
||||
Preference.OnPreferenceChangeListener,
|
||||
@@ -145,7 +144,8 @@ public class DownloadFragment extends PreferenceFragment implements
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
try {
|
||||
startActivityForResult(intent, REQUEST_CODE_PICK_IMAGE_DIR_L);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(getActivity(), R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1811,7 +1811,13 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
r.allowScanningByMediaScanner();
|
||||
r.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
dm.enqueue(r);
|
||||
if (dm != null) {
|
||||
try {
|
||||
dm.enqueue(r);
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mDialog != null) {
|
||||
|
||||
@@ -429,7 +429,7 @@ public class HistoryScene extends ToolbarScene
|
||||
HistoryInfo info = mLazyList.get(mPosition);
|
||||
EhDB.deleteHistoryInfo(info);
|
||||
updateLazyList();
|
||||
mAdapter.notifyItemRemoved(mPosition);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
updateView(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ import android.content.res.TypedArray;
|
||||
import android.preference.Preference;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import android.widget.Toast;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.util.ExceptionUtils;
|
||||
|
||||
public class ActivityPreference extends Preference {
|
||||
|
||||
@@ -68,6 +69,11 @@ public class ActivityPreference extends Preference {
|
||||
Context context = getContext();
|
||||
Intent intent = new Intent(context, mActivityClazz);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(context, R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ package com.hippo.util;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.Service;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -28,7 +27,6 @@ import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
public class AppHelper {
|
||||
@@ -47,7 +45,8 @@ public class AppHelper {
|
||||
try {
|
||||
from.startActivity(i);
|
||||
return true;
|
||||
} catch (ActivityNotFoundException e) {
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(from, R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
@@ -63,7 +62,8 @@ public class AppHelper {
|
||||
try {
|
||||
from.startActivity(chooser);
|
||||
return true;
|
||||
} catch (ActivityNotFoundException e) {
|
||||
} catch (Throwable e) {
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
Toast.makeText(from, R.string.error_cant_find_activity, Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -898,12 +898,13 @@ public class ContentLayout extends FrameLayout {
|
||||
mTipView.setText(bundle.getString(KEY_TIP));
|
||||
|
||||
mSavedDataId = bundle.getInt(KEY_DATA);
|
||||
ArrayList<E> newData = null;
|
||||
EhApplication app = (EhApplication) getContext().getApplicationContext();
|
||||
if (mSavedDataId != IntIdGenerator.INVALID_ID) {
|
||||
ArrayList<E> data = (ArrayList<E>) app.removeGlobalStuff(mSavedDataId);
|
||||
newData = (ArrayList<E>) app.removeGlobalStuff(mSavedDataId);
|
||||
mSavedDataId = IntIdGenerator.INVALID_ID;
|
||||
if (data != null) {
|
||||
mData = data;
|
||||
if (newData != null) {
|
||||
mData = newData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,6 +913,15 @@ public class ContentLayout extends FrameLayout {
|
||||
mStartPage = bundle.getInt(KEY_START_PAGE);
|
||||
mEndPage = bundle.getInt(KEY_END_PAGE);
|
||||
mPages = bundle.getInt(KEY_PAGES);
|
||||
|
||||
if (newData == null) {
|
||||
mPageDivider.clear();
|
||||
mStartPage = 0;
|
||||
mEndPage = 0;
|
||||
mPages = 0;
|
||||
firstRefresh();
|
||||
}
|
||||
|
||||
return bundle.getParcelable(KEY_SUPER);
|
||||
} else {
|
||||
return state;
|
||||
|
||||
Reference in new issue
Block a user