Commit 3636de24 authored by 林生雨's avatar 林生雨

commit

parent 703b4906
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidLogFilters">
<option name="TOOL_WINDOW_LOG_LEVEL" value="verbose" />
<option name="TOOL_WINDOW_LOG_LEVEL" value="error" />
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
</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/.idea/caches/build_file_checksums.ser" beforeDir="false" afterPath="$PROJECT_DIR$/android/.idea/caches/build_file_checksums.ser" 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/bean/MediaFile.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/bean/MediaFile.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ImageScanner.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ImageScanner.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/VideoScanner.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/VideoScanner.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/utils/MyUtil.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/utils/MyUtil.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/android/.idea/caches/build_file_checksums.ser" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/.idea/caches/build_file_checksums.ser" 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/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/pubspec.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/gengmei_flutter_plugin.iml" beforeDir="false" afterPath="$PROJECT_DIR$/gengmei_flutter_plugin.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
......@@ -28,15 +41,19 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/temp.dart">
<provider selected="true" editor-type-id="text-editor" />
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="26" column="36" selection-start-line="26" selection-start-column="24" selection-end-line="26" selection-end-column="36" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$USER_HOME$/Downloads/flutter/packages/flutter/lib/src/material/icons.dart">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45144">
<caret line="2054" column="24" selection-start-line="2054" selection-start-column="24" selection-end-line="2054" selection-end-column="24" />
<state relative-caret-position="88">
<caret line="4" selection-start-line="4" selection-end-line="4" />
</state>
</provider>
</entry>
......@@ -44,8 +61,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1298">
<caret line="70" column="20" selection-start-line="70" selection-start-column="12" selection-end-line="70" selection-end-column="20" />
<state relative-caret-position="111">
<caret line="74" column="7" selection-start-line="59" selection-start-column="4" selection-end-line="74" selection-end-column="7" />
<folding>
<element signature="e#46#66#0" expanded="true" />
</folding>
......@@ -54,74 +71,51 @@
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart">
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396">
<caret line="23" column="47" selection-start-line="23" selection-start-column="47" selection-end-line="23" selection-end-column="47" />
<folding>
<element signature="e#46#106#0" expanded="true" />
</folding>
<state relative-caret-position="1392">
<caret line="267" column="13" selection-start-line="267" selection-start-column="13" selection-end-line="267" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="26" column="36" selection-start-line="26" selection-start-column="24" selection-end-line="26" selection-end-column="36" />
</state>
</provider>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pubspec.lock">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1430">
<caret line="71" column="32" selection-start-line="71" selection-start-column="32" selection-end-line="71" selection-end-column="32" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
<state relative-caret-position="44">
<caret line="2" column="9" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="16" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/SharedPlugin.dart">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="18" column="39" selection-start-line="18" selection-start-column="28" selection-end-line="18" selection-end-column="39" />
<state relative-caret-position="183">
<caret line="387" column="22" selection-start-line="387" selection-start-column="12" selection-end-line="387" selection-end-column="22" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="682">
<caret line="31" column="9" selection-start-line="29" selection-start-column="5" selection-end-line="31" selection-end-column="9" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/AlbumItem.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="154">
<caret line="7" selection-start-line="7" selection-end-line="7" />
</state>
</provider>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$USER_HOME$/Downloads/flutter/packages/flutter/lib/src/services/platform_channel.dart">
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6534">
<caret line="306" column="12" selection-start-line="306" selection-start-column="12" selection-end-line="306" selection-end-column="12" />
</state>
<state relative-caret-position="-138" />
</provider>
</entry>
</file>
......@@ -150,6 +144,8 @@
<find>Icons</find>
<find>dispo</find>
<find>phoneImages</find>
<find>_eventSink</find>
<find>isAdd</find>
</findStrings>
</component>
<component name="Git.Settings">
......@@ -182,10 +178,10 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="439" />
<option name="y" value="-1020" />
<option name="x" value="504" />
<option name="y" value="-895" />
<option name="width" value="1440" />
<option name="height" value="811" />
<option name="height" value="812" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
......@@ -193,6 +189,8 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="AndroidView" />
<pane id="ProjectPane">
<subPane>
......@@ -201,6 +199,24 @@
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
<item name="android" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
<item name="android" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
<item name="android" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
......@@ -210,8 +226,6 @@
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -257,7 +271,8 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="439" y="-1020" width="1440" height="811" extended-state="0" />
<frame x="297" y="-941" width="1440" height="812" extended-state="0" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.1695279" />
<window_info id="Captures" order="1" side_tool="true" />
......@@ -272,13 +287,13 @@
<window_info anchor="bottom" id="Run" order="1" weight="0.4625" />
<window_info anchor="bottom" id="TODO" order="2" />
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.33977902" />
<window_info active="true" anchor="bottom" id="Logcat" order="4" visible="true" weight="0.21666667" />
<window_info anchor="bottom" id="Debug" order="5" />
<window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.4812239" />
<window_info anchor="bottom" id="Terminal" order="6" weight="0.25555557" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="bottom" id="Flutter Performance" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" />
<window_info anchor="bottom" id="Messages" order="10" weight="0.3451417" />
<window_info anchor="bottom" id="Messages" order="10" weight="0.34444445" />
<window_info anchor="right" id="Device File Explorer" order="0" side_tool="true" weight="0.32960597" />
<window_info anchor="right" id="Capture Analysis" order="1" />
<window_info anchor="right" id="Theme Preview" order="2" />
......@@ -332,9 +347,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.lock">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
......@@ -385,25 +397,12 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="44">
<caret line="2" column="9" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/android/app/app.iml">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/AlbumItem.m">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/AlbumItem.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.m">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1276">
......@@ -418,13 +417,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="88">
<caret line="4" selection-start-line="4" selection-end-line="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/result/ResultManager.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="814">
......@@ -432,23 +424,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3938">
<caret line="207" column="93" selection-start-line="207" selection-start-column="80" selection-end-line="207" selection-end-column="93" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="15" column="4" selection-start-line="15" selection-start-column="4" selection-end-line="15" selection-end-column="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/luban/Engine.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1606">
......@@ -486,16 +461,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1298">
<caret line="70" column="20" selection-start-line="70" selection-start-column="12" selection-end-line="70" selection-end-column="20" />
<folding>
<element signature="e#46#66#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="396">
......@@ -554,5 +519,57 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/AlbumItem.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-138" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="88">
<caret line="4" selection-start-line="4" selection-end-line="4" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="183">
<caret line="387" column="22" selection-start-line="387" selection-start-column="12" selection-end-line="387" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="111">
<caret line="74" column="7" selection-start-line="59" selection-start-column="4" selection-end-line="74" selection-end-column="7" />
<folding>
<element signature="e#46#66#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1392">
<caret line="267" column="13" selection-start-line="267" selection-start-column="13" selection-end-line="267" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.lock">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="44">
<caret line="2" column="9" selection-start-line="2" selection-start-column="9" selection-end-line="2" selection-end-column="16" />
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
......@@ -3,7 +3,9 @@ package com.example.myimagepicker.repository
import android.content.Context
import android.graphics.BitmapFactory
import android.os.Environment
import android.provider.MediaStore
import android.util.Log
import com.example.gengmei_flutter_plugin.utils.MyUtil
import com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getFileFullName
import com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getFileName
import com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getImageCacheDir
......@@ -11,6 +13,7 @@ import com.example.myimagepicker.bean.MediaFile
import com.example.myimagepicker.bean.MediaFolder
import com.example.myimagepicker.luban.Luban
import com.example.myimagepicker.repository.local.ImageScanner
import com.example.myimagepicker.repository.local.VideoScanner
import io.reactivex.Observable
import io.reactivex.ObservableOnSubscribe
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -35,7 +38,6 @@ class ImageRespository {
var finishOneTask = false
val fileDir = Environment.getExternalStorageDirectory().absolutePath + "/GMAlbum/.album";
//: HashMap<String, ArrayList<HashMap<String, Any>>>
fun scanPhoneImage(context: Context): Observable<HashMap<String, ArrayList<HashMap<String, Any>>>> {
......@@ -48,10 +50,15 @@ class ImageRespository {
.subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread())
}
return Observable.create(ObservableOnSubscribe<HashMap<String, ArrayList<HashMap<String, Any>>>> {
it.onNext(getFinalMap(context, ImageScanner(context).queryMedia()))
// val images = ArrayList<MediaFile>()
val images = ImageScanner(context).queryMedia()
val videos = VideoScanner(context).queryMedia()
images.addAll(videos)
it.onNext(getFinalMap(context, images))
}).subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread())
}
fun savePreviewImg(context: Context, listener: savePreviewListener) {
val needSize = recordImageListMap.size;
var currentSize = 0;
......@@ -62,11 +69,16 @@ class ImageRespository {
val realPath = it["realPath"] as String
if (any == null) {
globalThreadPool.execute {
if (it["isVideo"] == "T") {
it["path"] = MyUtil.saveVideoImg("${fileDir}/${getFileName(realPath)!!}.png",
realPath, MediaStore.Images.Thumbnails.MICRO_KIND, 220, 220)
} else {
val get = Luban.with(context).setTargetDir(fileDir)
.setName(getFileName(realPath)!!)
.get(realPath);
it["path"] = get.absolutePath;
}
//getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath
val get = Luban.with(context).setTargetDir(fileDir)
.setName(getFileName(realPath)!!)
.get(realPath);
it["path"] = get.absolutePath;
synchronized(this) {
currentSize++;
noPathSize++;
......@@ -158,6 +170,14 @@ class ImageRespository {
it.realPath?.run {
itemMap.put("realPath", this)
}
it.isVideo?.run {
if (this) {
itemMap.put("isVideo", "T")
itemMap.put("during", "${it.duration}")
} else {
itemMap.put("isVideo", "F")
}
}
imageListMap.add(itemMap)
}
synchronized(this) {
......@@ -177,14 +197,29 @@ class ImageRespository {
finalList[this as String] = ArrayList<HashMap<String, Any>>()
if (it["path"] == null) {
val realPath = it["realPath"] as String
val get = Luban.with(context).setTargetDir(
fileDir
// getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath
)
.setName(getFileName(realPath)!!)
.get(realPath);
it["path"] = get.absolutePath
Log.e("lsy", "封面照片 ${get.absolutePath}");
if (it["isVideo"] == "T") {
it["path"] = MyUtil.saveVideoImg("${fileDir}/${getFileName(realPath)!!}.png",
realPath, MediaStore.Images.Thumbnails.MINI_KIND, 300, 300)
} else {
val png = File("${fileDir}/${getFileName(realPath)!!}.png")
val jpg = File("${fileDir}/${getFileName(realPath)!!}.jpg")
val jpeg = File("${fileDir}/${getFileName(realPath)!!}.jpeg")
if (png.exists()) {
it["path"] = png.absolutePath
} else if (jpg.exists()) {
it["path"] = jpg.absolutePath
} else if (jpeg.exists()) {
it["path"] = jpeg.absolutePath
} else {
val get = Luban.with(context).setTargetDir(
fileDir
)
.setName(getFileName(realPath)!!)
.get(realPath);
it["path"] = get.absolutePath
Log.e("lsy", "封面照片 ${get.absolutePath}");
}
}
}
finalList[this]!!.add(it);
} else {
......
......@@ -15,5 +15,6 @@ data class MediaFile(
var size: Long = 0,
var isBigIm: Boolean = false,
var bigScare: Float = 0f,
var realPath: String? = null
var realPath: String? = null,
var isVideo: Boolean? = null
)
......@@ -60,6 +60,7 @@ class ImageScanner(var context: Context) : AbsMediaScanner<MediaFile>(context) {
mediaFile.dateToken = dateToken
mediaFile.size = size
mediaFile.realPath = path
mediaFile.isVideo = false
val dir = Environment.getExternalStorageDirectory().absolutePath + "/GMAlbum/.album";
// val dir = getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath;
val tempFilePngString = dir + "/" + getFileName(path)!! + ".png";
......
......@@ -3,8 +3,11 @@ package com.example.myimagepicker.repository.local
import android.content.Context
import android.database.Cursor
import android.net.Uri
import android.os.Environment
import android.provider.MediaStore
import com.example.gengmei_flutter_plugin.utils.MyUtil
import com.example.myimagepicker.bean.MediaFile
import java.io.File
/**
* Created by lsy
......@@ -19,16 +22,19 @@ class VideoScanner(private val mContext: Context) : AbsMediaScanner<MediaFile>(m
override val projection: Array<String>
get() =
arrayOf(MediaStore.Video.Media.DATA, MediaStore.Video.Media.MIME_TYPE, MediaStore.Video.Media.BUCKET_ID, MediaStore.Video.Media.BUCKET_DISPLAY_NAME, MediaStore.Video.Media.DURATION, MediaStore.Video.Media.DATE_TAKEN)
arrayOf(MediaStore.Video.Media.DATA, MediaStore.Video.Media.MIME_TYPE, MediaStore.Video.Media.BUCKET_ID, MediaStore.Video.Media.BUCKET_DISPLAY_NAME, MediaStore.Video.Media.DURATION, MediaStore.Video.Media.DATE_TAKEN, MediaStore.Images.Media.SIZE
)
override val order: String
get() = MediaStore.Video.Media.DATE_TAKEN + " desc"
override val selectionArgs: Array<String>?
get() = null
// get() = null
get() = arrayOf("video/mp4", "video/avi")
override val selection: String
get() = ""
get() = (MediaStore.Video.Media.MIME_TYPE + "=? or "
+ MediaStore.Video.Media.MIME_TYPE + "=?")
/**
......@@ -47,12 +53,31 @@ class VideoScanner(private val mContext: Context) : AbsMediaScanner<MediaFile>(m
val dateToken = cursor.getLong(cursor.getColumnIndex(MediaStore.Video.Media.DATE_TAKEN))
val mediaFile = MediaFile()
mediaFile.path = path
mediaFile.realPath = path
mediaFile.mime = mime
mediaFile.folderId = folderId
mediaFile.folderName = folderName
mediaFile.duration = duration
mediaFile.dateToken = dateToken
mediaFile.isVideo=true
val dir = Environment.getExternalStorageDirectory().absolutePath + "/GMAlbum/.album"
// val dir = getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath;
val tempFilePngString = dir + "/" + MyUtil.getFileName(path)!! + ".png";
val tempFilePngExists = File(tempFilePngString).exists()
if (tempFilePngExists) {
mediaFile.path = tempFilePngString;
}
val tempFileJpgString = dir + "/" + MyUtil.getFileName(path)!! + ".jpg";
val tempFileJpgExists = File(tempFileJpgString).exists()
if (tempFileJpgExists) {
mediaFile.path = tempFileJpgString;
}
val tempFileJpegString = dir + "/" + MyUtil.getFileName(path)!! + ".jpeg"
val tempFileJpegExists = File(tempFileJpegString).exists()
if (tempFileJpegExists) {
mediaFile.path = tempFileJpegString;
}
return mediaFile
}
......
......@@ -4,6 +4,12 @@ import android.content.Context
import android.util.Log
import com.example.myimagepicker.luban.Luban
import java.io.File
import android.media.ThumbnailUtils
import android.graphics.Bitmap
import android.util.DebugUtils
import java.io.FileOutputStream
import java.lang.Exception
/**
* @author lsy
......@@ -13,7 +19,7 @@ import java.io.File
class MyUtil {
companion object{
companion object {
fun getImageCacheDir(context: Context, cacheName: String): File? {
val cacheDir = context.externalCacheDir
if (cacheDir != null) {
......@@ -49,5 +55,28 @@ class MyUtil {
null
}
}
fun saveVideoImg(filePath: String, videoPath: String, kind: Int, width: Int, height: Int): String {
val file = File(filePath);
var bitmap: Bitmap? = null
// 获取视频的缩略图
bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind)
if (width > 0 && height > 0) {
bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height,
ThumbnailUtils.OPTIONS_RECYCLE_INPUT)
}
try {
val out = FileOutputStream(file)
bitmap.compress(Bitmap.CompressFormat.PNG, 80, out)
out.flush()
out.close()
bitmap.recycle()
} catch (e: Exception) {
e.printStackTrace()
}
return filePath
}
}
}
......@@ -5,35 +5,35 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.11"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.2"
flutter:
......@@ -57,44 +57,44 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.7.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
rxdart:
dependency: "direct main"
description:
name: rxdart
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.22.3"
version: "0.22.4"
sky_engine:
dependency: transitive
description: flutter
......@@ -104,56 +104,56 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.5"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
sdks:
......
......@@ -17,7 +17,6 @@
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/ios/Flutter/App.framework/flutter_assets/packages" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/Flutter/App.framework/flutter_assets/packages" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
......
......@@ -413,6 +413,11 @@ bool isRunning=false;
self.nowSize++;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:tmpPath forKey:@"path"];
if(assets.mediaType==PHAssetMediaTypeVideo){
[queryItemDict setObject:@"T" forKey:@"isVideo"];
}else{
[queryItemDict setObject:@"F" forKey:@"isVideo"];
}
NSMutableArray * arr=self.finalMap[docName];
if (arr==nil) {
self.finalMap[docName]=[NSMutableArray array];
......@@ -460,6 +465,11 @@ bool isRunning=false;
NSMutableDictionary* queryItemDict = [NSMutableDictionary dictionary];
[queryItemDict setObject:tmpPath forKey:@"path"];
[queryItemDict setObject:imgName forKey:@"name"];
if(assets.mediaType==PHAssetMediaTypeVideo){
[queryItemDict setObject:@"T" forKey:@"isVideo"];
}else{
[queryItemDict setObject:@"F" forKey:@"isVideo"];
}
NSMutableArray * arr=self.finalMap[docName];
self.nowSize++;
if (arr==nil) {
......@@ -507,8 +517,21 @@ bool isRunning=false;
__block NSString *tmpPath=[cacheDirectory stringByAppendingPathComponent:imgName];
if ([fileManager fileExistsAtPath:realPath]==YES){
self.nowSize++;
if(assets.mediaType==PHAssetMediaTypeVideo){
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
options.version = PHImageRequestOptionsVersionCurrent;
options.networkAccessAllowed = true;
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
[[PHImageManager defaultManager]requestAVAssetForVideo:assets options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
}];
}else{
}
NSLog(@"!!!REAL IS EXIE!! %@",realPath);
NSMutableArray<NSMutableDictionary<NSString*,NSObject*>*>* array=self.finalMap[docName];
for (int x=0; x<[array count]; x++) {
NSMutableDictionary<NSString*,NSObject*>* map=[array objectAtIndex:x];
NSString* index=[map objectForKey:@"path"];
......
......@@ -11,12 +11,13 @@ class ScanImagePlugn {
Map<String, List<ScanImageItem>> newMap = new Map();
images.forEach((k, v) {
List<ScanImageItem> tempList = new List();
print("-------UP ${k} ${tempList.length}");
for (var item in v) {
ScanImageItem scanImageItem = new ScanImageItem();
scanImageItem.path = item["path"];
scanImageItem.size = item["size"];
scanImageItem.realPath = item["realPath"];
scanImageItem.path = item["path"] ?? "";
scanImageItem.size = item["size"] ?? "";
scanImageItem.realPath = item["realPath"] ?? "";
scanImageItem.isVideo = item["isVideo"] == "T" ? true : false;
scanImageItem.during = item["during"] ?? "";
tempList.add(scanImageItem);
}
newMap.putIfAbsent(k, () => tempList);
......@@ -38,6 +39,7 @@ class ScanImagePlugn {
class ScanImageItem {
String path;
String realPath;
String during;
bool isVideo;
int size;
bool isSelected = false;
}
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