Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
flutter_plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林生雨
flutter_plugin
Commits
939834a5
Commit
939834a5
authored
Nov 04, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coomit
parent
f0733818
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
143 deletions
+117
-143
workspace.xml
.idea/workspace.xml
+23
-61
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+94
-82
No files found.
.idea/workspace.xml
View file @
939834a5
...
...
@@ -6,46 +6,7 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/act/PreviewActivity.kt"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/act/view/PinchImageView.kt"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/android/src/main/res/layout/preview_act.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/act/PreviewActivity.kt"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/act/view/PinchImageView.kt"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/res/layout/preview_act.xml"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/MyPreviewController.h"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/MyPreviewController.m"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/ios/Classes/MyPreviewController.h"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/ios/Classes/MyPreviewController.m"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/android/build.gradle"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/build.gradle"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/android/src/main/AndroidManifest.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/AndroidManifest.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/bean/MediaFile.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/bean/MediaFile.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/local/ThumbUtil.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ThumbUtil.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/act/VideoActivity.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/act/VideoActivity.kt"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/utils/MyUtil.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/utils/MyUtil.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/android/build.gradle"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/build.gradle"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/AndroidManifest.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/AndroidManifest.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/bean/MediaFile.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/bean/MediaFile.kt"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ImageScanner.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ImageScanner.kt"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ThumbUtil.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ThumbUtil.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/act/VideoActivity.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/act/VideoActivity.kt"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/utils/MyUtil.kt"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/android/src/main/java/com/example/gengmei_flutter_plugin/utils/MyUtil.kt"
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/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/MyPlayerViewController.m"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/ios/Classes/MyPlayerViewController.m"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/ScanImagePlugn.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/ScanImagePlugn.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/gengmei_flutter_plugin.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/lib/gengmei_flutter_plugin.dart"
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"
/>
<change
beforePath=
"$PROJECT_DIR$/ios/Classes/MyPlayerViewController.m"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/ios/Classes/MyPlayerViewController.m"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/lib/ScanImagePlugn.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/lib/ScanImagePlugn.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"
afterDir=
"false"
/>
</list>
<ignored
path=
"$PROJECT_DIR$/.dart_tool/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
...
...
@@ -62,13 +23,13 @@
<component
name=
"DefaultGradleProjectSettings"
>
<option
name=
"isMigrated"
value=
"true"
/>
</component>
<component
name=
"ExecutionTargetManager"
SELECTED_TARGET=
"
Pixel_2_API_25
"
/>
<component
name=
"ExecutionTargetManager"
SELECTED_TARGET=
"
AKC0218316000622
"
/>
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<file
pinned=
"false"
current-in-tab=
"
fals
e"
>
<file
pinned=
"false"
current-in-tab=
"
tru
e"
>
<entry
file=
"file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
8184
"
>
<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#46#66#0"
expanded=
"true"
/>
...
...
@@ -107,7 +68,7 @@
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/example/lib/main.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"3
674
"
>
<state
relative-caret-position=
"3
806
"
>
<caret
line=
"173"
column=
"47"
selection-start-line=
"173"
selection-start-column=
"47"
selection-end-line=
"173"
selection-end-column=
"47"
/>
<folding>
<element
signature=
"e#0#17#0"
expanded=
"true"
/>
...
...
@@ -146,10 +107,10 @@
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"
tru
e"
>
<file
pinned=
"false"
current-in-tab=
"
fals
e"
>
<entry
file=
"file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
357
"
>
<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"
/>
...
...
@@ -252,8 +213,6 @@
<foldersAlwaysOnTop
value=
"true"
/>
</navigator>
<panes>
<pane
id=
"PackagesPane"
/>
<pane
id=
"Scope"
/>
<pane
id=
"ProjectPane"
>
<subPane>
<expand>
...
...
@@ -345,7 +304,9 @@
<select
/>
</subPane>
</pane>
<pane
id=
"PackagesPane"
/>
<pane
id=
"AndroidView"
/>
<pane
id=
"Scope"
/>
</panes>
</component>
<component
name=
"PropertiesComponent"
>
...
...
@@ -395,7 +356,7 @@
<frame
x=
"29"
y=
"23"
width=
"1440"
height=
"811"
extended-state=
"0"
/>
<editor
active=
"true"
/>
<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"
/>
...
...
@@ -410,7 +371,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
anchor=
"bottom"
id=
"Terminal"
order=
"6"
weight=
"0.22361112
"
/>
<window_info
anchor=
"bottom"
id=
"Terminal"
order=
"6"
visible=
"true"
weight=
"0.22253129
"
/>
<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"
/>
...
...
@@ -645,16 +606,6 @@
</state>
</provider>
</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=
"8184"
>
<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#46#66#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"242"
>
...
...
@@ -678,7 +629,7 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/lib/main.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"3
674
"
>
<state
relative-caret-position=
"3
806
"
>
<caret
line=
"173"
column=
"47"
selection-start-line=
"173"
selection-start-column=
"47"
selection-end-line=
"173"
selection-end-column=
"47"
/>
<folding>
<element
signature=
"e#0#17#0"
expanded=
"true"
/>
...
...
@@ -722,7 +673,7 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
357
"
>
<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"
/>
...
...
@@ -730,5 +681,15 @@
</state>
</provider>
</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=
"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#46#66#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
939834a5
...
...
@@ -35,21 +35,20 @@ import java.io.FileNotFoundException
class
GengmeiFlutterPlugin
:
MethodCallHandler
{
var
disposable
=
CompositeDisposable
()
var
result
:
Result
?
=
null
var
resultKey
=
0L
var
gotoNativeCameraKey
=
0L
;
var
isAdded
=
false
;
private
var
record
:
HashMap
<
String
,
ArrayList
<
HashMap
<
String
,
Any
>>>?
=
null
;
var
nativeImage
:
File
?
=
null
var
isTaskingExectured
:
Boolean
=
false
;
@Volatile
var
quit_page
=
false
;
companion
object
{
var
disposable
=
CompositeDisposable
()
var
gotoNativeCameraKey
=
0L
;
var
premissionHandler
:
PermissionListener
?
=
null
var
nativeImage
:
File
?
=
null
const
val
IMAGE_PICKER
=
"scan_image_picker"
const
val
NATIVE_CAMERA
=
"native_camera"
const
val
QUIT_PAGE
=
"quit_page"
...
...
@@ -99,6 +98,81 @@ class GengmeiFlutterPlugin : MethodCallHandler {
listener
=
null
;
}
})
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
)
{
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
};
}
}
...
...
@@ -125,6 +199,11 @@ class GengmeiFlutterPlugin : MethodCallHandler {
ResultManager
.
getInstance
().
addResult
(
resultKey
,
result
);
when
(
call
.
method
)
{
IMAGE_PICKER
->
checkPermission
(
object
:
PermissionListener
{
override
fun
error
(
str
:
String
)
{
val
result
=
resultKey
;
ResultManager
.
getInstance
().
resultError
(
result
,
str
,
str
)
}
override
fun
OK
()
{
val
result
=
resultKey
;
ScanImage
(
result
)
...
...
@@ -133,6 +212,11 @@ class GengmeiFlutterPlugin : MethodCallHandler {
NATIVE_CAMERA
->
{
gotoNativeCameraKey
=
resultKey
;
checkPermission
(
object
:
PermissionListener
{
override
fun
error
(
str
:
String
)
{
val
result
=
resultKey
;
ResultManager
.
getInstance
().
resultError
(
result
,
str
,
str
)
}
override
fun
OK
()
{
gotoNativeCamera
(
call
.
argument
<
String
>(
"authority"
)
!!
)
}
...
...
@@ -254,8 +338,8 @@ class GengmeiFlutterPlugin : MethodCallHandler {
val
result
=
resultKey
;
val
path
=
call
.
arguments
as
String
?
path
?.
run
{
val
intent
=
Intent
(
resign
.
activity
(),
PreviewActivity
::
class
.
java
)
intent
.
putExtra
(
"PATH"
,
this
)
val
intent
=
Intent
(
resign
.
activity
(),
PreviewActivity
::
class
.
java
)
intent
.
putExtra
(
"PATH"
,
this
)
resign
.
activity
().
startActivity
(
intent
)
ResultManager
.
getInstance
().
resultSuccess
(
result
,
true
)
// ImageRespository.getInstance().getPreviewImg(resign.context().applicationContext,this, 800.0f).subscribe({
...
...
@@ -307,6 +391,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
@TargetApi
(
Build
.
VERSION_CODES
.
M
)
private
fun
checkPermission
(
listener
:
PermissionListener
)
{
premissionHandler
=
listener
val
activity
=
resign
.
activity
()
val
writePremission
=
activity
.
checkSelfPermission
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
val
readPremission
=
activity
.
checkSelfPermission
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
...
...
@@ -331,84 +416,11 @@ 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
)
{
listener
.
OK
()
}
else
{
Toast
.
makeText
(
activity
.
applicationContext
,
"请同意权限"
,
Toast
.
LENGTH_SHORT
).
show
()
result
?.
run
{
this
.
error
(
"没有权限!!"
,
"no premission"
,
"没有权限!!"
);
}
}
}
else
{
Toast
.
makeText
(
activity
.
applicationContext
,
"请同意权限"
,
Toast
.
LENGTH_SHORT
).
show
()
result
?.
run
{
this
.
error
(
"没有权限!!"
,
"no premission"
,
"没有权限!!"
);
}
}
true
;
}
resign
.
addActivityResultListener
{
requestCode
,
resultCode
,
intent
->
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("")
// }
}
}
}
true
};
isAdded
=
true
;
}
interface
PermissionListener
{
fun
OK
()
fun
error
(
str
:
String
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment