Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
fallenstardust
YGOMobile
Commits
4406eb1c
Commit
4406eb1c
authored
Jul 31, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改为分享文件路径
adapt provider
parent
2a9fb92c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/ShareFileActivity.java
.../cn/garymb/ygomobile/ui/activities/ShareFileActivity.java
+7
-4
mobile/src/main/res/xml/provider_paths.xml
mobile/src/main/res/xml/provider_paths.xml
+6
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/ShareFileActivity.java
View file @
4406eb1c
...
...
@@ -7,12 +7,14 @@ import android.os.Bundle;
import
android.widget.Toast
;
import
androidx.annotation.Nullable
;
import
androidx.core.content.FileProvider
;
import
java.io.File
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.core.IrrlichtBridge
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.R
;
public
class
ShareFileActivity
extends
BaseActivity
{
...
...
@@ -34,14 +36,15 @@ public class ShareFileActivity extends BaseActivity{
String
ext
=
intent
.
getStringExtra
(
IrrlichtBridge
.
EXTRA_SHARE_FILE
);
//TODO
Toast
.
makeText
(
this
,
title
+
"."
+
ext
,
Toast
.
LENGTH_LONG
).
show
();
File
shareFile
=
null
;
String
shareFile
=
null
;
if
(
ext
.
equals
(
"yrp"
))
{
shareFile
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
Constants
.
CORE_REPLAY_PATH
+
"/"
+
title
)
;
shareFile
=
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
Constants
.
CORE_REPLAY_PATH
+
"/"
+
title
;
}
else
if
(
ext
.
equals
(
"lua"
))
{
shareFile
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()+
"/"
+
Constants
.
CORE_SINGLE_PATH
+
"/"
+
title
)
;
shareFile
=
AppsSettings
.
get
().
getResourcePath
()+
"/"
+
Constants
.
CORE_SINGLE_PATH
+
"/"
+
title
;
}
Intent
shareIntent
=
new
Intent
(
Intent
.
ACTION_SEND
);
shareIntent
.
putExtra
(
Intent
.
EXTRA_STREAM
,
Uri
.
fromFile
(
shareFile
));
shareIntent
.
putExtra
(
Intent
.
EXTRA_STREAM
,
FileProvider
.
getUriForFile
(
this
,
BuildConfig
.
APPLICATION_ID
+
".fileprovider"
,
new
File
(
shareFile
)));
shareIntent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
shareIntent
.
setType
(
"*/*"
);
//此处可发送多种文件
startActivity
(
Intent
.
createChooser
(
shareIntent
,
"分享到"
));
}
...
...
mobile/src/main/res/xml/provider_paths.xml
View file @
4406eb1c
...
...
@@ -4,4 +4,10 @@
<external-path
name=
"beta_external_path"
path=
"Download/"
/>
<!--/storage/emulated/0/Android/data/${applicationId}/files/apk/-->
<external-path
name=
"beta_external_files_path"
path=
"Android/data/"
/>
<external-path
path=
"Android/data/${applicationId}/"
name=
"files_root"
/>
<external-path
path=
"."
name=
"external_storage_root"
/>
</paths>
\ No newline at end of file
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