Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
5e5c45b2
Commit
5e5c45b2
authored
Apr 29, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打开ypk文件自动放到expansions并加载
parent
f979a88a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
28 deletions
+82
-28
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+73
-28
mobile/src/main/res/values-ko/strings.xml
mobile/src/main/res/values-ko/strings.xml
+3
-0
mobile/src/main/res/values-zh/strings.xml
mobile/src/main/res/values-zh/strings.xml
+3
-0
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+3
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
5e5c45b2
...
...
@@ -10,12 +10,15 @@ import android.widget.Toast;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.util.Locale
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
import
cn.garymb.ygomobile.ui.preference.SettingsActivity
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
ocgcore.DataManager
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_DECK
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_GAME
;
...
...
@@ -111,40 +114,82 @@ public class GameUriManager {
}
private
void
doUri
(
Uri
uri
)
{
Intent
startSeting
=
new
Intent
(
activity
,
SettingsActivity
.
class
);
if
(
"file"
.
equals
(
uri
.
getScheme
()))
{
File
file
=
new
File
(
uri
.
getPath
());
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
if
(
isDeckDir
(
file
))
{
//deck目录
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
}
else
{
//非deck目录
File
ydk
=
getDeckFile
(
new
File
(
AppsSettings
.
get
().
getDeckDir
()),
getDeckName
(
uri
));
FileUtils
.
copyFile
(
file
,
ydk
);
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
ydk
.
getAbsolutePath
());
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ydk"
))
{
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
if
(
isDeckDir
(
file
))
{
//deck目录
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
}
else
{
//非deck目录
File
ydk
=
getDeckFile
(
new
File
(
AppsSettings
.
get
().
getDeckDir
()),
getDeckName
(
uri
));
FileUtils
.
copyFile
(
file
,
ydk
);
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
ydk
.
getAbsolutePath
());
}
activity
.
startActivity
(
startdeck
);
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
try
{
FileUtils
.
moveFile
(
file
.
getAbsolutePath
(),
AppsSettings
.
get
().
getExpansionsPath
().
toString
(),
false
);
if
(!
AppsSettings
.
get
().
isReadExpansions
())
{
activity
.
startActivity
(
startSeting
);
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_go_setting
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
DataManager
.
get
().
load
(
true
);
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
ypk_failed_bcos
)
+
e
,
Toast
.
LENGTH_LONG
).
show
();
}
}
activity
.
startActivity
(
startdeck
);
}
else
if
(
"content"
.
equals
(
uri
.
getScheme
()))
{
try
{
File
dir
=
Constants
.
COPY_YDK_FILE
?
new
File
(
AppsSettings
.
get
().
getDeckDir
())
:
new
File
(
getActivity
().
getApplicationInfo
().
dataDir
,
"cache"
);
File
ydk
=
getDeckFile
(
dir
,
getDeckName
(
uri
));
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
pfd
==
null
)
{
return
;
}
else
{
try
{
FileUtils
.
copyFile
(
new
FileInputStream
(
pfd
.
getFileDescriptor
()),
ydk
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
finally
{
pfd
.
close
();
File
urifile
=
new
File
(
uri
.
getPath
());
if
(
urifile
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ydk"
))
{
try
{
File
dir
=
Constants
.
COPY_YDK_FILE
?
new
File
(
AppsSettings
.
get
().
getDeckDir
())
:
new
File
(
getActivity
().
getApplicationInfo
().
dataDir
,
"cache"
);
File
ydk
=
getDeckFile
(
dir
,
getDeckName
(
uri
));
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
pfd
==
null
)
{
return
;
}
else
{
try
{
FileUtils
.
copyFile
(
new
FileInputStream
(
pfd
.
getFileDescriptor
()),
ydk
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
finally
{
pfd
.
close
();
}
}
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
ydk
.
getAbsolutePath
());
activity
.
startActivity
(
startdeck
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
}
else
if
(
urifile
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
try
{
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
pfd
==
null
)
{
return
;
}
else
{
try
{
FileUtils
.
copyFile
(
new
FileInputStream
(
pfd
.
getFileDescriptor
()),
AppsSettings
.
get
().
getExpansionsPath
());
if
(!
AppsSettings
.
get
().
isReadExpansions
())
{
activity
.
startActivity
(
startSeting
);
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_go_setting
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
DataManager
.
get
().
load
(
true
);
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_installed
,
Toast
.
LENGTH_LONG
).
show
();
}
}
catch
(
Exception
e
)
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
ypk_failed_bcos
)
+
e
,
Toast
.
LENGTH_LONG
).
show
();
}
finally
{
pfd
.
close
();
}
}
}
catch
(
Throwable
e
)
{
}
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
ydk
.
getAbsolutePath
());
activity
.
startActivity
(
startdeck
);
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
}
else
{
String
host
=
uri
.
getHost
();
...
...
mobile/src/main/res/values-ko/strings.xml
View file @
5e5c45b2
...
...
@@ -278,4 +278,7 @@
<string
name=
"tip_expansions_image"
>
카드의 고화질 이미지가 없습니다.
</string>
<string
name=
"tip_return_to_duel"
>
이미 돌아 가기 현재 게임
</string>
<string
name=
"my_favorites"
>
즐겨 찾기★
</string>
<string
name=
"ypk_installed"
>
expansion file installed
</string>
<string
name=
"ypk_go_setting"
>
check \"Use Expansions\" to use it
</string>
<string
name=
"ypk_failed_bcos"
>
expansion file install failed, because\:
</string>
</resources>
mobile/src/main/res/values-zh/strings.xml
View file @
5e5c45b2
...
...
@@ -277,4 +277,7 @@
<string
name=
"tip_expansions_image"
>
非自带卡片没有大图
</string>
<string
name=
"tip_return_to_duel"
>
已回到当前游戏
</string>
<string
name=
"my_favorites"
>
我的收藏★
</string>
<string
name=
"ypk_installed"
>
拓展卡包文件已安装
</string>
<string
name=
"ypk_go_setting"
>
这是拓展卡包文件,要使用须启用扩展卡包
</string>
<string
name=
"ypk_failed_bcos"
>
拓展卡包安装失败,原因:
</string>
</resources>
mobile/src/main/res/values/strings.xml
View file @
5e5c45b2
...
...
@@ -280,4 +280,7 @@
<string
name=
"tip_expansions_image"
>
no Large image for pre-released data
</string>
<string
name=
"tip_return_to_duel"
>
Current game has been Returned
</string>
<string
name=
"my_favorites"
>
myFav★
</string>
<string
name=
"ypk_installed"
>
expansion file installed
</string>
<string
name=
"ypk_go_setting"
>
check \"Use Expansions\" to use it
</string>
<string
name=
"ypk_failed_bcos"
>
expansion file install failed, because\:
</string>
</resources>
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