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
85f3ca47
Commit
85f3ca47
authored
Nov 07, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
02bd549a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
112 deletions
+96
-112
workspace.xml
.idea/workspace.xml
+11
-11
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+85
-101
No files found.
.idea/workspace.xml
View file @
85f3ca47
...
...
@@ -5,7 +5,11 @@
<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$/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"
/>
</list>
<ignored
path=
"$PROJECT_DIR$/.dart_tool/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
<ignored
path=
"$PROJECT_DIR$/.pub/"
/>
...
...
@@ -199,11 +203,11 @@
</list>
</option>
</component>
<component
name=
"ProjectFrameBounds"
extendedState=
"6"
>
<option
name=
"x"
value=
"
36
"
/>
<option
name=
"y"
value=
"
134
"
/>
<component
name=
"ProjectFrameBounds"
>
<option
name=
"x"
value=
"
165
"
/>
<option
name=
"y"
value=
"
66
"
/>
<option
name=
"width"
value=
"1440"
/>
<option
name=
"height"
value=
"81
2
"
/>
<option
name=
"height"
value=
"81
1
"
/>
</component>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"true"
/>
<component
name=
"ProjectView"
>
...
...
@@ -219,11 +223,6 @@
<item
name=
"gengmei_flutter_plugin"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"gengmei_flutter_plugin"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"gengmei_flutter_plugin"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"gengmei_flutter_plugin"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"lib"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"gengmei_flutter_plugin"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"External Libraries"
type=
"cb654da1:ExternalLibrariesNode"
/>
...
...
@@ -291,7 +290,8 @@
<servers
/>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"3"
y=
"23"
width=
"1440"
height=
"811"
extended-state=
"6"
/>
<frame
x=
"165"
y=
"66"
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
id=
"Captures"
order=
"1"
side_tool=
"true"
/>
...
...
android/src/main/java/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
85f3ca47
...
...
@@ -3,6 +3,8 @@ package com.example.gengmei_flutter_plugin
import
android.Manifest
import
android.annotation.TargetApi
import
android.app.Activity.RESULT_OK
import
android.app.Application
import
android.content.Context
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.graphics.Bitmap
...
...
@@ -76,15 +78,15 @@ class GengmeiFlutterPlugin : MethodCallHandler {
//剪裁请求码
private
val
CROP_REQUEST_CODE
=
3
lateinit
var
resign
:
Registrar
;
lateinit
var
resign
:
Context
var
listener
:
EventChannel
.
EventSink
?
=
null
@JvmStatic
fun
registerWith
(
registrar
:
Registrar
)
{
if
(
registrar
.
activity
()
==
null
)
{
return
}
resign
=
registrar
;
val
gengmeiFlutterPlugin
=
GengmeiFlutterPlugin
()
;
resign
=
registrar
.
context
().
applicationContext
val
gengmeiFlutterPlugin
=
GengmeiFlutterPlugin
()
val
channel
=
MethodChannel
(
registrar
.
messenger
(),
"gengmei_flutter_plugin"
)
channel
.
setMethodCallHandler
(
gengmeiFlutterPlugin
)
val
eventChannel
=
EventChannel
(
registrar
.
messenger
(),
"gengmei_flutter_plugin_event"
)
...
...
@@ -98,36 +100,34 @@ 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
->
// registrar.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(registrar.context().applicationContext, "请同意权限", Toast.LENGTH_SHORT).show()
// premissionHandler?.run {
// this.error("没有权限!!")
// }
// }
// } else {
// Toast.makeText(registrar.context().applicationContext, "请同意权限", Toast.LENGTH_SHORT).show()
// premissionHandler?.run {
// this.error("没有权限!!")
// }
// }
// true;
// }
registrar
.
addActivityResultListener
{
requestCode
,
resultCode
,
intent
->
Log
.
e
(
"lsy"
,
" LSY ACTIVITY RESULT ${nativeImage?.exists()} ${requestCode} "
)
when
(
requestCode
)
{
CAMERA_REQUEST_CODE
->
{
...
...
@@ -146,7 +146,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
// e.printStackTrace();
// }
// 最后通知图库更新
re
sign
.
context
().
applicationContext
.
sendBroadcast
(
Intent
(
Intent
.
ACTION_MEDIA_SCANNER_SCAN_FILE
,
re
gistrar
.
context
().
applicationContext
.
sendBroadcast
(
Intent
(
Intent
.
ACTION_MEDIA_SCANNER_SCAN_FILE
,
Uri
.
fromFile
(
nativeImage
)))
ImageRespository
.
getInstance
().
recordImageListMap
.
add
(
0
,
map
)
ResultManager
.
getInstance
().
resultSuccess
(
gotoNativeCameraKey
,
map
);
...
...
@@ -195,12 +195,11 @@ class GengmeiFlutterPlugin : MethodCallHandler {
// } 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
.
sendBroadcast
(
broad
)
// resign.activity().startActivityForResult(intent, CAMERA_REQUEST_CODE);
}
...
...
@@ -208,54 +207,37 @@ class GengmeiFlutterPlugin : MethodCallHandler {
resultKey
++
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
)
}
})
IMAGE_PICKER
->
{
val
result
=
resultKey
;
ScanImage
(
result
)
}
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"
)
!!
)
}
})
gotoNativeCamera
(
call
.
argument
<
String
>(
"authority"
)
!!
)
}
SAVE_STRING_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
saveString
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
String
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
saveString
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
String
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
}
SAVE_INT_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
saveInt
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Int
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
saveInt
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Int
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
}
SAVE_FLOAT_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
saveFloat
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Float
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
saveFloat
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Float
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
}
SAVE_BOOLEAN_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
saveBoolean
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Boolean
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
saveBoolean
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Boolean
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
...
...
@@ -265,14 +247,14 @@ class GengmeiFlutterPlugin : MethodCallHandler {
val
temp
=
call
.
argument
<
List
<
String
>>(
"value"
)
!!
val
set
=
HashSet
<
String
>();
set
.
addAll
(
temp
)
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
saveStringList
(
call
.
argument
<
String
>(
"key"
)
!!
,
set
)
SharedManager
.
getInstance
(
resign
).
saveStringList
(
call
.
argument
<
String
>(
"key"
)
!!
,
set
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
}
GET_STRING_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
getString
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
String
>(
"value"
))
SharedManager
.
getInstance
(
resign
).
getString
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
String
>(
"value"
))
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
if
(
it
==
null
)
{
""
...
...
@@ -286,21 +268,21 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
GET_INT_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
getInt
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Int
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
getInt
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Int
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
}
GET_FLOAT_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
getFloat
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Float
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
getFloat
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Float
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
}
GET_BOOLEAN_SHARED
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
getBoolean
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Boolean
>(
"value"
)
!!
)
SharedManager
.
getInstance
(
resign
).
getBoolean
(
call
.
argument
<
String
>(
"key"
)
!!
,
call
.
argument
<
Boolean
>(
"value"
)
!!
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
DebugUtil
::
printStackTrace
).
addTo
(
disposable
)
...
...
@@ -312,7 +294,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
temp
?.
run
{
set
.
addAll
(
this
)
}
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
getStringList
(
call
.
argument
<
String
>(
"key"
)
!!
,
set
)
SharedManager
.
getInstance
(
resign
).
getStringList
(
call
.
argument
<
String
>(
"key"
)
!!
,
set
)
.
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
{
...
...
@@ -322,7 +304,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
CLEAR_SHARE
->
{
val
result
=
resultKey
;
SharedManager
.
getInstance
(
resign
.
activity
().
applicationContext
).
clear
().
subscribe
({
SharedManager
.
getInstance
(
resign
).
clear
().
subscribe
({
ResultManager
.
getInstance
().
resultSuccess
(
result
,
it
);
},
{
DebugUtil
.
printStackTrace
(
it
);
...
...
@@ -339,18 +321,20 @@ class GengmeiFlutterPlugin : MethodCallHandler {
ALBUM_PLAY_VIDEO
->
{
val
path
=
call
.
arguments
as
String
?
path
?.
run
{
val
intent
=
Intent
(
resign
.
context
()
,
VideoActivity
::
class
.
java
)
val
intent
=
Intent
(
resign
,
VideoActivity
::
class
.
java
)
intent
.
putExtra
(
"PATH"
,
this
)
resign
.
activity
().
startActivity
(
intent
)
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
resign
.
startActivity
(
intent
)
}
}
PREVIEW_IMAGE
->
{
val
result
=
resultKey
;
val
path
=
call
.
arguments
as
String
?
path
?.
run
{
val
intent
=
Intent
(
resign
.
activity
()
,
PreviewActivity
::
class
.
java
)
val
intent
=
Intent
(
resign
,
PreviewActivity
::
class
.
java
)
intent
.
putExtra
(
"PATH"
,
this
)
resign
.
activity
().
startActivity
(
intent
)
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
resign
.
startActivity
(
intent
)
ResultManager
.
getInstance
().
resultSuccess
(
result
,
true
)
// ImageRespository.getInstance().getPreviewImg(resign.context().applicationContext,this, 800.0f).subscribe({
// val resutlMap=HashMap<String,String>(5);
...
...
@@ -368,7 +352,7 @@ class GengmeiFlutterPlugin : MethodCallHandler {
fun
ScanImage
(
resultKey
:
Long
)
{
quit_page
=
false
;
ImageRespository
.
getInstance
().
scanPhoneImage
(
resign
.
context
().
applicationContext
).
subscribe
(
ImageRespository
.
getInstance
().
scanPhoneImage
(
resign
).
subscribe
(
{
record
=
it
if
(!
quit_page
)
{
...
...
@@ -386,10 +370,10 @@ class GengmeiFlutterPlugin : MethodCallHandler {
}
fun
savePreview
()
{
ImageRespository
.
getInstance
().
savePreviewImg
(
resign
.
context
().
applicationContext
,
object
:
ImageRespository
.
savePreviewListener
{
ImageRespository
.
getInstance
().
savePreviewImg
(
resign
,
object
:
ImageRespository
.
savePreviewListener
{
override
fun
onSuccess
(
data
:
HashMap
<
String
,
ArrayList
<
HashMap
<
String
,
Any
>>>)
{
if
(!
quit_page
)
{
Handler
(
resign
.
activeContext
().
applicationContext
.
mainLooper
).
post
{
Handler
(
resign
.
mainLooper
).
post
{
listener
?.
run
{
this
.
success
(
data
)
}
...
...
@@ -401,32 +385,32 @@ 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
)
val
cameraPremission
=
activity
.
checkSelfPermission
(
Manifest
.
permission
.
CAMERA
);
if
(
writePremission
!=
PackageManager
.
PERMISSION_GRANTED
||
cameraPremission
!=
PackageManager
.
PERMISSION_GRANTED
||
readPremission
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
activity
.
shouldShowRequestPermissionRationale
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
))
{
Toast
.
makeText
(
activity
.
applicationContext
,
"请开通相关权限,否则无法正常使用本应用!"
,
Toast
.
LENGTH_SHORT
).
show
()
}
if
(
activity
.
shouldShowRequestPermissionRationale
(
Manifest
.
permission
.
CAMERA
))
{
Toast
.
makeText
(
activity
.
applicationContext
,
"请开通相关权限,否则无法正常使用本应用"
,
Toast
.
LENGTH_SHORT
).
show
()
}
if
(
activity
.
shouldShowRequestPermissionRationale
(
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
))
{
Toast
.
makeText
(
activity
.
applicationContext
,
"请开通相关权限,否则无法正常使用本应用"
,
Toast
.
LENGTH_SHORT
).
show
()
}
//申请权限
activity
.
requestPermissions
(
arrayOf
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
),
PREMISSION
);
}
else
{
// Toast.makeText(activity.applicationContext, "授权成功!", Toast.LENGTH_SHORT).show();
listener
.
OK
()
}
listener
.
OK
()
// val activity = resign
// val writePremission = activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
// val readPremission = activity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
// val cameraPremission = activity.checkSelfPermission(Manifest.permission.CAMERA);
// if (writePremission != PackageManager.PERMISSION_GRANTED ||
// cameraPremission != PackageManager.PERMISSION_GRANTED ||
// readPremission != PackageManager.PERMISSION_GRANTED) {
//// if (activity.shouldShowRequestPermissionRationale(Manifest.permission
//// .WRITE_EXTERNAL_STORAGE)) {
//// Toast.makeText(activity.applicationContext, "请开通相关权限,否则无法正常使用本应用!", Toast.LENGTH_SHORT).show()
//// }
//// if (activity.shouldShowRequestPermissionRationale(Manifest.permission.CAMERA)) {
//// Toast.makeText(activity.applicationContext, "请开通相关权限,否则无法正常使用本应用", Toast.LENGTH_SHORT).show()
//// }
//// if (activity.shouldShowRequestPermissionRationale(Manifest.permission.READ_EXTERNAL_STORAGE)) {
//// Toast.makeText(activity.applicationContext, "请开通相关权限,否则无法正常使用本应用", Toast.LENGTH_SHORT).show()
//// }
// //申请权限
// activity.requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE
// , Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE), PREMISSION);
// } else {
//// Toast.makeText(activity.applicationContext, "授权成功!", Toast.LENGTH_SHORT).show();
// listener.OK()
// }
}
interface
PermissionListener
{
...
...
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