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
bc74c8bd
Commit
bc74c8bd
authored
Nov 05, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
parent
656e2fdd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
128 deletions
+65
-128
workspace.xml
.idea/workspace.xml
+45
-37
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+18
-89
ImageRespository.kt
...flutter_plugin/ImagePlugin/repository/ImageRespository.kt
+1
-0
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+1
-2
No files found.
.idea/workspace.xml
View file @
bc74c8bd
...
...
@@ -5,7 +5,15 @@
<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$/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$/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/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$/ios/Classes/GengmeiFlutterPlugin.m"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m"
afterDir=
"false"
/>
</list>
<ignored
path=
"$PROJECT_DIR$/.dart_tool/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
<ignored
path=
"$PROJECT_DIR$/.pub/"
/>
...
...
@@ -27,7 +35,7 @@
<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
"
>
<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"
/>
...
...
@@ -66,7 +74,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
806
"
>
<state
relative-caret-position=
"3
674
"
>
<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"
/>
...
...
@@ -87,7 +95,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=
"
487
"
>
<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"
/>
...
...
@@ -199,9 +207,9 @@
</list>
</option>
</component>
<component
name=
"ProjectFrameBounds"
>
<option
name=
"x"
value=
"
65
"
/>
<option
name=
"y"
value=
"
2
3"
/>
<component
name=
"ProjectFrameBounds"
extendedState=
"6"
>
<option
name=
"x"
value=
"
178
"
/>
<option
name=
"y"
value=
"
16
3"
/>
<option
name=
"width"
value=
"1440"
/>
<option
name=
"height"
value=
"811"
/>
</component>
...
...
@@ -211,6 +219,7 @@
<foldersAlwaysOnTop
value=
"true"
/>
</navigator>
<panes>
<pane
id=
"Scope"
/>
<pane
id=
"ProjectPane"
>
<subPane>
<expand>
...
...
@@ -244,7 +253,6 @@
</pane>
<pane
id=
"PackagesPane"
/>
<pane
id=
"AndroidView"
/>
<pane
id=
"Scope"
/>
</panes>
</component>
<component
name=
"PropertiesComponent"
>
...
...
@@ -291,7 +299,7 @@
<servers
/>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"
65"
y=
"23"
width=
"1440"
height=
"811"
extended-state=
"0
"
/>
<frame
x=
"
3"
y=
"23"
width=
"1440"
height=
"811"
extended-state=
"6
"
/>
<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"
/>
...
...
@@ -543,6 +551,23 @@
</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$/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://$USER_HOME$/Downloads/flutter/packages/flutter/lib/src/widgets/image.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"6556"
>
...
...
@@ -559,7 +584,7 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/lib/main.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"3
806
"
>
<state
relative-caret-position=
"3
674
"
>
<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"
/>
...
...
@@ -574,6 +599,16 @@
</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"
>
...
...
@@ -591,33 +626,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=
"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>
<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$/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#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=
"157"
>
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
bc74c8bd
...
...
@@ -71,7 +71,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
const
val
CLEAR_SHARE
=
"CLEAR_SHARE"
const
val
PREMISSION
=
10090
//相机请求码
private
val
CAMERA_REQUEST_CODE
=
2
private
val
CAMERA_REQUEST_CODE
=
11223
private
val
CAMERA_REQUEST_CODE_AI
=
10012
//剪裁请求码
...
...
@@ -171,9 +171,10 @@ class GengmeiFlutterPlugin : MethodCallHandler {
// this.success("")
// }
}
return
@addActivityResultListener
true
}
}
false
return
@addActivityResultListener
false
};
}
...
...
@@ -186,15 +187,21 @@ 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
));
}
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.activeContext().applicationContext, providerString, nativeImage!!);
// intent.putExtra(MediaStore.EXTRA_OUTPUT, contentUri);
// } else {
// intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(nativeImage));
// }
Log
.
e
(
"lsy"
,
" ACT NAMT ${resign.activity().localClassName} ${resign.activity().componentName}"
)
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
.
context
().
applicationContext
.
sendBroadcast
(
broad
)
// resign.activity().startActivityForResult(intent, CAMERA_REQUEST_CODE);
}
override
fun
onMethodCall
(
call
:
MethodCall
,
result
:
Result
)
{
...
...
@@ -420,84 +427,6 @@ 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
{
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt
View file @
bc74c8bd
...
...
@@ -119,6 +119,7 @@ class ImageRespository {
// if (it["realPath"] == null) {
// continue
// }
Log
.
e
(
"lsy"
,
"index ${index}"
)
val
any
=
it
[
"path"
]
val
realPath
=
it
[
"realPath"
]
as
String
if
(
any
!=
null
&&
!
TextUtils
.
isEmpty
(
any
as
String
))
{
...
...
ios/Classes/GengmeiFlutterPlugin.m
View file @
bc74c8bd
...
...
@@ -731,8 +731,7 @@ CFAbsoluteTime startTime;
self
.
finishScanImg
=
true
;
CFAbsoluteTime
linkTime
=
(
CFAbsoluteTimeGetCurrent
()
-
startTime
);
NSLog
(
@"IOS COPY IMAGE 时间:%f ms"
,
linkTime
*
1000
.
0
);
[
self
reslutImg
:
resultId
];
self
.
finalMap
=
[
self
.
finalMapTemp
mutableCopy
];
[
self
reslutImgFinalMap
:
resultId
];
}
}
}
...
...
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