sunfusheng / glideimageview Goto Github PK
View Code? Open in Web Editor NEW基于Glide V4.9.0封装的图片加载库,可以监听加载图片时的进度
Home Page: https://github.com/sunfusheng/GlideImageView
基于Glide V4.9.0封装的图片加载库,可以监听加载图片时的进度
Home Page: https://github.com/sunfusheng/GlideImageView
<com.sunfusheng.glideimageview.ShapeImageView android:layout_width="@dimen/dimen_dp_80" android:layout_height="@dimen/dimen_dp_80" android:layout_centerHorizontal="true" android:scaleType="centerCrop" android:src="@mipmap/timg" app:siv_border_width="@dimen/dimen_dp_2" app:siv_shape_type="circle" />
如果图片尺寸过大 不会自动居中 所以只好自己手动改造代码 实现居中 并且android:scaleType 设置center会出现border与图片错位 因该是没有处理这些状态 如果能加上这些东东就完美了
楼主是不是没有考虑proguard, 打Release包错误比较多,看下?
浏览单张大图时希望加上双击放大,还有双指缩放,就可以不用去依赖其他的库了
添加过度动画后transition(DrawableTransitionOptions.withCrossFade()),图片加载不会显示,你的demo就有这个问题,在方法private void line42()中,使用Imageview过渡动画就没问题,应该还是ShapeImageView封装的有冲突
正常项目
添加compile 'com.sunfusheng:GlideImageView:2.0.0后编译时出现
Error:In FontFamilyFont, unable to find attribute android:font
Error:In FontFamilyFont, unable to find attribute android:fontWeight
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
如题 如何设置缓存的地址
如题,如何设置本地缓存位置
如何不启用图片点击效果。。
在运行实例的时候RecycleViewActivity,RecyclerView列表中的图片,在来回滑动的时候,发生位置错乱的情况
请问作者,1.2.0相比1.1.0做了哪些改动。1.1.0的sample,GildeImageView和普通的Imageview都能正常加载Gif,但是1.2.0的GlideImageView加载Gif无论是从网络还是本地,都无法动起来,但是Imageview用
GlideImageLoader.create(image32).load(gif1, new RequestOptions());这个方法还是能正常加载显示出来。请问问题出在哪里了?
源码中ProgressManager.java
private static final OnProgressListener LISTENER = new OnProgressListener() {
@OverRide
public void onProgress(String imageUrl, long bytesRead, long totalBytes, boolean isDone, GlideException exception) {
if (listeners == null || listeners.size() == 0) return;
for (int i = 0; i < listeners.size(); i++) {
WeakReference<OnProgressListener> listener = listeners.get(i);
OnProgressListener progressListener = listener.get();
if (progressListener == null) {
listeners.remove(i);
} else {
**_progressListener.onProgress(imageUrl, bytesRead, totalBytes, isDone, exception);_**
}
}
}
};
listeners中包含多个时会导致调用多次
您好,override方法是不是对占位图没有效果,谢谢
RecyclerView中加载grid图片列表时滑动卡顿很明显
如题,默认是哪个级别的缓存的
因为项目中大部分用的还是4.0之前的
If I use a border - will be the image scaled/resized to show the full image?
RecyclerView列表中使用时,滑出屏幕再滑动回来,ImageView尺寸发生变化,第一次加载无问题,复用会导致图片比例失调,并且图片会变得比第一次模糊,布局没有固定宽高,我加载的长图。
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (3.0.1) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
在listview中notifyDataSetChanged后图片就闪烁 有没办法解决
item使用 图片会 覆盖 item的点击事件 这个可以优化吗?
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference
android.view.ViewGroup.dispatchDraw(ViewGroup.java:4021) -------->这是报错
我把dispatchDraw 里代码全部注释还是报错在小米mix2s上还是直接奔溃
在recyclerview的item里使用,会抢占item的点击事件,怎么取消该图片区域触摸
能不能把CircleProgressView封装到GlideImageView,这样更方便
DisplayUtil 里面的windowManager 是静态的 会引起内存泄露
能不能把 library 中的 ProgressAppGlideModule 类改成继承 LibraryGlideModule, 因为 可能使用的时候项目需要配置自己的 GlideModule 类,以下是官方文档的建议
程序库 (Libraries)
程序库如果需要注册定制组件,例如 ModelLoader,可按以下步骤执行:
添加一个或多个 LibraryGlideModule 实现,以注册新的组件。
为每个 LibraryGlideModule 实现,添加 @GlideModule 注解。
添加 Glide 的注解处理器的依赖。
一个 [LibraryGlideModule] 的例子,在 Glide 的OkHttp 集成库 中:
@GlideModule
public final class OkHttpLibraryGlideModule extends LibraryGlideModule {
@OverRide
public void registerComponents(Context context, Glide glide, Registry registry) {
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
}
}
使用 GlideModule 注解需要使用 Glide 注解的依赖:
compile 'com.github.bumptech.glide:annotations:4.6.1'
避免在程序库中使用 AppGlideModule
程序库一定 不要 包含 AppGlideModule 实现。这么做将会阻止依赖该库的任何应用程序管理它们的依赖,或配置诸如 Glide 缓存大小和位置之类的选项。
此外,如果两个程序库都包含 AppGlideModule,应用程序将无法在同时依赖两个库的情况下通过编译,而不得不在二者之中做出取舍。
这确实意味着程序库将无法使用 Glide 的 generated API,但是使用 RequestOptions 加载仍然有效
Originally posted by @sunfusheng in #3 (comment)
1。ShapeImageView 的使用存在过渡的绘制,特别是在稍微低端的机子上很很卡,
2。GlideImageLoader 里面 Glide.with(getContext()) 中的context 使用 当前界面(activity,或者fragment)的context。不然内存释放不了。
这些都是我经过多次测试发现的,不知道你有没有发现。
同时也谢谢你提供的这个封装的库,辛苦了。
Jcenter仓库目前只有2.0.0版本,后面发布的2.0.1、2.0.2都没有 @sunfusheng
问题指向shapeImageView 中的 drawDrawable()方法 的 bitmap缩放的时候。
//Bitmap缩放
float scaleWidth = ((float) getWidth()) / bitmap.getWidth();
float scaleHeight = ((float) getHeight()) / bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
canvas.drawBitmap(bitmap, 0, 0, paint);
canvas.restore();
已最快的速度点击图片 动画未执行完毕会奔溃 共享元素的BUG 有处理办法吗
libEGL: call to OpenGL ES API with no current context
可不可以监听 加载本地图片的进度?
if (url.startsWith(HTTP) || url.startsWith(HTTPS))
话说第二个条件能走进去吗?
Item点击事件被imageview拦截掉了。点击imageview无法跳转~
机型 mx3
给item设置点击事件 但是事件被图片吃掉了 可以修改一下吗?给一个属性 配置是否 图片吃掉事件
rt
abstract method "com.bumptech.glide.RequestManager com.bumptech.glide.manager.RequestManagerRetriever$RequestManagerFactory.build(com.bumptech.glide.Glide, com.bumptech.glide.manager.Lifecycle, com.bumptech.glide.manager.RequestManagerTreeNode, android.content.Context)"
调用以下代码崩溃:
final RequestBuilder requestBuilder = imageLoader.requestBuilder(imgUrl, options);
requestBuilder.transition(DrawableTransitionOptions.withCrossFade())
.into(new SimpleTarget(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) {
@OverRide
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
if (resource.getIntrinsicHeight() > DisplayUtil.getScreenHeight(mActivity)) {
mIvPic.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
requestBuilder.into(mIvPic);
}
});
一定要代码调用loadCircleImageView才能有圆形效果吗,能不能在xml直接设置就生效
加载本地图片资源,调用load(String url, @DrawableRes int placeholder, int radius, OnProgressListener onProgressListener)
和loadCircle(String url, @DrawableRes int placeholder, OnProgressListener onProgressListener)
没效果,没有裁剪的效果
can't find superclass or interface javax.annotation.processing.AbstractProce
结果报空指针 请问需要怎么做呢? 我是了下如果把第一个list加上图片的话 就不会报错。
表示加载Gif图gG 应该是shapeImageView的问题
.transition(DrawableTransitionOptions.withCrossFade())
设置了这个之后缩略图出不来了啊。
Are error and placeholder also to set in xml?
public class ProgressManager {
private static Map<String, WeakReference<OnProgressListener>> listenersMap = Collections.synchronizedMap(new HashMap<String, WeakReference<OnProgressListener>>());
private static OkHttpClient okHttpClient;
private ProgressManager() {
}
public static OkHttpClient getOkHttpClient() {
if (okHttpClient == null) {
okHttpClient = new OkHttpClient.Builder()
.addNetworkInterceptor(new Interceptor() {
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
return response.newBuilder()
.body(new ProgressResponseBody(request.url().toString(), response.body(), listenersMap.get(request.url().toString()).get()))
.build();
}
})
.build();
}
return okHttpClient;
}
// private static final OnProgressListener LISTENER = new OnProgressListener() {
// @OverRide
// public void onProgress(String imageUrl, long bytesRead, long totalBytes, boolean isDone, GlideException exception) {
// if (listenersMap == null || listenersMap.size() == 0) return;
// for (int i = 0; i < listenersMap.size(); i++) {
// WeakReference listener = listenersMap.get(i);
// OnProgressListener progressListener = listener.get();
// if (progressListener == null) {
// listenersMap.remove(i);
// } else {
// progressListener.onProgress(imageUrl, bytesRead, totalBytes, isDone, exception);
// }
// }
// }
// };
/**
* 使用URL做key 保存在map中
* @param key
* @param progressListener
*/
public static void addProgressListener(String key, OnProgressListener progressListener) {
if (progressListener == null || TextUtils.isEmpty(key)) return;
if (!listenersMap.containsKey(key)) {
listenersMap.put(key, new WeakReference<>(progressListener));
}
}
public static void removeProgressListener(String key, OnProgressListener progressListener) {
if (progressListener == null || TextUtils.isEmpty(key)) return;
listenersMap.remove(key);
}
// private static WeakReference findProgressListener(OnProgressListener listener) {
// if (listener == null) return null;
// if (listenersMap == null || listenersMap.size() == 0) return null;
//
// for (int i = 0; i < listenersMap.size(); i++) {
// WeakReference progressListener = listenersMap.get(i);
// if (progressListener.get() == listener) {
// return progressListener;
// }
// }
// return null;
// }
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.