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
8f7e91ef
Commit
8f7e91ef
authored
Oct 14, 2022
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的->检查更新功能更改
parent
1e4d28ef
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
16 deletions
+64
-16
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
...java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
+61
-16
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/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
View file @
8f7e91ef
...
...
@@ -36,12 +36,14 @@ import static cn.garymb.ygomobile.Constants.SETTINGS_COVER;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_DOWNLOAD_LINK
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
ResCheckTask
.
getDatapath
;
import
android.annotation.SuppressLint
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.preference.CheckBoxPreference
;
import
android.preference.ListPreference
;
...
...
@@ -74,7 +76,6 @@ import cn.garymb.ygomobile.Constants;
import
cn.garymb.ygomobile.lite.BuildConfig
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.adapters.SimpleListAdapter
;
import
cn.garymb.ygomobile.ui.home.HomeFragment
;
import
cn.garymb.ygomobile.ui.home.MainActivity
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
...
...
@@ -89,14 +90,49 @@ import okhttp3.Callback;
import
okhttp3.Response
;
public
class
SettingFragment
extends
PreferenceFragmentPlus
{
private
static
final
int
TYPE_GET_VERSION_OK
=
0
;
private
static
final
int
TYPE_GET_VERSION_FAILED
=
1
;
private
AppsSettings
mSettings
;
p
rivate
HomeFragment
mHomeFragment
;
p
ublic
static
String
Version
;
private
boolean
isInit
=
true
;
public
SettingFragment
()
{
}
@SuppressLint
(
"HandlerLeak"
)
Handler
handler
=
new
Handler
()
{
@Override
public
void
handleMessage
(
Message
msg
)
{
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
)
{
case
TYPE_GET_VERSION_OK:
Version
=
msg
.
obj
.
toString
();
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
Version
);
if
(!
Version
.
equals
(
BuildConfig
.
VERSION_NAME
))
{
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
dialog
.
setMessage
(
R
.
string
.
Found_Update
);
dialog
.
setLeftButtonText
(
R
.
string
.
download_home
);
dialog
.
setLeftButtonListener
((
dlg
,
s
)
->
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
intent
.
setData
(
Uri
.
parse
(
"https://netdisk.link/YGOMobile_"
+
Version
+
".apk/links"
));
startActivity
(
intent
);
dialog
.
dismiss
();
});
dialog
.
show
();
}
else
{
Toast
.
makeText
(
getContext
(),
R
.
string
.
Already_Lastest
,
Toast
.
LENGTH_SHORT
).
show
();
}
break
;
case
TYPE_GET_VERSION_FAILED:
String
error
=
msg
.
obj
.
toString
();
Toast
.
makeText
(
getContext
(),
getString
(
R
.
string
.
Checking_Update_Failed
)
+
error
,
Toast
.
LENGTH_SHORT
).
show
();
break
;
}
}
};
@Override
protected
SharedPreferences
getSharedPreferences
()
{
return
AppsSettings
.
get
().
getSharedPreferences
();
...
...
@@ -107,7 +143,6 @@ public class SettingFragment extends PreferenceFragmentPlus {
super
.
onCreate
(
savedInstanceState
);
setHasOptionsMenu
(
false
);
mSettings
=
AppsSettings
.
get
();
mHomeFragment
=
new
HomeFragment
();
addPreferencesFromResource
(
R
.
xml
.
preference_game
);
bind
(
PREF_GAME_PATH
,
mSettings
.
getResourcePath
());
...
...
@@ -218,19 +253,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
joinQQGroup
(
groupkey
);
}
if
(
PREF_CHECK_UPDATE
.
equals
(
key
))
{
OkhttpUtil
.
get
(
URL_YGO233_DOWNLOAD_LINK
,
new
Callback
()
{
@Override
public
void
onFailure
(
Call
call
,
IOException
e
)
{
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
"error"
+
e
);
}
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
String
json
=
response
.
body
().
string
();
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
StringUtils
.
substringBetween
(
json
,
"https://netdisk.link/"
,
"/links"
));
}
});
//Beta.checkUpgrade();
checkUpgrade
();
}
if
(
PREF_DEL_EX
.
equals
(
key
))
{
File
[]
ypks
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
().
getAbsolutePath
()).
listFiles
();
...
...
@@ -565,6 +588,28 @@ public class SettingFragment extends PreferenceFragmentPlus {
});
}
public
void
checkUpgrade
(){
OkhttpUtil
.
get
(
URL_YGO233_DOWNLOAD_LINK
,
new
Callback
()
{
@Override
public
void
onFailure
(
Call
call
,
IOException
e
)
{
Message
message
=
new
Message
();
message
.
what
=
TYPE_GET_VERSION_FAILED
;
message
.
obj
=
e
;
handler
.
sendMessage
(
message
);
Log
.
i
(
BuildConfig
.
VERSION_NAME
,
"error"
+
e
);
}
@Override
public
void
onResponse
(
Call
call
,
Response
response
)
throws
IOException
{
String
json
=
response
.
body
().
string
();
Message
message
=
new
Message
();
message
.
what
=
TYPE_GET_VERSION_OK
;
message
.
obj
=
StringUtils
.
substringBetween
(
json
,
"https://netdisk.link/YGOMobile_"
,
".apk/links"
);
handler
.
sendMessage
(
message
);
}
});
}
public
boolean
joinQQGroup
(
String
key
)
{
Intent
intent
=
new
Intent
();
intent
.
setData
(
Uri
.
parse
(
"mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D"
+
key
));
...
...
mobile/src/main/res/values-ko/strings.xml
View file @
8f7e91ef
...
...
@@ -251,6 +251,7 @@
<string
name=
"OK"
>
확인
</string>
<string
name=
"Cancel"
>
취소
</string>
<string
name=
"Checking_Update"
>
업데이트를 확인하는 중입니다. 잠시 기다려 주십시오.
</string>
<string
name=
"Found_Update"
>
새 업그레이드 버전을 찾아 다운로드하시겠습니까?
</string>
<string
name=
"Checking_Update_Failed"
>
업데이트 확인 실패
</string>
<string
name=
"Ask_to_Change_Other_Way"
>
다른 방식을 시도해 봐...
</string>
<string
name=
"DuelAssistant"
>
듀얼 어시스턴트가 활성화되었습니다
</string>
...
...
mobile/src/main/res/values-zh/strings.xml
View file @
8f7e91ef
...
...
@@ -251,6 +251,7 @@
<string
name=
"OK"
>
确定
</string>
<string
name=
"Cancel"
>
取消
</string>
<string
name=
"Checking_Update"
>
检查更新中,请稍候
</string>
<string
name=
"Found_Update"
>
发现新版本,前往下载?
</string>
<string
name=
"Checking_Update_Failed"
>
检查更新失败
</string>
<string
name=
"Ask_to_Change_Other_Way"
>
主线下载失败,尝试备选线路中...
</string>
<string
name=
"DuelAssistant"
>
决斗助手启用中
</string>
...
...
mobile/src/main/res/values/strings.xml
View file @
8f7e91ef
...
...
@@ -249,6 +249,7 @@
<string
name=
"OK"
>
OK
</string>
<string
name=
"Cancel"
>
Cancel
</string>
<string
name=
"Checking_Update"
>
Now Checking Update
</string>
<string
name=
"Found_Update"
>
New upGrade is Founded, Download?
</string>
<string
name=
"Checking_Update_Failed"
>
Checking Update Failed
</string>
<string
name=
"Ask_to_Change_Other_Way"
>
trying other way...
</string>
<string
name=
"DuelAssistant"
>
DuelAssiatant is On
</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