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
3041b7eb
Commit
3041b7eb
authored
Mar 12, 2019
by
fallenstardust
Committed by
GitHub
Mar 12, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21 from 247321453/master
非deck的卡组文件读取
parents
0593a688
2d63379e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
142 additions
and
32 deletions
+142
-32
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/bean/DeckInfo.java
mobile/src/main/java/cn/garymb/ygomobile/bean/DeckInfo.java
+3
-0
mobile/src/main/java/cn/garymb/ygomobile/loader/DeckLoader.java
.../src/main/java/cn/garymb/ygomobile/loader/DeckLoader.java
+4
-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
+61
-29
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+4
-1
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+17
-0
mobile/src/main/res/menu/deck_menu.xml
mobile/src/main/res/menu/deck_menu.xml
+5
-0
mobile/src/main/res/values-ko/strings.xml
mobile/src/main/res/values-ko/strings.xml
+1
-0
mobile/src/main/res/values-zh/strings.xml
mobile/src/main/res/values-zh/strings.xml
+1
-0
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+1
-0
No files found.
mobile/src/main/AndroidManifest.xml
View file @
3041b7eb
...
@@ -87,6 +87,14 @@
...
@@ -87,6 +87,14 @@
<data
android:host=
"*"
/>
<data
android:host=
"*"
/>
<data
android:pathPattern=
".*\\.ydk"
/>
<data
android:pathPattern=
".*\\.ydk"
/>
</intent-filter>
</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>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
</intent-filter>
</intent-filter>
...
...
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
3041b7eb
...
@@ -3,16 +3,20 @@ package cn.garymb.ygomobile;
...
@@ -3,16 +3,20 @@ package cn.garymb.ygomobile;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.ParcelFileDescriptor
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.util.List
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.bean.Deck
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.cards.DeckManagerActivity
;
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_DECK
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ACTION_OPEN_GAME
;
...
@@ -65,11 +69,35 @@ public class GameUriManager {
...
@@ -65,11 +69,35 @@ public class GameUriManager {
}
}
private
void
doUri
(
Uri
uri
)
{
private
void
doUri
(
Uri
uri
)
{
if
(
"file"
.
equals
IgnoreCase
(
uri
.
getScheme
()))
{
if
(
"file"
.
equals
(
uri
.
getScheme
()))
{
File
file
=
new
File
(
uri
.
getPath
());
File
file
=
new
File
(
uri
.
getPath
());
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
Intent
startdeck
=
new
Intent
(
getActivity
(),
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
activity
.
startActivity
(
startdeck
);
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
{
}
else
{
String
host
=
uri
.
getHost
();
String
host
=
uri
.
getHost
();
if
(!
Constants
.
URI_HOST
.
equalsIgnoreCase
(
host
))
{
if
(!
Constants
.
URI_HOST
.
equalsIgnoreCase
(
host
))
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/bean/DeckInfo.java
View file @
3041b7eb
package
cn.garymb.ygomobile.bean
;
package
cn.garymb.ygomobile.bean
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -23,6 +24,8 @@ public class DeckInfo {
...
@@ -23,6 +24,8 @@ public class DeckInfo {
private
final
List
<
Card
>
extraCards
;
private
final
List
<
Card
>
extraCards
;
private
final
List
<
Card
>
sideCards
;
private
final
List
<
Card
>
sideCards
;
public
File
source
;
private
int
mainCount
,
extraCount
,
sideCount
;
private
int
mainCount
,
extraCount
,
sideCount
;
public
DeckInfo
()
{
public
DeckInfo
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/DeckLoader.java
View file @
3041b7eb
...
@@ -26,6 +26,9 @@ public class DeckLoader {
...
@@ -26,6 +26,9 @@ public class DeckLoader {
try
{
try
{
inputStream
=
new
FileInputStream
(
file
);
inputStream
=
new
FileInputStream
(
file
);
deckInfo
=
readDeck
(
cardLoader
,
inputStream
,
limitList
);
deckInfo
=
readDeck
(
cardLoader
,
inputStream
,
limitList
);
if
(
deckInfo
!=
null
){
deckInfo
.
source
=
file
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
Log
.
e
(
"deckreader"
,
"read 1"
,
e
);
Log
.
e
(
"deckreader"
,
"read 1"
,
e
);
}
finally
{
}
finally
{
...
@@ -34,7 +37,7 @@ public class DeckLoader {
...
@@ -34,7 +37,7 @@ public class DeckLoader {
return
deckInfo
;
return
deckInfo
;
}
}
p
ublic
static
DeckInfo
readDeck
(
CardLoader
cardLoader
,
InputStream
inputStream
,
LimitList
limitList
)
{
p
rivate
static
DeckInfo
readDeck
(
CardLoader
cardLoader
,
InputStream
inputStream
,
LimitList
limitList
)
{
Deck
deck
=
new
Deck
();
Deck
deck
=
new
Deck
();
SparseArray
<
Integer
>
mIds
=
new
SparseArray
<>();
SparseArray
<
Integer
>
mIds
=
new
SparseArray
<>();
InputStreamReader
in
=
null
;
InputStreamReader
in
=
null
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivity3.java
View file @
3041b7eb
package
cn.garymb.ygomobile.ui.cards
;
package
cn.garymb.ygomobile.ui.cards
;
import
android.content.Intent
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.RecyclerView
;
...
@@ -59,6 +60,13 @@ public class DeckManagerActivity3 extends BaseActivity implements OnItemDragList
...
@@ -59,6 +60,13 @@ public class DeckManagerActivity3 extends BaseActivity implements OnItemDragList
mCardLoader
=
new
CardLoader
(
this
);
mCardLoader
=
new
CardLoader
(
this
);
mCardLoader
.
setCallBack
(
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
));
DialogPlus
dlg
=
DialogPlus
.
show
(
this
,
null
,
getString
(
R
.
string
.
loading
));
VUiKit
.
defer
().
when
(()
->
{
VUiKit
.
defer
().
when
(()
->
{
mCardLoader
.
setLimitList
(
mLimitManager
.
getTopLimit
());
mCardLoader
.
setLimitList
(
mLimitManager
.
getTopLimit
());
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
3041b7eb
...
@@ -42,6 +42,7 @@ import org.greenrobot.eventbus.ThreadMode;
...
@@ -42,6 +42,7 @@ import org.greenrobot.eventbus.ThreadMode;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Locale
;
...
@@ -79,6 +80,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -79,6 +80,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
private
AppsSettings
mSettings
=
AppsSettings
.
get
();
private
AppsSettings
mSettings
=
AppsSettings
.
get
();
private
LimitList
mLimitList
;
private
LimitList
mLimitList
;
private
File
mYdkFile
;
private
File
mYdkFile
;
private
File
mPreLoadFile
;
private
DeckItemTouchHelper
mDeckItemTouchHelper
;
private
DeckItemTouchHelper
mDeckItemTouchHelper
;
private
AppCompatSpinner
mDeckSpinner
;
private
AppCompatSpinner
mDeckSpinner
;
private
SimpleSpinnerAdapter
mSimpleSpinnerAdapter
;
private
SimpleSpinnerAdapter
mSimpleSpinnerAdapter
;
...
@@ -133,30 +135,36 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -133,30 +135,36 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
});
});
//
//
DialogPlus
dlg
=
DialogPlus
.
show
(
this
,
null
,
getString
(
R
.
string
.
loading
));
DialogPlus
dlg
=
DialogPlus
.
show
(
this
,
null
,
getString
(
R
.
string
.
loading
));
final
File
_file
;
if
(!
TextUtils
.
isEmpty
(
mPreLoad
))
{
mPreLoadFile
=
new
File
(
mPreLoad
);
_file
=
mPreLoadFile
;
mPreLoad
=
null
;
}
else
{
_file
=
new
File
(
mSettings
.
getResourcePath
(),
Constants
.
CORE_DECK_PATH
+
"/"
+
mSettings
.
getLastDeck
()
+
Constants
.
YDK_FILE_EX
);
}
VUiKit
.
defer
().
when
(()
->
{
VUiKit
.
defer
().
when
(()
->
{
DataManager
.
get
().
load
(
false
);
DataManager
.
get
().
load
(
false
);
if
(
mLimitManager
.
getCount
()
>
0
)
{
if
(
mLimitManager
.
getCount
()
>
0
)
{
mCardLoader
.
setLimitList
(
mLimitManager
.
getTopLimit
());
mCardLoader
.
setLimitList
(
mLimitManager
.
getTopLimit
());
}
}
File
file
=
new
File
(
mSettings
.
getResourcePath
(),
Constants
.
CORE_DECK_PATH
+
"/"
+
mSettings
.
getLastDeck
()
+
Constants
.
YDK_FILE_EX
);
File
file
=
_file
;
if
(!
TextUtils
.
isEmpty
(
mPreLoad
))
{
file
=
new
File
(
mPreLoad
);
mPreLoad
=
null
;
}
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
//当默认卡组不存在的时候
//当默认卡组不存在的时候
File
[]
files
=
getYdkFiles
();
List
<
File
>
files
=
getYdkFiles
();
if
(
files
!=
null
&&
files
.
length
>
0
)
{
if
(
files
!=
null
&&
files
.
size
()
>
0
)
{
file
=
files
[
0
]
;
file
=
files
.
get
(
0
)
;
}
}
}
}
//EXTRA_DECK
//EXTRA_DECK
if
(
file
==
null
)
{
if
(
file
==
null
)
{
return
new
DeckInfo
();
return
new
DeckInfo
();
}
}
Log
.
i
(
"kk"
,
"load ydk "
+
file
);
mYdkFile
=
file
;
mYdkFile
=
file
;
if
(
mCardLoader
.
isOpen
()
&&
f
ile
.
exists
())
{
if
(
mCardLoader
.
isOpen
()
&&
mYdkF
ile
.
exists
())
{
return
mDeckAdapater
.
read
(
mCardLoader
,
f
ile
,
mLimitList
);
return
mDeckAdapater
.
read
(
mCardLoader
,
mYdkF
ile
,
mLimitList
);
}
else
{
}
else
{
return
new
DeckInfo
();
return
new
DeckInfo
();
}
}
...
@@ -166,7 +174,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -166,7 +174,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
mCardSelector
.
initItems
();
mCardSelector
.
initItems
();
mLimitList
=
mCardLoader
.
getLimitList
();
mLimitList
=
mCardLoader
.
getLimitList
();
isLoad
=
true
;
isLoad
=
true
;
setCurYdkFile
(
mYdkFil
e
,
false
);
setCurYdkFile
(
rs
.
sourc
e
,
false
);
initLimitListSpinners
(
mLimitSpinner
);
initLimitListSpinners
(
mLimitSpinner
);
initDecksListSpinners
(
mDeckSpinner
);
initDecksListSpinners
(
mDeckSpinner
);
mDeckAdapater
.
setDeck
(
rs
);
mDeckAdapater
.
setDeck
(
rs
);
...
@@ -592,8 +600,19 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -592,8 +600,19 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
save
();
save
();
}
}
break
;
break
;
// case R.id.action_save_as:
// if (mYdkFile == null) {
// inputDeckName(null);
// } else {
// inputDeckName(mYdkFile.getName());
// }
// break;
case
R
.
id
.
action_rename
:
case
R
.
id
.
action_rename
:
inputDeckName
(
null
);
if
(
mYdkFile
==
null
)
{
inputDeckName
(
null
);
}
else
{
inputDeckName
(
mYdkFile
.
getName
());
}
break
;
break
;
case
R
.
id
.
action_deck_new
:
{
case
R
.
id
.
action_deck_new
:
{
final
String
old
=
mYdkFile
==
null
?
null
:
mYdkFile
.
getAbsolutePath
();
final
String
old
=
mYdkFile
==
null
?
null
:
mYdkFile
.
getAbsolutePath
();
...
@@ -672,7 +691,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -672,7 +691,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
mRecyclerView
.
buildDrawingCache
();
mRecyclerView
.
buildDrawingCache
();
//获取绘图缓存 这里直接创建了一个新的bitmap
//获取绘图缓存 这里直接创建了一个新的bitmap
//因为我们在最后需要释放缓存资源,会释放掉缓存中创建的bitmap对象
//因为我们在最后需要释放缓存资源,会释放掉缓存中创建的bitmap对象
Bitmap
bitmap
=
BitmapUtil
.
drawBg4Bitmap
(
Color
.
parseColor
(
"#e6f3fd"
),
Bitmap
.
createBitmap
(
mRecyclerView
.
getDrawingCache
(),
0
,
0
,
mRecyclerView
.
getMeasuredWidth
(),
Bitmap
bitmap
=
BitmapUtil
.
drawBg4Bitmap
(
Color
.
parseColor
(
"#e6f3fd"
),
Bitmap
.
createBitmap
(
mRecyclerView
.
getDrawingCache
(),
0
,
0
,
mRecyclerView
.
getMeasuredWidth
(),
mRecyclerView
.
getMeasuredHeight
()));
mRecyclerView
.
getMeasuredHeight
()));
//清理绘图缓存,释放资源
//清理绘图缓存,释放资源
...
@@ -680,14 +699,14 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -680,14 +699,14 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
// shotRecyclerView(mRecyclerView)
// shotRecyclerView(mRecyclerView)
Deck
deck
=
mDeckAdapater
.
toDeck
(
mYdkFile
);
Deck
deck
=
mDeckAdapater
.
toDeck
(
mYdkFile
);
String
deckName
=
deck
.
getName
();
String
deckName
=
deck
.
getName
();
int
end
=
deckName
.
lastIndexOf
(
"."
);
int
end
=
deckName
.
lastIndexOf
(
"."
);
if
(
end
!=-
1
)
{
if
(
end
!=
-
1
)
{
deckName
=
deckName
.
substring
(
0
,
end
);
deckName
=
deckName
.
substring
(
0
,
end
);
}
}
String
savePath
=
new
File
(
AppsSettings
.
get
().
getDeckSharePath
(),
deckName
+
".jpg"
).
getAbsolutePath
();
String
savePath
=
new
File
(
AppsSettings
.
get
().
getDeckSharePath
(),
deckName
+
".jpg"
).
getAbsolutePath
();
BitmapUtil
.
saveBitmap
(
bitmap
,
savePath
,
50
);
BitmapUtil
.
saveBitmap
(
bitmap
,
savePath
,
50
);
ShareUtil
.
shareImage
(
DeckManagerActivityImpl
.
this
,
"卡组分享"
,
savePath
,
null
);
ShareUtil
.
shareImage
(
DeckManagerActivityImpl
.
this
,
"卡组分享"
,
savePath
,
null
);
// String label = TextUtils.isEmpty(deck.getName()) ? getString(R.string.share_deck) : deck.getName();
// String label = TextUtils.isEmpty(deck.getName()) ? getString(R.string.share_deck) : deck.getName();
...
@@ -725,16 +744,32 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -725,16 +744,32 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
// return null;
// return null;
// }
// }
private
File
[]
getYdkFiles
()
{
private
List
<
File
>
getYdkFiles
()
{
File
dir
=
new
File
(
mSettings
.
getResourcePath
(),
Constants
.
CORE_DECK_PATH
);
File
dir
=
new
File
(
mSettings
.
getResourcePath
(),
Constants
.
CORE_DECK_PATH
);
File
[]
files
=
dir
.
listFiles
((
file
,
s
)
->
{
File
[]
files
=
dir
.
listFiles
((
file
,
s
)
->
{
return
s
.
toLowerCase
(
Locale
.
US
).
endsWith
(
Constants
.
YDK_FILE_EX
);
return
s
.
toLowerCase
(
Locale
.
US
).
endsWith
(
Constants
.
YDK_FILE_EX
);
});
});
return
files
;
if
(
files
!=
null
)
{
List
<
File
>
list
=
new
ArrayList
<>(
Arrays
.
asList
(
files
));
if
(
mPreLoadFile
!=
null
)
{
boolean
hasCur
=
false
;
for
(
File
f
:
list
)
{
if
(
TextUtils
.
equals
(
f
.
getAbsolutePath
(),
mPreLoadFile
.
getAbsolutePath
()))
{
hasCur
=
true
;
break
;
}
}
if
(!
hasCur
)
{
list
.
add
(
mPreLoadFile
);
}
}
return
list
;
}
return
null
;
}
}
private
void
initDecksListSpinners
(
Spinner
spinner
)
{
private
void
initDecksListSpinners
(
Spinner
spinner
)
{
File
[]
files
=
getYdkFiles
();
List
<
File
>
files
=
getYdkFiles
();
List
<
SimpleSpinnerItem
>
items
=
new
ArrayList
<>();
List
<
SimpleSpinnerItem
>
items
=
new
ArrayList
<>();
String
name
=
mYdkFile
!=
null
?
mYdkFile
.
getName
()
:
null
;
String
name
=
mYdkFile
!=
null
?
mYdkFile
.
getName
()
:
null
;
int
index
=
-
1
;
int
index
=
-
1
;
...
@@ -838,9 +873,6 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -838,9 +873,6 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
editText
.
setGravity
(
Gravity
.
TOP
|
Gravity
.
LEFT
);
editText
.
setGravity
(
Gravity
.
TOP
|
Gravity
.
LEFT
);
editText
.
setInputType
(
InputType
.
TYPE_TEXT_FLAG_NO_SUGGESTIONS
);
editText
.
setInputType
(
InputType
.
TYPE_TEXT_FLAG_NO_SUGGESTIONS
);
editText
.
setSingleLine
();
editText
.
setSingleLine
();
if
(
mYdkFile
!=
null
)
{
editText
.
setText
(
mYdkFile
.
getName
());
}
builder
.
setContentView
(
editText
);
builder
.
setContentView
(
editText
);
builder
.
setOnCloseLinster
((
dlg
)
->
{
builder
.
setOnCloseLinster
((
dlg
)
->
{
dlg
.
dismiss
();
dlg
.
dismiss
();
...
@@ -860,7 +892,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -860,7 +892,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
showToast
(
R
.
string
.
file_exist
,
Toast
.
LENGTH_SHORT
);
showToast
(
R
.
string
.
file_exist
,
Toast
.
LENGTH_SHORT
);
return
;
return
;
}
}
if
(
mYdkFile
!=
null
&&
mYdkFile
.
exists
())
{
if
(
mYdkFile
!=
null
&&
mYdkFile
.
exists
())
{
if
(
mYdkFile
.
renameTo
(
ydk
))
{
if
(
mYdkFile
.
renameTo
(
ydk
))
{
mYdkFile
=
ydk
;
mYdkFile
=
ydk
;
initDecksListSpinners
(
mDeckSpinner
);
initDecksListSpinners
(
mDeckSpinner
);
...
@@ -896,8 +928,8 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
...
@@ -896,8 +928,8 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
private
void
initBoomMenuButton
(
BoomMenuButton
menu
)
{
private
void
initBoomMenuButton
(
BoomMenuButton
menu
)
{
final
SparseArray
<
Integer
>
mMenuIds
=
new
SparseArray
<>();
final
SparseArray
<
Integer
>
mMenuIds
=
new
SparseArray
<>();
// addMenuButton(mMenuIds, menu, R.id.action_card_search, R.string.deck_list, R.drawable.listicon);
// addMenuButton(mMenuIds, menu, R.id.action_card_search, R.string.deck_list, R.drawable.listicon);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_share_deck
,
R
.
string
.
share_deck
,
R
.
drawable
.
listicon
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_share_deck
,
R
.
string
.
share_deck
,
R
.
drawable
.
listicon
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_save
,
R
.
string
.
save_deck
,
R
.
drawable
.
save
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_save
,
R
.
string
.
save_deck
,
R
.
drawable
.
save
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_clear_deck
,
R
.
string
.
clear_deck
,
R
.
drawable
.
clear_deck
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_clear_deck
,
R
.
string
.
clear_deck
,
R
.
drawable
.
clear_deck
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
3041b7eb
...
@@ -207,13 +207,16 @@ public class ServiceDuelAssistant extends Service {
...
@@ -207,13 +207,16 @@ public class ServiceDuelAssistant extends Service {
remoteViews
.
setOnClickPendingIntent
(
R
.
id
.
buttonStopService
,
pendingIntent
);
remoteViews
.
setOnClickPendingIntent
(
R
.
id
.
buttonStopService
,
pendingIntent
);
NotificationChannel
channel
=
new
NotificationChannel
(
CHANNEL_ID
,
CHANNEL_NAME
,
NotificationChannel
channel
=
new
NotificationChannel
(
CHANNEL_ID
,
CHANNEL_NAME
,
NotificationManager
.
IMPORTANCE_HIGH
);
NotificationManager
.
IMPORTANCE_DEFAULT
);
channel
.
setSound
(
null
,
null
);
channel
.
enableLights
(
false
);
NotificationManager
manager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
NotificationManager
manager
=
(
NotificationManager
)
getSystemService
(
Context
.
NOTIFICATION_SERVICE
);
manager
.
createNotificationChannel
(
channel
);
manager
.
createNotificationChannel
(
channel
);
Notification
.
Builder
builder
=
new
Notification
.
Builder
(
this
,
CHANNEL_ID
);
Notification
.
Builder
builder
=
new
Notification
.
Builder
(
this
,
CHANNEL_ID
);
builder
.
setSmallIcon
(
R
.
drawable
.
ic_icon
);
builder
.
setSmallIcon
(
R
.
drawable
.
ic_icon
);
builder
.
setSound
(
null
);
builder
.
setCustomContentView
(
remoteViews
);
builder
.
setCustomContentView
(
remoteViews
);
startForeground
(
1
,
builder
.
build
());
startForeground
(
1
,
builder
.
build
());
}
else
{
}
else
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
3041b7eb
...
@@ -63,4 +63,21 @@ public class FileUtils {
...
@@ -63,4 +63,21 @@ public class FileUtils {
}
}
return
true
;
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
);
}
}
}
}
mobile/src/main/res/menu/deck_menu.xml
View file @
3041b7eb
...
@@ -38,6 +38,11 @@
...
@@ -38,6 +38,11 @@
android:id=
"@+id/action_save"
android:id=
"@+id/action_save"
android:icon=
"@drawable/ic_mode_save_white"
android:icon=
"@drawable/ic_mode_save_white"
android:title=
"@string/save_deck"
/>
android:title=
"@string/save_deck"
/>
<!-- <item
android:id="@+id/action_save_as"
android:icon="@drawable/ic_mode_save_white"
android:title="@string/save_as_deck"/>-->
<!--<item
<!--<item
android:id="@+id/action_share_deck"
android:id="@+id/action_share_deck"
android:icon="@drawable/ic_refresh"
android:icon="@drawable/ic_refresh"
...
...
mobile/src/main/res/values-ko/strings.xml
View file @
3041b7eb
...
@@ -132,6 +132,7 @@
...
@@ -132,6 +132,7 @@
<string
name=
"rename_deck"
>
이름변경
</string>
<string
name=
"rename_deck"
>
이름변경
</string>
<string
name=
"delete_deck"
>
삭제
</string>
<string
name=
"delete_deck"
>
삭제
</string>
<string
name=
"save_deck"
>
덱저장
</string>
<string
name=
"save_deck"
>
덱저장
</string>
<string
name=
"save_as_deck"
>
Deck save as
</string>
<string
name=
"deck_list"
>
덱 리스트
</string>
<string
name=
"deck_list"
>
덱 리스트
</string>
<string
name=
"loading"
>
로딩중..."
</string>
<string
name=
"loading"
>
로딩중..."
</string>
<string
name=
"tip"
>
정보
</string>
<string
name=
"tip"
>
정보
</string>
...
...
mobile/src/main/res/values-zh/strings.xml
View file @
3041b7eb
...
@@ -132,6 +132,7 @@
...
@@ -132,6 +132,7 @@
<string
name=
"rename_deck"
>
重命名
</string>
<string
name=
"rename_deck"
>
重命名
</string>
<string
name=
"delete_deck"
>
删除
</string>
<string
name=
"delete_deck"
>
删除
</string>
<string
name=
"save_deck"
>
保存
</string>
<string
name=
"save_deck"
>
保存
</string>
<string
name=
"save_as_deck"
>
另存为
</string>
<string
name=
"deck_list"
>
卡组列表
</string>
<string
name=
"deck_list"
>
卡组列表
</string>
<string
name=
"loading"
>
加载中..."
</string>
<string
name=
"loading"
>
加载中..."
</string>
<string
name=
"tip"
>
提示
</string>
<string
name=
"tip"
>
提示
</string>
...
...
mobile/src/main/res/values/strings.xml
View file @
3041b7eb
...
@@ -124,6 +124,7 @@
...
@@ -124,6 +124,7 @@
<string
name=
"rename_deck"
>
Rename
</string>
<string
name=
"rename_deck"
>
Rename
</string>
<string
name=
"delete_deck"
>
Delete
</string>
<string
name=
"delete_deck"
>
Delete
</string>
<string
name=
"save_deck"
>
Save Deck
</string>
<string
name=
"save_deck"
>
Save Deck
</string>
<string
name=
"save_as_deck"
>
Deck save as
</string>
<string
name=
"deck_list"
>
Deck List
</string>
<string
name=
"deck_list"
>
Deck List
</string>
<string
name=
"card_add_main"
>
+Main Deck
</string>
<string
name=
"card_add_main"
>
+Main Deck
</string>
<string
name=
"card_add_side"
>
+Side Deck
</string>
<string
name=
"card_add_side"
>
+Side Deck
</string>
...
...
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