Commit 323048b5 authored by 林生雨's avatar 林生雨

commit

parent fd7f6284
......@@ -50,7 +50,7 @@
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="$ENABLE_FLUTTER_DESKTOP$">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="179">
......@@ -88,11 +88,11 @@
</provider>
</entry>
</file>
<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="1650">
<caret line="82" column="24" selection-start-line="82" selection-start-column="24" selection-end-line="82" selection-end-column="24" />
<state relative-caret-position="137">
<caret line="108" column="18" selection-start-line="108" selection-start-column="18" selection-end-line="108" selection-end-column="18" />
<folding>
<element signature="e#45#62#0" expanded="$ENABLE_FLUTTER_DESKTOP$" />
</folding>
......@@ -103,7 +103,7 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/SharedPlugin.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="308">
<state relative-caret-position="247">
<caret line="17" selection-start-line="17" selection-end-line="17" />
</state>
</provider>
......@@ -188,8 +188,8 @@
<option value="$PROJECT_DIR$/lib/SharedPlugin.dart" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" />
<option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" />
<option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" />
</list>
</option>
</component>
......@@ -229,6 +229,11 @@
<item name="ios" type="462c0819:PsiDirectoryNode" />
<item name="Classes" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
......@@ -283,7 +288,6 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="816" extended-state="6" />
<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$" />
......@@ -596,39 +600,39 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="1650">
<caret line="82" column="24" selection-start-line="82" selection-start-column="24" selection-end-line="82" selection-end-column="24" />
<state relative-caret-position="3916">
<caret line="187" column="18" selection-start-line="187" selection-start-column="18" selection-end-line="187" selection-end-column="18" />
<folding>
<element signature="e#45#62#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="179">
<caret line="251" column="22" selection-start-line="251" selection-start-column="22" selection-end-line="251" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/SharedPlugin.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="308">
<state relative-caret-position="247">
<caret line="17" selection-start-line="17" selection-end-line="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="$ENABLE_FLUTTER_DESKTOP$" editor-type-id="text-editor">
<state relative-caret-position="3916">
<caret line="187" column="18" selection-start-line="187" selection-start-column="18" selection-end-line="187" selection-end-column="18" />
<state relative-caret-position="137">
<caret line="108" column="18" selection-start-line="108" selection-start-column="18" selection-end-line="108" selection-end-column="18" />
<folding>
<element signature="e#45#62#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="179">
<caret line="251" column="22" selection-start-line="251" selection-start-column="22" selection-end-line="251" selection-end-column="22" />
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
......@@ -84,7 +84,6 @@ class GengmeiFlutterPlugin : MethodCallHandler {
//剪裁请求码
private val CROP_REQUEST_CODE = 3
lateinit var resign: Context
lateinit var refrence:WeakReference<Activity>
var listener: EventChannel.EventSink? = null
@JvmStatic
......@@ -92,7 +91,6 @@ class GengmeiFlutterPlugin : MethodCallHandler {
if (registrar.activity() == null) {
return
}
refrence= WeakReference(registrar.activity());
resign = registrar.context().applicationContext
val gengmeiFlutterPlugin = GengmeiFlutterPlugin()
val channel = MethodChannel(registrar.messenger(), "gengmei_flutter_plugin")
......@@ -198,23 +196,20 @@ 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.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)
// 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));
// }
//
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