forked from ym6745476/andbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhaoqp2010
committed
Dec 24, 2013
1 parent
41f85dc
commit df197bb
Showing
147 changed files
with
1,271 additions
and
291 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloadPool$1.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloadPool$2.class
Binary file not shown.
Binary file modified
BIN
+299 Bytes
(110%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloadPool.class
Binary file not shown.
Binary file modified
BIN
+141 Bytes
(100%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloadQueue.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloadTask$1.class
Binary file not shown.
Binary file modified
BIN
-45 Bytes
(99%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloadTask.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/bitmap/AbImageDownloader$1.class
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/download/AbDownloadProgressListener.class
Binary file not shown.
Binary file modified
BIN
+54 Bytes
(100%)
AndBase/bin/classes/com/ab/download/AbDownloadThread.class
Binary file not shown.
Binary file modified
BIN
+14 Bytes
(100%)
AndBase/bin/classes/com/ab/download/AbFileDownloader.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/util/AbFileUtil$FileLastModifSort.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+80 Bytes
(110%)
AndBase/bin/classes/com/ab/view/titlebar/AbBottomBar$1.class
Binary file not shown.
Binary file modified
BIN
+178 Bytes
(100%)
AndBase/bin/classes/com/ab/view/titlebar/AbBottomBar.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
AndBase/bin/classes/com/ab/view/titlebar/AbTitleBar$1.class
Binary file not shown.
Binary file modified
BIN
+2 Bytes
(100%)
AndBase/bin/classes/com/ab/view/titlebar/AbTitleBar$2.class
Binary file not shown.
Binary file modified
BIN
+565 Bytes
(110%)
AndBase/bin/classes/com/ab/view/titlebar/AbTitleBar.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/* | ||
* Copyright (C) 2013 www.418log.org | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.ab.bitmap; | ||
|
||
import java.io.File; | ||
import java.util.HashMap; | ||
import java.util.concurrent.locks.ReentrantLock; | ||
|
||
import com.ab.global.AbAppData; | ||
import com.ab.util.AbFileUtil; | ||
import com.ab.util.AbStrUtil; | ||
|
||
// TODO: Auto-generated Javadoc | ||
/** | ||
* 描述:图片SD卡缓存管理. | ||
* | ||
* @author zhaoqp | ||
* @date:2013-5-23 上午10:10:53 | ||
* @version v1.0 | ||
*/ | ||
|
||
public class AbFileCache { | ||
|
||
/** The tag. */ | ||
private static String TAG = "AbFileCache"; | ||
|
||
/** The Constant D. */ | ||
private static final boolean D = AbAppData.DEBUG; | ||
|
||
/** 10MB. */ | ||
public static int maxCacheSize = 10 * 1024 * 1024; | ||
|
||
/** 当前缓存大小. */ | ||
public static int cacheSize = 0; | ||
|
||
/** 文件缓存(文件名,文件) */ | ||
private static final HashMap<String, File> fileCache = new HashMap<String, File>(); | ||
|
||
/**锁对象*/ | ||
public static final ReentrantLock lock = new ReentrantLock(); | ||
|
||
static { | ||
//初始化缓存 | ||
AbFileUtil.initFileCache(); | ||
} | ||
|
||
/** | ||
* 描述:从缓存中获取这个File. | ||
* | ||
* @param name 文件名 | ||
* @return the file from mem cache | ||
*/ | ||
public static File getFileFromCache(String name) { | ||
return fileCache.get(name); | ||
} | ||
|
||
/** | ||
* 描述:增加一个File到缓存. | ||
* | ||
* @param name 文件名 | ||
* @param bitmap the bitmap | ||
*/ | ||
public static void addFileToCache(String name,File file){ | ||
try { | ||
lock.lock(); | ||
if(AbStrUtil.isEmpty(name)){ | ||
return; | ||
} | ||
|
||
if (getFileFromCache(name) == null && file!=null) { | ||
fileCache.put(name, file); | ||
} | ||
|
||
//当前大小大于预定缓存空间 | ||
if (cacheSize > maxCacheSize) { | ||
//释放部分文件 | ||
AbFileUtil.freeCacheFiles(); | ||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} finally{ | ||
lock.unlock(); | ||
} | ||
} | ||
|
||
/** | ||
* 描述:从缓存删除. | ||
* | ||
* @param name 文件名 | ||
*/ | ||
public static void removeFileFromCache(String name){ | ||
try { | ||
lock.lock(); | ||
if (getFileFromCache(name) != null) { | ||
fileCache.remove(name); | ||
} | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} finally{ | ||
lock.unlock(); | ||
} | ||
} | ||
|
||
/** | ||
* 描述:清空缓存的Bitmap. | ||
*/ | ||
public static void removeAllFileFromCache() { | ||
AbFileUtil.removeAllFileCache(); | ||
fileCache.clear(); | ||
} | ||
|
||
|
||
/** | ||
* 设置缓存空间大小 | ||
* @param cacheSize | ||
*/ | ||
public static void setMaxCacheSize(int cacheSize) { | ||
AbFileCache.maxCacheSize = cacheSize; | ||
} | ||
|
||
/** | ||
* | ||
* 描述:缓存文件夹的大小 | ||
* @return | ||
* @throws | ||
*/ | ||
public static int getCacheSize() { | ||
return cacheSize; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.