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
d1da53f0
Commit
d1da53f0
authored
Nov 14, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
c4e2b084
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
88 additions
and
108 deletions
+88
-108
workspace.xml
.idea/workspace.xml
+0
-0
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+4
-0
flutter_export_environment.sh
example/ios/Flutter/flutter_export_environment.sh
+2
-3
Podfile.lock
example/ios/Podfile.lock
+2
-2
pubspec.lock
example/pubspec.lock
+1
-50
gengmei_flutter_plugin.iml
gengmei_flutter_plugin.iml
+1
-1
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+61
-45
ScanImagePlugn.dart
lib/ScanImagePlugn.dart
+6
-0
gengmei_flutter_plugin.dart
lib/gengmei_flutter_plugin.dart
+4
-0
pubspec.lock
pubspec.lock
+7
-7
No files found.
.idea/workspace.xml
View file @
d1da53f0
This diff is collapsed.
Click to expand it.
android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
d1da53f0
...
...
@@ -132,6 +132,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
when
(
requestCode
)
{
CAMERA_REQUEST_CODE
->
{
if
(
resultCode
==
RESULT_OK
)
{
android
.
util
.
Log
.
e
(
"lsy"
,
" RESULT OKKKKK "
)
if
(
nativeImage
!=
null
&&
nativeImage
!!
.
exists
())
{
ImageRespository
.
getInstance
().
scareImg
(
nativeImage
!!
.
absolutePath
).
subscribe
({
val
map
=
HashMap
<
String
,
Any
>()
...
...
@@ -139,6 +140,8 @@ class GengmeiFlutterPlugin : MethodCallHandler {
map
.
put
(
"path"
,
it
.
second
)
map
.
put
(
"isVideo"
,
"F"
)
map
.
put
(
"folderName"
,
"GengmeiAlbum"
)
android
.
util
.
Log
.
e
(
"lsy"
,
" RESULT MAPPP "
)
// try {
// MediaStore.Images.Media.insertImage(resign.context().applicationContext.getContentResolver(),
// nativeImage!!.absolutePath, getFileName(nativeImage!!.absolutePath), null);
...
...
@@ -212,6 +215,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
ScanImage
(
result
)
}
NATIVE_CAMERA
->
{
gotoNativeCameraKey
=
resultKey
;
gotoNativeCamera
(
call
.
argument
<
String
>(
"authority"
)
!!
)
}
SAVE_STRING_SHARED
->
{
...
...
example/ios/Flutter/flutter_export_environment.sh
View file @
d1da53f0
...
...
@@ -2,9 +2,8 @@
# This is a generated file; do not edit or check into version control.
export
"FLUTTER_ROOT=/Users/apple/Downloads/flutter"
export
"FLUTTER_APPLICATION_PATH=/Users/apple/lsy/gengmei_flutter_plugin/example"
export
"FLUTTER_TARGET=lib/main.dart"
export
"FLUTTER_TARGET=
/Users/apple/lsy/gengmei_flutter_plugin/example/
lib/main.dart"
export
"FLUTTER_BUILD_DIR=build"
export
"SYMROOT=
${
SOURCE_ROOT
}
/../build/ios"
export
"FLUTTER_FRAMEWORK_DIR=/Users/apple/Downloads/flutter/bin/cache/artifacts/engine/ios"
export
"FLUTTER_BUILD_NAME=1.0.0"
export
"FLUTTER_BUILD_NUMBER=1"
export
"TRACK_WIDGET_CREATION=true"
example/ios/Podfile.lock
View file @
d1da53f0
...
...
@@ -14,9 +14,9 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/gengmei_flutter_plugin/ios"
SPEC CHECKSUMS:
Flutter:
58dd7d1b27887414a370fcccb9e645c08ffd7a6a
Flutter:
0e3d915762c693b495b44d77113d4970485de6ec
gengmei_flutter_plugin: 9461e8644c06c4a0e38292ddcca1cc55e6ac6156
PODFILE CHECKSUM: 7fb83752f59ead6285236625b82473f90b1cb932
COCOAPODS: 1.
7
.4
COCOAPODS: 1.
8
.4
example/pubspec.lock
View file @
d1da53f0
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.10"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
...
...
@@ -43,20 +29,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
cupertino_icons:
dependency: "direct main"
description:
...
...
@@ -81,13 +53,6 @@ packages:
relative: true
source: path
version: "0.0.735"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
matcher:
dependency: transitive
description:
...
...
@@ -116,13 +81,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
...
...
@@ -198,12 +156,5 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.
4.0
<3.0.0"
dart: ">=2.
2.2
<3.0.0"
gengmei_flutter_plugin.iml
View file @
d1da53f0
<?xml version="1.0" encoding="UTF-8"?>
<module
type=
"JAVA_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"
true
"
>
<component
name=
"NewModuleRootManager"
inherit-compiler-output=
"
$ENABLE_FLUTTER_DESKTOP$
"
>
<exclude-output
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/lib"
isTestSource=
"false"
/>
...
...
ios/Classes/GengmeiFlutterPlugin.m
View file @
d1da53f0
...
...
@@ -383,45 +383,7 @@ NSString *cacheDirectory;
[
video
setImagePre
:
assets
];
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultTemp
]
:
@YES
];
// if([fileManager fileExistsAtPath:tempTake]){
// NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
// [dict setObject:path forKey:@"path"];
// [dict setObject:tempTake forKey:@"realImagePath"];
// [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
// }else{
// dispatch_async(queue, ^{
// CFAbsoluteTime start=CFAbsoluteTimeGetCurrent();
// int picWidth=[assets pixelWidth];
// int picHeight=[assets pixelHeight];
// float tempScareSize=1;
// float limit=1024.0;
// float max=MAX(picWidth, picHeight);
// if(max>limit){
// tempScareSize=limit/max;
// }
// CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
// __block bool isResult=false;
// [[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
// if(isResult){
// return ;
// }
// isResult=true;
// @autoreleasepool{
// NSData *data = UIImageJPEGRepresentation(result, 0.7) ;
// [data writeToFile:tempTake atomically:YES];
// // result=nil;
// // data=nil;
// }
// NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
// [dict setObject:path forKey:@"path"];
// [dict setObject:tempTake forKey:@"realImagePath"];
// dispatch_async(dispatch_get_main_queue(), ^{
// NSLog(@"压缩预览图片耗时:%f ms Temp路径%@",(CFAbsoluteTimeGetCurrent()-start)*1000,tempTake);
// [[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
// });
// }];
// });
// }
}
else
if
([[
self
.
takePhotoMap
allKeys
]
containsObject
:
path
]){
MyPreviewController
*
video
=
[[
MyPreviewController
alloc
]
init
];
[
viewController
presentViewController
:
video
animated
:
YES
completion
:
nil
];
...
...
@@ -434,6 +396,60 @@ NSString *cacheDirectory;
}
else
{
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultTemp
]
:
nil
];
}
}
else
if
([
@"scare_image"
isEqualToString
:
call
.
method
]
){
long
resultTemp
=
self
.
resultKey
;
NSMutableDictionary
*
dict
=
call
.
arguments
;
int
size
=
dict
[
@"size"
];
PHImageRequestOptions
*
imageRequestOption
=
[[
PHImageRequestOptions
alloc
]
init
];
imageRequestOption
.
synchronous
=
NO
;
imageRequestOption
.
networkAccessAllowed
=
YES
;
imageRequestOption
.
deliveryMode
=
PHImageRequestOptionsDeliveryModeHighQualityFormat
;
imageRequestOption
.
resizeMode
=
PHImageRequestOptionsResizeModeFast
;
imageRequestOption
.
version
=
PHImageRequestOptionsVersionUnadjusted
;
NSString
*
tempPath
=
NSTemporaryDirectory
();
NSFileManager
*
fileManager
=
[
NSFileManager
defaultManager
];
NSString
*
path
=
dict
[
@"path"
];
if
(
path
!=
nil
){
if
([[
self
.
scanMap
allKeys
]
containsObject
:
path
]){
NSString
*
name
=
[
path
lastPathComponent
];
NSString
*
tempTake
=
[
tempPath
stringByAppendingPathComponent
:[
NSString
stringWithFormat
:
@"%@%@"
,
name
,
@"_preview"
]];
PHAsset
*
assets
=
self
.
scanMap
[
path
];
if
([
fileManager
fileExistsAtPath
:
tempTake
]){
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultTemp
]
:
tempTake
];
}
else
{
dispatch_async
(
queue
,
^
{
CFAbsoluteTime
start
=
CFAbsoluteTimeGetCurrent
();
int
picWidth
=
[
assets
pixelWidth
];
int
picHeight
=
[
assets
pixelHeight
];
float
tempScareSize
=
1
;
float
limit
=
size
+
0
.
0
;
float
max
=
MAX
(
picWidth
,
picHeight
);
if
(
max
>
limit
){
tempScareSize
=
limit
/
max
;
}
CGSize
temp
=
CGSizeMake
(
picWidth
*
tempScareSize
,
picHeight
*
tempScareSize
);
__block
bool
isResult
=
false
;
[[
PHImageManager
defaultManager
]
requestImageForAsset
:
assets
targetSize
:
temp
contentMode
:
PHImageContentModeDefault
options
:
imageRequestOption
resultHandler
:^
(
UIImage
*
_Nullable
result
,
NSDictionary
*
_Nullable
info
)
{
if
(
isResult
){
return
;
}
isResult
=
true
;
@autoreleasepool
{
NSData
*
data
=
UIImageJPEGRepresentation
(
result
,
1
)
;
[
data
writeToFile
:
tempTake
atomically
:
YES
];
// result=nil;
// data=nil;
}
NSLog
(
@"压缩预览图片耗时:%f ms Temp路径%@"
,(
CFAbsoluteTimeGetCurrent
()
-
start
)
*
1000
,
tempTake
);
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultTemp
]
:
tempTake
];
}];
});
}
}
else
if
([[
self
.
takePhotoMap
allKeys
]
containsObject
:
path
]){
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultTemp
]
:
self
.
takePhotoMap
[
path
]];
}
}
}
else
if
([
@"play_album_video"
isEqualToString
:
call
.
method
]
){
long
resultTemp
=
self
.
resultKey
;
NSString
*
path
=
call
.
arguments
;
...
...
@@ -923,12 +939,12 @@ CFAbsoluteTime startTime;
-
(
void
)
popWindow
:
(
NSString
*
)
str
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
@"提示"
message
:
str
preferredStyle
:
UIAlertControllerStyleAlert
];
UIAlertAction
*
okAction
=
[
UIAlertAction
actionWithTitle
:
@"确定"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
NSLog
(
@"确定"
);
}];
[
alertController
addAction
:
okAction
];
[
viewController
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
UIAlertAction
*
okAction
=
[
UIAlertAction
actionWithTitle
:
@"确定"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
NSLog
(
@"确定"
);
}];
[
alertController
addAction
:
okAction
];
[
viewController
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
}
//-(void)execRealImg:(long)resultId{
...
...
lib/ScanImagePlugn.dart
View file @
d1da53f0
...
...
@@ -38,6 +38,12 @@ class ScanImagePlugn {
.
invokeMethod
(
"native_camera"
,
{
"authority"
:
authority
});
}
static
Future
<
String
>
scareImg
(
MethodChannel
channel
,
String
path
,
int
scare
)
async
{
return
await
channel
.
invokeMethod
(
"scare_image"
,
{
"path"
:
path
,
"size"
:
scare
});
}
static
Future
<
bool
>
quitPage
(
MethodChannel
channel
)
async
{
return
await
channel
.
invokeMethod
(
"quit_page"
);
}
...
...
lib/gengmei_flutter_plugin.dart
View file @
d1da53f0
...
...
@@ -19,6 +19,10 @@ class GengmeiFlutterPlugin {
return
await
ScanImagePlugn
.
scanImages
(
_channel
);
}
static
Future
<
String
>
scareImg
(
String
path
,
int
scare
)
async
{
return
await
ScanImagePlugn
.
scareImg
(
_channel
,
path
,
scare
);
}
static
Future
<
Map
>
nativeCamera
(
String
authority
)
async
{
return
await
ScanImagePlugn
.
nativeCamera
(
_channel
,
authority
);
}
...
...
pubspec.lock
View file @
d1da53f0
...
...
@@ -7,14 +7,14 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.
2
.0"
version: "2.
3
.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.
4
"
version: "1.0.
5
"
charcode:
dependency: transitive
description:
...
...
@@ -52,28 +52,28 @@ packages:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.
6
"
version: "1.1.
7
"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.
2
"
version: "1.6.
4
"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.
7.0
"
version: "1.
8.0+1
"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.
3
"
version: "2.0.
5
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -106,7 +106,7 @@ packages:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.
4
"
version: "1.0.
5
"
term_glyph:
dependency: transitive
description:
...
...
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