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
65d6fd04
Commit
65d6fd04
authored
Oct 17, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
17fcda9a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
153 additions
and
93 deletions
+153
-93
misc.xml
.idea/misc.xml
+1
-0
workspace.xml
.idea/workspace.xml
+0
-0
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+17
-2
ImageScanner.kt
...utter_plugin/ImagePlugin/repository/local/ImageScanner.kt
+1
-1
Engine.kt
...mei_flutter_plugin/ImagePlugin/repository/luban/Engine.kt
+1
-1
ResultManager.kt
...om/example/gengmei_flutter_plugin/result/ResultManager.kt
+0
-3
SharedManager.kt
.../gengmei_flutter_plugin/sharedPrefernces/SharedManager.kt
+12
-5
AlbumModel.dart
example/lib/AlbumModel/page/album/AlbumModel.dart
+17
-17
AlbumPage.dart
example/lib/AlbumModel/page/album/AlbumPage.dart
+1
-4
pubspec.lock
example/pubspec.lock
+21
-21
gengmei_flutter_plugin.iml
gengmei_flutter_plugin.iml
+3
-0
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+44
-18
AlbumItem.m
ios/Classes/Image/AlbumItem.m
+7
-5
ScanImagePlugn.dart
lib/ScanImagePlugn.dart
+1
-0
SharedPlugin.dart
lib/SharedPlugin.dart
+7
-1
gengmei_flutter_plugin.dart
lib/gengmei_flutter_plugin.dart
+20
-15
No files found.
.idea/misc.xml
View file @
65d6fd04
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Android API 29 Platform"
project-jdk-type=
"Android SDK"
/>
<component
name=
"ProjectType"
>
<option
name=
"id"
value=
"io.flutter"
/>
</component>
...
...
.idea/workspace.xml
View file @
65d6fd04
This diff is collapsed.
Click to expand it.
android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
65d6fd04
...
...
@@ -43,6 +43,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
private
var
record
:
HashMap
<
String
,
ArrayList
<
HashMap
<
String
,
Any
>>>?
=
null
;
var
nativeImage
:
File
?
=
null
var
isTaskingExectured
:
Boolean
=
false
;
var
quit_page
=
false
;
companion
object
{
const
val
IMAGE_PICKER
=
"scan_image_picker"
...
...
@@ -61,6 +62,8 @@ class GengmeiFlutterPlugin : MethodCallHandler {
const
val
GET_FLOAT_SHARED
=
"GET_FLOAT_SHARED"
const
val
GET_BOOLEAN_SHARED
=
"GET_BOOLEAN_SHARED"
const
val
GET_STRINGLIST_SHARED
=
"GET_STRINGLIST_SHARED"
const
val
CLEAR_SHARE
=
"CLEAR_SHARE"
const
val
PREMISSION
=
10090
//相机请求码
private
val
CAMERA_REQUEST_CODE
=
2
...
...
@@ -213,9 +216,19 @@ class GengmeiFlutterPlugin : MethodCallHandler {
ResultManager
.
getInstance
().
resultError
(
result
,
it
.
message
!!
,
it
.
message
!!
);
}).
addTo
(
disposable
)
}
CLEAR_SHARE
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
clear
().
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
{
DebugUtil
.
printStackTrace
(
it
);
ResultManager
.
getInstance
().
resultError
(
result
,
it
.
message
!!
,
it
.
message
!!
)
}).
addTo
(
disposable
)
}
QUIT_PAGE
->
{
disposable
.
dispose
()
disposable
=
CompositeDisposable
()
quit_page
=
true
;
ResultManager
.
getInstance
().
resultSuccess
(
resultKey
,
true
)
}
else
->
result
.
notImplemented
()
...
...
@@ -223,11 +236,13 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
fun
ScanImage
(
resultKey
:
Long
)
{
quit_page
=
false
;
ImageRespository
.
getInstance
().
scanPhoneImage
(
resign
.
context
().
applicationContext
).
subscribe
(
{
record
=
it
ResultManager
.
getInstance
().
resultSuccess
(
resultKey
,
it
);
if
(!
quit_page
)
{
ResultManager
.
getInstance
().
resultSuccess
(
resultKey
,
it
);
}
if
(
isTaskingExectured
)
{
return
@subscribe
;
}
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/local/ImageScanner.kt
View file @
65d6fd04
...
...
@@ -77,7 +77,7 @@ class ImageScanner(var context: Context) : AbsMediaScanner<MediaFile>(context) {
if
(
tempFileJpegExists
)
{
mediaFile
.
path
=
tempFileJpegString
;
}
if
(
size
<
1024
*
512
)
{
if
(
size
<
1024
*
100
)
{
mediaFile
.
path
=
path
}
//
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/ImagePlugin/repository/luban/Engine.kt
View file @
65d6fd04
...
...
@@ -70,7 +70,7 @@ constructor(private val srcImg: InputStreamProvider, private val tagImgPath: Str
if
(
quality
==
100
)
{
options
.
inSampleSize
=
computeSize
()
}
else
{
options
.
inSampleSize
=
(
srcWidth
/
24
0
).
toInt
();
options
.
inSampleSize
=
(
srcWidth
/
16
0
).
toInt
();
}
// Log.e("lsy"," SAMPLE SIZE ${options.inSampleSize} ${srcWidth}")
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/result/ResultManager.kt
View file @
65d6fd04
...
...
@@ -20,12 +20,10 @@ class ResultManager private constructor() {
}
fun
resultSuccess
(
key
:
Long
,
value
:
Any
)
{
Log
.
e
(
"lsy"
,
"KEYYY $key "
)
map
.
get
(
key
)
?.
run
{
this
.
success
(
value
);
}
map
.
remove
(
key
)
Log
.
e
(
"lsy"
,
" ${map.size}"
)
}
fun
resultError
(
key
:
Long
,
message
:
String
,
ob
:
Any
)
{
...
...
@@ -33,7 +31,6 @@ class ResultManager private constructor() {
this
.
error
(
message
,
message
,
ob
)
}
map
.
remove
(
key
)
Log
.
e
(
"lsy"
,
" ${map.size}"
)
}
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/sharedPrefernces/SharedManager.kt
View file @
65d6fd04
...
...
@@ -24,7 +24,7 @@ class SharedManager private constructor(app: Context) {
companion
object
{
const
val
SHARED_PREFERENCES_NAME
=
"FlutterSharedPreferences"
@Volatile
private
var
instance
:
SharedManager
?
=
null
;
private
var
instance
:
SharedManager
?
=
null
;
@JvmStatic
fun
getInstance
(
app
:
Context
):
SharedManager
{
...
...
@@ -78,9 +78,9 @@ class SharedManager private constructor(app: Context) {
fun
getString
(
key
:
String
,
value
:
String
?):
Observable
<
String
?>
{
return
Observable
.
create
(
ObservableOnSubscribe
<
String
>
{
val
string
=
preferences
.
getString
(
key
,
value
)
if
(
string
==
null
)
{
if
(
string
==
null
)
{
it
.
onNext
(
""
)
}
else
{
}
else
{
it
.
onNext
(
string
)
}
}).
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
());
...
...
@@ -102,13 +102,19 @@ class SharedManager private constructor(app: Context) {
fun
getStringList
(
key
:
String
,
value
:
Set
<
String
>?):
Observable
<
ArrayList
<
String
>>
{
return
Observable
.
create
(
ObservableOnSubscribe
<
ArrayList
<
String
>>
{
val
stringSet
=
preferences
.
getStringSet
(
key
,
value
)
if
(
stringSet
==
null
)
{
if
(
stringSet
==
null
)
{
throw
RxExpecition
(
"NULL!!"
)
}
val
temp
=
ArrayList
<
String
>()
val
temp
=
ArrayList
<
String
>()
temp
.
addAll
(
stringSet
)
it
.
onNext
(
temp
)
}).
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
());
}
fun
clear
():
Observable
<
Boolean
>
{
return
Observable
.
create
(
ObservableOnSubscribe
<
Boolean
>
{
it
.
onNext
(
preferences
.
edit
().
clear
().
commit
());
}).
subscribeOn
(
Schedulers
.
io
()).
observeOn
(
AndroidSchedulers
.
mainThread
());
}
}
\ No newline at end of file
example/lib/AlbumModel/page/album/AlbumModel.dart
View file @
65d6fd04
...
...
@@ -16,7 +16,7 @@ import 'package:gengmei_flutter_plugin_example/AlbumModel/repository/AlbumReposi
const
String
MainDir
=
"IsGengmeiAlbumAllImages"
;
const
String
MainDirExplain
=
"全部相片"
;
class
AlbumModel
{
class
AlbumModel
{
LiveData
<
List
<
ScanImageItem
>>
albumLive
=
LiveData
();
LiveData
<
List
<
DirBean
>>
dirLive
=
LiveData
();
LiveData
<
String
>
titleData
=
LiveData
();
...
...
@@ -58,19 +58,18 @@ class AlbumModel {
var
map
=
(
event
as
Map
);
// var list = map[_nowDirName];
_mainValue
.
forEach
((
k
,
itemList
)
{
for
(
int
i
=
0
;
i
<
itemList
.
length
;
i
++)
{
if
(
map
[
k
]
==
null
||
map
[
k
][
i
]
==
null
)
{
continue
;
}
var
newPath
=
map
[
k
][
i
][
"path"
]
as
String
;
if
((
itemList
[
i
].
path
==
null
||
itemList
[
i
].
path
.
isEmpty
)
&&
newPath
!=
null
)
{
itemList
[
i
].
path
=
newPath
;
}
var
realPath
=
map
[
k
][
i
][
"realPath"
]
as
String
;
if
((
itemList
[
i
].
realPath
==
null
||
itemList
[
i
].
realPath
.
isEmpty
)
&&
realPath
!=
null
)
{
itemList
[
i
].
realPath
=
realPath
;
var
key
=
map
[
k
];
if
(
key
!=
null
)
{
for
(
int
i
=
0
;
i
<
itemList
.
length
;
i
++)
{
if
(
key
[
i
]
==
null
)
{
continue
;
}
if
(
itemList
[
i
].
path
==
null
)
{
itemList
[
i
].
path
=
key
[
i
][
"path"
];
}
if
(
itemList
[
i
].
realPath
==
null
)
{
itemList
[
i
].
realPath
=
key
[
i
][
"realPath"
];
}
}
}
});
...
...
@@ -100,9 +99,9 @@ class AlbumModel {
void
initScanImages
(
BuildContext
context
)
{
// if (isAndroid) {
_listen
=
GengmeiFlutterPlugin
.
phoneImagesEvent
.
receiveBroadcastStream
()
.
listen
(
_onEvent
,
onError:
_onError
);
_listen
=
GengmeiFlutterPlugin
.
phoneImagesEvent
.
receiveBroadcastStream
()
.
listen
(
_onEvent
,
onError:
_onError
);
// }
AlbumRepository
.
getInstance
().
scanPhoneImg
().
listen
((
value
)
{
if
(
value
!=
null
)
{
...
...
@@ -132,6 +131,7 @@ class AlbumModel {
@override
void
dispose
()
{
GengmeiFlutterPlugin
.
quitPage
();
if
(
_listen
!=
null
)
{
_listen
.
cancel
();
}
...
...
example/lib/AlbumModel/page/album/AlbumPage.dart
View file @
65d6fd04
...
...
@@ -179,10 +179,7 @@ class AlbumState extends State<AlbumPage> {
if
(
imgList
.
data
[
newIndex
]
==
null
||
imgList
.
data
[
newIndex
].
path
==
null
||
imgList
.
data
[
newIndex
].
realPath
==
null
)
{
return
Icon
(
Icons
.
photo
,
size:
20
,
);
return
Container
();
}
return
GestureDetector
(
onTap:
()
=>
_model
.
clickItem
(
context
,
newIndex
),
...
...
example/pubspec.lock
View file @
65d6fd04
...
...
@@ -5,35 +5,35 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.14.11"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "0.1.2"
flutter:
...
...
@@ -52,49 +52,49 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.7
28
"
version: "0.0.7
35
"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.7.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "2.0.3"
rxdart:
dependency: "direct main"
description:
name: rxdart
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "0.22.
2
"
version: "0.22.
3
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -104,56 +104,56 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "0.2.5"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.
flutter-io.cn
"
url: "https://pub.
dartlang.org
"
source: hosted
version: "2.0.8"
sdks:
...
...
gengmei_flutter_plugin.iml
View file @
65d6fd04
...
...
@@ -14,6 +14,9 @@
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.dart_tool"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.pub"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/build"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/.dart_tool"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/.pub"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/build"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/ios/Flutter/App.framework/flutter_assets/packages"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/example/ios/Flutter/App.framework/flutter_assets/packages"
/>
</content>
...
...
ios/Classes/GengmeiFlutterPlugin.m
View file @
65d6fd04
...
...
@@ -16,6 +16,7 @@
@property
(
nonatomic
,
strong
)
UIImagePickerController
*
imagePicker
;
@property
(
atomic
)
Boolean
quitPage
;
@property
(
atomic
)
Boolean
execdTask
;
@property
(
atomic
)
Boolean
copyScareImgOk
;
@property
(
atomic
)
Boolean
finishScanImg
;
@end
...
...
@@ -269,15 +270,20 @@ FlutterEventSink _eventSink;
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
self
.
nativeCameraKey
]
:
@""
];
}
bool
isRunning
=
false
;
-
(
void
)
scanPhone
:(
long
)
resultId
{
self
.
quitPage
=
false
;
if
(
self
.
finishScanImg
)
{
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultId
]
:
self
.
finalMap
];
return
;
}
// if(isRunning){
// isRunning=true;
// return;
// }
if
(
self
.
finalMap
==
nil
)
{
self
.
finalMap
=
[
NSMutableDictionary
dictionary
];
}
if
([
self
.
finalMap
count
]
>
0
&&
self
.
finishScanImg
)
{
[
self
resultImgs
:
resultId
];
return
;
}
self
.
nowSize
=
0
;
self
.
needSize
=
0
;
[
self
.
finalMap
removeAllObjects
];
...
...
@@ -322,6 +328,11 @@ FlutterEventSink _eventSink;
for
(
AlbumItem
*
item
in
assetCollectionList
)
{
self
.
needSize
+=
[
item
collectionNumber
];
}
NSMutableArray
*
arr
=
self
.
finalMap
[
@"IsGengmeiAlbumAllImages"
];
if
(
arr
==
nil
)
{
self
.
finalMap
[
@"IsGengmeiAlbumAllImages"
]
=
[
NSMutableArray
array
];
}
}
-
(
void
)
resultImgs
:
(
long
)
resultId
{
...
...
@@ -329,16 +340,18 @@ FlutterEventSink _eventSink;
return
;
}
dispatch_async
(
dispatch_get_main_queue
(),
^
{
self
.
finishScanImg
=
true
;
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultId
]
:
self
.
finalMap
];
if
(
self
.
execdTask
){
return
;
}
self
.
execdTask
=
true
;
[
NSThread
detachNewThreadWithBlock
:
^
{
NSLog
(
@"block run..."
);
[
self
execRealImg
];
}];
// if(self.execdTask){
// return ;
// }
// self.execdTask=true;
// [NSThread detachNewThreadSelector:@selector(run) toTarget:self withObject:nil];
[
NSThread
detachNewThreadSelector
:
@selector
(
thread
:)
toTarget
:
self
withObject
:
@"baby"
];
// [NSThread detachNewThreadSelector: toTarget:<#(nonnull id)#> withObject:<#(nullable id)#>:^{
// NSLog(@"block run...");
//
// }];
// [self performSelectorInBackground:@selector(run) withObject:nil];
// dispatch_queue_t queue1 = dispatch_queue_create("com.onealon.gcdTest1", DISPATCH_QUEUE_CONCURRENT);
// dispatch_sync(queue1, ^{
...
...
@@ -348,6 +361,10 @@ FlutterEventSink _eventSink;
}
-
(
void
)
thread
:
(
id
)
parameter
{
[
self
execRealImg
];
}
-
(
void
)
upImgs
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
...
...
@@ -364,6 +381,9 @@ FlutterEventSink _eventSink;
AlbumItem
*
item
=
assetCollectionList
[
j
];
PHFetchResult
<
PHAsset
*>
*
assetResult
=
[
item
assets
];
for
(
int
i
=
0
;
i
<
[
assetResult
count
];
i
++
)
{
if
(
self
.
quitPage
){
return
;
}
__block
NSString
*
docName
=
[
item
collectionTitle
];
PHAsset
*
assets
=
[
assetResult
objectAtIndex
:
i
];
__block
NSString
*
imgName
=
[
assets
valueForKey
:
@"filename"
];
...
...
@@ -384,13 +404,14 @@ FlutterEventSink _eventSink;
}
else
{
[
self
.
finalMap
[
docName
]
addObject
:
queryItemDict
];
}
[
self
.
finalMap
[
@"IsGengmeiAlbumAllImages"
]
addObject
:
queryItemDict
];
NSLog
(
@"SCARE SIZEEE %d %d "
,
self
.
nowSize
,
self
.
needSize
);
if
(
self
.
nowSize
==
self
.
needSize
)
{
[
self
resultImgs
:
resultId
];
}
}
else
{
PHImageRequestOptions
*
imageRequestOption
=
[[
PHImageRequestOptions
alloc
]
init
];
imageRequestOption
.
synchronous
=
NO
;
imageRequestOption
.
synchronous
=
YES
;
int
picWidth
=
[
assets
pixelWidth
];
int
picHeight
=
[
assets
pixelHeight
];
float
tempScareSize
=
1
;
...
...
@@ -431,6 +452,7 @@ FlutterEventSink _eventSink;
}
else
{
[
self
.
finalMap
[
docName
]
addObject
:
queryItemDict
];
}
[
self
.
finalMap
[
@"IsGengmeiAlbumAllImages"
]
addObject
:
queryItemDict
];
NSLog
(
@"SCARE SIZEEE %d %d "
,
self
.
nowSize
,
self
.
needSize
);
result
=
nil
;
if
(
self
.
nowSize
==
self
.
needSize
)
{
...
...
@@ -452,6 +474,9 @@ FlutterEventSink _eventSink;
PHFetchResult
<
PHAsset
*>
*
assetResult
=
[
item
assets
];
NSLog
(
@"09090909090 %d %d"
,[
assetResult
count
],
self
.
needSize
);
for
(
int
i
=
0
;
i
<
[
assetResult
count
];
i
++
)
{
if
(
self
.
quitPage
){
return
;
}
__block
NSString
*
docName
=
[
item
collectionTitle
];
PHAsset
*
assets
=
[
assetResult
objectAtIndex
:
i
];
__block
NSString
*
imgName
=
[
assets
valueForKey
:
@"filename"
];
...
...
@@ -479,10 +504,11 @@ FlutterEventSink _eventSink;
NSLog
(
@"SIZEEE %d %d "
,
self
.
nowSize
,
self
.
needSize
);
if
(
self
.
nowSize
==
self
.
needSize
)
{
[
self
upImgs
];
self
.
execdTask
=
true
;
self
.
finishScanImg
=
true
;
// self.execdTask=true;
}
}
else
{
NSLog
(
@"file NOT EXIT !!
"
);
NSLog
(
@"file NOT EXIT !!
%@"
,
realPath
);
PHImageRequestOptions
*
imageRequestOption
=
[[
PHImageRequestOptions
alloc
]
init
];
imageRequestOption
.
synchronous
=
YES
;
int
picWidth
=
[
assets
pixelWidth
];
...
...
@@ -524,9 +550,9 @@ FlutterEventSink _eventSink;
// result=nil;
if
(
self
.
nowSize
==
self
.
needSize
)
{
[
self
upImgs
];
self
.
finishScanImg
=
true
;
self
.
execdTask
=
true
;
}
else
if
(
self
.
copySize
%
35
==
0
||
self
.
copySize
==
10
){
NSLog
(
@"UPPP!!"
);
}
else
if
(
self
.
copySize
%
20
==
0
||
self
.
copySize
==
10
){
[
self
upImgs
];
}
}];
...
...
ios/Classes/Image/AlbumItem.m
View file @
65d6fd04
...
...
@@ -12,11 +12,13 @@
-
(
void
)
setCollection
:(
PHAssetCollection
*
)
collection
{
_collection
=
collection
;
if
([
collection
.
localizedTitle
isEqualToString
:
@"All Photos"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"所有照片"
])
{
self
.
collectionTitle
=
@"IsGengmeiAlbumAllImages"
;
}
else
{
self
.
collectionTitle
=
collection
.
localizedTitle
;
}
// if ([collection.localizedTitle isEqualToString:@"All Photos"]||[collection.localizedTitle isEqualToString:@"所有照片"]) {
// self.collectionTitle = @"IsGengmeiAlbumAllImages";
// } else {
//
// }
self
.
collectionTitle
=
collection
.
localizedTitle
;
// self.collectionTitle = collection.localizedTitle;
...
...
lib/ScanImagePlugn.dart
View file @
65d6fd04
...
...
@@ -11,6 +11,7 @@ class ScanImagePlugn {
Map
<
String
,
List
<
ScanImageItem
>>
newMap
=
new
Map
();
images
.
forEach
((
k
,
v
)
{
List
<
ScanImageItem
>
tempList
=
new
List
();
print
(
"-------UP
${k}
${tempList.length}
"
);
for
(
var
item
in
v
)
{
ScanImageItem
scanImageItem
=
new
ScanImageItem
();
scanImageItem
.
path
=
item
[
"path"
];
...
...
lib/SharedPlugin.dart
View file @
65d6fd04
...
...
@@ -16,6 +16,8 @@ const String GET_FLOAT_SHARED = "GET_FLOAT_SHARED";
const
String
GET_BOOLEAN_SHARED
=
"GET_BOOLEAN_SHARED"
;
const
String
GET_STRINGLIST_SHARED
=
"GET_STRINGLIST_SHARED"
;
const
String
CLEAR_SHARE
=
"CLEAR_SHARE"
;
class
SharedPlugin
{
static
Future
<
bool
>
saveString
(
String
key
,
String
value
,
MethodChannel
channel
)
async
{
...
...
@@ -75,7 +77,7 @@ class SharedPlugin {
String
key
,
List
<
String
>
value
,
MethodChannel
channel
)
async
{
List
list
=
await
channel
.
invokeMethod
(
GET_STRINGLIST_SHARED
,
{
"key"
:
key
,
"value"
:
value
});
if
(
list
==
null
)
{
if
(
list
==
null
)
{
print
(
"LIST IS NULLL!!!! "
);
return
Future
.
value
(
null
);
}
...
...
@@ -86,4 +88,8 @@ class SharedPlugin {
});
return
Future
.
value
(
finalList
);
}
static
Future
<
bool
>
clear
(
MethodChannel
channel
)
async
{
return
await
channel
.
invokeMethod
(
CLEAR_SHARE
);
}
}
lib/gengmei_flutter_plugin.dart
View file @
65d6fd04
...
...
@@ -27,43 +27,48 @@ class GengmeiFlutterPlugin {
return
await
ScanImagePlugn
.
quitPage
(
_channel
);
}
static
Future
<
int
>
getInt
(
String
key
,
int
value
)
async
{
return
await
SharedPlugin
.
getInt
(
key
,
value
,
_channel
);
static
Future
<
int
>
getInt
(
String
key
,
int
value
)
async
{
return
await
SharedPlugin
.
getInt
(
key
,
value
,
_channel
);
}
static
Future
<
double
>
getDouble
(
String
key
,
double
value
)
async
{
return
await
SharedPlugin
.
getDouble
(
key
,
value
,
_channel
);
static
Future
<
double
>
getDouble
(
String
key
,
double
value
)
async
{
return
await
SharedPlugin
.
getDouble
(
key
,
value
,
_channel
);
}
static
Future
<
String
>
getString
(
String
key
,
String
value
)
async
{
return
await
SharedPlugin
.
getString
(
key
,
value
,
_channel
);
static
Future
<
String
>
getString
(
String
key
,
String
value
)
async
{
return
await
SharedPlugin
.
getString
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
getbool
(
String
key
,
bool
value
)
async
{
return
await
SharedPlugin
.
getBoolean
(
key
,
value
,
_channel
);
static
Future
<
bool
>
getbool
(
String
key
,
bool
value
)
async
{
return
await
SharedPlugin
.
getBoolean
(
key
,
value
,
_channel
);
}
static
Future
<
List
<
String
>>
getStringList
(
String
key
,
List
<
String
>
value
)
async
{
return
await
SharedPlugin
.
getStringList
(
key
,
value
,
_channel
);
static
Future
<
List
<
String
>>
getStringList
(
String
key
,
List
<
String
>
value
)
async
{
return
await
SharedPlugin
.
getStringList
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
saveString
(
String
key
,
String
value
)
async
{
static
Future
<
bool
>
saveString
(
String
key
,
String
value
)
async
{
return
await
SharedPlugin
.
saveString
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
saveInt
(
String
key
,
int
value
)
async
{
static
Future
<
bool
>
saveInt
(
String
key
,
int
value
)
async
{
return
await
SharedPlugin
.
saveInt
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
saveDouble
(
String
key
,
double
value
)
async
{
static
Future
<
bool
>
saveDouble
(
String
key
,
double
value
)
async
{
return
await
SharedPlugin
.
saveDouble
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
saveBool
(
String
key
,
bool
value
)
async
{
static
Future
<
bool
>
saveBool
(
String
key
,
bool
value
)
async
{
return
await
SharedPlugin
.
saveBoolean
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
saveStringList
(
String
key
,
List
<
String
>
value
)
async
{
static
Future
<
bool
>
saveStringList
(
String
key
,
List
<
String
>
value
)
async
{
return
await
SharedPlugin
.
saveStringList
(
key
,
value
,
_channel
);
}
static
Future
<
bool
>
clearShare
()
async
{
return
await
SharedPlugin
.
clear
(
_channel
);
}
}
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