Commit 13da6aa9 authored by 林生雨's avatar 林生雨

commit

parent 888cd394
......@@ -6,11 +6,7 @@
</component>
<component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/Thumb.kt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/Thumb.kt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
......@@ -283,6 +279,7 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="811" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1509299" />
<window_info id="Captures" order="1" side_tool="true" />
......
......@@ -27,6 +27,7 @@ import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import android.media.ThumbnailUtils
import android.graphics.Bitmap
import android.text.TextUtils
/**
......@@ -40,7 +41,7 @@ class ImageRespository {
val recordImageListMap = ArrayList<HashMap<String, Any>>()
var finishOneTask = false
val fileDir = Environment.getExternalStorageDirectory().absolutePath + "/GMAlbum/.album";
val fileDir = Environment.getExternalStorageDirectory().absolutePath + "/.GMAlbum/.album";
//: HashMap<String, ArrayList<HashMap<String, Any>>>
......@@ -64,7 +65,7 @@ class ImageRespository {
val it2 = iterator.next()
for (item in images) {
if (item.id == it2.id) {
if (item.path != null && File(item.path).exists()) {
if (item.path != null && !TextUtils.isEmpty(item.path) && File(item.path).exists()) {
it2.path = item.path
}
it2.isVideo = false
......@@ -80,7 +81,7 @@ class ImageRespository {
val it1 = iteratorVideo.next()
for (item in videos) {
if (item.id == it1.id) {
if (item.path != null && File(item.path).exists()) {
if (item.path != null && !TextUtils.isEmpty(item.path) && File(item.path).exists()) {
it1.path = item.path
}
it1.isVideo = true
......@@ -131,7 +132,7 @@ class ImageRespository {
if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH
listener.onSuccess(toMap(context, recordImageListMap))
listener.onSuccess(toMapSync(context, recordImageListMap))
}
}
return@execute
......@@ -143,7 +144,7 @@ class ImageRespository {
if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH
listener.onSuccess(toMap(context, recordImageListMap))
listener.onSuccess(toMapSync(context, recordImageListMap))
}
}
return@execute
......@@ -155,7 +156,7 @@ class ImageRespository {
if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH
listener.onSuccess(toMap(context, recordImageListMap))
listener.onSuccess(toMapSync(context, recordImageListMap))
}
}
return@execute
......@@ -177,11 +178,11 @@ class ImageRespository {
if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH
listener.onSuccess(toMap(context, recordImageListMap))
listener.onSuccess(toMapSync(context, recordImageListMap))
} else {
if (noPathSize > letSize) {
letSize += 70
listener.onSuccess(toMap(context, recordImageListMap))
listener.onSuccess(toMapSync(context, recordImageListMap))
}
}
}
......@@ -192,7 +193,7 @@ class ImageRespository {
if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH
listener.onSuccess(toMap(context, recordImageListMap))
listener.onSuccess(toMapSync(context, recordImageListMap))
}
}
}
......@@ -324,6 +325,21 @@ class ImageRespository {
return finalList;
}
private fun toMapSync(context: Context, imageListMap: ArrayList<HashMap<String, Any>>): HashMap<String, ArrayList<HashMap<String, Any>>> {
val finalList = HashMap<String, ArrayList<HashMap<String, Any>>>()
imageListMap.forEach {
it["folderName"]?.run {
if (finalList[this] == null) {
finalList[this as String] = ArrayList<HashMap<String, Any>>()
finalList[this]!!.add(it);
} else {
finalList[this as String]!!.add(it);
}
}
}
finalList["IsGengmeiAlbumAllImages"] = imageListMap;
return finalList;
}
companion object {
private var instance: ImageRespository? = null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment