Commit 656e2fdd authored by 林生雨's avatar 林生雨

commit

parent e82a2366
......@@ -5,9 +5,7 @@
<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$/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" />
</list>
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
<ignored path="$PROJECT_DIR$/.pub/" />
......@@ -202,8 +200,8 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="82" />
<option name="y" value="89" />
<option name="x" value="65" />
<option name="y" value="23" />
<option name="width" value="1440" />
<option name="height" value="811" />
</component>
......@@ -293,9 +291,9 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="82" y="89" width="1440" height="811" extended-state="0" />
<frame x="65" y="23" width="1440" height="811" extended-state="0" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.19742489" />
<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" />
<window_info id="Structure" order="2" side_tool="true" />
<window_info id="Image Layers" order="3" />
......@@ -310,7 +308,7 @@
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.68194443" />
<window_info anchor="bottom" id="Debug" order="5" />
<window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.3838665" />
<window_info anchor="bottom" id="Terminal" order="6" visible="true" weight="0.3838665" />
<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" />
......
......@@ -420,6 +420,84 @@ class GengmeiFlutterPlugin : MethodCallHandler {
// Toast.makeText(activity.applicationContext, "授权成功!", Toast.LENGTH_SHORT).show();
listener.OK()
}
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 ->
Log.e("lsy"," LSY ACTIVITY RESULT ${nativeImage?.exists()} ${requestCode} ")
when (requestCode) {
CAMERA_REQUEST_CODE -> {
if (resultCode == RESULT_OK) {
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("")
// }
}
}
}
false
};
}
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