Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
30b4d247
authored
Jun 08, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、优化代码结构及注释
2、优化后台切换支付提示语后的响应
parent
e251b4e5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.java
+7
-2
No files found.
app/src/main/java/com/bgycc/smartcanteen/activity/MainActivity.java
View file @
30b4d247
...
...
@@ -89,6 +89,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
private
TextView
message
;
private
AudioManager
audioManager
;
private
Gson
gson
;
private
String
idle_notice
;
private
WorkManager
workManager
;
private
Handler
handler
=
new
Handler
();
...
...
@@ -107,9 +108,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
}
String
host
=
SmartCanteenUtils
.
getMainWebSocketServerUrl
(
deviceSN
,
BuildConfig
.
VERSION_NAME
);
LogUtils
.
d
(
TAG
,
"服务器地址: "
+
host
);
gson
=
Injection
.
provideGson
();
try
{
URI
uri
=
new
URI
(
host
);
SCWebSocketClient
.
init
(
uri
,
deviceSN
,
Injection
.
provideGson
()
);
SCWebSocketClient
.
init
(
uri
,
deviceSN
,
gson
);
}
catch
(
URISyntaxException
e
)
{
LogUtils
.
e
(
TAG
,
"服务器地址异常: "
+
e
.
getMessage
(),
e
);
}
...
...
@@ -247,11 +249,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
commandViewModel
.
commandFinish
(
command
);
return
;
}
// 修改主界面的提示语
if
(
CommandHelper
.
changedPaymentNotice
(
command
))
{
Gson
gson
=
Injection
.
provideGson
();
try
{
CommandNotice
commandNotice
=
gson
.
fromJson
(
command
.
getData
(),
CommandNotice
.
class
);
idle_notice
=
commandNotice
.
getData
().
getNotice
();
message
.
setText
(
idle_notice
);
}
finally
{
commandViewModel
.
commandFinish
(
command
);
}
...
...
@@ -343,10 +346,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
SCWebSocketClient
.
getInstance
().
tryConnect
();
}
// 检查debug layout是否已初始化
private
boolean
debugLayoutIsNotInflate
()
{
return
debugVs
!=
null
;
}
// 主界面显示模式切换: Debug <==> Release
private
void
toggleDebugLayout
()
{
if
(
debugLayoutIsNotInflate
())
{
inflateDebugLayout
();
...
...
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