本文整理汇总了Java中com.bumptech.glide.signature.ObjectKey类的典型用法代码示例。如果您正苦于以下问题:Java ObjectKey类的具体用法?Java ObjectKey怎么用?Java ObjectKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectKey类属于com.bumptech.glide.signature包,在下文中一共展示了ObjectKey类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadExperimentImage
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
public static void loadExperimentImage(Context context, ImageView view, String experimentId,
String relativeFilePath) {
if (isDestroyed(context)) {
if (Log.isLoggable(TAG, Log.ERROR)) {
Log.e(TAG, "Trying to load image for destroyed context");
}
// Nothing we can do, return
return;
}
File file = FileMetadataManager.getExperimentFile(context, experimentId, relativeFilePath);
// Use last modified time as part of the signature to force a glide cache refresh.
GlideApp.with(context)
.load(file.getAbsolutePath())
.signature(new ObjectKey(file.getPath() + file.lastModified()))
.fitCenter()
// caches only the final image, after reducing the resolution
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(view);
}
开发者ID:google,项目名称:science-journal,代码行数:21,代码来源:PictureUtils.java
示例2: loadExperimentOverviewImage
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
public static void loadExperimentOverviewImage(ImageView imageView,
String experimentOverviewFilePath) {
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
Context context = imageView.getContext();
String fullPath = PictureUtils.getExperimentOverviewFullImagePath(context,
experimentOverviewFilePath);
File file = new File(fullPath);
GlideApp.with(context)
.load(fullPath)
// Create a signature based on the last modified time so that cached images will
// not be used if the underlying file changes. This may happen if the user has
// picked an experiment photo from the "edit experiment" page because there is only
// one filename used for that photo.
.signature(new ObjectKey(file.getPath() + file.lastModified()))
.into(imageView);
}
开发者ID:google,项目名称:science-journal,代码行数:17,代码来源:PictureUtils.java
示例3: getKey
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
public String getKey(String value) {
String safeKey;
synchronized (lruCache) {
safeKey = lruCache.get(value);
}
if (safeKey == null) {
try {
Key key = new ObjectKey(value);
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
key.updateDiskCacheKey(messageDigest);
safeKey = Util.sha256BytesToHex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
synchronized (lruCache) {
lruCache.put(value, safeKey);
}
}
return safeKey;
}
开发者ID:ykrank,项目名称:S1-Next,代码行数:21,代码来源:EditorDiskCache.java
示例4: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
@Nullable
public LoadData<InputStream> buildLoadData(Uri model, int width, int height, Options options) {
if (MediaStoreUtil.isThumbnailSize(width, height) && isRequestingDefaultFrame(options)) {
// TODO(nnaze): Tighten down this call to just the dependencies neede by buildVideoFetcher
return new LoadData<>(new ObjectKey(model), ThumbFetcher.buildVideoFetcher(context, model));
} else {
return null;
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:MediaStoreVideoThumbLoader.java
示例5: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<InputStream> buildLoadData(Uri model, int width, int height, Options options) {
if (MediaStoreUtil.isThumbnailSize(width, height)) {
return new LoadData<>(new ObjectKey(model), ThumbFetcher.buildImageFetcher(context, model));
} else {
return null;
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:MediaStoreImageThumbLoader.java
示例6: testDifferIfSourceKeyDiffers
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Test
public void testDifferIfSourceKeyDiffers()
throws UnsupportedEncodingException, NoSuchAlgorithmException {
mutateAndAssertDifferent(new FactoryMutation() {
@Override
public void mutate(Factory factory) {
factory.sourceKey = new ObjectKey("secondKey");
}
});
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:ResourceCacheKeyTest.java
示例7: testDiffersIfSignatureDiffers
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Test
public void testDiffersIfSignatureDiffers() {
mutateAndAssertDifferent(new FactoryMutation() {
@Override
public void mutate(Factory factory) {
factory.signature = new ObjectKey("secondSignature");
}
});
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:ResourceCacheKeyTest.java
示例8: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
@Nullable
public LoadData<InputStream> buildLoadData(Uri model, int width, int height, Options options) {
if (MediaStoreUtil.isThumbnailSize(width, height) && isRequestingDefaultFrame(options)) {
return new LoadData<>(new ObjectKey(model), ThumbFetcher.buildVideoFetcher(context, model));
} else {
return null;
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:MediaStoreVideoThumbLoader.java
示例9: updateDiskCacheKey_throwsException
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Test
public void updateDiskCacheKey_throwsException() throws NoSuchAlgorithmException {
// If this test fails, update testEqualsAndHashcode to use KeyTester including regression tests.
EngineKey key = new EngineKey(
"id",
new ObjectKey("signature"),
100,
100,
Collections.<Class<?>, Transformation<?>>emptyMap(),
Object.class,
Object.class,
new Options());
expectedException.expect(UnsupportedOperationException.class);
key.updateDiskCacheKey(MessageDigest.getInstance("SHA-1"));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:EngineKeyTest.java
示例10: setUp
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Before
public void setUp() {
dir = RuntimeEnvironment.application.getCacheDir();
cache = DiskLruCacheWrapper.create(dir, 10 * 1024 * 1024);
key = new ObjectKey("test" + Math.random());
data = new byte[] { 1, 2, 3, 4, 5, 6 };
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:DiskLruCacheWrapperTest.java
示例11: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<File> buildLoadData(Uri uri, int width, int height, Options options) {
return new LoadData<>(new ObjectKey(uri), new FilePathFetcher(context, uri));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:MediaStoreFileLoader.java
示例12: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<ByteBuffer> buildLoadData(File file, int width, int height,
Options options) {
return new LoadData<>(new ObjectKey(file), new ByteBufferFetcher(file));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:ByteBufferFileLoader.java
示例13: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<Data> buildLoadData(Uri model, int width, int height,
Options options) {
String assetPath = model.toString().substring(ASSET_PREFIX_LENGTH);
return new LoadData<>(new ObjectKey(model), factory.buildFetcher(assetManager, assetPath));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:AssetUriLoader.java
示例14: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<Data> buildLoadData(String model, int width, int height, Options options) {
return new LoadData<>(new ObjectKey(model), new DataUriFetcher<Data>(model, dataDecoder));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:DataUrlLoader.java
示例15: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<Model> buildLoadData(Model model, int width, int height,
Options options) {
return new LoadData<>(new ObjectKey(model), new UnitFetcher<>(model));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:UnitModelLoader.java
示例16: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<Data> buildLoadData(File model, int width, int height,
Options options) {
return new LoadData<>(new ObjectKey(model), new FileFetcher<>(model, fileOpener));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:FileLoader.java
示例17: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<Data> buildLoadData(Uri model, int width, int height,
Options options) {
return new LoadData<>(new ObjectKey(model), factory.build(model));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:UriLoader.java
示例18: getFrameSignature
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
private static Key getFrameSignature() {
// Some devices seem to have crypto bugs that throw exceptions when you create a new UUID.
// See #1510.
return new ObjectKey(Math.random());
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:GifFrameLoader.java
示例19: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Override
public LoadData<Data> buildLoadData(String model, int width, int height, Options options) {
return new LoadData<>(new ObjectKey(model), new DataUriFetcher<>(model, dataDecoder));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:DataUrlLoader.java
示例20: buildLoadData
import com.bumptech.glide.signature.ObjectKey; //导入依赖的package包/类
@Nullable
@Override
public LoadData<InputStream> buildLoadData(String category, int width, int height, Options options) {
return new LoadData<>(new ObjectKey(category), new ArtworkDataFetcher(category));
}
开发者ID:komamj,项目名称:KomaMusic,代码行数:6,代码来源:ArtworkModeLoader.java
注:本文中的com.bumptech.glide.signature.ObjectKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论