Loading QKSMS/src/main/java/com/moez/QKSMS/common/google/BlobCache.java +5 −3 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ public class BlobCache implements Closeable { private byte[] mBlobHeader = new byte[BLOB_HEADER_SIZE]; private Adler32 mAdler32 = new Adler32(); private int mSlotOffset; private int mFileOffset; private LookupRequest mLookupRequest = new LookupRequest(); // Creates the cache. Three files will be created: // path + ".idx", path + ".0", and path + ".1" // The ".0" file and the ".1" file each stores data for a region. Each of Loading Loading @@ -407,7 +412,6 @@ public class BlobCache implements Closeable { // This method is for one-off lookup. For repeated lookup, use the version // accepting LookupRequest to avoid repeated memory allocation. private LookupRequest mLookupRequest = new LookupRequest(); public byte[] lookup(long key) throws IOException { mLookupRequest.key = key; mLookupRequest.buffer = null; Loading Loading @@ -531,8 +535,6 @@ public class BlobCache implements Closeable { // insertion. // If the lookup is successful, the file offset is also saved in // mFileOffset. private int mSlotOffset; private int mFileOffset; private boolean lookupInternal(long key, int hashStart) { int slot = (int) (key % mMaxEntries); if (slot < 0) slot += mMaxEntries; Loading QKSMS/src/main/java/com/moez/QKSMS/common/google/DraftCache.java +6 −6 Original line number Diff line number Diff line Loading @@ -35,6 +35,12 @@ package com.moez.QKSMS.common.google; public class DraftCache { private static final String TAG = "Mms/draft"; static final String[] DRAFT_PROJECTION = new String[] { Conversations.THREAD_ID // 0 }; static final int COLUMN_DRAFT_THREAD_ID = 0; private static DraftCache sInstance; private final Context mContext; Loading @@ -61,12 +67,6 @@ public class DraftCache { refresh(); } static final String[] DRAFT_PROJECTION = new String[] { Conversations.THREAD_ID // 0 }; static final int COLUMN_DRAFT_THREAD_ID = 0; /** To be called whenever the draft state might have changed. * Dispatches work to a thread and returns immediately. */ Loading QKSMS/src/main/java/com/moez/QKSMS/common/google/SimpleCache.java +6 −7 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ import java.util.LinkedHashMap; * from Peter Balwin and books app. */ public class SimpleCache<K, V> { private final SoftReferenceMap mSoftReferences; private final HardReferenceMap mHardReferences; /** * A simple LRU cache to prevent the number of {@link java.util.Map.Entry} instances Loading Loading @@ -66,13 +68,6 @@ public class SimpleCache<K, V> { } } private static <V> V unwrap(SoftReference<V> ref) { return ref != null ? ref.get() : null; } private final SoftReferenceMap mSoftReferences; private final HardReferenceMap mHardReferences; /** * Constructor. * Loading @@ -95,6 +90,10 @@ public class SimpleCache<K, V> { } } private static <V> V unwrap(SoftReference<V> ref) { return ref != null ? ref.get() : null; } /** * See {@link java.util.Map#get(Object)}. */ Loading QKSMS/src/main/java/com/moez/QKSMS/common/google/UriImage.java +1 −2 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import java.io.IOException; import java.io.InputStream; public class UriImage { private static final int NUMBER_OF_RESIZE_ATTEMPTS = 4; private static final String TAG = "Mms/image"; private static final boolean DEBUG = false; private static final boolean LOCAL_LOGV = false; Loading Loading @@ -259,8 +260,6 @@ public class UriImage { return part; } private static final int NUMBER_OF_RESIZE_ATTEMPTS = 4; /** * Resize and recompress the image such that it fits the given limits. The resulting byte * array contains an image in JPEG format, regardless of the original image's content type. Loading Loading
QKSMS/src/main/java/com/moez/QKSMS/common/google/BlobCache.java +5 −3 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ public class BlobCache implements Closeable { private byte[] mBlobHeader = new byte[BLOB_HEADER_SIZE]; private Adler32 mAdler32 = new Adler32(); private int mSlotOffset; private int mFileOffset; private LookupRequest mLookupRequest = new LookupRequest(); // Creates the cache. Three files will be created: // path + ".idx", path + ".0", and path + ".1" // The ".0" file and the ".1" file each stores data for a region. Each of Loading Loading @@ -407,7 +412,6 @@ public class BlobCache implements Closeable { // This method is for one-off lookup. For repeated lookup, use the version // accepting LookupRequest to avoid repeated memory allocation. private LookupRequest mLookupRequest = new LookupRequest(); public byte[] lookup(long key) throws IOException { mLookupRequest.key = key; mLookupRequest.buffer = null; Loading Loading @@ -531,8 +535,6 @@ public class BlobCache implements Closeable { // insertion. // If the lookup is successful, the file offset is also saved in // mFileOffset. private int mSlotOffset; private int mFileOffset; private boolean lookupInternal(long key, int hashStart) { int slot = (int) (key % mMaxEntries); if (slot < 0) slot += mMaxEntries; Loading
QKSMS/src/main/java/com/moez/QKSMS/common/google/DraftCache.java +6 −6 Original line number Diff line number Diff line Loading @@ -35,6 +35,12 @@ package com.moez.QKSMS.common.google; public class DraftCache { private static final String TAG = "Mms/draft"; static final String[] DRAFT_PROJECTION = new String[] { Conversations.THREAD_ID // 0 }; static final int COLUMN_DRAFT_THREAD_ID = 0; private static DraftCache sInstance; private final Context mContext; Loading @@ -61,12 +67,6 @@ public class DraftCache { refresh(); } static final String[] DRAFT_PROJECTION = new String[] { Conversations.THREAD_ID // 0 }; static final int COLUMN_DRAFT_THREAD_ID = 0; /** To be called whenever the draft state might have changed. * Dispatches work to a thread and returns immediately. */ Loading
QKSMS/src/main/java/com/moez/QKSMS/common/google/SimpleCache.java +6 −7 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ import java.util.LinkedHashMap; * from Peter Balwin and books app. */ public class SimpleCache<K, V> { private final SoftReferenceMap mSoftReferences; private final HardReferenceMap mHardReferences; /** * A simple LRU cache to prevent the number of {@link java.util.Map.Entry} instances Loading Loading @@ -66,13 +68,6 @@ public class SimpleCache<K, V> { } } private static <V> V unwrap(SoftReference<V> ref) { return ref != null ? ref.get() : null; } private final SoftReferenceMap mSoftReferences; private final HardReferenceMap mHardReferences; /** * Constructor. * Loading @@ -95,6 +90,10 @@ public class SimpleCache<K, V> { } } private static <V> V unwrap(SoftReference<V> ref) { return ref != null ? ref.get() : null; } /** * See {@link java.util.Map#get(Object)}. */ Loading
QKSMS/src/main/java/com/moez/QKSMS/common/google/UriImage.java +1 −2 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import java.io.IOException; import java.io.InputStream; public class UriImage { private static final int NUMBER_OF_RESIZE_ATTEMPTS = 4; private static final String TAG = "Mms/image"; private static final boolean DEBUG = false; private static final boolean LOCAL_LOGV = false; Loading Loading @@ -259,8 +260,6 @@ public class UriImage { return part; } private static final int NUMBER_OF_RESIZE_ATTEMPTS = 4; /** * Resize and recompress the image such that it fits the given limits. The resulting byte * array contains an image in JPEG format, regardless of the original image's content type. Loading