本文整理匯總了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());
}
}
}