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
768ffddc
Commit
768ffddc
authored
Dec 24, 2020
by
王文龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix]修复各种细节问题
parent
93c9f846
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
89 additions
and
17 deletions
+89
-17
build.gradle
app/build.gradle
+1
-1
MyApp.java
app/src/main/java/com/offcn/imclient/MyApp.java
+8
-1
ContactListExpandableAdapter.java
.../offcn/imclient/adapter/ContactListExpandableAdapter.java
+0
-1
ChatActivity.java
app/src/main/java/com/offcn/imclient/ui/ChatActivity.java
+5
-0
ContactListFragment.java
.../main/java/com/offcn/imclient/ui/ContactListFragment.java
+66
-6
MainActivity.java
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
+3
-6
Constants.java
app/src/main/java/com/offcn/imclient/util/Constants.java
+3
-1
UserBeanDaoManager.java
...main/java/com/offcn/imclient/util/UserBeanDaoManager.java
+1
-0
activity_login.xml
app/src/main/res/layout/activity_login.xml
+2
-1
No files found.
app/build.gradle
View file @
768ffddc
...
...
@@ -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.
17
"
)
implementation
(
"com.offcn.live:imsdk-kit:1.0.0.
24
"
)
// DB
implementation
'org.greenrobot:greendao:3.2.2'
...
...
app/src/main/java/com/offcn/imclient/MyApp.java
View file @
768ffddc
...
...
@@ -48,10 +48,17 @@ public class MyApp extends MultiDexApplication {
EventBusUtil
.
sendEvent
(
new
EventBusCenter
(
Constants
.
EventCode
.
Code_Count_Changed
,
count
));
}
});
OIMSDK
.
getInstance
().
setOnMsgListener
(
new
OIMCallback
.
OnReceiveMsgListener
()
{
@Override
public
void
onMsg
(
OIMMsg
oimMsg
)
{
ZGLLogUtils
.
e
(
TAG
,
"onMsg 新消息"
);
EventBusUtil
.
sendEvent
(
new
EventBusCenter
(
Constants
.
EventCode
.
Code_New_Msg
));
}
});
OIMSDK
.
getInstance
().
setUserInfoProvider
(
new
OIMCallback
.
OnUserInfoProvider
()
{
@Override
public
OIMUserInfo
getUserInfo
(
String
s
)
{
if
(
ValidateUtils
.
isEmpty
(
s
))
{
if
(
ValidateUtils
.
isEmpty
(
s
))
{
return
null
;
}
// 当前登录用户
...
...
app/src/main/java/com/offcn/imclient/adapter/ContactListExpandableAdapter.java
View file @
768ffddc
...
...
@@ -72,7 +72,6 @@ public class ContactListExpandableAdapter extends AnimatedExpandableListView.Ani
holder
=
(
ChildHolder
)
convertView
.
getTag
();
}
if
(
childPosition
==
0
)
{
holder
.
title
.
setText
(
"群发消息"
);
holder
.
avatar
.
setImageResource
(
R
.
mipmap
.
ic_chat_group_mixed
);
...
...
app/src/main/java/com/offcn/imclient/ui/ChatActivity.java
View file @
768ffddc
...
...
@@ -4,9 +4,12 @@ import android.net.Uri;
import
android.text.TextUtils
;
import
com.jyall.base.base.BaseActivity
;
import
com.jyall.base.util.EventBusCenter
;
import
com.jyall.base.util.EventBusUtil
;
import
com.jyall.titleview.TitleView
;
import
com.jyall.titleview.TitleViewCompatible
;
import
com.offcn.imclient.R
;
import
com.offcn.imclient.util.Constants
;
import
com.offcn.live.imkit.ui.ChatFragment
;
/**
...
...
@@ -55,6 +58,8 @@ public class ChatActivity extends BaseActivity {
if
(
mChatFragment
!=
null
&&
mChatFragment
.
hookOnBackPressed
())
{
return
;
}
// EventBusUtil.sendEvent(new EventBusCenter(Constants.EventCode.Code_Refresh_Contact));
super
.
onBackPressed
();
}
}
app/src/main/java/com/offcn/imclient/ui/ContactListFragment.java
View file @
768ffddc
...
...
@@ -2,6 +2,7 @@ package com.offcn.imclient.ui;
import
android.content.Intent
;
import
android.view.View
;
import
android.widget.AbsListView
;
import
android.widget.ExpandableListView
;
import
android.widget.RelativeLayout
;
...
...
@@ -13,12 +14,14 @@ import com.android.volley.toolbox.JsonObjectRequest;
import
com.android.volley.toolbox.Volley
;
import
com.jyall.base.base.BaseFragment
;
import
com.jyall.base.util.CommonUtils
;
import
com.jyall.base.util.EventBusCenter
;
import
com.jyall.base.util.ValidateUtils
;
import
com.offcn.imclient.R
;
import
com.offcn.imclient.adapter.ContactListExpandableAdapter
;
import
com.offcn.imclient.bean.ServerContactBean
;
import
com.offcn.imclient.bean.ServerContactBeanWrapper
;
import
com.offcn.imclient.bean.UserBean
;
import
com.offcn.imclient.util.Constants
;
import
com.offcn.imclient.util.LoginManager
;
import
com.offcn.imclient.util.UserBeanDaoManager
;
import
com.offcn.imclient.util.Utils
;
...
...
@@ -28,11 +31,14 @@ import com.offcn.live.im.bean.OIMSendTypeEnum;
import
com.offcn.live.im.util.ZGLLogUtils
;
import
com.offcn.live.im.util.ZGLParseUtils
;
import
org.greenrobot.eventbus.Subscribe
;
import
org.greenrobot.eventbus.ThreadMode
;
import
org.json.JSONObject
;
import
java.sql.SQLInvalidAuthorizationSpecException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Handler
;
import
androidx.swiperefreshlayout.widget.SwipeRefreshLayout
;
...
...
@@ -59,6 +65,11 @@ public class ContactListFragment extends BaseFragment {
}
@Override
protected
boolean
isRegisterEventBus
()
{
return
true
;
}
@Override
protected
void
init
(
View
view
)
{
mContainerContact
=
view
.
findViewById
(
R
.
id
.
container_list
);
mRecyclerView
=
view
.
findViewById
(
R
.
id
.
recycler_view
);
...
...
@@ -71,8 +82,25 @@ public class ContactListFragment extends BaseFragment {
getContactList
();
}
});
mAdapter
=
new
ContactListExpandableAdapter
(
getContext
(),
friends
);
mRecyclerView
.
setAdapter
(
mAdapter
);
mRecyclerView
.
setOnScrollListener
(
new
AbsListView
.
OnScrollListener
()
{
@Override
public
void
onScrollStateChanged
(
AbsListView
view
,
int
scrollState
)
{
}
@Override
public
void
onScroll
(
AbsListView
view
,
int
firstVisibleItem
,
int
visibleItemCount
,
int
totalItemCount
)
{
View
firstView
=
view
.
getChildAt
(
firstVisibleItem
);
if
(
firstVisibleItem
==
0
&&
(
firstView
==
null
||
firstView
.
getTop
()
==
0
))
{
mSwipeRefreshLayout
.
setEnabled
(
true
);
}
else
{
mSwipeRefreshLayout
.
setEnabled
(
false
);
}
}
});
mRecyclerView
.
setOnChildClickListener
(
new
ExpandableListView
.
OnChildClickListener
()
{
@Override
public
boolean
onChildClick
(
ExpandableListView
parent
,
View
v
,
int
groupPosition
,
int
childPosition
,
long
id
)
{
...
...
@@ -88,9 +116,11 @@ public class ContactListFragment extends BaseFragment {
if
(!
ValidateUtils
.
isEmpty
(
tmpList
))
{
for
(
int
i
=
0
;
i
<
tmpList
.
size
();
i
++)
{
UserBean
tmp
=
tmpList
.
get
(
i
);
stringBuilder
.
append
(
tmp
.
getUser_id
());
if
(
i
!=
tmpList
.
size
()
-
1
)
{
stringBuilder
.
append
(
","
);
if
(
tmp
!=
null
&&
!
ValidateUtils
.
isEmpty
(
tmp
.
getUser_id
()))
{
stringBuilder
.
append
(
tmp
.
getUser_id
());
if
(
i
!=
tmpList
.
size
()
-
1
)
{
stringBuilder
.
append
(
","
);
}
}
}
toId
=
stringBuilder
.
toString
();
...
...
@@ -137,9 +167,11 @@ public class ContactListFragment extends BaseFragment {
if
(!
ValidateUtils
.
isEmpty
(
tmpList
))
{
for
(
int
i
=
0
;
i
<
tmpList
.
size
();
i
++)
{
UserBean
tmp
=
tmpList
.
get
(
i
);
stringBuilder
.
append
(
tmp
.
getUser_id
());
if
(
i
!=
tmpList
.
size
()
-
1
)
{
stringBuilder
.
append
(
","
);
if
(
tmp
!=
null
&&
!
ValidateUtils
.
isEmpty
(
tmp
.
getUser_id
()))
{
stringBuilder
.
append
(
tmp
.
getUser_id
());
if
(
i
!=
tmpList
.
size
()
-
1
)
{
stringBuilder
.
append
(
","
);
}
}
}
toId
=
stringBuilder
.
toString
();
...
...
@@ -185,6 +217,34 @@ public class ContactListFragment extends BaseFragment {
});
}
@Override
public
void
onResume
()
{
super
.
onResume
();
if
(!
ValidateUtils
.
isEmpty
(
friends
))
{
for
(
int
i
=
0
;
i
<
friends
.
size
();
i
++)
{
if
(
mRecyclerView
.
isGroupExpanded
(
i
))
{
mRecyclerView
.
collapseGroup
(
i
);
int
finalI
=
i
;
mRecyclerView
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
mRecyclerView
.
expandGroup
(
finalI
);
}
},
100
);
}
}
}
}
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
public
void
onEventBus
(
EventBusCenter
eventBusCenter
)
{
// int eventCode = eventBusCenter.getEvenCode();
// if (eventCode == Constants.EventCode.Code_Refresh_Contact) {
//
// }
}
private
void
getContactList
()
{
if
(!
CommonUtils
.
isNetConnected
(
getActivity
()))
{
showNoNetView
();
...
...
app/src/main/java/com/offcn/imclient/ui/MainActivity.java
View file @
768ffddc
...
...
@@ -280,13 +280,10 @@ public class MainActivity extends BaseActivity {
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
public
void
onEventBus
(
EventBusCenter
eventBusCenter
)
{
int
eventCode
=
eventBusCenter
.
getEvenCode
();
if
(
eventCode
==
Constants
.
EventCode
.
Code_
Count_Changed
)
{
if
(
eventCode
==
Constants
.
EventCode
.
Code_
New_Msg
)
{
try
{
int
count
=
(
int
)
eventBusCenter
.
getData
();
if
(
count
>
0
)
{
if
(
mViewPager
.
getCurrentItem
()
!=
0
)
{
showDot
(
true
);
}
if
(
mViewPager
.
getCurrentItem
()
!=
0
)
{
showDot
(
true
);
}
}
catch
(
Exception
e
)
{
...
...
app/src/main/java/com/offcn/imclient/util/Constants.java
View file @
768ffddc
...
...
@@ -2,8 +2,10 @@ package com.offcn.imclient.util;
public
class
Constants
{
public
static
class
EventCode
{
public
static
class
EventCode
{
public
static
final
int
Code_Count_Changed
=
1
;
public
static
final
int
Code_New_Msg
=
2
;
public
static
final
int
Code_Refresh_Contact
=
3
;
}
}
app/src/main/java/com/offcn/imclient/util/UserBeanDaoManager.java
View file @
768ffddc
...
...
@@ -119,6 +119,7 @@ public class UserBeanDaoManager {
UserBeanDao
.
Properties
.
Username
.
like
(
"%"
+
content
+
"%"
)
)
)
.
distinct
()
.
list
();
return
list
;
}
catch
(
Exception
e
)
{
...
...
app/src/main/res/layout/activity_login.xml
View file @
768ffddc
...
...
@@ -103,7 +103,7 @@
android:text=
"测试一键登录(lqy62094)"
android:textColor=
"@android:color/white"
android:textSize=
"16sp"
android:visibility=
"
visibl
e"
/>
android:visibility=
"
gon
e"
/>
</LinearLayout>
\ No newline at end of file
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