Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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-Cn-Ko-En
Commits
a0bdc2c7
Commit
a0bdc2c7
authored
Jul 02, 2019
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入空逻辑判断
parent
e2efd3c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/management/ServiceManagement.java
...mobile/ui/mycard/mcchat/management/ServiceManagement.java
+15
-9
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/util/TaxiConnectionListener.java
...omobile/ui/mycard/mcchat/util/TaxiConnectionListener.java
+4
-4
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/management/ServiceManagement.java
View file @
a0bdc2c7
...
...
@@ -30,6 +30,10 @@ import cn.garymb.ygomobile.utils.FileLogUtil;
public
class
ServiceManagement
{
public
static
final
String
GROUP_ADDRESS
=
"ygopro_china_north@conference.mycard.moe"
;
public
static
final
int
TYPE_ADD_MESSAGE
=
0
;
public
static
final
int
TYPE_RE_LOGIN
=
1
;
public
static
final
int
TYPE_RE_JOIN
=
2
;
private
static
ServiceManagement
su
=
new
ServiceManagement
();
private
XMPPTCPConnection
con
;
private
MultiUserChat
muc
;
...
...
@@ -45,7 +49,7 @@ public class ServiceManagement {
// TODO: Implement this method
super
.
handleMessage
(
msg
);
switch
(
msg
.
what
)
{
case
0
:
case
TYPE_ADD_MESSAGE
:
for
(
ChatListener
c
:
chatListenerList
)
{
if
(
c
!=
null
)
{
c
.
addMessage
((
Message
)
msg
.
obj
);
...
...
@@ -54,7 +58,7 @@ public class ServiceManagement {
}
}
break
;
case
1
:
case
TYPE_RE_LOGIN
:
for
(
ChatListener
c
:
chatListenerList
)
{
if
(
c
!=
null
)
{
c
.
reLogin
((
boolean
)
msg
.
obj
);
...
...
@@ -63,7 +67,7 @@ public class ServiceManagement {
}
}
break
;
case
2
:
case
TYPE_RE_JOIN
:
for
(
ChatListener
c
:
chatListenerList
)
{
if
(
c
!=
null
)
{
c
.
reJoin
((
boolean
)
msg
.
obj
);
...
...
@@ -164,7 +168,7 @@ public class ServiceManagement {
ChatMessage
cm
=
ChatMessage
.
toChatMessage
(
message
);
if
(
cm
!=
null
)
{
chatMessageList
.
add
(
cm
);
han
.
sendEmptyMessage
(
0
);
han
.
sendEmptyMessage
(
TYPE_ADD_MESSAGE
);
}
}
});
...
...
@@ -172,22 +176,24 @@ public class ServiceManagement {
}
}
public
void
set
r
eLogin
(
boolean
state
)
{
public
void
set
R
eLogin
(
boolean
state
)
{
android
.
os
.
Message
me
=
new
android
.
os
.
Message
();
me
.
what
=
1
;
me
.
what
=
TYPE_RE_LOGIN
;
me
.
obj
=
state
;
han
.
sendMessage
(
me
);
}
public
void
set
r
eJoin
(
boolean
state
)
{
public
void
set
R
eJoin
(
boolean
state
)
{
android
.
os
.
Message
me
=
new
android
.
os
.
Message
();
me
.
what
=
2
;
me
.
what
=
TYPE_RE_JOIN
;
me
.
obj
=
state
;
han
.
sendMessage
(
me
);
}
public
void
disSerVice
()
{
con
.
disconnect
();
if
(
con
!=
null
)
{
con
.
disconnect
();
}
setIsConnected
(
false
);
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/mycard/mcchat/util/TaxiConnectionListener.java
View file @
a0bdc2c7
...
...
@@ -64,12 +64,12 @@ public class TaxiConnectionListener implements ConnectionListener {
username
=
UserManagement
.
getUserName
();
password
=
UserManagement
.
getUserPassword
();
if
(
username
!=
null
&&
password
!=
null
)
{
sm
.
set
r
eLogin
(
false
);
sm
.
set
R
eLogin
(
false
);
Log
.
e
(
"TaxiConnectionListener"
,
"尝试登录"
);
// 连接服务器
try
{
if
(
sm
.
login
(
username
,
password
))
{
sm
.
set
r
eLogin
(
true
);
sm
.
set
R
eLogin
(
true
);
Log
.
e
(
"TaxiConnectionListener"
,
"登录成功"
);
tExit
.
schedule
(
new
timeJoin
(),
logintime
);
}
else
{
...
...
@@ -86,11 +86,11 @@ public class TaxiConnectionListener implements ConnectionListener {
class
timeJoin
extends
TimerTask
{
@Override
public
void
run
()
{
sm
.
set
r
eJoin
(
false
);
sm
.
set
R
eJoin
(
false
);
Log
.
e
(
"TaxiConnectionListener"
,
"尝试加入房间"
);
try
{
sm
.
joinChat
();
sm
.
set
r
eJoin
(
true
);
sm
.
set
R
eJoin
(
true
);
Log
.
e
(
"TaxiConnectionListener"
,
"加入房间成功"
);
}
catch
(
Exception
e
)
{
Log
.
e
(
"TaxiConnectionListener"
,
"重新加入房间"
);
...
...
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