diff options
author | Andrew Dolgov <[email protected]> | 2012-11-29 12:31:34 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-11-29 12:31:34 +0300 |
commit | 32f0504f7459156fd6a45e2b6696b9c0e63e8c3d (patch) | |
tree | fbf1ffe0a17ab2d4031c287ed157c286f34fecf3 /src | |
parent | cbc931fc6cc5a55d25f30bb8aaa1a6e6b96fd1f3 (diff) |
add an option to enable rar archives
make downsampling less aggressive on ICS
Diffstat (limited to 'src')
-rw-r--r-- | src/org/fox/ttcomics/ComicFragment.java | 7 | ||||
-rw-r--r-- | src/org/fox/ttcomics/ComicListFragment.java | 4 | ||||
-rw-r--r-- | src/org/fox/ttcomics/CommonActivity.java | 16 |
3 files changed, 22 insertions, 5 deletions
diff --git a/src/org/fox/ttcomics/ComicFragment.java b/src/org/fox/ttcomics/ComicFragment.java index 584115b..da34ce4 100644 --- a/src/org/fox/ttcomics/ComicFragment.java +++ b/src/org/fox/ttcomics/ComicFragment.java @@ -46,7 +46,12 @@ public class ComicFragment extends Fragment { options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(archive.getItem(page), null, options);
- options.inSampleSize = CommonActivity.calculateInSampleSize(options, 512, 512);
+ if (CommonActivity.isCompatMode()) {
+ options.inSampleSize = CommonActivity.calculateInSampleSize(options, 512, 512);
+ } else {
+ options.inSampleSize = CommonActivity.calculateInSampleSize(options, 1024, 1024);
+ }
+
options.inJustDecodeBounds = false;
return BitmapFactory.decodeStream(archive.getItem(page), null, options);
diff --git a/src/org/fox/ttcomics/ComicListFragment.java b/src/org/fox/ttcomics/ComicListFragment.java index 4b6b924..fce1959 100644 --- a/src/org/fox/ttcomics/ComicListFragment.java +++ b/src/org/fox/ttcomics/ComicListFragment.java @@ -254,6 +254,10 @@ public class ComicListFragment extends Fragment implements OnItemClickListener { selectionArgs = new String[] { baseDir };
}
+ if (!m_prefs.getBoolean("enable_rar", false)) {
+ selection += " AND (UPPER(filename) NOT LIKE '%.CBR' AND UPPER(filename) NOT LIKE '%.RAR')";
+ }
+
return m_activity.getReadableDb().query("comics_cache", null, selection,
selectionArgs, null, null, "size != " + SIZE_DIR + ", filename, size = " + SIZE_DIR + ", filename");
}
diff --git a/src/org/fox/ttcomics/CommonActivity.java b/src/org/fox/ttcomics/CommonActivity.java index 0245d78..873ccd3 100644 --- a/src/org/fox/ttcomics/CommonActivity.java +++ b/src/org/fox/ttcomics/CommonActivity.java @@ -408,13 +408,21 @@ public class CommonActivity extends FragmentActivity { }
public void toast(int msgId) {
- Toast toast = Toast.makeText(CommonActivity.this, msgId, Toast.LENGTH_SHORT);
- toast.show();
+ try {
+ Toast toast = Toast.makeText(CommonActivity.this, msgId, Toast.LENGTH_SHORT);
+ toast.show();
+ } catch (RuntimeException e) {
+ // might happen if UI lags
+ }
}
public void toast(String msg) {
- Toast toast = Toast.makeText(CommonActivity.this, msg, Toast.LENGTH_SHORT);
- toast.show();
+ try {
+ Toast toast = Toast.makeText(CommonActivity.this, msg, Toast.LENGTH_SHORT);
+ toast.show();
+ } catch (RuntimeException e) {
+ // might happen if UI lags
+ }
}
public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
|