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
75ab9224
Commit
75ab9224
authored
Dec 24, 2020
by
王文龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix]修复搜索去重,优化IM通道失败提示
parent
768ffddc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
12 deletions
+41
-12
build.gradle
app/build.gradle
+2
-2
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-2
UserBean.java
app/src/main/java/com/offcn/imclient/bean/UserBean.java
+15
-0
ContactListFragment.java
.../main/java/com/offcn/imclient/ui/ContactListFragment.java
+2
-2
MainActivity.java
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
+7
-3
UserBeanDaoManager.java
...main/java/com/offcn/imclient/util/UserBeanDaoManager.java
+13
-3
No files found.
app/build.gradle
View file @
75ab9224
...
...
@@ -12,7 +12,7 @@ android {
compileSdkVersion
29
defaultConfig
{
applicationId
"com.offcn.im
client
"
applicationId
"com.offcn.im
teacher
"
minSdkVersion
19
targetSdkVersion
29
versionCode
1
...
...
@@ -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.2
4
"
)
implementation
(
"com.offcn.live:imsdk-kit:1.0.0.2
8
"
)
// DB
implementation
'org.greenrobot:greendao:3.2.2'
...
...
app/src/main/AndroidManifest.xml
View file @
75ab9224
...
...
@@ -34,7 +34,7 @@
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:host=
"com.offcn.im
client
"
android:host=
"com.offcn.im
teacher
"
android:pathPrefix=
"/chatlist"
android:scheme=
"offcn"
/>
</intent-filter>
...
...
@@ -64,7 +64,7 @@
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:host=
"com.offcn.im
client
"
android:host=
"com.offcn.im
teacher
"
android:pathPrefix=
"/chat/"
android:scheme=
"offcn"
/>
</intent-filter>
...
...
app/src/main/java/com/offcn/imclient/bean/UserBean.java
View file @
75ab9224
...
...
@@ -5,6 +5,8 @@ import org.greenrobot.greendao.annotation.Entity;
import
org.greenrobot.greendao.annotation.Id
;
import
java.io.Serializable
;
import
java.util.Objects
;
import
org.greenrobot.greendao.annotation.Generated
;
@Entity
...
...
@@ -157,4 +159,17 @@ public class UserBean implements Serializable {
", group_name='"
+
group_name
+
'\''
+
'}'
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
UserBean
userBean
=
(
UserBean
)
o
;
return
user_id
.
equals
(
userBean
.
user_id
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
user_id
);
}
}
app/src/main/java/com/offcn/imclient/ui/ContactListFragment.java
View file @
75ab9224
...
...
@@ -126,7 +126,7 @@ public class ContactListFragment extends BaseFragment {
toId
=
stringBuilder
.
toString
();
OIMSDK
.
getInstance
().
startChat
(
getActivity
(),
OIMSendTypeEnum
.
GROUP
,
toId
,
title
,
0
);
}
else
{
CommonUtils
.
showToast
(
getActivity
(),
"
该课程下暂无学生
"
);
CommonUtils
.
showToast
(
getActivity
(),
"
暂无学员
"
);
}
}
else
{
CommonUtils
.
showToast
(
getActivity
(),
"获取课程信息失败"
);
...
...
@@ -177,7 +177,7 @@ public class ContactListFragment extends BaseFragment {
toId
=
stringBuilder
.
toString
();
OIMSDK
.
getInstance
().
startChat
(
getActivity
(),
OIMSendTypeEnum
.
GROUP
,
toId
,
title
,
0
);
}
else
{
CommonUtils
.
showToast
(
getActivity
(),
"
该课程下暂无学生
"
);
CommonUtils
.
showToast
(
getActivity
(),
"
暂无学员
"
);
}
}
}
...
...
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
View file @
75ab9224
...
...
@@ -103,13 +103,17 @@ public class MainActivity extends BaseActivity {
LoginManager
.
logout
(
MainActivity
.
this
);
UserBeanDaoManager
.
getInstance
().
deleteAll
();
if
(
code
==
OIMCode
.
Code_IM_Disconnect_Kick
)
{
if
(
code
==
OIMCode
.
Code_IM_Error_NoExist
||
code
==
OIMCode
.
Code_IM_Error_TokenInvalid
)
{
CommonUtils
.
showToast
(
MainActivity
.
this
,
"请求失败,请重新登录"
);
startActivity
(
new
Intent
(
MainActivity
.
this
,
LoginActivity
.
class
));
AppManager
.
getAppManager
().
finishAllActivity
();
}
else
if
(
code
==
OIMCode
.
Code_IM_Disconnect_Kick
)
{
Activity
curActivity
=
AppManager
.
getAppManager
().
getCurrentActivity
();
if
(
curActivity
!=
null
)
{
AlertDialog
dialog
=
new
AlertDialog
.
Builder
(
curActivity
)
.
setTitle
(
"下线通知"
)
.
setMessage
(
error
)
.
setMessage
(
"你的帐号已在另一台设备登录,如非本人操作,则密码可能已泄漏,为了你的帐号安全,建议尽快修改密码。"
)
.
setPositiveButton
(
"重新登录"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
...
...
app/src/main/java/com/offcn/imclient/util/UserBeanDaoManager.java
View file @
75ab9224
...
...
@@ -2,12 +2,14 @@ package com.offcn.imclient.util;
import
android.content.Context
;
import
com.jyall.base.util.ValidateUtils
;
import
com.offcn.imclient.bean.UserBean
;
import
com.offcn.imclient.greendao.gen.DaoSession
;
import
com.offcn.imclient.greendao.gen.UserBeanDao
;
import
org.greenrobot.greendao.query.QueryBuilder
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
UserBeanDaoManager
{
...
...
@@ -111,6 +113,7 @@ public class UserBeanDaoManager {
}
public
List
<
UserBean
>
queryByNameOrMobile
(
String
content
)
{
List
<
UserBean
>
result
=
new
ArrayList
<>();
try
{
QueryBuilder
<
UserBean
>
builder
=
manager
.
getDaoSession
().
queryBuilder
(
UserBean
.
class
);
List
<
UserBean
>
list
=
builder
.
where
(
...
...
@@ -119,12 +122,19 @@ public class UserBeanDaoManager {
UserBeanDao
.
Properties
.
Username
.
like
(
"%"
+
content
+
"%"
)
)
)
.
distinct
()
.
list
();
return
list
;
if
(!
ValidateUtils
.
isEmpty
(
list
))
{
for
(
UserBean
userBean
:
list
)
{
if
(!
result
.
contains
(
userBean
))
{
result
.
add
(
userBean
);
}
}
}
}
catch
(
Exception
e
)
{
return
null
;
}
return
result
;
}
/**
...
...
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