Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
IMSDK_Demo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王文龙
IMSDK_Demo
Commits
036e248b
Commit
036e248b
authored
Dec 22, 2020
by
王文龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update]优化账号被踢弹窗逻辑
parent
565646d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
17 deletions
+28
-17
build.gradle
app/build.gradle
+1
-1
MainActivity.java
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
+27
-16
No files found.
app/build.gradle
View file @
036e248b
...
...
@@ -94,7 +94,7 @@ dependencies {
implementation
'com.android.support:multidex:1.0.3'
implementation
(
"com.offcn.live:titleview:1.1.0-s1"
)
implementation
(
"com.offcn.live:imsdk-kit:1.0.0.1
3
"
)
implementation
(
"com.offcn.live:imsdk-kit:1.0.0.1
4
"
)
// DB
implementation
'org.greenrobot:greendao:3.2.2'
...
...
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
View file @
036e248b
...
...
@@ -2,6 +2,7 @@ package com.offcn.imclient.ui;
import
android.animation.ObjectAnimator
;
import
android.animation.ValueAnimator
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
...
...
@@ -14,6 +15,7 @@ import android.widget.TextView;
import
com.google.android.material.tabs.TabLayout
;
import
com.jyall.base.adapter.BaseVPAdapter
;
import
com.jyall.base.base.BaseActivity
;
import
com.jyall.base.util.AppManager
;
import
com.jyall.base.util.CommonUtils
;
import
com.offcn.imclient.R
;
import
com.offcn.imclient.bean.UserBean
;
...
...
@@ -74,7 +76,7 @@ public class MainActivity extends BaseActivity {
@Override
public
void
onStateDisconnected
(
int
code
,
String
error
)
{
ZGLLogUtils
.
e
(
TAG
,
"IM连接失败 "
+
code
+
" "
+
error
);
ZGLCommonUtils
.
showToast
(
MainActivity
.
this
,
"IM连接失败 "
+
code
+
" "
+
error
);
//
ZGLCommonUtils.showToast(MainActivity.this, "IM连接失败 " + code + " " + error);
// 连接失败超时,和部分情况作特殊处理如退出页面:token失效、被踢
if
(
code
==
OIMCode
.
Code_IM_Connect_Fail
||
code
==
OIMCode
.
Code_IM_Connect_Timeout
...
...
@@ -88,20 +90,29 @@ public class MainActivity extends BaseActivity {
LoginManager
.
logout
(
MainActivity
.
this
);
UserBeanDaoManager
.
getInstance
().
deleteAll
();
AlertDialog
dialog
=
new
AlertDialog
.
Builder
(
MainActivity
.
this
)
.
setTitle
(
"IM连接失败"
)
.
setMessage
(
code
+
","
+
error
)
.
setPositiveButton
(
"退出"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
startActivity
(
new
Intent
(
MainActivity
.
this
,
LoginActivity
.
class
));
finish
();
}
})
.
setCancelable
(
false
)
.
create
();
dialog
.
setCanceledOnTouchOutside
(
false
);
dialog
.
show
();
Activity
curActivity
=
AppManager
.
getAppManager
().
getCurrentActivity
();
if
(
curActivity
!=
null
)
{
AlertDialog
dialog
=
new
AlertDialog
.
Builder
(
curActivity
)
.
setTitle
(
"IM连接失败"
)
.
setMessage
(
code
+
","
+
error
)
.
setPositiveButton
(
"重新登录"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
startActivity
(
new
Intent
(
curActivity
,
LoginActivity
.
class
));
AppManager
.
getAppManager
().
finishAllActivity
();
}
})
.
setNegativeButton
(
"我知道了"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
AppManager
.
getAppManager
().
AppExit
(
curActivity
);
}
})
.
setCancelable
(
false
)
.
create
();
dialog
.
setCanceledOnTouchOutside
(
false
);
dialog
.
show
();
}
}
}
...
...
@@ -134,7 +145,7 @@ public class MainActivity extends BaseActivity {
@Override
public
void
onTabSelected
(
TabLayout
.
Tab
tab
)
{
mViewPager
.
setCurrentItem
(
tab
.
getPosition
());
mViewPager
.
setCurrentItem
(
tab
.
getPosition
()
,
false
);
changeTabSelect
(
tab
);
//Tab获取焦点
}
...
...
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