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
cdde8627
Commit
cdde8627
authored
Jan 08, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
发送版本号和下载地址供更新直达
parent
0167d4a0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
+18
-15
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+8
-6
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
...java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
+9
-8
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
cdde8627
...
@@ -156,7 +156,7 @@ public interface Constants {
...
@@ -156,7 +156,7 @@ public interface Constants {
String
URL_DONATE
=
"https://afdian.net/@ygomobile"
;
String
URL_DONATE
=
"https://afdian.net/@ygomobile"
;
String
URL_MASTER_RULE_CN
=
"https://ocg-rule.readthedocs.io/"
;
String
URL_MASTER_RULE_CN
=
"https://ocg-rule.readthedocs.io/"
;
String
WIKI_SEARCH_URL
=
"https://ygocdb.com/card/"
;
String
WIKI_SEARCH_URL
=
"https://ygocdb.com/card/"
;
String
URL_HOME_VERSION
=
"https://ygomobile.top/ver
sion
.txt"
;
String
URL_HOME_VERSION
=
"https://ygomobile.top/ver
ndwnload
.txt"
;
String
URL_YGO233_DOWNLOAD_LINK
=
"https://ygo233.com/download/ygomobile"
;
String
URL_YGO233_DOWNLOAD_LINK
=
"https://ygo233.com/download/ygomobile"
;
String
URL_YGO233_ADVANCE
=
"https://ygo233.com/pre"
;
String
URL_YGO233_ADVANCE
=
"https://ygo233.com/pre"
;
String
URL_YGO233_DATAVER
=
"https://ygo233.com/pre/dataver"
;
String
URL_YGO233_DATAVER
=
"https://ygo233.com/pre/dataver"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
cdde8627
...
@@ -47,6 +47,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -47,6 +47,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
long
exitLasttime
=
0
;
long
exitLasttime
=
0
;
public
static
String
Version
;
public
static
String
Version
;
public
static
String
Cache_link
;
private
static
final
int
TYPE_GET_VERSION_OK
=
0
;
private
static
final
int
TYPE_GET_VERSION_OK
=
0
;
private
static
final
int
TYPE_GET_VERSION_FAILED
=
1
;
private
static
final
int
TYPE_GET_VERSION_FAILED
=
1
;
...
@@ -71,15 +72,16 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -71,15 +72,16 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
super
.
handleMessage
(
msg
);
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
)
{
switch
(
msg
.
what
)
{
case
TYPE_GET_VERSION_OK:
case
TYPE_GET_VERSION_OK:
Version
=
msg
.
obj
.
toString
();
Version
=
msg
.
obj
.
toString
().
substring
(
0
,
msg
.
obj
.
toString
().
indexOf
(
"|"
));
//截取版本号
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
Version
);
Cache_link
=
msg
.
obj
.
toString
().
substring
(
msg
.
obj
.
toString
().
indexOf
(
"|"
)
+
1
);
if
(!
Version
.
equals
(
BuildConfig
.
VERSION_NAME
)
&&
!
Version
.
isEmpty
())
{
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
Version
+
"和"
+
Cache_link
);
if
(!
Version
.
equals
(
BuildConfig
.
VERSION_NAME
)
&&
!
Version
.
isEmpty
()
&&
!
Cache_link
.
isEmpty
())
{
DialogPlus
dialog
=
new
DialogPlus
(
getActivity
());
DialogPlus
dialog
=
new
DialogPlus
(
getActivity
());
dialog
.
setMessage
(
R
.
string
.
Found_Update
);
dialog
.
setMessage
(
R
.
string
.
Found_Update
);
dialog
.
setLeftButtonText
(
R
.
string
.
download_home
);
dialog
.
setLeftButtonText
(
R
.
string
.
download_home
);
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
intent
.
setData
(
Uri
.
parse
(
"https://netdisk.link/YGOMobile_"
+
Version
+
".apk/links"
));
intent
.
setData
(
Uri
.
parse
(
Cache_link
));
startActivity
(
intent
);
startActivity
(
intent
);
dialog
.
dismiss
();
dialog
.
dismiss
();
});
});
...
@@ -174,7 +176,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -174,7 +176,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
private
void
showNewsCounts
()
{
private
void
showNewsCounts
()
{
mTextBadgeItem
=
new
TextBadgeItem
()
mTextBadgeItem
=
new
TextBadgeItem
()
.
setBorderWidth
(
4
)
//文本大小
.
setBorderWidth
(
4
)
//文本大小
.
setGravity
(
Gravity
.
LEFT
)
//位置 默认右上
.
setGravity
(
Gravity
.
LEFT
)
//位置 默认右上
.
setBackgroundColorResource
(
R
.
color
.
holo_orange_bright
)
//背景颜色
.
setBackgroundColorResource
(
R
.
color
.
holo_orange_bright
)
//背景颜色
.
setAnimationDuration
(
200
)
//动画时间
.
setAnimationDuration
(
200
)
//动画时间
.
setText
(
"3"
)
.
setText
(
"3"
)
...
@@ -356,12 +358,12 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -356,12 +358,12 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
message
.
what
=
TYPE_GET_VERSION_FAILED
;
message
.
what
=
TYPE_GET_VERSION_FAILED
;
message
.
obj
=
e
;
message
.
obj
=
e
;
handlerHome
.
sendMessage
(
message
);
handlerHome
.
sendMessage
(
message
);
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
"error"
+
e
);
}
}
@Override
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
String
json
=
response
.
body
().
string
();
String
json
=
response
.
body
().
string
();
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
json
);
Message
message
=
new
Message
();
Message
message
=
new
Message
();
message
.
what
=
TYPE_GET_VERSION_OK
;
message
.
what
=
TYPE_GET_VERSION_OK
;
message
.
obj
=
json
;
message
.
obj
=
json
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
View file @
cdde8627
...
@@ -93,6 +93,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -93,6 +93,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
private
static
final
int
TYPE_SETTING_GET_VERSION_FAILED
=
1
;
private
static
final
int
TYPE_SETTING_GET_VERSION_FAILED
=
1
;
private
AppsSettings
mSettings
;
private
AppsSettings
mSettings
;
public
static
String
Version
;
public
static
String
Version
;
public
static
String
Cache_link
;
private
boolean
isInit
=
true
;
private
boolean
isInit
=
true
;
public
SettingFragment
()
{
public
SettingFragment
()
{
...
@@ -106,15 +107,16 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -106,15 +107,16 @@ public class SettingFragment extends PreferenceFragmentPlus {
super
.
handleMessage
(
msg
);
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
)
{
switch
(
msg
.
what
)
{
case
TYPE_SETTING_GET_VERSION_OK:
case
TYPE_SETTING_GET_VERSION_OK:
Version
=
msg
.
obj
.
toString
();
Version
=
msg
.
obj
.
toString
().
substring
(
0
,
msg
.
obj
.
toString
().
indexOf
(
"|"
));
//截取版本号
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
Version
);
Cache_link
=
msg
.
obj
.
toString
().
substring
(
msg
.
obj
.
toString
().
indexOf
(
"|"
)
+
1
);
if
(!
Version
.
equals
(
BuildConfig
.
VERSION_NAME
)
&&
!
Version
.
isEmpty
())
{
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
Version
+
"和"
+
Cache_link
);
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
if
(!
Version
.
equals
(
BuildConfig
.
VERSION_NAME
)
&&
!
Version
.
isEmpty
()
&&
!
Cache_link
.
isEmpty
())
{
DialogPlus
dialog
=
new
DialogPlus
(
getActivity
());
dialog
.
setMessage
(
R
.
string
.
Found_Update
);
dialog
.
setMessage
(
R
.
string
.
Found_Update
);
dialog
.
setLeftButtonText
(
R
.
string
.
download_home
);
dialog
.
setLeftButtonText
(
R
.
string
.
download_home
);
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
intent
.
setData
(
Uri
.
parse
(
"https://netdisk.link/YGOMobile_"
+
Version
+
".apk/links"
));
intent
.
setData
(
Uri
.
parse
(
Cache_link
));
startActivity
(
intent
);
startActivity
(
intent
);
dialog
.
dismiss
();
dialog
.
dismiss
();
});
});
...
@@ -134,7 +136,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -134,7 +136,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
@Override
@Override
protected
SharedPreferences
getSharedPreferences
()
{
protected
SharedPreferences
getSharedPreferences
()
{
return
mSettings
.
getSharedPreferences
();
return
AppsSettings
.
get
()
.
getSharedPreferences
();
}
}
@Override
@Override
...
@@ -250,7 +252,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -250,7 +252,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
}
}
mSettings
.
setDataLanguage
(
Integer
.
valueOf
(
listPreference
.
getValue
()));
mSettings
.
setDataLanguage
(
Integer
.
valueOf
(
listPreference
.
getValue
()));
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
mSettings
.
getDataLanguage
()
+
preference
.
getKey
()
+
listPreference
.
getValue
());
Toast
.
makeText
(
getContext
(),
R
.
string
.
restart_app
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
getContext
(),
R
.
string
.
restart_app
,
Toast
.
LENGTH_LONG
).
show
();
DataManager
.
get
().
load
(
true
);
DataManager
.
get
().
load
(
true
);
}
}
...
@@ -287,12 +288,12 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -287,12 +288,12 @@ public class SettingFragment extends PreferenceFragmentPlus {
message
.
what
=
TYPE_SETTING_GET_VERSION_FAILED
;
message
.
what
=
TYPE_SETTING_GET_VERSION_FAILED
;
message
.
obj
=
e
;
message
.
obj
=
e
;
handler
.
sendMessage
(
message
);
handler
.
sendMessage
(
message
);
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
"error"
+
e
);
}
}
@Override
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
String
json
=
response
.
body
().
string
();
String
json
=
response
.
body
().
string
();
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
json
);
Message
message
=
new
Message
();
Message
message
=
new
Message
();
message
.
what
=
TYPE_SETTING_GET_VERSION_OK
;
message
.
what
=
TYPE_SETTING_GET_VERSION_OK
;
message
.
obj
=
json
;
message
.
obj
=
json
;
...
...
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