Commit 768ffddc by 王文龙

[fix]修复各种细节问题

parent 93c9f846
......@@ -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'
......
......@@ -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;
}
// 当前登录用户
......
......@@ -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);
......
......@@ -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();
}
}
......@@ -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();
......
......@@ -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) {
......
......@@ -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;
}
}
......@@ -119,6 +119,7 @@ public class UserBeanDaoManager {
UserBeanDao.Properties.Username.like("%" + content + "%")
)
)
.distinct()
.list();
return list;
} catch (Exception e) {
......
......@@ -103,7 +103,7 @@
android:text="测试一键登录(lqy62094)"
android:textColor="@android:color/white"
android:textSize="16sp"
android:visibility="visible" />
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment