Some code cleanup

This commit is contained in:
Ammar Githam 2021-06-03 20:42:28 +09:00
parent 8491d1aac7
commit 708e0fda5b
2 changed files with 0 additions and 20 deletions

View File

@ -17,10 +17,6 @@ import java.io.IOException
object BitmapUtils { object BitmapUtils {
private val bitmapMemoryCache: LruCache<String, Bitmap> private val bitmapMemoryCache: LruCache<String, Bitmap>
// private val appExecutors = AppExecutors
// private val callbackHandlers = Executors
// .newCachedThreadPool { r: Runnable? -> Thread(r, "bm-load-callback-handler#" + random(0, 100)) }
const val THUMBNAIL_SIZE = 200f const val THUMBNAIL_SIZE = 200f
@JvmStatic @JvmStatic
@ -53,7 +49,6 @@ object BitmapUtils {
* @param reqWidth Required width * @param reqWidth Required width
* @param reqHeight Required height * @param reqHeight Required height
* @param addToCache true if the loaded bitmap should be added to the mem cache * @param addToCache true if the loaded bitmap should be added to the mem cache
// * @param callback Bitmap load callback
*/ */
suspend fun loadBitmap( suspend fun loadBitmap(
contentResolver: ContentResolver?, contentResolver: ContentResolver?,
@ -70,7 +65,6 @@ object BitmapUtils {
* @param uri Uri from where Bitmap will be loaded * @param uri Uri from where Bitmap will be loaded
* @param maxDimenSize Max size of the largest side of the image * @param maxDimenSize Max size of the largest side of the image
* @param addToCache true if the loaded bitmap should be added to the mem cache * @param addToCache true if the loaded bitmap should be added to the mem cache
// * @param callback Bitmap load callback
*/ */
suspend fun loadBitmap( suspend fun loadBitmap(
contentResolver: ContentResolver?, contentResolver: ContentResolver?,
@ -88,7 +82,6 @@ object BitmapUtils {
* @param reqHeight Required height (set to -1 if maxDimenSize provided) * @param reqHeight Required height (set to -1 if maxDimenSize provided)
* @param maxDimenSize Max size of the largest side of the image (set to -1 if setting reqWidth and reqHeight) * @param maxDimenSize Max size of the largest side of the image (set to -1 if setting reqWidth and reqHeight)
* @param addToCache true if the loaded bitmap should be added to the mem cache * @param addToCache true if the loaded bitmap should be added to the mem cache
// * @param callback Bitmap load callback
*/ */
private suspend fun loadBitmap( private suspend fun loadBitmap(
contentResolver: ContentResolver?, contentResolver: ContentResolver?,
@ -227,16 +220,6 @@ object BitmapUtils {
class BitmapResult(var bitmap: Bitmap?, var width: Int, var height: Int) class BitmapResult(var bitmap: Bitmap?, var width: Int, var height: Int)
interface ThumbnailLoadCallback {
/**
* @param bitmap Resulting bitmap
* @param width width of the bitmap (Only correct if loadBitmap was called or -1)
* @param height height of the bitmap (Only correct if loadBitmap was called or -1)
*/
fun onLoad(bitmap: Bitmap, width: Int, height: Int)
fun onFailure(t: Throwable)
}
init { init {
// Get max available VM memory, exceeding this amount will throw an // Get max available VM memory, exceeding this amount will throw an
// OutOfMemory exception. Stored in kilobytes as LruCache takes an // OutOfMemory exception. Stored in kilobytes as LruCache takes an

View File

@ -6,7 +6,6 @@ import androidx.annotation.NonNull;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -16,9 +15,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.UUID;
import awais.instagrabber.models.Comment;
import awais.instagrabber.models.enums.MediaItemType; import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.repositories.MediaRepository; import awais.instagrabber.repositories.MediaRepository;
import awais.instagrabber.repositories.requests.Clip; import awais.instagrabber.repositories.requests.Clip;