Commit 6ca8a004 authored by 林生雨's avatar 林生雨

mm

parent d37dd26d
......@@ -6,7 +6,11 @@
<option name="TOOL_WINDOW_CONFIGURED_FILTER" value="Show only selected application" />
</component>
<component name="ChangeListManager">
<list default="$ENABLE_FLUTTER_DESKTOP$" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="" />
<list default="$ENABLE_FLUTTER_DESKTOP$" 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/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$/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" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
<ignored path="$PROJECT_DIR$/.pub/" />
......@@ -50,7 +54,7 @@
<file pinned="false" current-in-tab="$ENABLE_FLUTTER_DESKTOP$">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="245">
<state relative-caret-position="77">
<caret line="251" column="22" selection-start-line="251" selection-start-column="22" selection-end-line="251" selection-end-column="22" />
</state>
</provider>
......@@ -64,7 +68,7 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="195">
<state relative-caret-position="3432">
<caret line="171" selection-start-line="171" selection-end-line="171" />
<folding>
<element signature="e#46#66#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
......@@ -191,10 +195,10 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-40" />
<option name="y" value="236" />
<option name="x" value="394" />
<option name="y" value="68" />
<option name="width" value="1440" />
<option name="height" value="825" />
<option name="height" value="814" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="$ENABLE_FLUTTER_DESKTOP$" />
<component name="ProjectView">
......@@ -202,8 +206,6 @@
<foldersAlwaysOnTop value="$ENABLE_FLUTTER_DESKTOP$" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -232,7 +234,9 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="AndroidView" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -279,10 +283,10 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-40" y="236" width="1440" height="825" extended-state="0" />
<frame x="394" y="68" width="1440" height="814" extended-state="0" />
<editor active="$ENABLE_FLUTTER_DESKTOP$" />
<layout>
<window_info active="$ENABLE_FLUTTER_DESKTOP$" 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="Structure" order="2" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
<window_info id="Image Layers" order="3" />
......@@ -297,7 +301,7 @@
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.42701226" />
<window_info anchor="bottom" id="Debug" order="5" weight="0.32962447" />
<window_info anchor="bottom" id="Terminal" order="6" weight="0.5607094" />
<window_info active="$ENABLE_FLUTTER_DESKTOP$" anchor="bottom" id="Terminal" order="6" visible="$ENABLE_FLUTTER_DESKTOP$" weight="0.5609418" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
<window_info anchor="bottom" id="Flutter Performance" order="8" side_tool="$ENABLE_FLUTTER_DESKTOP$" />
<window_info anchor="bottom" id="Version Control" order="9" />
......@@ -573,6 +577,16 @@
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/bean/DirBean.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="3432">
<caret line="171" selection-start-line="171" selection-end-line="171" />
<folding>
<element signature="e#46#66#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="396">
......@@ -610,19 +624,9 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="171" selection-start-line="171" selection-end-line="171" />
<folding>
<element signature="e#46#66#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="245">
<state relative-caret-position="77">
<caret line="251" column="22" selection-start-line="251" selection-start-column="22" selection-end-line="251" selection-end-column="22" />
</state>
</provider>
......
......@@ -2,6 +2,7 @@ package com.example.gengmei_flutter_plugin
import android.Manifest
import android.annotation.TargetApi
import android.app.Activity
import android.app.Activity.RESULT_OK
import android.app.Application
import android.content.Context
......@@ -34,6 +35,7 @@ import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import java.io.File
import java.io.FileNotFoundException
import java.lang.ref.WeakReference
class GengmeiFlutterPlugin : MethodCallHandler {
......@@ -82,12 +84,15 @@ class GengmeiFlutterPlugin : MethodCallHandler {
//剪裁请求码
private val CROP_REQUEST_CODE = 3
lateinit var resign: Context
lateinit var refrence:WeakReference<Activity>
var listener: EventChannel.EventSink? = null
@JvmStatic
fun registerWith(registrar: Registrar) {
if (registrar.activity() == null) {
return
}
refrence= WeakReference(registrar.activity());
resign = registrar.context().applicationContext
val gengmeiFlutterPlugin = GengmeiFlutterPlugin()
val channel = MethodChannel(registrar.messenger(), "gengmei_flutter_plugin")
......@@ -193,20 +198,23 @@ class GengmeiFlutterPlugin : MethodCallHandler {
file1.mkdirs()
}
nativeImage = File(Environment.getExternalStorageDirectory(), "/GengmeiAlbum/GengmeiAi${System.currentTimeMillis()}.jpg");
// val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //如果在Android7.0以上,使用FileProvider获取Uri
// intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
// val contentUri = FileProvider.getUriForFile(resign.activeContext().applicationContext, providerString, nativeImage!!);
// intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
// } else {
// intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(nativeImage));
// }
val broad = Intent("com.alpha.flutter.album")
broad.putExtra("PATH", nativeImage!!.absolutePath)
broad.putExtra("providerString", providerString)
broad.putExtra("CAMERA_REQUEST_CODE", CAMERA_REQUEST_CODE)
resign.sendBroadcast(broad)
// resign.activity().startActivityForResult(intent, CAMERA_REQUEST_CODE);
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { //如果在Android7.0以上,使用FileProvider获取Uri
intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
val contentUri = FileProvider.getUriForFile(resign.applicationContext, providerString, nativeImage!!);
intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
} else {
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(nativeImage));
}
if(refrence!=null&&refrence.get()!=null&&!refrence.get()!!.isDestroyed){
refrence.get()!!.startActivityForResult(intent, CAMERA_REQUEST_CODE);
}
// val broad = Intent("com.alpha.flutter.album")
// broad.putExtra("PATH", nativeImage!!.absolutePath)
// broad.putExtra("providerString", providerString)
// broad.putExtra("CAMERA_REQUEST_CODE", CAMERA_REQUEST_CODE)
// resign.sendBroadcast(broad)
}
override fun onMethodCall(call: MethodCall, result: Result) {
......
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