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
00cc6945
Commit
00cc6945
authored
Jul 15, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分段处理,onCreate预加载好卡片信息数组
parent
10b62798
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
37 deletions
+28
-37
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
...n/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
+10
-20
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+12
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+0
-1
mobile/src/main/res/layout/dialog_cardinfo_small.xml
mobile/src/main/res/layout/dialog_cardinfo_small.xml
+2
-8
No files found.
mobile/src/main/java/cn/garymb/ygomobile/YGOStarter.java
View file @
00cc6945
...
...
@@ -161,12 +161,12 @@ public class YGOStarter {
//显示加载背景
showLoadingBg
(
activity
);
Log
.
e
(
"YGOStarter"
,
"设置背景后"
+
System
.
currentTimeMillis
());
if
(!
ComponentUtils
.
isActivityRunning
(
activity
,
new
ComponentName
(
activity
,
YGOMobileActivity
.
class
)))
{
/*
if (!ComponentUtils.isActivityRunning(activity, new ComponentName(activity, YGOMobileActivity.class))) {
String[] tipsList = activity.getResources().getStringArray(R.array.tips);
int x = (int) (Math.random() * tipsList.length);
String tips = tipsList[x];
Toast.makeText(activity, tips, Toast.LENGTH_LONG).show();
}
}
*/
}
Intent
intent
=
new
Intent
(
activity
,
YGOMobileActivity
.
class
);
if
(
options
!=
null
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
00cc6945
...
...
@@ -264,13 +264,13 @@ public class ImageLoader implements Closeable {
}
}
}
}
}
/*
if (!bind) {
if (Constants.NETWORK_IMAGE && NetUtils.isWifiConnected(imageview.getContext())) {
bind(String.format(Constants.IMAGE_URL, "" + code), imageview, code, pre, isBig);
} else {
imageview.setImageResource(R.drawable.unknown);
}
}
}
*/
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardDetailRandom.java
View file @
00cc6945
...
...
@@ -24,6 +24,7 @@ import ocgcore.enums.CardType;
import
static
android
.
view
.
View
.
inflate
;
public
class
CardDetailRandom
{
private
static
ThreeDLayoutUtil
viewCardDetail
;
private
static
ImageView
cardImage
;
private
static
TextView
name
;
private
static
TextView
desc
;
...
...
@@ -33,23 +34,18 @@ public class CardDetailRandom {
private
static
TextView
cardAtk
;
private
static
TextView
cardDef
;
private
static
TextView
attrView
;
private
static
View
linkArrow
;
private
static
View
monsterlayout
;
private
static
View
layout_detail_p_scale
;
private
static
View
atkdefView
;
private
static
TextView
detail_cardscale
;
private
static
CardManager
mCardManager
;
private
static
ImageLoader
imageLoader
;
private
static
StringManager
mStringManager
;
private
static
SparseArray
<
Card
>
cards
;
private
static
View
view
;
public
static
void
RandomCardDetail
(
BaseActivity
context
,
Card
cardInfo
)
{
ThreeDLayoutUtil
viewCardDetail
=
(
ThreeDLayoutUtil
)
inflate
(
context
,
R
.
layout
.
dialog_cardinfo_small
,
null
);
public
static
void
RandomCardDetail
(
Context
context
,
Card
cardInfo
)
{
imageLoader
=
ImageLoader
.
get
(
context
);
viewCardDetail
=
(
ThreeDLayoutUtil
)
inflate
(
context
,
R
.
layout
.
dialog_cardinfo_small
,
null
);
cardImage
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_image_toast
);
name
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_name_toast
);
monsterlayout
=
viewCardDetail
.
findViewById
(
R
.
id
.
star_attr_race_toast
);
level
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_level_toast
);
linkArrow
=
viewCardDetail
.
findViewById
(
R
.
id
.
link_arrows_toast
);
race
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_race_toast
);
attrView
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_attr_toast
);
type
=
viewCardDetail
.
findViewById
(
R
.
id
.
card_type_toast
);
...
...
@@ -58,13 +54,9 @@ public class CardDetailRandom {
atkdefView
=
viewCardDetail
.
findViewById
(
R
.
id
.
layout_atkdef2_toast
);
desc
=
viewCardDetail
.
findViewById
(
R
.
id
.
text_desc_toast
);
layout_detail_p_scale
=
viewCardDetail
.
findViewById
(
R
.
id
.
detail_p_scale
);
detail_cardscale
=
viewCardDetail
.
findViewById
(
R
.
id
.
detail_cardscale
);
if
(
cardInfo
==
null
)
return
;
mStringManager
=
DataManager
.
get
().
getStringManager
();
imageLoader
=
ImageLoader
.
get
(
context
);
imageLoader
.
bindImage
(
cardImage
,
cardInfo
.
Code
,
null
,
true
);
imageLoader
.
bindImage
(
cardImage
,
cardInfo
.
Code
);
name
.
setText
(
cardInfo
.
Name
);
type
.
setText
(
CardUtils
.
getAllTypeString
(
cardInfo
,
mStringManager
).
replace
(
"/"
,
"|"
));
attrView
.
setText
(
mStringManager
.
getAttributeString
(
cardInfo
.
Attribute
));
...
...
@@ -86,21 +78,19 @@ public class CardDetailRandom {
//连接怪兽设置
if
(
cardInfo
.
isType
(
CardType
.
Link
))
{
level
.
setVisibility
(
View
.
GONE
);
linkArrow
.
setVisibility
(
View
.
VISIBLE
);
cardDef
.
setText
((
cardInfo
.
getStar
()
<
0
?
"?"
:
"LINK-"
+
String
.
valueOf
(
cardInfo
.
getStar
())));
BaseActivity
.
showLinkArrows
(
cardInfo
,
view
);
}
else
{
level
.
setVisibility
(
View
.
VISIBLE
);
linkArrow
.
setVisibility
(
View
.
GONE
);
cardDef
.
setText
((
cardInfo
.
Defense
<
0
?
"?"
:
String
.
valueOf
(
cardInfo
.
Defense
)));
}
race
.
setText
(
mStringManager
.
getRaceString
(
cardInfo
.
Race
));
}
else
{
atkdefView
.
setVisibility
(
View
.
GONE
);
race
.
setVisibility
(
View
.
GONE
);
level
.
setVisibility
(
View
.
GONE
);
linkArrow
.
setVisibility
(
View
.
GONE
);
monsterlayout
.
setVisibility
(
View
.
GONE
);
}
}
public
static
void
showRandromCardDetailToast
(
Context
context
)
{
Toast
toast
=
new
Toast
(
context
);
toast
.
setView
(
viewCardDetail
);
toast
.
setDuration
(
Toast
.
LENGTH_LONG
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
00cc6945
...
...
@@ -80,7 +80,6 @@ import cn.garymb.ygomobile.utils.PayUtils;
import
cn.garymb.ygomobile.utils.ScreenUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.CardManager
;
import
ocgcore.DataManager
;
import
ocgcore.data.Card
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_SERVER_LIST
;
...
...
@@ -104,6 +103,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_home
);
setExitAnimEnable
(
false
);
mCardManager
=
new
CardManager
(
AppsSettings
.
get
().
getDataBaseFile
().
getAbsolutePath
(),
null
);
mServerList
=
$
(
R
.
id
.
list_server
);
mServerListAdapter
=
new
ServerListAdapter
(
this
);
//server list
...
...
@@ -122,6 +122,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
AnimationShake
();
tv
=
(
ShimmerTextView
)
findViewById
(
R
.
id
.
shimmer_tv
);
toggleAnimation
(
tv
);
setRandomCardDetail
();
QbSdk
.
PreInitCallback
cb
=
new
QbSdk
.
PreInitCallback
()
{
@Override
...
...
@@ -154,6 +155,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
@Override
protected
void
onResume
()
{
super
.
onResume
();
setRandomCardDetail
();
BacktoDuel
();
}
...
...
@@ -314,6 +316,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
}
break
;
case
R
.
id
.
action_game
:
CardDetailRandom
.
showRandromCardDetailToast
(
this
);
openGame
();
break
;
case
R
.
id
.
action_settings
:
{
...
...
@@ -656,10 +659,15 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
}
public
void
setRandomCardDetail
()
{
mCardManager
=
DataManager
.
get
().
getCardManager
();
//加载数据库中所有卡片卡片
mCardManager
.
loadCards
();
//mCardManager = DataManager.get().getCardManager();
cards
=
mCardManager
.
getAllCards
();
int
y
=
(
int
)
(
Math
.
random
()
*
cards
.
size
());
Card
cardinfo
=
cards
.
valueAt
(
y
);
CardDetailRandom
.
RandomCardDetail
(
this
,
cardinfo
);
Card
cardInfo
=
cards
.
valueAt
(
y
);
if
(
cardInfo
==
null
)
{
Toast
.
makeText
(
this
,
"code为空"
,
Toast
.
LENGTH_LONG
).
show
();
}
CardDetailRandom
.
RandomCardDetail
(
this
,
cardInfo
);
}
}
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
00cc6945
...
...
@@ -42,7 +42,6 @@ import static cn.garymb.ygomobile.Constants.NETWORK_IMAGE;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ORI_DECK
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ORI_PICS
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ORI_REPLAY
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ORI_TEXTURES
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
ResCheckTask
.
ResCheckListener
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
ResCheckTask
.
getDatapath
;
...
...
mobile/src/main/res/layout/dialog_cardinfo_small.xml
View file @
00cc6945
...
...
@@ -26,8 +26,7 @@
android:layout_centerHorizontal=
"true"
android:layout_centerVertical=
"true"
android:layout_gravity=
"center_vertical"
android:scaleType=
"fitXY"
tools:src=
"@drawable/unknown"
/>
android:scaleType=
"fitXY"
/>
</RelativeLayout>
<LinearLayout
...
...
@@ -116,17 +115,12 @@
tools:text=
"Card Name"
/>
<LinearLayout
android:id=
"@+id/star_attr_race_
scale_
toast"
android:id=
"@+id/star_attr_race_toast"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center_horizontal"
android:orientation=
"horizontal"
>
<include
android:id=
"@+id/link_arrows_toast"
layout=
"@layout/item_linkmaker_small"
android:visibility=
"gone"
/>
<TextView
android:id=
"@+id/card_level_toast"
android:layout_width=
"wrap_content"
...
...
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