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

commir

parent ba7147ca
......@@ -5,7 +5,10 @@
<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="" />
<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$/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/" />
......@@ -24,7 +27,7 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="AKC0218316000622" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<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="473">
......@@ -37,10 +40,10 @@
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart">
<entry file="file://$PROJECT_DIR$/lib/SharedPlugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="11" selection-start-line="11" selection-end-line="11" />
<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>
</provider>
</entry>
......@@ -87,7 +90,7 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1078">
<state relative-caret-position="487">
<caret line="53" column="20" selection-start-line="53" selection-start-column="20" selection-end-line="53" selection-end-column="20" />
<folding>
<element signature="e#45#86#0" expanded="true" />
......@@ -105,7 +108,7 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
......@@ -200,8 +203,8 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="29" />
<option name="y" value="23" />
<option name="x" value="28" />
<option name="y" value="138" />
<option name="width" value="1440" />
<option name="height" value="811" />
</component>
......@@ -351,7 +354,7 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="29" y="23" width="1440" height="811" extended-state="0" />
<frame x="28" y="138" width="1440" height="811" extended-state="0" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.19742489" />
<window_info id="Captures" order="1" side_tool="true" />
......@@ -557,13 +560,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/SharedPlugin.dart">
<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>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1390" />
......@@ -641,16 +637,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1078">
<caret line="53" column="20" selection-start-line="53" selection-start-column="20" selection-end-line="53" selection-end-column="20" />
<folding>
<element signature="e#45#86#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/Downloads/flutter/packages/flutter/lib/src/services/platform_channel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6534">
......@@ -668,22 +654,39 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
<caret line="32" selection-start-line="32" selection-end-line="32" />
<state relative-caret-position="473">
<caret line="387" column="36" selection-start-line="387" selection-start-column="36" selection-end-line="387" selection-end-column="36" />
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#46#66#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<entry file="file://$PROJECT_DIR$/lib/SharedPlugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="473">
<caret line="387" column="36" selection-start-line="387" selection-start-column="36" selection-end-line="387" selection-end-column="36" />
<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>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="487">
<caret line="53" column="20" selection-start-line="53" selection-start-column="20" selection-end-line="53" selection-end-column="20" />
<folding>
<element signature="e#46#66#0" expanded="true" />
<element signature="e#45#86#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="702">
<caret line="32" selection-start-line="32" selection-end-line="32" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
......
......@@ -99,81 +99,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
})
resign.addRequestPermissionsResultListener { id, permissions, grantResults ->
if (grantResults.size > 0) {
var givePremission = true;
grantResults.forEach {
Log.e("lsy", " ${it} ${PackageManager.PERMISSION_GRANTED}")
if (it != PackageManager.PERMISSION_GRANTED) {
givePremission = false;
}
}
if (givePremission) {
premissionHandler?.run {
this.OK()
}
} else {
Toast.makeText(resign.context().applicationContext, "请同意权限", Toast.LENGTH_SHORT).show()
premissionHandler?.run {
this.error("没有权限!!")
}
}
} else {
Toast.makeText(resign.context().applicationContext, "请同意权限", Toast.LENGTH_SHORT).show()
premissionHandler?.run {
this.error("没有权限!!")
}
}
true;
}
resign.addActivityResultListener { requestCode, resultCode, intent ->
when (requestCode) {
CAMERA_REQUEST_CODE -> {
if (resultCode == RESULT_OK) {
Log.e("lsy"," LSY ACTIVITY RESULT ${nativeImage?.exists()} ")
if (nativeImage != null && nativeImage!!.exists()) {
ImageRespository.getInstance().scareImg(nativeImage!!.absolutePath).subscribe({
val map = HashMap<String, Any>()
map.put("realPath", it.first)
map.put("path", it.second)
map.put("isVideo", "F")
map.put("folderName", "GengmeiAlbum")
// try {
// MediaStore.Images.Media.insertImage(resign.context().applicationContext.getContentResolver(),
// nativeImage!!.absolutePath, getFileName(nativeImage!!.absolutePath), null);
// } catch ( e: FileNotFoundException) {
// e.printStackTrace();
// }
// 最后通知图库更新
resign.context().applicationContext.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.fromFile(nativeImage)))
ImageRespository.getInstance().recordImageListMap.add(0, map)
ResultManager.getInstance().resultSuccess(gotoNativeCameraKey, map);
}, {
DebugUtil.printStackTrace(it)
}).addTo(disposable)
} else {
ResultManager.getInstance().resultSuccess(gotoNativeCameraKey, HashMap<String, Any>());
}
// nativeImage?.run {
// }
// result?.run {
// if (nativeImage != null) {
// this.success(nativeImage!!.absolutePath);
// } else {
// this.success("");
// }
// }
} else {
ResultManager.getInstance().resultSuccess(gotoNativeCameraKey, "");
// result?.run {
// this.success("")
// }
}
}
}
true
};
}
}
......@@ -392,6 +318,85 @@ class GengmeiFlutterPlugin : MethodCallHandler {
@TargetApi(Build.VERSION_CODES.M)
private fun checkPermission(listener: PermissionListener) {
resign.addRequestPermissionsResultListener { id, permissions, grantResults ->
if (grantResults.size > 0) {
var givePremission = true;
grantResults.forEach {
Log.e("lsy", " ${it} ${PackageManager.PERMISSION_GRANTED}")
if (it != PackageManager.PERMISSION_GRANTED) {
givePremission = false;
}
}
if (givePremission) {
premissionHandler?.run {
this.OK()
}
} else {
Toast.makeText(resign.context().applicationContext, "请同意权限", Toast.LENGTH_SHORT).show()
premissionHandler?.run {
this.error("没有权限!!")
}
}
} else {
Toast.makeText(resign.context().applicationContext, "请同意权限", Toast.LENGTH_SHORT).show()
premissionHandler?.run {
this.error("没有权限!!")
}
}
true;
}
resign.addActivityResultListener { requestCode, resultCode, intent ->
when (requestCode) {
CAMERA_REQUEST_CODE -> {
if (resultCode == RESULT_OK) {
Log.e("lsy"," LSY ACTIVITY RESULT ${nativeImage?.exists()} ")
if (nativeImage != null && nativeImage!!.exists()) {
ImageRespository.getInstance().scareImg(nativeImage!!.absolutePath).subscribe({
val map = HashMap<String, Any>()
map.put("realPath", it.first)
map.put("path", it.second)
map.put("isVideo", "F")
map.put("folderName", "GengmeiAlbum")
// try {
// MediaStore.Images.Media.insertImage(resign.context().applicationContext.getContentResolver(),
// nativeImage!!.absolutePath, getFileName(nativeImage!!.absolutePath), null);
// } catch ( e: FileNotFoundException) {
// e.printStackTrace();
// }
// 最后通知图库更新
resign.context().applicationContext.sendBroadcast(Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.fromFile(nativeImage)))
ImageRespository.getInstance().recordImageListMap.add(0, map)
ResultManager.getInstance().resultSuccess(gotoNativeCameraKey, map);
}, {
DebugUtil.printStackTrace(it)
}).addTo(disposable)
} else {
ResultManager.getInstance().resultSuccess(gotoNativeCameraKey, HashMap<String, Any>());
}
// nativeImage?.run {
// }
// result?.run {
// if (nativeImage != null) {
// this.success(nativeImage!!.absolutePath);
// } else {
// this.success("");
// }
// }
} else {
ResultManager.getInstance().resultSuccess(gotoNativeCameraKey, "");
// result?.run {
// this.success("")
// }
}
}
}
true
};
premissionHandler=listener
val activity = resign.activity()
val writePremission = activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
......@@ -417,6 +422,8 @@ class GengmeiFlutterPlugin : MethodCallHandler {
// Toast.makeText(activity.applicationContext, "授权成功!", Toast.LENGTH_SHORT).show();
listener.OK()
}
}
interface PermissionListener {
......
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