ThumbnailsUtil.java
885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.metroapp.forum;
import android.annotation.SuppressLint;
import android.text.TextUtils;
import java.io.File;
import java.util.HashMap;
public class ThumbnailsUtil {
@SuppressLint("UseSparseArrays")
private static HashMap<Integer,String> hash = new HashMap<Integer, String>();
public static String getThumbnailWithImageID(int key, String defalt){
if(hash == null || !hash.containsKey(key)) {
return defalt;
}
try{
String thumbFilePath = hash.get(key);
if(TextUtils.isEmpty(thumbFilePath)){
return defalt;
}
String thumbPath = thumbFilePath.substring("file://".length());
File file = new File(thumbPath);
if(file.exists()){
return thumbFilePath;
}
}catch(Exception e){}
return defalt;
}
public static void put(Integer key,String value){
hash.put(key, value);
}
public static void clear(){
hash.clear();
}
}