Issue #1053 - Drop support Android and remove Fennec - Part 1a: Remove mobile/android

This commit is contained in:
Matt A. Tobin 2019-04-23 15:32:23 -04:00 committed by Roy Tam
commit c9b411d6cd
3891 changed files with 0 additions and 428084 deletions

View file

@ -1,51 +0,0 @@
package com.squareup.picasso;
import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.IOException;
import java.io.InputStream;
import static com.squareup.picasso.Picasso.LoadedFrom.DISK;
class AssetBitmapHunter extends BitmapHunter {
private AssetManager assetManager;
public AssetBitmapHunter(Context context, Picasso picasso, Dispatcher dispatcher, Cache cache,
Stats stats, Action action) {
super(picasso, dispatcher, cache, stats, action);
assetManager = context.getAssets();
}
@Override Bitmap decode(Request data) throws IOException {
String filePath = data.uri.toString().substring(ASSET_PREFIX_LENGTH);
return decodeAsset(filePath);
}
@Override Picasso.LoadedFrom getLoadedFrom() {
return DISK;
}
Bitmap decodeAsset(String filePath) throws IOException {
BitmapFactory.Options options = null;
if (data.hasSize()) {
options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
InputStream is = null;
try {
is = assetManager.open(filePath);
BitmapFactory.decodeStream(is, null, options);
} finally {
Utils.closeQuietly(is);
}
calculateInSampleSize(data.targetWidth, data.targetHeight, options);
}
InputStream is = assetManager.open(filePath);
try {
return BitmapFactory.decodeStream(is, null, options);
} finally {
Utils.closeQuietly(is);
}
}
}