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
05e4651a
Commit
05e4651a
authored
Aug 01, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 分享的uri
arrange code
parent
db226e7a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
30 deletions
+31
-30
Classes/gframe/data_manager.cpp
Classes/gframe/data_manager.cpp
+3
-3
mobile/src/main/AndroidManifest.xml
mobile/src/main/AndroidManifest.xml
+3
-6
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+8
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/ShareFileActivity.java
.../cn/garymb/ygomobile/ui/activities/ShareFileActivity.java
+7
-8
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+1
-1
mobile/src/main/res/xml/provider_paths.xml
mobile/src/main/res/xml/provider_paths.xml
+9
-9
No files found.
Classes/gframe/data_manager.cpp
View file @
05e4651a
...
...
@@ -195,10 +195,10 @@ const wchar_t* DataManager::GetText(int code) {
return
unknown_string
;
}
const
wchar_t
*
DataManager
::
GetDesc
(
int
strCode
)
{
if
(
strCode
<
10000
)
if
(
(
unsigned
int
)
strCode
<
10000u
)
return
GetSysString
(
strCode
);
int
code
=
strCode
>>
4
;
int
offset
=
strCode
&
0xf
;
unsigned
int
code
=
strCode
>>
4
;
unsigned
int
offset
=
strCode
&
0xf
;
auto
csit
=
_strings
.
find
(
code
);
if
(
csit
==
_strings
.
end
())
return
unknown_string
;
...
...
mobile/src/main/AndroidManifest.xml
View file @
05e4651a
...
...
@@ -107,6 +107,7 @@
android:name=
"cn.garymb.ygomobile.ui.activities.ShareFileActivity"
android:configChanges=
"orientation|keyboardHidden|navigation|screenSize"
android:launchMode=
"singleTop"
android:excludeFromRecents=
"true"
android:theme=
"@style/TranslucentTheme"
android:windowSoftInputMode=
"stateAlwaysHidden|adjustResize"
>
<intent-filter>
...
...
@@ -208,14 +209,10 @@
android:name=
"cn.garymb.ygomobile.ui.preference.YGOPreferencesProvider"
android:authorities=
"cn.garymb.ygomobile.ui.preference.YGOPreferencesProvider"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/provider_paths"
/>
</provider>
android:grantUriPermissions=
"true"
/>
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"${applicationId}.
fileprovider
"
android:authorities=
"${applicationId}.
gamefiles
"
android:exported=
"false"
android:grantUriPermissions=
"true"
>
<meta-data
...
...
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
05e4651a
...
...
@@ -3,7 +3,6 @@ package cn.garymb.ygomobile;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.graphics.Point
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.WindowManager
;
...
...
@@ -25,6 +24,7 @@ import cn.garymb.ygomobile.utils.IOUtils;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_DECK_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_EXPANSIONS
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_PACK_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_REPLAY_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SYSTEM_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_KEEP_SCALE
;
...
...
@@ -48,11 +48,11 @@ import static cn.garymb.ygomobile.Constants.YDK_FILE_EX;
public
class
AppsSettings
{
private
static
final
String
PREF_VERSION
=
"app_version"
;
private
static
AppsSettings
sAppsSettings
;
private
final
Point
mScreenSize
=
new
Point
();
private
final
Point
mRealScreenSize
=
new
Point
();
private
Context
context
;
private
PreferenceFragmentPlus
.
SharedPreferencesPlus
mSharedPreferences
;
private
float
mDensity
;
private
final
Point
mScreenSize
=
new
Point
();
private
final
Point
mRealScreenSize
=
new
Point
();
private
AppsSettings
(
Context
context
)
{
this
.
context
=
context
;
...
...
@@ -471,6 +471,11 @@ public class AppsSettings {
mSharedPreferences
.
putString
(
Constants
.
PREF_GAME_PATH
,
path
);
}
//获取录像文件夹
public
String
getReplayDir
()
{
return
new
File
(
getResourcePath
(),
CORE_REPLAY_PATH
).
getAbsolutePath
();
}
//获取卡组文件夹
public
String
getDeckDir
()
{
return
new
File
(
getResourcePath
(),
CORE_DECK_PATH
).
getAbsolutePath
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/ShareFileActivity.java
View file @
05e4651a
...
...
@@ -4,19 +4,15 @@ import android.app.Activity;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
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
;
import
cn.garymb.ygomobile.utils.FileUtils
;
...
...
@@ -38,12 +34,11 @@ public class ShareFileActivity extends Activity {
String
title
=
intent
.
getStringExtra
(
IrrlichtBridge
.
EXTRA_SHARE_FILE
);
String
ext
=
intent
.
getStringExtra
(
IrrlichtBridge
.
EXTRA_SHARE_TYPE
);
//TODO
Toast
.
makeText
(
this
,
"title="
+
title
+
",ext="
+
ext
,
Toast
.
LENGTH_SHORT
).
show
();
String
sharePath
=
""
;
if
(
ext
.
equals
(
"yrp"
))
{
sharePath
=
AppsSettings
.
get
().
getRe
sourcePath
()
+
"/"
+
Constants
.
CORE_REPLAY_PATH
+
"/"
+
title
;
sharePath
=
AppsSettings
.
get
().
getRe
playDir
()
+
"/"
+
title
;
}
else
if
(
ext
.
equals
(
"lua"
))
{
sharePath
=
AppsSettings
.
get
().
get
ResourcePath
()+
"/"
+
Constants
.
CORE_SINGLE_PATH
+
"/"
+
title
;
sharePath
=
AppsSettings
.
get
().
get
SingleDir
()
+
"/"
+
title
;
}
File
shareFile
=
new
File
(
sharePath
);
Intent
shareIntent
=
new
Intent
(
Intent
.
ACTION_SEND
);
...
...
@@ -51,7 +46,11 @@ public class ShareFileActivity extends Activity {
shareIntent
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
shareIntent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
shareIntent
.
setType
(
"*/*"
);
//此处可发送多种文件
startActivity
(
Intent
.
createChooser
(
shareIntent
,
getString
(
R
.
string
.
send
)));
try
{
startActivity
(
Intent
.
createChooser
(
shareIntent
,
getString
(
R
.
string
.
send
)));
}
catch
(
Exception
e
)
{
Toast
.
makeText
(
this
,
getString
(
R
.
string
.
sending_failed
)
+
e
,
Toast
.
LENGTH_SHORT
).
show
();
}
finish
();
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
05e4651a
...
...
@@ -22,7 +22,7 @@ import java.util.List;
public
class
FileUtils
{
public
static
Uri
toUri
(
Context
context
,
File
file
)
{
return
FileProvider
.
getUriForFile
(
context
,
context
.
getPackageName
()
+
".
fileprovider
"
,
file
);
return
FileProvider
.
getUriForFile
(
context
,
context
.
getPackageName
()
+
".
gamefiles
"
,
file
);
}
public
static
boolean
deleteFile
(
File
file
)
{
...
...
mobile/src/main/res/xml/provider_paths.xml
View file @
05e4651a
<?xml version="1.0" encoding="utf-8"?>
<paths
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!-- /storage/emulated/0/Download/${applicationId}/.beta/apk-->
<paths>
<external-path
name=
"external_files"
path=
"."
/>
<root-path
name=
"external_files"
path=
"/storage/"
/>
<!-- /storage/emulated/0/Download/com.bugly.upgrade.demo/.beta/apk-->
<external-path
name=
"beta_external_path"
path=
"Download/"
/>
<!--/storage/emulated/0/Android/data/
${applicationId}
/files/apk/-->
<!--/storage/emulated/0/Android/data/
com.bugly.upgrade.demo
/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