Browse Source

Some code cleanup

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
708e0fda5b
  1. 17
      app/src/main/java/awais/instagrabber/utils/BitmapUtils.kt
  2. 3
      app/src/main/java/awais/instagrabber/webservices/MediaService.java

17
app/src/main/java/awais/instagrabber/utils/BitmapUtils.kt

@ -17,10 +17,6 @@ import java.io.IOException
object BitmapUtils {
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
@JvmStatic
@ -53,7 +49,6 @@ object BitmapUtils {
* @param reqWidth Required width
* @param reqHeight Required height
* @param addToCache true if the loaded bitmap should be added to the mem cache
// * @param callback Bitmap load callback
*/
suspend fun loadBitmap(
contentResolver: ContentResolver?,
@ -70,7 +65,6 @@ object BitmapUtils {
* @param uri Uri from where Bitmap will be loaded
* @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 callback Bitmap load callback
*/
suspend fun loadBitmap(
contentResolver: ContentResolver?,
@ -88,7 +82,6 @@ object BitmapUtils {
* @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 addToCache true if the loaded bitmap should be added to the mem cache
// * @param callback Bitmap load callback
*/
private suspend fun loadBitmap(
contentResolver: ContentResolver?,
@ -227,16 +220,6 @@ object BitmapUtils {
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 {
// Get max available VM memory, exceeding this amount will throw an
// OutOfMemory exception. Stored in kilobytes as LruCache takes an

3
app/src/main/java/awais/instagrabber/webservices/MediaService.java

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

Loading…
Cancel
Save