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
178a5715
Commit
178a5715
authored
Sep 15, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加先行卡有新版本时的提醒
在开启拓展卡包后才检查先行卡远端版本号
parent
821095bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
15 deletions
+70
-15
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
+36
-15
mobile/src/main/java/cn/garymb/ygomobile/utils/SharedPreferenceUtil.java
.../java/cn/garymb/ygomobile/utils/SharedPreferenceUtil.java
+8
-0
mobile/src/main/res/layout/fragment_home.xml
mobile/src/main/res/layout/fragment_home.xml
+26
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
View file @
178a5715
package
cn.garymb.ygomobile.ui.home
;
package
cn.garymb.ygomobile.ui.home
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_SERVER_LIST
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_SERVER_LIST
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_DATAVER
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.DashPathEffect
;
import
android.graphics.Paint
;
import
android.graphics.RectF
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
...
@@ -24,7 +20,6 @@ import android.view.ViewGroup;
...
@@ -24,7 +20,6 @@ import android.view.ViewGroup;
import
android.view.inputmethod.EditorInfo
;
import
android.view.inputmethod.EditorInfo
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.EditText
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.ListView
;
import
android.widget.ListView
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
...
@@ -33,17 +28,11 @@ import android.widget.Toast;
...
@@ -33,17 +28,11 @@ import android.widget.Toast;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.widget.LinearLayoutCompat
;
import
androidx.cardview.widget.CardView
;
import
androidx.cardview.widget.CardView
;
import
androidx.recyclerview.widget.DividerItemDecoration
;
import
androidx.recyclerview.widget.DividerItemDecoration
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
com.app.hubert.guide.NewbieGuide
;
import
com.app.hubert.guide.core.Controller
;
import
com.app.hubert.guide.listener.OnHighlightDrewListener
;
import
com.app.hubert.guide.listener.OnLayoutInflatedListener
;
import
com.app.hubert.guide.model.GuidePage
;
import
com.app.hubert.guide.model.HighLight
;
import
com.app.hubert.guide.model.HighlightOptions
;
import
com.ourygo.assistant.base.listener.OnDuelAssistantListener
;
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
;
...
@@ -86,10 +75,15 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
...
@@ -86,10 +75,15 @@ import cn.garymb.ygomobile.ui.plus.VUiKit;
import
cn.garymb.ygomobile.ui.widget.Shimmer
;
import
cn.garymb.ygomobile.ui.widget.Shimmer
;
import
cn.garymb.ygomobile.ui.widget.ShimmerTextView
;
import
cn.garymb.ygomobile.ui.widget.ShimmerTextView
;
import
cn.garymb.ygomobile.utils.FileLogUtil
;
import
cn.garymb.ygomobile.utils.FileLogUtil
;
import
cn.garymb.ygomobile.utils.OkhttpUtil
;
import
cn.garymb.ygomobile.utils.SharedPreferenceUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
import
ocgcore.CardManager
;
import
ocgcore.CardManager
;
import
ocgcore.DataManager
;
import
ocgcore.DataManager
;
import
ocgcore.data.Card
;
import
ocgcore.data.Card
;
import
okhttp3.Call
;
import
okhttp3.Callback
;
import
okhttp3.Response
;
public
class
HomeFragment
extends
BaseFragemnt
implements
OnDuelAssistantListener
,
View
.
OnClickListener
{
public
class
HomeFragment
extends
BaseFragemnt
implements
OnDuelAssistantListener
,
View
.
OnClickListener
{
...
@@ -104,6 +98,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -104,6 +98,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
private
RelativeLayout
ll_back
;
private
RelativeLayout
ll_back
;
ShimmerTextView
tv
;
ShimmerTextView
tv
;
ShimmerTextView
tv2
;
Shimmer
shimmer
;
Shimmer
shimmer
;
private
SwipeMenuRecyclerView
mServerList
;
private
SwipeMenuRecyclerView
mServerList
;
private
ServerListAdapter
mServerListAdapter
;
private
ServerListAdapter
mServerListAdapter
;
...
@@ -123,6 +118,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -123,6 +118,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
private
CardView
cv_watch_replay
;
private
CardView
cv_watch_replay
;
//辅助功能
//辅助功能
private
CardView
cv_download_ex
;
private
CardView
cv_download_ex
;
private
LinearLayoutCompat
ll_new_notice
;
//外连
//外连
private
CardView
cv_donation
;
private
CardView
cv_donation
;
private
CardView
cv_help
;
private
CardView
cv_help
;
...
@@ -145,6 +141,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -145,6 +141,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
{
//加上判断
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
{
//加上判断
EventBus
.
getDefault
().
register
(
this
);
EventBus
.
getDefault
().
register
(
this
);
}
}
findExPansionsDataVer
();
//showNewbieGuide("homePage");
//showNewbieGuide("homePage");
return
layoutView
;
return
layoutView
;
}
}
...
@@ -181,6 +178,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -181,6 +178,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
cv_watch_replay
.
setOnClickListener
(
this
);
cv_watch_replay
.
setOnClickListener
(
this
);
cv_download_ex
=
view
.
findViewById
(
R
.
id
.
action_download_ex
);
cv_download_ex
=
view
.
findViewById
(
R
.
id
.
action_download_ex
);
cv_download_ex
.
setOnClickListener
(
this
);
cv_download_ex
.
setOnClickListener
(
this
);
ll_new_notice
=
view
.
findViewById
(
R
.
id
.
ll_new_notice
);
/*
/*
cv_download_ex.setOnLongClickListener(new View.OnLongClickListener() {
cv_download_ex.setOnLongClickListener(new View.OnLongClickListener() {
@Override
@Override
...
@@ -197,7 +195,9 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -197,7 +195,9 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
ll_back
=
view
.
findViewById
(
R
.
id
.
return_to_duel
);
ll_back
=
view
.
findViewById
(
R
.
id
.
return_to_duel
);
ll_back
.
setOnClickListener
(
this
);
ll_back
.
setOnClickListener
(
this
);
tv
=
(
ShimmerTextView
)
view
.
findViewById
(
R
.
id
.
shimmer_tv
);
tv
=
(
ShimmerTextView
)
view
.
findViewById
(
R
.
id
.
shimmer_tv
);
tv2
=
(
ShimmerTextView
)
view
.
findViewById
(
R
.
id
.
shimmer_tv2
);
toggleAnimation
(
tv
);
toggleAnimation
(
tv
);
toggleAnimation
(
tv2
);
mImageLoader
=
new
ImageLoader
(
false
);
mImageLoader
=
new
ImageLoader
(
false
);
mCardManager
=
DataManager
.
get
().
getCardManager
();
mCardManager
=
DataManager
.
get
().
getCardManager
();
...
@@ -265,6 +265,26 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -265,6 +265,26 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
}
}
};
};
private
void
findExPansionsDataVer
()
{
if
(
AppsSettings
.
get
().
isReadExpansions
())
{
String
oldVer
=
SharedPreferenceUtil
.
getExpansionDataVer
();
OkhttpUtil
.
get
(
URL_YGO233_DATAVER
,
new
Callback
()
{
@Override
public
void
onFailure
(
Call
call
,
IOException
e
)
{
findExPansionsDataVer
();
}
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
WebActivity
.
dataVer
=
response
.
body
().
string
();
}
});
if
(!
WebActivity
.
dataVer
.
equals
(
oldVer
))
{
ll_new_notice
.
setVisibility
(
View
.
VISIBLE
);
}
}
}
private
void
findMcNews
()
{
private
void
findMcNews
()
{
isMcNewsLoadException
=
false
;
isMcNewsLoadException
=
false
;
tv_banner_loading
.
setVisibility
(
View
.
VISIBLE
);
tv_banner_loading
.
setVisibility
(
View
.
VISIBLE
);
...
@@ -445,12 +465,12 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -445,12 +465,12 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
}
}
}
}
public
void
toggleAnimation
(
View
target
)
{
public
void
toggleAnimation
(
ShimmerText
View
target
)
{
if
(
shimmer
!=
null
&&
shimmer
.
isAnimating
())
{
if
(
shimmer
!=
null
&&
shimmer
.
isAnimating
())
{
shimmer
.
cancel
();
shimmer
.
cancel
();
}
else
{
}
else
{
shimmer
=
new
Shimmer
();
shimmer
=
new
Shimmer
();
shimmer
.
start
(
t
v
);
shimmer
.
start
(
t
arget
);
}
}
}
}
...
@@ -662,6 +682,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -662,6 +682,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
break
;
break
;
case
R
.
id
.
action_download_ex
:
case
R
.
id
.
action_download_ex
:
WebActivity
.
open
(
getContext
(),
getString
(
R
.
string
.
action_download_expansions
),
Constants
.
URL_YGO233_ADVANCE
);
WebActivity
.
open
(
getContext
(),
getString
(
R
.
string
.
action_download_expansions
),
Constants
.
URL_YGO233_ADVANCE
);
ll_new_notice
.
setVisibility
(
View
.
GONE
);
break
;
break
;
case
R
.
id
.
action_help
:
{
case
R
.
id
.
action_help
:
{
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/SharedPreferenceUtil.java
View file @
178a5715
...
@@ -50,6 +50,14 @@ public class SharedPreferenceUtil {
...
@@ -50,6 +50,14 @@ public class SharedPreferenceUtil {
return
getShareRecord
().
getInt
(
"StartTimes"
,
0
);
return
getShareRecord
().
getInt
(
"StartTimes"
,
0
);
}
}
public
static
void
setExpansionDataVer
(
String
json
){
getShareRecord
().
edit
().
putString
(
"ExpansionsDataVer"
,
json
).
commit
();
};
public
static
String
getExpansionDataVer
()
{
return
getShareRecord
().
getString
(
"ExpansionsDataVer"
,
null
);
}
public
static
String
getUserName
()
{
public
static
String
getUserName
()
{
return
getShareRecord
().
getString
(
"userName"
,
null
);
return
getShareRecord
().
getString
(
"userName"
,
null
);
}
}
...
...
mobile/src/main/res/layout/fragment_home.xml
View file @
178a5715
...
@@ -119,6 +119,8 @@
...
@@ -119,6 +119,8 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:layout_alignParentLeft=
"true"
android:layout_alignParentLeft=
"true"
android:layout_marginStart=
"-263dp"
android:layout_marginLeft=
"1dp"
android:layout_toEndOf=
"@id/logo_small"
android:layout_toEndOf=
"@id/logo_small"
android:gravity=
"center"
android:gravity=
"center"
android:text=
"@string/return_to_duel"
android:text=
"@string/return_to_duel"
...
@@ -432,6 +434,30 @@
...
@@ -432,6 +434,30 @@
android:textSize=
"10sp"
android:textSize=
"10sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
</RelativeLayout>
</RelativeLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/ll_new_notice"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right|bottom"
android:orientation=
"horizontal"
android:visibility=
"visible"
>
<cn.garymb.ygomobile.ui.widget.ShimmerTextView
android:id=
"@+id/shimmer_tv2"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:text=
"NEW!"
android:textColor=
"@color/holo_orange_bright"
android:textSize=
"15sp"
android:textStyle=
"bold|italic"
/>
<ImageView
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:layout_gravity=
"center"
android:src=
"@drawable/ic_expansions"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
...
...
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