Skip to content

Commit 928e715

Browse files
committed
自定义Bitmap请求时防止闪烁的操作
1 parent 9b6d8e0 commit 928e715

File tree

6 files changed

+8
-10
lines changed

6 files changed

+8
-10
lines changed

KJFrame/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="org.kymjs.kjframe"
3-
android:versionCode="223"
4-
android:versionName="2.239" >
3+
android:versionCode="224"
4+
android:versionName="2.24" >
55

66
<uses-sdk
77
android:minSdkVersion="11"

KJFrame/src/org/kymjs/kjframe/bitmap/BitmapConfig.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ public class BitmapConfig {
4242
public static ImageCache mMemoryCache;
4343

4444
public int cacheTime = 1440000;
45-
46-
/** 已使用全新的DiskCache,不再需要prefix参数 */
47-
@Deprecated
48-
public static String CACHE_FILENAME_PREFIX = "KJLibrary_";
45+
// 为了防止网速很快的时候速度过快而造成先显示加载中图片,然后瞬间显示网络图片的闪烁问题
46+
public long delayTime = 100;
4947

5048
public BitmapConfig() {
5149
File folder = FileUtils.getSaveFolder(CACHEPATH);

KJFrame/src/org/kymjs/kjframe/bitmap/ImageDisplayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public class ImageDisplayer {
3737
private final KJHttp mKJHttp; // 使用KJHttp的线程池执行队列去加载图片
3838

3939
private final ImageCache mMemoryCache; // 内存缓存器
40-
// 为了防止网速很快的时候速度过快而造成先显示加载中图片,然后瞬间显示网络图片的闪烁问题
41-
private final int mResponseDelayMs = 100;
40+
private final long mResponseDelayMs;
4241

4342
private Runnable mRunnable;
4443
private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -64,6 +63,7 @@ public ImageDisplayer(BitmapConfig bitmapConfig) {
6463
config.cacheTime = bitmapConfig.cacheTime;
6564
mKJHttp = new KJHttp(config);
6665
mMemoryCache = BitmapConfig.mMemoryCache;
66+
mResponseDelayMs = bitmapConfig.delayTime;
6767
}
6868

6969
/**

KJFrame/src/org/kymjs/kjframe/http/HttpConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public HttpStack httpStackFactory() {
8686
return new HttpConnectStack();
8787
} else {
8888
return new HttpClientStack(
89-
AndroidHttpClient.newInstance("volley/0"));
89+
AndroidHttpClient.newInstance("kjframe/0"));
9090
}
9191
}
9292

KJFrame/src/org/kymjs/kjframe/utils/KJConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
public final class KJConfig {
2323

24-
public static final double VERSION = 2.239;
24+
public static final double VERSION = 2.24;
2525

2626
/** 错误处理广播 */
2727
public static final String RECEIVER_ERROR = KJConfig.class.getName()

0 commit comments

Comments
 (0)