Commit d87af72d authored by 林生雨's avatar 林生雨

commit

parent f4c17948
......@@ -10,8 +10,6 @@
<change beforePath="$PROJECT_DIR$/android/src/main/kotlin/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/kotlin/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt" afterDir="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$/lib/ScanImagePlugn.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/ScanImagePlugn.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
......@@ -31,11 +29,11 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="AKC0218316000622" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="$ENABLE_FLUTTER_DESKTOP$">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="417">
<caret line="67" column="36" selection-start-line="67" selection-start-column="22" selection-end-line="67" selection-end-column="36" />
<state relative-caret-position="176">
<caret line="68" column="55" selection-start-line="68" selection-start-column="39" selection-end-line="68" selection-end-column="55" />
<folding>
<element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
......@@ -102,11 +100,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="$ENABLE_FLUTTER_DESKTOP$">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="462">
<caret line="56" column="63" selection-start-line="56" selection-start-column="63" selection-end-line="56" selection-end-column="63" />
<state relative-caret-position="426">
<caret line="56" column="39" selection-start-line="56" selection-start-column="39" selection-end-line="56" selection-end-column="39" />
<folding>
<element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
......@@ -199,8 +197,8 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="26" />
<option name="y" value="184" />
<option name="x" value="30" />
<option name="y" value="23" />
<option name="width" value="1440" />
<option name="height" value="821" />
</component>
......@@ -275,7 +273,8 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="67" y="23" width="1440" height="821" extended-state="0" />
<frame x="30" y="23" width="1440" height="821" extended-state="0" />
<editor active="$ENABLE_FLUTTER_DESKTOP$" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="$ENABLE_FLUTTER_DESKTOP$" weight="0.19742489" />
<window_info id="Captures" order="1" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
......@@ -599,22 +598,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="417">
<caret line="67" column="36" selection-start-line="67" selection-start-column="22" selection-end-line="67" selection-end-column="36" />
<state relative-caret-position="426">
<caret line="56" column="39" selection-start-line="56" selection-start-column="39" selection-end-line="56" selection-end-column="39" />
<folding>
<element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
<element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="462">
<caret line="56" column="63" selection-start-line="56" selection-start-column="63" selection-end-line="56" selection-end-column="63" />
<state relative-caret-position="176">
<caret line="68" column="55" selection-start-line="68" selection-start-column="39" selection-end-line="68" selection-end-column="55" />
<folding>
<element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
<element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
</state>
</provider>
......
......@@ -379,7 +379,6 @@ class GengmeiFlutterPlugin : MethodCallHandler {
quit_page = false;
ImageRespository.getInstance().scanPhoneImage(resign,albumNeedCache).subscribe(
{
record = it
if (!quit_page) {
ResultManager.getInstance().resultSuccess(resultKey, it);
}
......
......@@ -60,6 +60,80 @@ class ImageRespository {
toMap(context, recordImageListMap))
.subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread())
}
if (!recordImageListMap.isEmpty() && finishOneTask && !needCache) {
return Observable.create(ObservableOnSubscribe<HashMap<String, ArrayList<HashMap<String, Any>>>> {
val realImages = ImageScanner(context.applicationContext).queryMedia()
val realVideos = VideoScanner(context.applicationContext).queryMedia()
realVideos.addAll(realImages);
realVideos.sortByDescending {
it.dateToken
}
val tempList = ArrayList<HashMap<String, Any>>()
val iterator = realVideos.iterator()
while (iterator.hasNext()) {
val next = iterator.next()
var haveIt = false
val mapIter = recordImageListMap.iterator()
while (mapIter.hasNext()) {
val next1 = mapIter.next()
if (next1["realPath"] != null &&
next1["realPath"]!!.equals(next.realPath)) {
haveIt = true
tempList.add(next1);
break
}
}
if (!haveIt) {
var path = ""
val itemMap = HashMap<String, Any>()
var degree = 0
if (next.degree != null) {
degree = next.degree as Int;
}
val tempFilePngString = fileDir + "/" + getFileName(next.realPath!!)!! + ".png";
if (next.isVideo!!) {
path = MyUtil.saveVideoImg("${fileDir}/${getFileName(next.realPath!!)!!}.png",
next.realPath!!, MediaStore.Images.Thumbnails.MICRO_KIND, 220, 220)
} else {
path = MyUtil.scareImg(next.realPath!!, 200f, tempFilePngString, 75, degree)
}
next.folderName?.run {
itemMap.put("folderName", this)
}
if (!haveIt) {
} else {
}
itemMap.put("path", path)
next.degree?.run {
itemMap.put("degree", this)
}
next.size?.run {
itemMap.put("size", this)
}
next.realPath?.run {
itemMap.put("realPath", this)
}
next.isVideo?.run {
if (this) {
itemMap.put("isVideo", "T")
itemMap.put("during", "${next.duration}")
} else {
itemMap.put("isVideo", "F")
}
}
tempList.add(itemMap);
}
}
synchronized(ImageRespository::class.java) {
recordImageListMap.clear()
recordImageListMap.addAll(tempList)
}
it.onNext(toMap(context, tempList))
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
}
return Observable.create(ObservableOnSubscribe<HashMap<String, ArrayList<HashMap<String, Any>>>> {
val st = System.currentTimeMillis();
val images = ThumbUtil.getAllPictures(context.applicationContext)
......@@ -100,6 +174,7 @@ class ImageRespository {
}
Log.e("lsy", " T15555 !! " + (System.currentTimeMillis() - st))
val finalMap = getFinalMap(context, realVideos)
it.onNext(finalMap)
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
}
......@@ -135,7 +210,7 @@ class ImageRespository {
val any = it["path"]
val realPath = it["realPath"] as String
if (any != null && !TextUtils.isEmpty(any as String)) {
synchronized(this) {
synchronized(ImageRespository::class.java) {
currentSize++
Log.e("lsy", "${noPathSize} ${currentSize} ${needSize}")
if (currentSize == needSize) {
......@@ -149,7 +224,7 @@ class ImageRespository {
val tempFilePngString = fileDir + "/" + getFileName(realPath)!! + ".png";
val tempFilePngExists = File(tempFilePngString).exists()
if (tempFilePngExists) {
synchronized(this) {
synchronized(ImageRespository::class.java) {
currentSize++
recordImageListMap[index]["path"] = tempFilePngString
Log.e("lsy", "${noPathSize} ${currentSize} ${needSize}")
......@@ -180,7 +255,7 @@ class ImageRespository {
Log.e("lsy", "TIMM${System.currentTimeMillis() - time}")
}
// getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath
synchronized(this) {
synchronized(ImageRespository::class.java) {
currentSize++
noPathSize++
recordImageListMap[index]["path"] = path
......@@ -279,7 +354,7 @@ class ImageRespository {
}
imageListMap.add(itemMap)
}
synchronized(this) {
synchronized(ImageRespository::class.java) {
recordImageListMap.clear()
recordImageListMap.addAll(imageListMap)
finishOneTask = true
......
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