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
2f2ced98
Commit
2f2ced98
authored
Apr 17, 2020
by
zhouteng
Committed by
GitHub
Apr 17, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #28 from JEuler/fix-content-provider
Fix content provider
parents
6435b318
d050e97f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
android/src/main/java/com/zt/shareextend/ShareExtendPlugin.java
...d/src/main/java/com/zt/shareextend/ShareExtendPlugin.java
+9
-3
No files found.
android/src/main/java/com/zt/shareextend/ShareExtendPlugin.java
View file @
2f2ced98
...
...
@@ -3,6 +3,7 @@ package com.zt.shareextend;
import
android.Manifest
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.net.Uri
;
import
java.io.File
;
...
...
@@ -71,6 +72,7 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
shareIntent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
shareIntent
.
putExtra
(
Intent
.
EXTRA_SUBJECT
,
subject
);
ArrayList
<
Uri
>
uriList
=
new
ArrayList
<>();
if
(
"text"
.
equals
(
type
))
{
shareIntent
.
setAction
(
Intent
.
ACTION_SEND
);
shareIntent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
list
.
get
(
0
));
...
...
@@ -83,7 +85,6 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
}
}
ArrayList
<
Uri
>
uriList
=
new
ArrayList
<>();
for
(
String
path
:
list
)
{
File
f
=
new
File
(
path
);
Uri
uri
=
ShareUtils
.
getUriForFile
(
mRegistrar
.
activity
(),
f
);
...
...
@@ -105,12 +106,17 @@ public class ShareExtendPlugin implements MethodChannel.MethodCallHandler, Plugi
shareIntent
.
putParcelableArrayListExtra
(
Intent
.
EXTRA_STREAM
,
uriList
);
}
}
startChooserActivity
(
shareIntent
,
sharePanelTitle
);
startChooserActivity
(
uriList
.
get
(
0
),
shareIntent
,
sharePanelTitle
);
}
private
void
startChooserActivity
(
Intent
shareIntent
,
String
sharePanelTitle
)
{
private
void
startChooserActivity
(
Uri
uri
,
Intent
shareIntent
,
String
sharePanelTitle
)
{
Intent
chooserIntent
=
Intent
.
createChooser
(
shareIntent
,
sharePanelTitle
/* dialog subject optional */
);
if
(
mRegistrar
.
activity
()
!=
null
)
{
List
<
ResolveInfo
>
resInfoList
=
mRegistrar
.
activity
().
getPackageManager
().
queryIntentActivities
(
chooserIntent
,
PackageManager
.
MATCH_DEFAULT_ONLY
);
for
(
ResolveInfo
resolveInfo
:
resInfoList
)
{
String
packageName
=
resolveInfo
.
activityInfo
.
packageName
;
mRegistrar
.
activity
().
grantUriPermission
(
packageName
,
uri
,
Intent
.
FLAG_GRANT_WRITE_URI_PERMISSION
|
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
}
mRegistrar
.
activity
().
startActivity
(
chooserIntent
);
}
else
{
chooserIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
...
...
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