Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShareExtend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
ShareExtend
Commits
58661e28
Commit
58661e28
authored
Oct 28, 2018
by
zhouteng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新版本号,修复FileProvider在低版本下的用法
parent
1028417f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
README.md
README.md
+1
-1
android/src/main/java/com/zt/shareextend/ShareExtendPlugin.java
...d/src/main/java/com/zt/shareextend/ShareExtendPlugin.java
+11
-1
pubspec.yaml
pubspec.yaml
+2
-2
No files found.
README.md
View file @
58661e28
...
...
@@ -5,7 +5,7 @@
```
dependencies:
share_extend: "^
0.0.1
"
share_extend: "^
1.0.0
"
```
## 导入
```
...
...
android/src/main/java/com/zt/shareextend/ShareExtendPlugin.java
View file @
58661e28
...
...
@@ -4,9 +4,11 @@ import io.flutter.plugin.common.MethodCall;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.PluginRegistry.Registrar
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.support.v4.content.FileProvider
;
...
...
@@ -57,7 +59,7 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler {
shareIntent
.
setType
(
"text/plain"
);
}
else
{
File
f
=
new
File
(
text
);
Uri
uri
=
FileProvider
.
getUriForFile
(
mRegistrar
.
context
(),
authorities
,
f
);
Uri
uri
=
getUriForFile
(
mRegistrar
.
context
(),
authorities
,
f
);
if
(
"file"
.
equals
(
type
))
{
shareIntent
.
setType
(
"application/*"
);
}
...
...
@@ -75,4 +77,12 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler {
mRegistrar
.
context
().
startActivity
(
chooserIntent
);
}
}
public
static
Uri
getUriForFile
(
Context
context
,
String
authories
,
File
file
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
{
return
FileProvider
.
getUriForFile
(
context
,
authories
,
file
);
}
else
{
return
Uri
.
fromFile
(
file
);
}
}
}
pubspec.yaml
View file @
58661e28
name
:
share_extend
description
:
A flutter plugin to share text, image, file with systemui.
version
:
0.0.1
description
:
A flutter plugin to share text, image, file with systemui.
一个调用系统分享的flutter插件,支持分享文本,图片和文件。
version
:
1.0.0
author
:
zhouteng <qfszyq@gmail.com>
homepage
:
https://github.com/zhouteng0217/ShareExtend.git
...
...
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