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
b42ff39e
Commit
b42ff39e
authored
Mar 11, 2019
by
k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android 7.0 ydk文件
parent
0593a688
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
1 deletion
+74
-1
mobile/src/main/AndroidManifest.xml
mobile/src/main/AndroidManifest.xml
+8
-0
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+29
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivity3.java
...va/cn/garymb/ygomobile/ui/cards/DeckManagerActivity3.java
+8
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
...cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
+12
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+17
-0
No files found.
mobile/src/main/AndroidManifest.xml
View file @
b42ff39e
...
...
@@ -87,6 +87,14 @@
<data
android:host=
"*"
/>
<data
android:pathPattern=
".*\\.ydk"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:scheme=
"content"
/>
<data
android:host=
"*"
/>
<data
android:pathPattern=
".*\\.ydk"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
</intent-filter>
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
b42ff39e
...
...
@@ -3,16 +3,20 @@ package cn.garymb.ygomobile;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.ParcelFileDescriptor
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.util.List
;
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.utils.FileUtils
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_DECK
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_GAME
;
...
...
@@ -65,11 +69,35 @@ public class GameUriManager {
}
private
void
doUri
(
Uri
uri
)
{
if
(
"file"
.
equals
IgnoreCase
(
uri
.
getScheme
()))
{
if
(
"file"
.
equals
(
uri
.
getScheme
()))
{
File
file
=
new
File
(
uri
.
getPath
());
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
activity
.
startActivity
(
startdeck
);
}
else
if
(
"content"
.
equals
(
uri
.
getScheme
()))
{
try
{
List
<
String
>
paths
=
uri
.
getPathSegments
();
String
name
=
"tmp_"
+
System
.
currentTimeMillis
()
+
".ydk"
;
if
(
paths
.
size
()
>
0
)
{
String
tmp
=
paths
.
get
(
paths
.
size
()
-
1
);
if
(
tmp
.
endsWith
(
".ydk"
))
{
name
=
tmp
;
}
}
File
file
=
new
File
(
AppsSettings
.
get
().
getDeckDir
(),
name
);
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
pfd
==
null
)
{
return
;
}
else
{
FileUtils
.
copyFile
(
file
.
getAbsolutePath
(),
new
FileOutputStream
(
pfd
.
getFileDescriptor
()));
pfd
.
close
();
}
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
activity
.
startActivity
(
startdeck
);
}
catch
(
Throwable
e
)
{
throw
new
RuntimeException
(
e
);
}
}
else
{
String
host
=
uri
.
getHost
();
if
(!
Constants
.
URI_HOST
.
equalsIgnoreCase
(
host
))
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivity3.java
View file @
b42ff39e
package
cn.garymb.ygomobile.ui.cards
;
import
android.content.Intent
;
import
android.content.res.Configuration
;
import
android.os.Bundle
;
import
android.support.v7.widget.RecyclerView
;
...
...
@@ -59,6 +60,13 @@ public class DeckManagerActivity3 extends BaseActivity implements OnItemDragList
mCardLoader
=
new
CardLoader
(
this
);
mCardLoader
.
setCallBack
(
this
);
if
(
getIntent
().
hasExtra
(
Intent
.
EXTRA_TEXT
))
{
String
path
=
getIntent
().
getStringExtra
(
Intent
.
EXTRA_TEXT
);
if
(!
TextUtils
.
isEmpty
(
path
))
{
mPreLoad
=
path
;
}
}
DialogPlus
dlg
=
DialogPlus
.
show
(
this
,
null
,
getString
(
R
.
string
.
loading
));
VUiKit
.
defer
().
when
(()
->
{
mCardLoader
.
setLimitList
(
mLimitManager
.
getTopLimit
());
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
b42ff39e
...
...
@@ -181,6 +181,18 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
super
.
onDestroy
();
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
if
(
getIntent
().
hasExtra
(
Intent
.
EXTRA_TEXT
))
{
String
path
=
getIntent
().
getStringExtra
(
Intent
.
EXTRA_TEXT
);
if
(!
TextUtils
.
isEmpty
(
path
))
{
mPreLoad
=
path
;
loadDeck
(
new
File
(
path
));
}
}
}
@Override
public
void
onLimitListChanged
(
LimitList
limitList
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
b42ff39e
...
...
@@ -63,4 +63,21 @@ public class FileUtils {
}
return
true
;
}
public
static
void
copyFile
(
String
in
,
FileOutputStream
outputStream
)
{
FileInputStream
inputStream
=
null
;
byte
[]
data
=
new
byte
[
1024
*
8
];
try
{
inputStream
=
new
FileInputStream
(
in
);
int
len
;
while
((
len
=
inputStream
.
read
(
data
))
!=
-
1
)
{
outputStream
.
write
(
data
,
0
,
len
);
}
}
catch
(
Throwable
e
)
{
//
}
finally
{
IOUtils
.
close
(
outputStream
);
IOUtils
.
close
(
inputStream
);
}
}
}
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