本文整理汇总了Java中com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline方法的典型用法代码示例。如果您正苦于以下问题:Java Fresco.getImagePipeline方法的具体用法?Java Fresco.getImagePipeline怎么用?Java Fresco.getImagePipeline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.drawee.backends.pipeline.Fresco
的用法示例。
在下文中一共展示了Fresco.getImagePipeline方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearCache
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
/**
* 清除缓存
*/
private void clearCache() {
// 清理新闻json数据 - 不清理json数据
// NewsDALManager.shared.clearCache();
// Fresco清除图片缓存
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.clearCaches();
// 清除缓存目录 - 清除所有缓存目录文件
FileCacheUtils.clearAllCache(mContext);
final KProgressHUD hud = ProgressHUD.show(mContext, "正在清理...");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
hud.dismiss();
ProgressHUD.showInfo(mContext, "清理缓存完成");
}
}, 2000);
}
示例2: clear
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
@Override
public void clear(Context ctx, FrescoImageConfig config) {
Fresco.getImagePipeline().clearMemoryCaches();
Fresco.getImagePipeline().clearCaches();
Fresco.getImagePipeline().clearDiskCaches();
String url = appendUrl(config.getUrl());
ImagePipeline imagePipeline = Fresco.getImagePipeline();
Uri uri = Uri.parse(url);
imagePipeline.evictFromMemoryCache(uri);
}
示例3: onLowMemory
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
@Override
public void onLowMemory() {
super.onLowMemory();
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.clearMemoryCaches();
}
示例4: evictUri
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
/**
* 清除缓存中的一条url
*
* @param uri 需要被清除的url
*/
public void evictUri(Uri uri) {
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.evictFromMemoryCache(uri);
imagePipeline.evictFromDiskCache(uri);
imagePipeline.evictFromCache(uri);
}
示例5: clear
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
/**
* 清除所有缓存
*/
public void clear() {
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.clearMemoryCaches();
imagePipeline.clearDiskCaches();
imagePipeline.clearCaches();
}
示例6: save
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
public static void save(Uri uri, String action) {
ImageRequest request = ImageRequest.fromUri(uri);
ImagePipeline pipeline = Fresco.getImagePipeline();
DataSource<CloseableReference<PooledByteBuffer>> dataSource =
pipeline.fetchEncodedImage(request, null);
ImageSubscriber dataSubscriber = new ImageSubscriber(uri, action);
dataSource.subscribe(dataSubscriber,
ExpressApplication.getApplication().getImagePipelineConfig()
.getExecutorSupplier().forLocalStorageWrite());
}
示例7: onActivityResult
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
LogHelper.i("MainActivityFragment", "onActivityResult");
super.onActivityResult(requestCode, resultCode, data);
// retrieve selected image Uri from image picker
Uri newImageUri = null;
if (null != data) {
newImageUri = data.getData();
}
if (requestCode == TransistorKeys.REQUEST_LOAD_IMAGE && resultCode == Activity.RESULT_OK && newImageUri != null) {
ImageHelper imageHelper = new ImageHelper(newImageUri, mActivity, 500, 500);
Bitmap newImage = imageHelper.getInputImage();
if (newImage != null && mTempStationID_Position != -1) {
// write image to storage
File stationImageFile = mTempStation.getStationImageFileReference(mFolder);//get station file with correct path according to UniqueID of the station
try (FileOutputStream out = new FileOutputStream(stationImageFile)) {
newImage.compress(Bitmap.CompressFormat.PNG, 100, out);
out.close();
//remve image from fresco cache
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.evictFromCache(Uri.parse(stationImageFile.toURI().toString()));
} catch (IOException e) {
LogHelper.e(LOG_TAG, "Unable to save: " + newImage.toString());
}
// update adapter
mCollectionAdapter.notifyItemChanged(mTempStationID_Position);
Toast.makeText(mApplication, "Image Updated", Toast.LENGTH_SHORT).show();
} else {
LogHelper.e(LOG_TAG, "Unable to get image from media picker. Uri was: " + newImageUri.toString());
}
} else {
LogHelper.e(LOG_TAG, "Unable to get image from media picker. Did not receive an Uri");
}
}
示例8: isCache
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
/**
* @param uri 需要查找的uri
* @return uri对应的图片是否在缓存中
*/
public boolean isCache(Uri uri) {
ImagePipeline imagePipeline = Fresco.getImagePipeline();
return imagePipeline.isInBitmapMemoryCache(uri);
}
示例9: onActivityResult
import com.facebook.drawee.backends.pipeline.Fresco; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// retrieve selected image Uri from image picker
Uri newImageUri = null;
if (null != data) {
newImageUri = data.getData();
}
if (requestCode == TransistorKeys.REQUEST_LOAD_IMAGE && resultCode == Activity.RESULT_OK && null != data) {
ImageHelper imageHelper = new ImageHelper(newImageUri, mActivity, 500, 500);
Bitmap newImage = imageHelper.getInputImage();
if (newImage != null) {
// write image to storage
StorageHelper storageHelper = new StorageHelper(mActivity);
File mFolder = storageHelper.getCollectionDirectory();
File stationImageFile = mStation.getStationImageFileReference(mFolder);//get station file with correct path according to UniqueID of the station
boolean changeImageSuccessfully = false;
try (FileOutputStream out = new FileOutputStream(stationImageFile)) {
newImage.compress(Bitmap.CompressFormat.PNG, 100, out);
out.close();
//remve image from fresco cache
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.evictFromCache(Uri.parse(stationImageFile.toURI().toString()));
changeImageSuccessfully = true;
} catch (IOException e) {
LogHelper.e(LOG_TAG, "Unable to save: " + newImage.toString());
}
// send local broadcast
if (changeImageSuccessfully) {
Intent i = new Intent();
i.setAction(TransistorKeys.ACTION_COLLECTION_CHANGED);
i.putExtra(TransistorKeys.EXTRA_COLLECTION_CHANGE, TransistorKeys.STATION_CHANGED_IMAGE);
i.putExtra(TransistorKeys.EXTRA_STATION, mStation);
i.putExtra(TransistorKeys.EXTRA_STATION_DB_ID, mStation._ID);
LocalBroadcastManager.getInstance(mActivity.getApplicationContext()).sendBroadcast(i);
}
Toast.makeText(mActivity, "Image Updated", Toast.LENGTH_SHORT).show();
} else {
LogHelper.e(LOG_TAG, "Unable to get image from media picker: " + newImageUri.toString());
}
}
}