diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index d522e39d5..1aa9cfc9e 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -202,6 +202,9 @@
阅读
显示时间
显示电量
+ 自定义解码
+ 自定义解码可能会更使用更少内存,解码更快
+ 自定义解码暂不支持 x86, mips
下载
下载路径
diff --git a/res/xml/read_settings.xml b/res/xml/read_settings.xml
index f6fcb02f1..26e37b644 100644
--- a/res/xml/read_settings.xml
+++ b/res/xml/read_settings.xml
@@ -43,4 +43,9 @@
android:title="@string/gallery_show_battery_title"
android:defaultValue="true" />
+
+
\ No newline at end of file
diff --git a/src/com/hippo/ehviewer/gallery/GalleryView.java b/src/com/hippo/ehviewer/gallery/GalleryView.java
index 42c72b0a4..3e6f7b169 100644
--- a/src/com/hippo/ehviewer/gallery/GalleryView.java
+++ b/src/com/hippo/ehviewer/gallery/GalleryView.java
@@ -743,8 +743,10 @@ public class GalleryView extends GLView
return false;
ShowItem showItem;
- if (showItems[NEXT_TARGET_INDEX] != null)
+ if (showItems[NEXT_TARGET_INDEX] != null) {
showItems[NEXT_TARGET_INDEX].recycle();
+ showItems[NEXT_TARGET_INDEX] = null;
+ }
showItems[NEXT_TARGET_INDEX] = showItems[CUR_TARGET_INDEX];
showItems[CUR_TARGET_INDEX] = showItems[PRE_TARGET_INDEX];
showItems[PRE_TARGET_INDEX] = null;
@@ -780,8 +782,10 @@ public class GalleryView extends GLView
return false;
ShowItem showItem;
- if (showItems[PRE_TARGET_INDEX] != null)
+ if (showItems[PRE_TARGET_INDEX] != null) {
showItems[PRE_TARGET_INDEX].recycle();
+ showItems[PRE_TARGET_INDEX] = null;
+ }
showItems[PRE_TARGET_INDEX] = showItems[CUR_TARGET_INDEX];
showItems[CUR_TARGET_INDEX] = showItems[NEXT_TARGET_INDEX];
showItems[NEXT_TARGET_INDEX] = null;
@@ -819,12 +823,18 @@ public class GalleryView extends GLView
return goToNextPage();
} else {
// Free
- if (showItems[PRE_TARGET_INDEX] != null)
+ if (showItems[PRE_TARGET_INDEX] != null) {
showItems[PRE_TARGET_INDEX].recycle();
- if (showItems[CUR_TARGET_INDEX] != null)
+ showItems[PRE_TARGET_INDEX] = null;
+ }
+ if (showItems[CUR_TARGET_INDEX] != null) {
showItems[CUR_TARGET_INDEX].recycle();
- if (showItems[NEXT_TARGET_INDEX] != null)
+ showItems[CUR_TARGET_INDEX] = null;
+ }
+ if (showItems[NEXT_TARGET_INDEX] != null) {
showItems[NEXT_TARGET_INDEX].recycle();
+ showItems[NEXT_TARGET_INDEX] = null;
+ }
mCurIndex = index;
setState();
@@ -841,16 +851,21 @@ public class GalleryView extends GLView
}
}
+ public synchronized void free() {
+ for (int i = 0; i < TARGET_INDEX_SIZE; i++) {
+ if (showItems[i] != null) {
+ showItems[i].recycle();
+ showItems[i] = null;
+ }
+ }
+ }
+
@Override
protected boolean onTouch(MotionEvent event) {
mGestureRecognizer.onTouchEvent(event);
return true;
}
- private void setTouchLocked(boolean locked) {
-
- }
-
private class MyGestureListener implements GestureRecognizer.Listener {
private boolean isScale = false;
diff --git a/src/com/hippo/ehviewer/gallery/data/ImageSet.java b/src/com/hippo/ehviewer/gallery/data/ImageSet.java
index 066a40396..eefb45e1c 100644
--- a/src/com/hippo/ehviewer/gallery/data/ImageSet.java
+++ b/src/com/hippo/ehviewer/gallery/data/ImageSet.java
@@ -203,7 +203,7 @@ public class ImageSet implements ExDownloader.ListenerForImageSet {
String pathName = Utils.getPathName(mDir.getPath(), decodeInfo.filename);
Object res = null;
- if (Utils.SUPPORT_IMAGE) {
+ if (Utils.SUPPORT_IMAGE && Config.getCustomCodec()) {
res = Image.decodeFile(pathName, GL11.GL_RGB);
} else {
if (Utils.getExtension(pathName, "jpg").equals("gif"))
diff --git a/src/com/hippo/ehviewer/ui/GalleryActivity.java b/src/com/hippo/ehviewer/ui/GalleryActivity.java
index 6edfdf978..4533e9ab8 100644
--- a/src/com/hippo/ehviewer/ui/GalleryActivity.java
+++ b/src/com/hippo/ehviewer/ui/GalleryActivity.java
@@ -73,7 +73,6 @@ public class GalleryActivity extends AbsActivity
private ValueAnimator mShowAnimator;
private ValueAnimator mHideAnimator;
- private long mHideTaskTimeStamp;
@Override
public void onOrientationChanged(int paddingTop, int paddingBottom) {
@@ -266,6 +265,8 @@ public class GalleryActivity extends AbsActivity
if (mImageSet != null)
mImageSet.free();
+ if (mGalleryView != null)
+ mGalleryView.free();
}
@Override
diff --git a/src/com/hippo/ehviewer/ui/SettingsActivity.java b/src/com/hippo/ehviewer/ui/SettingsActivity.java
index c832a9365..19062d569 100644
--- a/src/com/hippo/ehviewer/ui/SettingsActivity.java
+++ b/src/com/hippo/ehviewer/ui/SettingsActivity.java
@@ -447,10 +447,23 @@ public class SettingsActivity extends AbsPreferenceActivity {
implements Preference.OnPreferenceChangeListener,
Preference.OnPreferenceClickListener {
+ private static final String KEY_CUSTOM_CODEC = "custom_codec";
+
+ private Preference mCustomCodec;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.read_settings);
+
+ mCustomCodec = findPreference(KEY_CUSTOM_CODEC);
+ if (!Utils.SUPPORT_IMAGE) {
+ mCustomCodec.setEnabled(false);
+ mCustomCodec.setDefaultValue(false);
+ mCustomCodec.setSummary(R.string.custom_codec_summary_not);
+ } else {
+ mCustomCodec.setDefaultValue(true);
+ }
}
@Override
diff --git a/src/com/hippo/ehviewer/util/Config.java b/src/com/hippo/ehviewer/util/Config.java
index 788f21b6f..4a86e26f8 100644
--- a/src/com/hippo/ehviewer/util/Config.java
+++ b/src/com/hippo/ehviewer/util/Config.java
@@ -477,13 +477,18 @@ public class Config {
private static final String KEY_PAGE_SCALING = "page_scaling";
private static final String DEFAULT_PAGE_SCALING = "3";
+
private static final String KEY_START_POSITION = "start_position";
private static final String DEFAULT_START_POSITION = "1";
+
private static final String KEY_GALLERY_SHOW_TIME = "gallery_show_clock";
private static final boolean DEFAULT_GALLERY_SHOW_TIME = true;
+
private static final String KEY_GALLERY_SHOW_BATTERY = "gallery_show_battery";
private static final boolean DEFAULT_GALLERY_SHOW_BATTERY = true;
+ private static final String KEY_CUSTOM_CODEC = "custom_codec";
+
public static int getPageScalingMode() {
int pageScalingMode = 3;
try {
@@ -516,6 +521,10 @@ public class Config {
return mConfigPre.getBoolean(KEY_GALLERY_SHOW_BATTERY, DEFAULT_GALLERY_SHOW_BATTERY);
}
+ public static boolean getCustomCodec() {
+ return mConfigPre.getBoolean(KEY_CUSTOM_CODEC, Utils.SUPPORT_IMAGE);
+ }
+
/****** Download ******/
diff --git a/src/com/hippo/ehviewer/util/Utils.java b/src/com/hippo/ehviewer/util/Utils.java
index 5cc7bad36..74bb47a4d 100644
--- a/src/com/hippo/ehviewer/util/Utils.java
+++ b/src/com/hippo/ehviewer/util/Utils.java
@@ -51,7 +51,7 @@ public final class Utils {
static {
String cpu = Build.CPU_ABI;
- SUPPORT_IMAGE = cpu.startsWith("armeabi") || cpu.equals("mips");
+ SUPPORT_IMAGE = cpu.equals("armeabi") || cpu.equals("armeabi-v7a");
}
/**