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
1e37c006
Commit
1e37c006
authored
Oct 28, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
e1f355c5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
22 deletions
+40
-22
workspace.xml
.idea/workspace.xml
+16
-12
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+13
-6
ImageRespository.kt
...flutter_plugin/ImagePlugin/repository/ImageRespository.kt
+7
-0
DebugUtil.java
...a/com/example/gengmei_flutter_plugin/utils/DebugUtil.java
+1
-1
AlbumRepository.dart
example/lib/AlbumModel/repository/AlbumRepository.dart
+1
-1
ScanImagePlugn.dart
lib/ScanImagePlugn.dart
+1
-1
gengmei_flutter_plugin.dart
lib/gengmei_flutter_plugin.dart
+1
-1
No files found.
.idea/workspace.xml
View file @
1e37c006
...
...
@@ -7,6 +7,9 @@
<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"
/>
<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/utils/DebugUtil.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/utils/DebugUtil.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/lib/ScanImagePlugn.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/lib/ScanImagePlugn.dart"
afterDir=
"false"
/>
</list>
<ignored
path=
"$PROJECT_DIR$/.dart_tool/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
...
...
@@ -54,7 +57,7 @@
<entry
file=
"file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"5258"
>
<caret
line=
"26
8"
column=
"13"
selection-start-line=
"268"
selection-start-column=
"13"
selection-end-line=
"268
"
selection-end-column=
"13"
/>
<caret
line=
"26
7"
column=
"13"
selection-start-line=
"267"
selection-start-column=
"13"
selection-end-line=
"267
"
selection-end-column=
"13"
/>
</state>
</provider>
</entry>
...
...
@@ -67,8 +70,8 @@
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/lib/ScanImagePlugn.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
98
"
>
<caret
line=
"
13"
selection-start-line=
"13"
selection-end-line=
"13
"
/>
<state
relative-caret-position=
"
142
"
>
<caret
line=
"
30"
column=
"36"
selection-start-line=
"30"
selection-start-column=
"23"
selection-end-line=
"30"
selection-end-column=
"36
"
/>
</state>
</provider>
</entry>
...
...
@@ -162,14 +165,15 @@
<option
value=
"$PROJECT_DIR$/lib/SharedPlugin.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/main.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/ScanImagePlugn.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/ScanImagePlugn.dart"
/>
</list>
</option>
</component>
<component
name=
"ProjectFrameBounds"
extendedState=
"6"
>
<option
name=
"y"
value=
"23"
/>
<component
name=
"ProjectFrameBounds"
>
<option
name=
"x"
value=
"673"
/>
<option
name=
"y"
value=
"-861"
/>
<option
name=
"width"
value=
"1440"
/>
<option
name=
"height"
value=
"811"
/>
</component>
...
...
@@ -278,10 +282,10 @@
<servers
/>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"
0"
y=
"23"
width=
"1440"
height=
"811"
extended-state=
"6
"
/>
<frame
x=
"
673"
y=
"-861"
width=
"1440"
height=
"811"
extended-state=
"0
"
/>
<editor
active=
"true"
/>
<layout>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.1509299"
/>
<window_info
active=
"true"
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.1509299"
/>
<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"
/>
...
...
@@ -291,7 +295,7 @@
<window_info
id=
"Capture Tool"
order=
"7"
/>
<window_info
id=
"Favorites"
order=
"8"
side_tool=
"true"
/>
<window_info
anchor=
"bottom"
id=
"Dart Analysis"
order=
"0"
weight=
"0.32963988"
/>
<window_info
a
ctive=
"true"
a
nchor=
"bottom"
id=
"Run"
order=
"1"
visible=
"true"
weight=
"0.46175244"
/>
<window_info
anchor=
"bottom"
id=
"Run"
order=
"1"
visible=
"true"
weight=
"0.46175244"
/>
<window_info
anchor=
"bottom"
id=
"TODO"
order=
"2"
/>
<window_info
anchor=
"bottom"
id=
"Android Profiler"
order=
"3"
show_stripe_button=
"false"
/>
<window_info
anchor=
"bottom"
id=
"Logcat"
order=
"4"
weight=
"0.5486111"
/>
...
...
@@ -515,7 +519,7 @@
<entry
file=
"file://$PROJECT_DIR$/android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"5258"
>
<caret
line=
"26
8"
column=
"13"
selection-start-line=
"268"
selection-start-column=
"13"
selection-end-line=
"268
"
selection-end-column=
"13"
/>
<caret
line=
"26
7"
column=
"13"
selection-start-line=
"267"
selection-start-column=
"13"
selection-end-line=
"267
"
selection-end-column=
"13"
/>
</state>
</provider>
</entry>
...
...
@@ -571,8 +575,8 @@
</entry>
<entry
file=
"file://$PROJECT_DIR$/lib/ScanImagePlugn.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
98
"
>
<caret
line=
"
13"
selection-start-line=
"13"
selection-end-line=
"13
"
/>
<state
relative-caret-position=
"
142
"
>
<caret
line=
"
30"
column=
"36"
selection-start-line=
"30"
selection-start-column=
"23"
selection-end-line=
"30"
selection-end-column=
"36
"
/>
</state>
</provider>
</entry>
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
1e37c006
...
...
@@ -12,7 +12,6 @@ import android.os.Environment
import
android.os.Handler
import
android.provider.MediaStore
import
android.support.v4.content.FileProvider
import
android.text.TextUtils
import
android.util.Log
import
android.widget.Toast
import
com.example.gengmei_flutter_plugin.result.ResultManager
...
...
@@ -99,7 +98,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
private
fun
gotoNativeCamera
(
providerString
:
String
)
{
nativeImage
=
File
(
resign
.
activity
().
getExternalFilesDir
(
Environment
.
DIRECTORY_PICTURES
),
"
/GengmeiAi${System.currentTimeMillis()}.jpg"
);
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
);
...
...
@@ -298,8 +297,6 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
resign
.
addRequestPermissionsResultListener
{
id
,
permissions
,
grantResults
->
Log
.
e
(
"lsy"
,
" ${grantResults} ${grantResults.size}"
)
if
(
grantResults
.
size
>
0
)
{
var
givePremission
=
true
;
grantResults
.
forEach
{
...
...
@@ -328,8 +325,18 @@ class GengmeiFlutterPlugin : MethodCallHandler {
when
(
requestCode
)
{
CAMERA_REQUEST_CODE
->
{
if
(
resultCode
==
RESULT_OK
)
{
if
(
nativeImage
!=
null
)
{
ResultManager
.
getInstance
().
resultSuccess
(
gotoNativeCameraKey
,
nativeImage
!!
.
absolutePath
);
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"
)
ImageRespository
.
getInstance
().
recordImageListMap
.
add
(
map
)
ResultManager
.
getInstance
().
resultSuccess
(
gotoNativeCameraKey
,
map
);
},
{
DebugUtil
.
printStackTrace
(
it
)
}).
addTo
(
disposable
)
}
else
{
ResultManager
.
getInstance
().
resultSuccess
(
gotoNativeCameraKey
,
""
);
}
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/ImageRespository.kt
View file @
1e37c006
...
...
@@ -43,6 +43,13 @@ class ImageRespository {
var
finishOneTask
=
false
val
fileDir
=
Environment
.
getExternalStorageDirectory
().
absolutePath
+
"/.GMAlbum/.album"
;
fun
scareImg
(
realPath
:
String
):
Observable
<
Pair
<
String
,
String
>>
{
return
Observable
.
create
(
ObservableOnSubscribe
<
Pair
<
String
,
String
>>
{
val
pair
=
Pair
<
String
,
String
>(
realPath
,
MyUtil
.
scareImg
(
realPath
,
200f
,
fileDir
+
"/"
+
getFileName
(
realPath
)
!!
+
".png"
,
75
))
it
.
onNext
(
pair
)
}).
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
());
}
//: HashMap<String, ArrayList<HashMap<String, Any>>>
fun
scanPhoneImage
(
context
:
Context
):
Observable
<
HashMap
<
String
,
ArrayList
<
HashMap
<
String
,
Any
>>>>
{
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/utils/DebugUtil.java
View file @
1e37c006
...
...
@@ -2,7 +2,7 @@ package com.example.gengmei_flutter_plugin.utils;
import
android.util.Log
;
import
com.example.gengmei_flutter_plugin
.BuildConfig
;
import
io.flutter
.BuildConfig
;
public
class
DebugUtil
{
...
...
example/lib/AlbumModel/repository/AlbumRepository.dart
View file @
1e37c006
...
...
@@ -38,7 +38,7 @@ class AlbumRepository {
_cacheList
.
clear
();
}
Observable
<
String
>
nativeCamera
()
{
Observable
<
Map
>
nativeCamera
()
{
return
Observable
.
fromFuture
(
GengmeiFlutterPlugin
.
nativeCamera
(
"com.example.gengmei_flutter_plugin_example"
));
}
}
lib/ScanImagePlugn.dart
View file @
1e37c006
...
...
@@ -25,7 +25,7 @@ class ScanImagePlugn {
return
newMap
;
}
static
Future
<
String
>
nativeCamera
(
static
Future
<
Map
>
nativeCamera
(
MethodChannel
channel
,
String
authority
)
async
{
return
await
channel
.
invokeMethod
(
"native_camera"
,
{
"authority"
:
authority
});
...
...
lib/gengmei_flutter_plugin.dart
View file @
1e37c006
...
...
@@ -19,7 +19,7 @@ class GengmeiFlutterPlugin {
return
await
ScanImagePlugn
.
scanImages
(
_channel
);
}
static
Future
<
String
>
nativeCamera
(
String
authority
)
async
{
static
Future
<
Map
>
nativeCamera
(
String
authority
)
async
{
return
await
ScanImagePlugn
.
nativeCamera
(
_channel
,
authority
);
}
...
...
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