Skip to content

Commit

Permalink
自定义Bitmap请求时防止闪烁的操作
Browse files Browse the repository at this point in the history
  • Loading branch information
kymjs committed Aug 5, 2015
1 parent 9b6d8e0 commit 928e715
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions KJFrame/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.kymjs.kjframe"
android:versionCode="223"
android:versionName="2.239" >
android:versionCode="224"
android:versionName="2.24" >

<uses-sdk
android:minSdkVersion="11"
Expand Down
6 changes: 2 additions & 4 deletions KJFrame/src/org/kymjs/kjframe/bitmap/BitmapConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ public class BitmapConfig {
public static ImageCache mMemoryCache;

public int cacheTime = 1440000;

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

public BitmapConfig() {
File folder = FileUtils.getSaveFolder(CACHEPATH);
Expand Down
4 changes: 2 additions & 2 deletions KJFrame/src/org/kymjs/kjframe/bitmap/ImageDisplayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public class ImageDisplayer {
private final KJHttp mKJHttp; // 使用KJHttp的线程池执行队列去加载图片

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

private Runnable mRunnable;
private final Handler mHandler = new Handler(Looper.getMainLooper());
Expand All @@ -64,6 +63,7 @@ public ImageDisplayer(BitmapConfig bitmapConfig) {
config.cacheTime = bitmapConfig.cacheTime;
mKJHttp = new KJHttp(config);
mMemoryCache = BitmapConfig.mMemoryCache;
mResponseDelayMs = bitmapConfig.delayTime;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion KJFrame/src/org/kymjs/kjframe/http/HttpConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public HttpStack httpStackFactory() {
return new HttpConnectStack();
} else {
return new HttpClientStack(
AndroidHttpClient.newInstance("volley/0"));
AndroidHttpClient.newInstance("kjframe/0"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion KJFrame/src/org/kymjs/kjframe/utils/KJConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
public final class KJConfig {

public static final double VERSION = 2.239;
public static final double VERSION = 2.24;

/** 错误处理广播 */
public static final String RECEIVER_ERROR = KJConfig.class.getName()
Expand Down
Binary file not shown.

0 comments on commit 928e715

Please sign in to comment.