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
7a92d476
Commit
7a92d476
authored
Sep 27, 2021
by
qq247321453
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ImageLoader
parent
e98a7e0c
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
350 additions
and
221 deletions
+350
-221
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+0
-2
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-0
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+229
-164
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/BaseCardsActivity.java
.../java/cn/garymb/ygomobile/ui/cards/BaseCardsActivity.java
+16
-9
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
...n/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
+37
-20
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchActivity.java
...java/cn/garymb/ygomobile/ui/cards/CardSearchActivity.java
+2
-8
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+16
-6
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
...ain/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
+9
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
...src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
+3
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckGroupView.java
...ain/java/cn/garymb/ygomobile/ui/widget/DeckGroupView.java
+13
-7
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckView.java
...src/main/java/cn/garymb/ygomobile/ui/widget/DeckView.java
+11
-0
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+13
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
7a92d476
...
@@ -3,7 +3,6 @@ package cn.garymb.ygomobile;
...
@@ -3,7 +3,6 @@ package cn.garymb.ygomobile;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Point
;
import
android.graphics.Point
;
import
android.os.ParcelFileDescriptor
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
...
@@ -36,7 +35,6 @@ import static cn.garymb.ygomobile.Constants.DEF_PREF_KEEP_SCALE;
...
@@ -36,7 +35,6 @@ import static cn.garymb.ygomobile.Constants.DEF_PREF_KEEP_SCALE;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_NOTCH_HEIGHT
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_NOTCH_HEIGHT
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_WINDOW_TOP_BOTTOM
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_IMMERSIVE_MODE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_IMMERSIVE_MODE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_SENSOR_REFRESH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_SENSOR_REFRESH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_FONT_SIZE
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
7a92d476
...
@@ -92,6 +92,7 @@ public interface Constants {
...
@@ -92,6 +92,7 @@ public interface Constants {
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
String
UNKNOWN_IMAGE
=
"unknown.jpg"
;
String
YDK_FILE_EX
=
".ydk"
;
String
YDK_FILE_EX
=
".ydk"
;
int
[]
CORE_SKIN_BG_SIZE
=
new
int
[]{
1280
,
720
};
int
[]
CORE_SKIN_BG_SIZE
=
new
int
[]{
1280
,
720
};
int
[]
CORE_SKIN_CARD_MINI_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_CARD_COVER_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_CARD_COVER_SIZE
=
new
int
[]{
177
,
254
};
int
[]
CORE_SKIN_AVATAR_SIZE
=
new
int
[]{
128
,
128
};
int
[]
CORE_SKIN_AVATAR_SIZE
=
new
int
[]{
128
,
128
};
boolean
SUPPORT_BPG
=
true
;
boolean
SUPPORT_BPG
=
true
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
7a92d476
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/BaseCardsActivity.java
View file @
7a92d476
...
@@ -24,7 +24,6 @@ import com.app.hubert.guide.model.HighLight;
...
@@ -24,7 +24,6 @@ import com.app.hubert.guide.model.HighLight;
import
com.app.hubert.guide.model.HighlightOptions
;
import
com.app.hubert.guide.model.HighlightOptions
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
...
@@ -45,7 +44,7 @@ public abstract class BaseCardsActivity extends BaseActivity implements CardLoad
...
@@ -45,7 +44,7 @@ public abstract class BaseCardsActivity extends BaseActivity implements CardLoad
protected
CardListAdapter
mCardListAdapter
;
protected
CardListAdapter
mCardListAdapter
;
protected
CardLoader
mCardLoader
;
protected
CardLoader
mCardLoader
;
protected
boolean
isLoad
=
false
;
protected
boolean
isLoad
=
false
;
pr
ivate
ImageLoader
mImageLoader
;
pr
otected
ImageLoader
mImageLoader
;
protected
StringManager
mStringManager
=
DataManager
.
get
().
getStringManager
();
protected
StringManager
mStringManager
=
DataManager
.
get
().
getStringManager
();
protected
LimitManager
mLimitManager
=
DataManager
.
get
().
getLimitManager
();
protected
LimitManager
mLimitManager
=
DataManager
.
get
().
getLimitManager
();
protected
int
screenWidth
;
protected
int
screenWidth
;
...
@@ -55,7 +54,7 @@ public abstract class BaseCardsActivity extends BaseActivity implements CardLoad
...
@@ -55,7 +54,7 @@ public abstract class BaseCardsActivity extends BaseActivity implements CardLoad
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_deck_cards
);
setContentView
(
R
.
layout
.
activity_deck_cards
);
AnimationShake2
();
AnimationShake2
();
mImageLoader
=
ImageLoader
.
get
(
this
);
mImageLoader
=
new
ImageLoader
(
true
);
mDrawerLayout
=
$
(
R
.
id
.
drawer_layout
);
mDrawerLayout
=
$
(
R
.
id
.
drawer_layout
);
screenWidth
=
getResources
().
getDisplayMetrics
().
widthPixels
;
screenWidth
=
getResources
().
getDisplayMetrics
().
widthPixels
;
mListView
=
$
(
R
.
id
.
list_cards
);
mListView
=
$
(
R
.
id
.
list_cards
);
...
@@ -217,14 +216,22 @@ public abstract class BaseCardsActivity extends BaseActivity implements CardLoad
...
@@ -217,14 +216,22 @@ public abstract class BaseCardsActivity extends BaseActivity implements CardLoad
}
}
}
}
@Override
protected
void
onResume
()
{
// mImageLoader.resume();
super
.
onResume
();
}
@Override
protected
void
onPause
()
{
//仅退出的时候才关闭zip
// mImageLoader.pause();
super
.
onPause
();
}
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
ImageLoader
.
onDestory
(
this
);
mImageLoader
.
close
();
try
{
mImageLoader
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
View file @
7a92d476
...
@@ -16,26 +16,28 @@ import ocgcore.data.Card;
...
@@ -16,26 +16,28 @@ import ocgcore.data.Card;
import
ocgcore.enums.CardType
;
import
ocgcore.enums.CardType
;
import
static
android
.
view
.
View
.
inflate
;
import
static
android
.
view
.
View
.
inflate
;
import
static
android
.
view
.
View
.
resolveSize
;
public
class
CardDetailRandom
{
public
class
CardDetailRandom
{
private
static
View
viewCardDetail
;
private
View
viewCardDetail
;
private
static
ImageView
cardImage
;
private
ImageView
cardImage
;
private
static
TextView
name
;
private
TextView
name
;
private
static
TextView
desc
;
private
TextView
desc
;
private
static
TextView
level
;
private
TextView
level
;
private
static
TextView
type
;
private
TextView
type
;
private
static
TextView
race
;
private
TextView
race
;
private
static
TextView
cardAtk
;
private
TextView
cardAtk
;
private
static
TextView
cardDef
;
private
TextView
cardDef
;
private
static
TextView
attrView
;
private
TextView
attrView
;
private
static
View
monsterlayout
;
private
View
monsterlayout
;
private
static
View
atkdefView
,
textdefView
;
private
View
atkdefView
,
textdefView
;
private
static
ImageLoader
imageLoad
er
;
private
StringManager
mStringManag
er
;
private
static
StringManager
mStringManager
;
private
Context
mContext
;
public
static
void
RandomCardDetail
(
Context
context
,
Card
cardInfo
)
{
private
static
CardDetailRandom
sCardDetailRandom
=
null
;
if
(
cardInfo
==
null
)
return
;
imageLoader
=
ImageLoader
.
get
(
context
);
private
CardDetailRandom
(
Context
context
,
Card
cardInfo
)
{
mContext
=
context
;
viewCardDetail
=
inflate
(
context
,
R
.
layout
.
dialog_cardinfo_small
,
null
);
viewCardDetail
=
inflate
(
context
,
R
.
layout
.
dialog_cardinfo_small
,
null
);
cardImage
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_image_toast
);
cardImage
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_image_toast
);
name
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_name_toast
);
name
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_name_toast
);
...
@@ -51,7 +53,6 @@ public class CardDetailRandom {
...
@@ -51,7 +53,6 @@ public class CardDetailRandom {
desc
=
viewCardDetail
.
findViewById
(
R
.
id
.
text_desc_toast
);
desc
=
viewCardDetail
.
findViewById
(
R
.
id
.
text_desc_toast
);
mStringManager
=
DataManager
.
get
().
getStringManager
();
mStringManager
=
DataManager
.
get
().
getStringManager
();
imageLoader
.
bindImage
(
cardImage
,
cardInfo
.
Code
);
name
.
setText
(
cardInfo
.
Name
);
name
.
setText
(
cardInfo
.
Name
);
type
.
setText
(
CardUtils
.
getAllTypeString
(
cardInfo
,
mStringManager
).
replace
(
"/"
,
"|"
));
type
.
setText
(
CardUtils
.
getAllTypeString
(
cardInfo
,
mStringManager
).
replace
(
"/"
,
"|"
));
attrView
.
setText
(
mStringManager
.
getAttributeString
(
cardInfo
.
Attribute
));
attrView
.
setText
(
mStringManager
.
getAttributeString
(
cardInfo
.
Attribute
));
...
@@ -88,8 +89,24 @@ public class CardDetailRandom {
...
@@ -88,8 +89,24 @@ public class CardDetailRandom {
viewCardDetail
.
setRotationY
(
5
);
viewCardDetail
.
setRotationY
(
5
);
}
}
public
static
void
showRandromCardDetailToast
(
Context
context
)
{
public
static
CardDetailRandom
genRandomCardDetail
(
Context
context
,
ImageLoader
imageLoader
,
Card
cardInfo
)
{
Toast
toast
=
new
Toast
(
context
);
if
(
cardInfo
==
null
)
return
null
;
CardDetailRandom
cardDetailRandom
=
new
CardDetailRandom
(
context
,
cardInfo
);
cardDetailRandom
.
bindCardImage
(
imageLoader
,
cardInfo
.
Alias
!=
0
?
cardInfo
.
Alias
:
cardInfo
.
Code
);
sCardDetailRandom
=
cardDetailRandom
;
return
cardDetailRandom
;
}
public
void
bindCardImage
(
ImageLoader
imageLoader
,
long
code
)
{
imageLoader
.
bindImage
(
cardImage
,
code
,
null
,
true
);
}
public
View
getView
()
{
return
viewCardDetail
;
}
public
void
show
(){
Toast
toast
=
new
Toast
(
mContext
);
toast
.
setView
(
viewCardDetail
);
toast
.
setView
(
viewCardDetail
);
toast
.
setDuration
(
Toast
.
LENGTH_LONG
);
toast
.
setDuration
(
Toast
.
LENGTH_LONG
);
toast
.
setGravity
(
Gravity
.
LEFT
,
0
,
0
);
toast
.
setGravity
(
Gravity
.
LEFT
,
0
,
0
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchActivity.java
View file @
7a92d476
...
@@ -27,7 +27,6 @@ import com.app.hubert.guide.model.HighlightOptions;
...
@@ -27,7 +27,6 @@ import com.app.hubert.guide.model.HighlightOptions;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.Glide
;
import
com.ourygo.assistant.util.DuelAssistantManagement
;
import
com.ourygo.assistant.util.DuelAssistantManagement
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
...
@@ -77,7 +76,7 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -77,7 +76,7 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
// setSupportActionBar(toolbar);
// setSupportActionBar(toolbar);
enableBackHome
();
enableBackHome
();
mDrawerlayout
=
$
(
R
.
id
.
drawer_layout
);
mDrawerlayout
=
$
(
R
.
id
.
drawer_layout
);
mImageLoader
=
ImageLoader
.
get
(
this
);
mImageLoader
=
new
ImageLoader
(
true
);
mListView
=
$
(
R
.
id
.
list_cards
);
mListView
=
$
(
R
.
id
.
list_cards
);
mCardListAdapter
=
new
CardListAdapter
(
this
,
mImageLoader
);
mCardListAdapter
=
new
CardListAdapter
(
this
,
mImageLoader
);
mCardListAdapter
.
setItemBg
(
true
);
mCardListAdapter
.
setItemBg
(
true
);
...
@@ -190,12 +189,7 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
...
@@ -190,12 +189,7 @@ public class CardSearchActivity extends BaseActivity implements CardLoader.CallB
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
ImageLoader
.
onDestory
(
this
);
mImageLoader
.
close
();
try
{
mImageLoader
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
7a92d476
...
@@ -47,7 +47,6 @@ import com.ourygo.assistant.base.listener.OnDuelAssistantListener;
...
@@ -47,7 +47,6 @@ import com.ourygo.assistant.base.listener.OnDuelAssistantListener;
import
com.ourygo.assistant.util.DuelAssistantManagement
;
import
com.ourygo.assistant.util.DuelAssistantManagement
;
import
com.ourygo.assistant.util.Util
;
import
com.ourygo.assistant.util.Util
;
import
com.tencent.bugly.beta.Beta
;
import
com.tencent.bugly.beta.Beta
;
import
com.tencent.smtt.export.external.TbsCoreSettings
;
import
com.tencent.smtt.sdk.QbSdk
;
import
com.tencent.smtt.sdk.QbSdk
;
import
com.tubb.smrv.SwipeMenuRecyclerView
;
import
com.tubb.smrv.SwipeMenuRecyclerView
;
...
@@ -58,7 +57,6 @@ import org.greenrobot.eventbus.ThreadMode;
...
@@ -58,7 +57,6 @@ import org.greenrobot.eventbus.ThreadMode;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygodata.YGOGameOptions
;
import
cn.garymb.ygodata.YGOGameOptions
;
...
@@ -71,6 +69,7 @@ import cn.garymb.ygomobile.bean.ServerList;
...
@@ -71,6 +69,7 @@ import cn.garymb.ygomobile.bean.ServerList;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.BaseActivity
;
import
cn.garymb.ygomobile.ui.activities.FileLogActivity
;
import
cn.garymb.ygomobile.ui.activities.FileLogActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
import
cn.garymb.ygomobile.ui.activities.WebActivity
;
...
@@ -108,13 +107,15 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -108,13 +107,15 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
private
ServerListManager
mServerListManager
;
private
ServerListManager
mServerListManager
;
private
DuelAssistantManagement
duelAssistantManagement
;
private
DuelAssistantManagement
duelAssistantManagement
;
private
CardManager
mCardManager
;
private
CardManager
mCardManager
;
private
SparseArray
<
Card
>
cards
;
private
CardDetailRandom
mCardDetailRandom
;
private
ImageLoader
mImageLoader
;
@Override
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_home
);
setContentView
(
R
.
layout
.
activity_home
);
setExitAnimEnable
(
false
);
setExitAnimEnable
(
false
);
mImageLoader
=
new
ImageLoader
(
false
);
mCardManager
=
DataManager
.
get
().
getCardManager
();
mCardManager
=
DataManager
.
get
().
getCardManager
();
//server list
//server list
initServerlist
();
initServerlist
();
...
@@ -158,10 +159,17 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -158,10 +159,17 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
mImageLoader
.
resume
();
super
.
onResume
();
super
.
onResume
();
BacktoDuel
();
BacktoDuel
();
}
}
@Override
protected
void
onPause
()
{
mImageLoader
.
pause
();
super
.
onPause
();
}
private
void
duelAssistantCheck
()
{
private
void
duelAssistantCheck
()
{
if
(
AppsSettings
.
get
().
isServiceDuelAssistant
())
{
if
(
AppsSettings
.
get
().
isServiceDuelAssistant
())
{
Handler
handler
=
new
Handler
();
Handler
handler
=
new
Handler
();
...
@@ -304,7 +312,9 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -304,7 +312,9 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
break
;
break
;
case
R
.
id
.
action_game
:
case
R
.
id
.
action_game
:
setRandomCardDetail
();
setRandomCardDetail
();
CardDetailRandom
.
showRandromCardDetailToast
(
this
);
if
(
mCardDetailRandom
!=
null
){
mCardDetailRandom
.
show
();
}
openGame
();
openGame
();
break
;
break
;
case
R
.
id
.
action_settings
:
{
case
R
.
id
.
action_settings
:
{
...
@@ -665,12 +675,12 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -665,12 +675,12 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
//加载数据库中所有卡片卡片
//加载数据库中所有卡片卡片
mCardManager
.
loadCards
();
mCardManager
.
loadCards
();
//mCardManager = DataManager.get().getCardManager();
//mCardManager = DataManager.get().getCardManager();
cards
=
mCardManager
.
getAllCards
();
SparseArray
<
Card
>
cards
=
mCardManager
.
getAllCards
();
int
y
=
(
int
)
(
Math
.
random
()
*
cards
.
size
());
int
y
=
(
int
)
(
Math
.
random
()
*
cards
.
size
());
Card
cardInfo
=
cards
.
valueAt
(
y
);
Card
cardInfo
=
cards
.
valueAt
(
y
);
if
(
cardInfo
==
null
)
if
(
cardInfo
==
null
)
return
;
return
;
CardDetailRandom
.
RandomCardDetail
(
this
,
cardInfo
);
mCardDetailRandom
=
CardDetailRandom
.
genRandomCardDetail
(
this
,
mImageLoader
,
cardInfo
);
}
}
public
void
showTipsToast
()
{
public
void
showTipsToast
()
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardGroupView.java
View file @
7a92d476
...
@@ -13,7 +13,9 @@ import androidx.annotation.Nullable;
...
@@ -13,7 +13,9 @@ import androidx.annotation.Nullable;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
ocgcore.data.LimitList
;
import
ocgcore.data.LimitList
;
...
@@ -23,8 +25,13 @@ public class CardGroupView extends FrameLayout {
...
@@ -23,8 +25,13 @@ public class CardGroupView extends FrameLayout {
private
int
mLineLimit
=
10
;
private
int
mLineLimit
=
10
;
private
int
mOrgLineLimit
=
10
;
private
int
mOrgLineLimit
=
10
;
private
int
mLineMaxCount
=
15
;
private
int
mLineMaxCount
=
15
;
private
int
mCardWidth
=
177
,
mCardHeight
=
255
;
private
int
mCardWidth
=
Constants
.
CORE_SKIN_CARD_MINI_SIZE
[
0
],
mCardHeight
=
Constants
.
CORE_SKIN_CARD_MINI_SIZE
[
1
]
;
private
boolean
mPausePadding
;
private
boolean
mPausePadding
;
private
ImageLoader
mImageLoader
;
public
void
setImageLoader
(
ImageLoader
imageLoader
)
{
mImageLoader
=
imageLoader
;
}
//region init
//region init
public
CardGroupView
(
@NonNull
Context
context
)
{
public
CardGroupView
(
@NonNull
Context
context
)
{
...
@@ -219,7 +226,7 @@ public class CardGroupView extends FrameLayout {
...
@@ -219,7 +226,7 @@ public class CardGroupView extends FrameLayout {
refreshLayoutParams
(
count
+
1
);
refreshLayoutParams
(
count
+
1
);
}
}
CardView
cardView
=
new
CardView
(
getContext
());
CardView
cardView
=
new
CardView
(
getContext
());
cardView
.
showCard
(
card
);
cardView
.
showCard
(
mImageLoader
,
card
);
addView
(
cardView
,
index
);
addView
(
cardView
,
index
);
return
true
;
return
true
;
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/CardView.java
View file @
7a92d476
...
@@ -91,11 +91,11 @@ public class CardView extends FrameLayout {
...
@@ -91,11 +91,11 @@ public class CardView extends FrameLayout {
}
}
}
}
public
void
showCard
(
Card
cardInfo
)
{
public
void
showCard
(
ImageLoader
imageLoader
,
Card
cardInfo
)
{
if
(
mCard
!=
null
&&
mCard
.
equals
(
cardInfo
))
return
;
if
(
mCard
!=
null
&&
mCard
.
equals
(
cardInfo
))
return
;
mCard
=
cardInfo
;
mCard
=
cardInfo
;
if
(
cardInfo
!=
null
)
{
if
(
cardInfo
!=
null
&&
imageLoader
!=
null
)
{
ImageLoader
.
get
(
getContext
()).
bindImage
(
mCardView
,
cardInfo
.
Cod
e
);
imageLoader
.
bindImage
(
mCardView
,
cardInfo
.
Code
,
null
,
tru
e
);
}
else
{
}
else
{
mTopImage
.
setVisibility
(
View
.
GONE
);
mTopImage
.
setVisibility
(
View
.
GONE
);
mCardView
.
setImageBitmap
(
null
);
mCardView
.
setImageBitmap
(
null
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckGroupView.java
View file @
7a92d476
...
@@ -20,6 +20,7 @@ import java.util.Map;
...
@@ -20,6 +20,7 @@ import java.util.Map;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
...
@@ -43,6 +44,11 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -43,6 +44,11 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
private
CardView
mLastView
;
private
CardView
mLastView
;
private
boolean
mAutoSort
;
private
boolean
mAutoSort
;
private
EditMode
mEditMode
;
private
EditMode
mEditMode
;
private
ImageLoader
mImageLoader
;
public
void
setImageLoader
(
ImageLoader
imageLoader
)
{
mImageLoader
=
imageLoader
;
}
public
enum
EditMode
{
public
enum
EditMode
{
None
,
None
,
...
@@ -257,7 +263,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -257,7 +263,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
cardView
.
setSelected
(
false
);
cardView
.
setSelected
(
false
);
if
(
i
<
mDeckInfo
.
getExtraCount
())
{
if
(
i
<
mDeckInfo
.
getExtraCount
())
{
if
(
i
==
index
&&
count
>
0
)
{
if
(
i
==
index
&&
count
>
0
)
{
cardView
.
showCard
(
mDeckInfo
.
getExtraCard
(
i
));
cardView
.
showCard
(
m
ImageLoader
,
m
DeckInfo
.
getExtraCard
(
i
));
index
++;
index
++;
count
--;
count
--;
}
}
...
@@ -265,7 +271,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -265,7 +271,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
cardView
.
updateLimit
(
getImageTop
(),
mLimitList
);
cardView
.
updateLimit
(
getImageTop
(),
mLimitList
);
}
}
}
else
{
}
else
{
cardView
.
showCard
(
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
}
}
}
}
resizePadding
(
Type
.
Extra
,
mExtraViews
);
resizePadding
(
Type
.
Extra
,
mExtraViews
);
...
@@ -278,11 +284,11 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -278,11 +284,11 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
cardView
.
setSelected
(
false
);
cardView
.
setSelected
(
false
);
orgPos
=
i
%
Constants
.
DECK_WIDTH_MAX_COUNT
;
orgPos
=
i
%
Constants
.
DECK_WIDTH_MAX_COUNT
;
if
(
orgPos
>=
mMainLimit
)
{
if
(
orgPos
>=
mMainLimit
)
{
cardView
.
showCard
(
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
}
else
{
}
else
{
if
(
index
<
mDeckInfo
.
getMainCount
())
{
if
(
index
<
mDeckInfo
.
getMainCount
())
{
if
(
targetIndex
==
i
&&
count
>
0
)
{
if
(
targetIndex
==
i
&&
count
>
0
)
{
cardView
.
showCard
(
mDeckInfo
.
getMainCard
(
index
));
cardView
.
showCard
(
m
ImageLoader
,
m
DeckInfo
.
getMainCard
(
index
));
index
++;
index
++;
targetIndex
=
(
index
/
mMainLimit
)
*
Constants
.
DECK_WIDTH_MAX_COUNT
+
(
index
%
mMainLimit
);
targetIndex
=
(
index
/
mMainLimit
)
*
Constants
.
DECK_WIDTH_MAX_COUNT
+
(
index
%
mMainLimit
);
count
--;
count
--;
...
@@ -295,7 +301,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -295,7 +301,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
mMainViews
.
get
(
i
).
updateLimit
(
getImageTop
(),
mLimitList
);
mMainViews
.
get
(
i
).
updateLimit
(
getImageTop
(),
mLimitList
);
}
}
}
else
{
}
else
{
cardView
.
showCard
(
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
}
}
}
}
}
}
...
@@ -307,7 +313,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -307,7 +313,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
cardView
.
setSelected
(
false
);
cardView
.
setSelected
(
false
);
if
(
i
<
mDeckInfo
.
getSideCount
())
{
if
(
i
<
mDeckInfo
.
getSideCount
())
{
if
(
i
==
index
&&
count
>
0
)
{
if
(
i
==
index
&&
count
>
0
)
{
cardView
.
showCard
(
mDeckInfo
.
getSideCard
(
i
));
cardView
.
showCard
(
m
ImageLoader
,
m
DeckInfo
.
getSideCard
(
i
));
index
++;
index
++;
count
--;
count
--;
}
}
...
@@ -315,7 +321,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
...
@@ -315,7 +321,7 @@ public class DeckGroupView extends FrameLayout implements View.OnClickListener {
cardView
.
updateLimit
(
getImageTop
(),
mLimitList
);
cardView
.
updateLimit
(
getImageTop
(),
mLimitList
);
}
}
}
else
{
}
else
{
cardView
.
showCard
(
null
);
cardView
.
showCard
(
mImageLoader
,
null
);
}
}
}
}
resizePadding
(
Type
.
Side
,
mSideViews
);
resizePadding
(
Type
.
Side
,
mSideViews
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/widget/DeckView.java
View file @
7a92d476
...
@@ -7,6 +7,7 @@ import android.widget.LinearLayout;
...
@@ -7,6 +7,7 @@ import android.widget.LinearLayout;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.bean.DeckInfo
;
import
cn.garymb.ygomobile.loader.ImageLoader
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.ImageTop
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
cn.garymb.ygomobile.ui.cards.deck.LabelInfo
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
...
@@ -20,6 +21,8 @@ public class DeckView extends LinearLayout {
...
@@ -20,6 +21,8 @@ public class DeckView extends LinearLayout {
private
final
ImageTop
mImageTop
;
private
final
ImageTop
mImageTop
;
private
boolean
mAutoSort
,
mEditMode
,
mLimitChanged
;
private
boolean
mAutoSort
,
mEditMode
,
mLimitChanged
;
private
ImageLoader
mImageLoader
;
//region init
//region init
public
DeckView
(
Context
context
)
{
public
DeckView
(
Context
context
)
{
this
(
context
,
null
);
this
(
context
,
null
);
...
@@ -40,6 +43,7 @@ public class DeckView extends LinearLayout {
...
@@ -40,6 +43,7 @@ public class DeckView extends LinearLayout {
mMainGroup
=
new
CardGroupView
(
context
);
mMainGroup
=
new
CardGroupView
(
context
);
mExtraGroup
=
new
CardGroupView
(
context
);
mExtraGroup
=
new
CardGroupView
(
context
);
mSideGroup
=
new
CardGroupView
(
context
);
mSideGroup
=
new
CardGroupView
(
context
);
int
cardWidth
=
0
;
int
cardWidth
=
0
;
int
cardHeight
=
0
;
int
cardHeight
=
0
;
if
(
cardWidth
<=
0
)
{
if
(
cardWidth
<=
0
)
{
...
@@ -67,6 +71,13 @@ public class DeckView extends LinearLayout {
...
@@ -67,6 +71,13 @@ public class DeckView extends LinearLayout {
addView
(
mSideGroup
,
new
LayoutParams
(
LayoutParams
.
MATCH_PARENT
,
cardHeight
));
addView
(
mSideGroup
,
new
LayoutParams
(
LayoutParams
.
MATCH_PARENT
,
cardHeight
));
}
}
public
void
setImageLoader
(
ImageLoader
imageLoader
)
{
mImageLoader
=
imageLoader
;
mMainGroup
.
setImageLoader
(
imageLoader
);
mExtraGroup
.
setImageLoader
(
imageLoader
);
mSideGroup
.
setImageLoader
(
imageLoader
);
}
public
ImageTop
getImageTop
()
{
public
ImageTop
getImageTop
()
{
return
mImageTop
;
return
mImageTop
;
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
7a92d476
...
@@ -27,6 +27,19 @@ import cn.garymb.ygomobile.Constants;
...
@@ -27,6 +27,19 @@ import cn.garymb.ygomobile.Constants;
public
class
FileUtils
{
public
class
FileUtils
{
public
static
boolean
isExist
(
String
path
){
return
path
!=
null
&&
new
File
(
path
).
exists
();
}
public
static
String
getFileExpansion
(
String
path
){
int
index
=
path
.
lastIndexOf
(
"."
);
if
(
index
>
0
){
return
path
.
substring
(
index
+
1
).
toLowerCase
();
}
return
""
;
}
public
static
void
closeQuietly
(
Closeable
closeable
)
{
public
static
void
closeQuietly
(
Closeable
closeable
)
{
if
(
closeable
!=
null
)
{
if
(
closeable
!=
null
)
{
try
{
try
{
...
...
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