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

commit

parent f4c17948
...@@ -10,8 +10,6 @@ ...@@ -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/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$/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$/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> </list>
<ignored path="$PROJECT_DIR$/.dart_tool/" /> <ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
...@@ -31,11 +29,11 @@ ...@@ -31,11 +29,11 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="AKC0218316000622" /> <component name="ExecutionTargetManager" SELECTED_TARGET="AKC0218316000622" />
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <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"> <entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor"> <provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="417"> <state relative-caret-position="176">
<caret line="67" column="36" selection-start-line="67" selection-start-column="22" selection-end-line="67" selection-end-column="36" /> <caret line="68" column="55" selection-start-line="68" selection-start-column="39" selection-end-line="68" selection-end-column="55" />
<folding> <folding>
<element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" /> <element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding> </folding>
...@@ -102,11 +100,11 @@ ...@@ -102,11 +100,11 @@
</provider> </provider>
</entry> </entry>
</file> </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"> <entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor"> <provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="462"> <state relative-caret-position="426">
<caret line="56" column="63" selection-start-line="56" selection-start-column="63" selection-end-line="56" selection-end-column="63" /> <caret line="56" column="39" selection-start-line="56" selection-start-column="39" selection-end-line="56" selection-end-column="39" />
<folding> <folding>
<element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" /> <element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding> </folding>
...@@ -199,8 +197,8 @@ ...@@ -199,8 +197,8 @@
</option> </option>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="26" /> <option name="x" value="30" />
<option name="y" value="184" /> <option name="y" value="23" />
<option name="width" value="1440" /> <option name="width" value="1440" />
<option name="height" value="821" /> <option name="height" value="821" />
</component> </component>
...@@ -275,7 +273,8 @@ ...@@ -275,7 +273,8 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <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> <layout>
<window_info content_ui="combo" id="Project" order="0" visible="$ENABLE_FLUTTER_DESKTOP$" weight="0.19742489" /> <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$" /> <window_info id="Captures" order="1" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
...@@ -599,22 +598,22 @@ ...@@ -599,22 +598,22 @@
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="417"> <state relative-caret-position="426">
<caret line="67" column="36" selection-start-line="67" selection-start-column="22" selection-end-line="67" selection-end-column="36" /> <caret line="56" column="39" selection-start-line="56" selection-start-column="39" selection-end-line="56" selection-end-column="39" />
<folding> <folding>
<element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" /> <element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="462"> <state relative-caret-position="176">
<caret line="56" column="63" selection-start-line="56" selection-start-column="63" selection-end-line="56" selection-end-column="63" /> <caret line="68" column="55" selection-start-line="68" selection-start-column="39" selection-end-line="68" selection-end-column="55" />
<folding> <folding>
<element signature="e#0#20#0" expanded="$ENABLE_FLUTTER_DESKTOP$" /> <element signature="e#45#86#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding> </folding>
</state> </state>
</provider> </provider>
......
...@@ -379,7 +379,6 @@ class GengmeiFlutterPlugin : MethodCallHandler { ...@@ -379,7 +379,6 @@ class GengmeiFlutterPlugin : MethodCallHandler {
quit_page = false; quit_page = false;
ImageRespository.getInstance().scanPhoneImage(resign,albumNeedCache).subscribe( ImageRespository.getInstance().scanPhoneImage(resign,albumNeedCache).subscribe(
{ {
record = it
if (!quit_page) { if (!quit_page) {
ResultManager.getInstance().resultSuccess(resultKey, it); ResultManager.getInstance().resultSuccess(resultKey, it);
} }
......
...@@ -60,6 +60,80 @@ class ImageRespository { ...@@ -60,6 +60,80 @@ class ImageRespository {
toMap(context, recordImageListMap)) toMap(context, recordImageListMap))
.subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread()) .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>>>> { return Observable.create(ObservableOnSubscribe<HashMap<String, ArrayList<HashMap<String, Any>>>> {
val st = System.currentTimeMillis(); val st = System.currentTimeMillis();
val images = ThumbUtil.getAllPictures(context.applicationContext) val images = ThumbUtil.getAllPictures(context.applicationContext)
...@@ -100,6 +174,7 @@ class ImageRespository { ...@@ -100,6 +174,7 @@ class ImageRespository {
} }
Log.e("lsy", " T15555 !! " + (System.currentTimeMillis() - st)) Log.e("lsy", " T15555 !! " + (System.currentTimeMillis() - st))
val finalMap = getFinalMap(context, realVideos) val finalMap = getFinalMap(context, realVideos)
it.onNext(finalMap) it.onNext(finalMap)
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
} }
...@@ -135,7 +210,7 @@ class ImageRespository { ...@@ -135,7 +210,7 @@ class ImageRespository {
val any = it["path"] val any = it["path"]
val realPath = it["realPath"] as String val realPath = it["realPath"] as String
if (any != null && !TextUtils.isEmpty(any as String)) { if (any != null && !TextUtils.isEmpty(any as String)) {
synchronized(this) { synchronized(ImageRespository::class.java) {
currentSize++ currentSize++
Log.e("lsy", "${noPathSize} ${currentSize} ${needSize}") Log.e("lsy", "${noPathSize} ${currentSize} ${needSize}")
if (currentSize == needSize) { if (currentSize == needSize) {
...@@ -149,7 +224,7 @@ class ImageRespository { ...@@ -149,7 +224,7 @@ class ImageRespository {
val tempFilePngString = fileDir + "/" + getFileName(realPath)!! + ".png"; val tempFilePngString = fileDir + "/" + getFileName(realPath)!! + ".png";
val tempFilePngExists = File(tempFilePngString).exists() val tempFilePngExists = File(tempFilePngString).exists()
if (tempFilePngExists) { if (tempFilePngExists) {
synchronized(this) { synchronized(ImageRespository::class.java) {
currentSize++ currentSize++
recordImageListMap[index]["path"] = tempFilePngString recordImageListMap[index]["path"] = tempFilePngString
Log.e("lsy", "${noPathSize} ${currentSize} ${needSize}") Log.e("lsy", "${noPathSize} ${currentSize} ${needSize}")
...@@ -180,7 +255,7 @@ class ImageRespository { ...@@ -180,7 +255,7 @@ class ImageRespository {
Log.e("lsy", "TIMM${System.currentTimeMillis() - time}") Log.e("lsy", "TIMM${System.currentTimeMillis() - time}")
} }
// getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath // getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath
synchronized(this) { synchronized(ImageRespository::class.java) {
currentSize++ currentSize++
noPathSize++ noPathSize++
recordImageListMap[index]["path"] = path recordImageListMap[index]["path"] = path
...@@ -279,7 +354,7 @@ class ImageRespository { ...@@ -279,7 +354,7 @@ class ImageRespository {
} }
imageListMap.add(itemMap) imageListMap.add(itemMap)
} }
synchronized(this) { synchronized(ImageRespository::class.java) {
recordImageListMap.clear() recordImageListMap.clear()
recordImageListMap.addAll(imageListMap) recordImageListMap.addAll(imageListMap)
finishOneTask = true 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