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

fix bug

parent 41e1e562
......@@ -6,12 +6,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="">
<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$/.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/GengmeiFlutterPlugin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt" 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/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/luban/Engine.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/luban/Engine.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/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" 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/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" 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/" />
......@@ -46,7 +46,7 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="118">
<state relative-caret-position="160">
<caret line="101" column="38" selection-start-line="101" selection-start-column="38" selection-end-line="101" selection-end-column="38" />
<folding>
<element signature="e#46#66#0" expanded="true" />
......@@ -83,7 +83,7 @@
<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="1144">
<caret line="71" column="45" selection-start-line="71" selection-start-column="45" selection-end-line="71" selection-end-column="45" />
<caret line="78" column="45" selection-start-line="78" selection-start-column="45" selection-end-line="78" selection-end-column="45" />
</state>
</provider>
</entry>
......@@ -189,8 +189,8 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="490" />
<option name="y" value="-1080" />
<option name="x" value="451" />
<option name="y" value="-742" />
<option name="width" value="1440" />
<option name="height" value="812" />
</component>
......@@ -335,7 +335,7 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="490" y="-1080" width="1440" height="812" extended-state="0" />
<frame x="451" y="-742" width="1440" height="812" extended-state="0" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.1695279" />
......@@ -353,7 +353,7 @@
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.6425591" />
<window_info anchor="bottom" id="Debug" order="5" />
<window_info anchor="bottom" id="Terminal" order="6" visible="true" weight="0.22638889" />
<window_info anchor="bottom" id="Terminal" order="6" visible="true" weight="0.3" />
<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" />
......@@ -539,7 +539,7 @@
<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="1144">
<caret line="71" column="45" selection-start-line="71" selection-start-column="45" selection-end-line="71" selection-end-column="45" />
<caret line="78" column="45" selection-start-line="78" selection-start-column="45" selection-end-line="78" selection-end-column="45" />
</state>
</provider>
</entry>
......@@ -613,7 +613,7 @@
</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="118">
<state relative-caret-position="160">
<caret line="101" column="38" selection-start-line="101" selection-start-column="38" selection-end-line="101" selection-end-column="38" />
<folding>
<element signature="e#46#66#0" expanded="true" />
......
......@@ -223,6 +223,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
fun ScanImage(resultKey: Long) {
ImageRespository.getInstance().scanPhoneImage(resign.context().applicationContext).subscribe(
{
record = it
......
......@@ -2,6 +2,7 @@ package com.example.myimagepicker.repository
import android.content.Context
import android.graphics.BitmapFactory
import android.os.Environment
import android.util.Log
import com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getFileFullName
import com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getFileName
......@@ -32,11 +33,16 @@ class ImageRespository {
val recordImageListMap = ArrayList<HashMap<String, Any>>()
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>>>> {
val file = File(fileDir);
if (!file.exists()) {
file.mkdirs();
}
if (!recordImageListMap.isEmpty() && finishOneTask) {
return Observable.just(toMap(context, recordImageListMap))
.subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread())
......@@ -56,7 +62,8 @@ class ImageRespository {
val realPath = it["realPath"] as String
if (any == null) {
globalThreadPool.execute {
val get = Luban.with(context).setTargetDir(getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.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;
......@@ -170,7 +177,10 @@ 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(getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath)
val get = Luban.with(context).setTargetDir(
fileDir
// getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath
)
.setName(getFileName(realPath)!!)
.get(realPath);
it["path"] = get.absolutePath
......
......@@ -4,6 +4,7 @@ import android.content.Context
import android.database.Cursor
import android.graphics.BitmapFactory
import android.net.Uri
import android.os.Environment
import android.provider.MediaStore
import android.util.Log
import com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getFileName
......@@ -59,7 +60,8 @@ class ImageScanner(var context: Context) : AbsMediaScanner<MediaFile>(context) {
mediaFile.dateToken = dateToken
mediaFile.size = size
mediaFile.realPath = path
val dir = getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath;
val dir = Environment.getExternalStorageDirectory().absolutePath + "/GMAlbum/.album";
// val dir = getImageCacheDir(context, Luban.DEFAULT_DISK_CACHE_DIR)!!.absolutePath;
val tempFilePngString = dir + "/" + getFileName(path)!! + ".png";
val tempFilePngExists = File(tempFilePngString).exists()
if (tempFilePngExists) {
......
......@@ -70,7 +70,7 @@ constructor(private val srcImg: InputStreamProvider, private val tagImgPath: Str
if (quality == 100) {
options.inSampleSize = computeSize()
} else {
options.inSampleSize = (srcWidth / 200).toInt();
options.inSampleSize = (srcWidth / 240).toInt();
}
// Log.e("lsy"," SAMPLE SIZE ${options.inSampleSize} ${srcWidth}")
......
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