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

commit

parent 888cd394
...@@ -6,11 +6,7 @@ ...@@ -6,11 +6,7 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment=""> <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/ImageRespository.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" 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" />
</list> </list>
<ignored path="$PROJECT_DIR$/.dart_tool/" /> <ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
...@@ -283,6 +279,7 @@ ...@@ -283,6 +279,7 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="811" extended-state="6" /> <frame x="0" y="23" width="1440" height="811" extended-state="6" />
<editor active="true" />
<layout> <layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1509299" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1509299" />
<window_info id="Captures" order="1" side_tool="true" /> <window_info id="Captures" order="1" side_tool="true" />
......
...@@ -27,6 +27,7 @@ import kotlin.collections.ArrayList ...@@ -27,6 +27,7 @@ import kotlin.collections.ArrayList
import kotlin.collections.HashMap import kotlin.collections.HashMap
import android.media.ThumbnailUtils import android.media.ThumbnailUtils
import android.graphics.Bitmap import android.graphics.Bitmap
import android.text.TextUtils
/** /**
...@@ -40,7 +41,7 @@ class ImageRespository { ...@@ -40,7 +41,7 @@ class ImageRespository {
val recordImageListMap = ArrayList<HashMap<String, Any>>() val recordImageListMap = ArrayList<HashMap<String, Any>>()
var finishOneTask = false var finishOneTask = false
val fileDir = Environment.getExternalStorageDirectory().absolutePath + "/GMAlbum/.album"; val fileDir = Environment.getExternalStorageDirectory().absolutePath + "/.GMAlbum/.album";
//: HashMap<String, ArrayList<HashMap<String, Any>>> //: HashMap<String, ArrayList<HashMap<String, Any>>>
...@@ -64,7 +65,7 @@ class ImageRespository { ...@@ -64,7 +65,7 @@ class ImageRespository {
val it2 = iterator.next() val it2 = iterator.next()
for (item in images) { for (item in images) {
if (item.id == it2.id) { 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.path = item.path
} }
it2.isVideo = false it2.isVideo = false
...@@ -80,7 +81,7 @@ class ImageRespository { ...@@ -80,7 +81,7 @@ class ImageRespository {
val it1 = iteratorVideo.next() val it1 = iteratorVideo.next()
for (item in videos) { for (item in videos) {
if (item.id == it1.id) { 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.path = item.path
} }
it1.isVideo = true it1.isVideo = true
...@@ -131,7 +132,7 @@ class ImageRespository { ...@@ -131,7 +132,7 @@ class ImageRespository {
if (currentSize == needSize) { if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}") Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH //FINISH
listener.onSuccess(toMap(context, recordImageListMap)) listener.onSuccess(toMapSync(context, recordImageListMap))
} }
} }
return@execute return@execute
...@@ -143,7 +144,7 @@ class ImageRespository { ...@@ -143,7 +144,7 @@ class ImageRespository {
if (currentSize == needSize) { if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}") Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH //FINISH
listener.onSuccess(toMap(context, recordImageListMap)) listener.onSuccess(toMapSync(context, recordImageListMap))
} }
} }
return@execute return@execute
...@@ -155,7 +156,7 @@ class ImageRespository { ...@@ -155,7 +156,7 @@ class ImageRespository {
if (currentSize == needSize) { if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}") Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH //FINISH
listener.onSuccess(toMap(context, recordImageListMap)) listener.onSuccess(toMapSync(context, recordImageListMap))
} }
} }
return@execute return@execute
...@@ -177,11 +178,11 @@ class ImageRespository { ...@@ -177,11 +178,11 @@ class ImageRespository {
if (currentSize == needSize) { if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}") Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH //FINISH
listener.onSuccess(toMap(context, recordImageListMap)) listener.onSuccess(toMapSync(context, recordImageListMap))
} else { } else {
if (noPathSize > letSize) { if (noPathSize > letSize) {
letSize += 70 letSize += 70
listener.onSuccess(toMap(context, recordImageListMap)) listener.onSuccess(toMapSync(context, recordImageListMap))
} }
} }
} }
...@@ -192,7 +193,7 @@ class ImageRespository { ...@@ -192,7 +193,7 @@ class ImageRespository {
if (currentSize == needSize) { if (currentSize == needSize) {
Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}") Log.e("lsy", " 压缩完成 耗时:${System.currentTimeMillis() - start}")
//FINISH //FINISH
listener.onSuccess(toMap(context, recordImageListMap)) listener.onSuccess(toMapSync(context, recordImageListMap))
} }
} }
} }
...@@ -324,6 +325,21 @@ class ImageRespository { ...@@ -324,6 +325,21 @@ class ImageRespository {
return finalList; 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 { companion object {
private var instance: ImageRespository? = null 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