@@ -46,7 +46,7 @@ public class FileUtils {
|
||
| 46 | 46 |
public boolean accept(File pathname) {
|
| 47 | 47 |
String filePath = pathname.getAbsolutePath(); |
| 48 | 48 |
return (filePath.endsWith(".png") || filePath.endsWith(".jpg") || filePath
|
| 49 |
- .endsWith(".jpeg"));
|
|
| 49 |
+ .endsWith(".jpeg")||filePath.endsWith(".PNG")||filePath.endsWith(".JPG")||filePath.endsWith(".JPEG"));
|
|
| 50 | 50 |
} |
| 51 | 51 |
})) {
|
| 52 | 52 |
photos.add(new PhotoItem(file.getAbsolutePath(), file.lastModified())); |
@@ -6,11 +6,13 @@ import android.graphics.Bitmap; |
||
| 6 | 6 |
import android.graphics.BitmapFactory; |
| 7 | 7 |
import android.graphics.Matrix; |
| 8 | 8 |
import android.media.ExifInterface; |
| 9 |
+import android.os.Environment; |
|
| 9 | 10 |
import android.provider.MediaStore; |
| 10 | 11 |
|
| 11 | 12 |
import com.android.common.utils.DeviceUtils; |
| 12 | 13 |
import com.android.common.utils.LogHelper; |
| 13 | 14 |
|
| 15 |
+import java.io.File; |
|
| 14 | 16 |
import java.util.ArrayList; |
| 15 | 17 |
import java.util.HashMap; |
| 16 | 18 |
import java.util.List; |
@@ -115,15 +117,19 @@ public class ImageUtils {
|
||
| 115 | 117 |
public static Map<String, Album> findGalleries(Context mContext, List<String> paths) {
|
| 116 | 118 |
paths.clear(); |
| 117 | 119 |
paths.add(FileUtils.getInst().getSystemPhotoPath()); |
| 120 |
+ String QQDir = "/mnt/sdcard/tencent/QQ_Images"; |
|
| 121 |
+ String WXDir = "/mnt/sdcard/tencent/MicroMsg/WeiXin"; |
|
| 122 |
+ paths.add(QQDir); |
|
| 123 |
+ paths.add(WXDir); |
|
| 118 | 124 |
String[] projection = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA,
|
| 119 | 125 |
MediaStore.Images.Media.DATE_ADDED }; |
| 120 | 126 |
long startTime = System.currentTimeMillis()-1000*60*60*24*7L; |
| 121 | 127 |
startTime = startTime/1000; |
| 122 | 128 |
Cursor cursor = mContext.getContentResolver().query( |
| 123 | 129 |
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection,//指定所要查询的字段 |
| 124 |
- MediaStore.Images.Media.SIZE + ">? and "+ MediaStore.Images.Media.DATE_MODIFIED+" > ?" ,//查询条件 |
|
| 130 |
+ MediaStore.Images.Media.SIZE + ">? and "+ MediaStore.Images.Media.DATE_ADDED+" > ?" ,//查询条件 |
|
| 125 | 131 |
new String[] { "10000",String.valueOf(startTime) }, //查询条件中问号对应的值
|
| 126 |
- MediaStore.Images.Media.DATE_MODIFIED + " desc"); |
|
| 132 |
+ MediaStore.Images.Media.DATE_ADDED + " desc"); |
|
| 127 | 133 |
|
| 128 | 134 |
cursor.moveToFirst(); |
| 129 | 135 |
//文件夹照片 |
@@ -158,6 +164,24 @@ public class ImageUtils {
|
||
| 158 | 164 |
galleries.remove(FileUtils.getInst().getSystemPhotoPath()); |
| 159 | 165 |
paths.remove(FileUtils.getInst().getSystemPhotoPath()); |
| 160 | 166 |
} |
| 167 |
+ |
|
| 168 |
+ ArrayList<PhotoItem> tencentPhotos = FileUtils.getInst().findPicsInDir( |
|
| 169 |
+ QQDir); |
|
| 170 |
+ if (!tencentPhotos.isEmpty()) {
|
|
| 171 |
+ galleries.put(QQDir, new Album("QQ", QQDir, tencentPhotos));
|
|
| 172 |
+ } else {
|
|
| 173 |
+ galleries.remove(QQDir); |
|
| 174 |
+ paths.remove(QQDir); |
|
| 175 |
+ } |
|
| 176 |
+ |
|
| 177 |
+ ArrayList<PhotoItem> wxPhotos = FileUtils.getInst().findPicsInDir( |
|
| 178 |
+ WXDir); |
|
| 179 |
+ if (!wxPhotos.isEmpty()) {
|
|
| 180 |
+ galleries.put(WXDir, new Album("WeiXin", WXDir, wxPhotos));
|
|
| 181 |
+ } else {
|
|
| 182 |
+ galleries.remove(WXDir); |
|
| 183 |
+ paths.remove(WXDir); |
|
| 184 |
+ } |
|
| 161 | 185 |
return galleries; |
| 162 | 186 |
} |
| 163 | 187 |
} |