Commit 93c9f846 by 王文龙

[fix]修复各种细节问题

parent 036e248b
......@@ -57,7 +57,7 @@ android {
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "imclient_v${defaultConfig.versionName}_${releaseTimeFull()}_${buildType.name}.apk";
outputFileName = "imteacher_v${defaultConfig.versionName}_${releaseTimeFull()}_${buildType.name}.apk";
}
}
}
......@@ -71,7 +71,7 @@ android {
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "imclient_v${defaultConfig.versionName}_${releaseTimeFull()}_${buildType.name}.apk";
outputFileName = "imteacher_v${defaultConfig.versionName}_${releaseTimeFull()}_${buildType.name}.apk";
}
}
}
......@@ -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.14")
implementation("com.offcn.live:imsdk-kit:1.0.0.17")
// DB
implementation 'org.greenrobot:greendao:3.2.2'
......
......@@ -34,6 +34,8 @@ import java.sql.SQLInvalidAuthorizationSpecException;
import java.util.ArrayList;
import java.util.List;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
/**
* 通讯录页
*
......@@ -46,6 +48,7 @@ public class ContactListFragment extends BaseFragment {
private RelativeLayout mContainerContact;
private AnimatedExpandableListView mRecyclerView;
private RelativeLayout mSearch;
private SwipeRefreshLayout mSwipeRefreshLayout;
private List<ServerContactBean> friends = new ArrayList<>();
private ContactListExpandableAdapter mAdapter;
......@@ -59,7 +62,15 @@ public class ContactListFragment extends BaseFragment {
protected void init(View view) {
mContainerContact = view.findViewById(R.id.container_list);
mRecyclerView = view.findViewById(R.id.recycler_view);
mSwipeRefreshLayout = view.findViewById(R.id.refresh_layout);
mSearch = view.findViewById(R.id.search);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
getContactList();
}
});
mAdapter = new ContactListExpandableAdapter(getContext(), friends);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
......@@ -150,7 +161,6 @@ public class ContactListFragment extends BaseFragment {
});
getContactList();
}
@Override
......@@ -181,7 +191,7 @@ public class ContactListFragment extends BaseFragment {
return;
}
showLoading();
// showLoading();
try {
JSONObject jsonObject = new JSONObject();
......@@ -195,19 +205,22 @@ public class ContactListFragment extends BaseFragment {
public void onResponse(JSONObject response) {
ZGLLogUtils.e(TAG, "contact success " + response.toString());
dismissLoading();
if (mSwipeRefreshLayout != null) {
mSwipeRefreshLayout.setRefreshing(false);
}
UserBeanDaoManager.getInstance().deleteAll();
try {
int rtnCode = response.getInt("code");
if (rtnCode == 0) {
ServerContactBeanWrapper beanWrapper = ZGLParseUtils.parseObjectByGson(response.getJSONObject("data").toString(), ServerContactBeanWrapper.class);
if (beanWrapper != null && !ValidateUtils.isEmpty(beanWrapper.user_list)) {
if (beanWrapper != null) {
friends = beanWrapper.user_list;
exeContactList();
} else {
// 数据为空
showEmptyView();
friends.clear();
}
exeContactList();
} else if (rtnCode == 1 || rtnCode == 2) {
// {"code":1,"msg":"登陆过期,请重新登陆","params":{"im_token":"0XR5YOS6dg7x2lirfeX3CbjRLqPWmesaFbdsr\/M4IRZS4mYYyZILI82FT8dgqybCA4W+MxfjJDY=@ip6c.cn.rongnav.com;ip6c.cn.rongcfg.com"}}
Utils.logout(getActivity());
......@@ -228,6 +241,9 @@ public class ContactListFragment extends BaseFragment {
public void onErrorResponse(VolleyError error) {
ZGLLogUtils.e(TAG, "contact error " + error.toString());
dismissLoading();
if (mSwipeRefreshLayout != null) {
mSwipeRefreshLayout.setRefreshing(false);
}
CommonUtils.showToast(getActivity(), error.toString());
}
}
......@@ -250,6 +266,7 @@ public class ContactListFragment extends BaseFragment {
userBeanList.addAll(contactBean.getList());
}
UserBeanDaoManager.getInstance().insertMulti(userBeanList);
OIMSDK.getInstance().refreshUserData();
} else {
showEmptyView();
UserBeanDaoManager.getInstance().deleteAll();
......
......@@ -55,6 +55,7 @@ public class LoginActivity extends BaseActivity {
mIvEye = findViewById(R.id.iv_eye);
mIvClear.setOnClickListener(v -> mEtName.setText(""));
mEtName.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
mIvEye.setOnClickListener(v -> {
if (isShowPassWord) {
mIvEye.setImageDrawable(getResources().getDrawable(R.mipmap.ic_et_eye_on));
......@@ -97,7 +98,7 @@ public class LoginActivity extends BaseActivity {
return;
}
if (ValidateUtils.isEmpty(name) || ValidateUtils.isEmpty(pwd)) {
CommonUtils.showToast(this, "请输入用户名或密码");
CommonUtils.showToast(this, "请输入工号或密码");
return;
}
......
......@@ -10,6 +10,7 @@ import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.google.android.material.tabs.TabLayout;
......@@ -17,18 +18,26 @@ 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.jyall.base.util.EventBusCenter;
import com.offcn.imclient.R;
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.live.im.OIMCallback;
import com.offcn.live.im.OIMSDK;
import com.offcn.live.im.bean.OIMCode;
import com.offcn.live.im.bean.OIMMsg;
import com.offcn.live.im.util.ZGLCommonUtils;
import com.offcn.live.im.util.ZGLLogUtils;
import com.offcn.live.imkit.ui.ChatListFragment;
import com.offcn.live.imkit.util.KitConstants;
import com.offcn.live.imkit.view.ScrollEnabledViewPager;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.List;
......@@ -43,6 +52,7 @@ public class MainActivity extends BaseActivity {
TabLayout mTabLayout;
ScrollEnabledViewPager mViewPager;
TextView mRedDot;
String[] titles = new String[]{"聊天", "通讯录", "我的"};
......@@ -54,8 +64,12 @@ public class MainActivity extends BaseActivity {
}
@Override
protected void initViewsAndEvents() {
public boolean isRegisterEventBus() {
return true;
}
@Override
protected void initViewsAndEvents() {
mTabLayout = findViewById(R.id.tab_layout);
mViewPager = findViewById(R.id.view_pager);
......@@ -84,34 +98,36 @@ public class MainActivity extends BaseActivity {
|| code == OIMCode.Code_IM_Disconnect_Kick
|| code == OIMCode.Code_IM_Error_NoExist) {
// 此处注释。内部已调用 destroy() 方法。
// OIMSDK.getInstance(DemoMainActivity.this).destroy();
// 注销登录信息
// CommonUtils.showToast(MainActivity.this, "通道连接异常:" + OIMCode.getCodeDesc(MainActivity.this, code));
LoginManager.logout(MainActivity.this);
UserBeanDaoManager.getInstance().deleteAll();
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();
if (code == OIMCode.Code_IM_Disconnect_Kick) {
Activity curActivity = AppManager.getAppManager().getCurrentActivity();
if (curActivity != null) {
AlertDialog dialog = new AlertDialog.Builder(curActivity)
.setTitle("下线通知")
.setMessage(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();
}
}
}
}
......@@ -147,6 +163,9 @@ public class MainActivity extends BaseActivity {
public void onTabSelected(TabLayout.Tab tab) {
mViewPager.setCurrentItem(tab.getPosition(), false);
changeTabSelect(tab); //Tab获取焦点
if (tab.getPosition() == 0) {
showDot(false);
}
}
@Override
......@@ -191,6 +210,9 @@ public class MainActivity extends BaseActivity {
if (index == 0) {
iv.setImageResource(R.mipmap.ic_chat_tab_on);
title.setTextColor(getResources().getColor(R.color.colorPrimary));
mRedDot = view.findViewById(R.id.dot);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mRedDot.getLayoutParams();
layoutParams.rightMargin = CommonUtils.getScreenWidth(this) / 6 - CommonUtils.dp2px(this, 25);
} else if (index == 1) {
iv.setImageResource(R.mipmap.ic_contact_tab_off);
title.setTextColor(getResources().getColor(R.color.color_333333));
......@@ -255,4 +277,26 @@ 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) {
try {
int count = (int) eventBusCenter.getData();
if (count > 0) {
if (mViewPager.getCurrentItem() != 0) {
showDot(true);
}
}
} catch (Exception e) {
}
}
}
private void showDot(boolean show) {
mRedDot.setVisibility(show ? View.VISIBLE : View.GONE);
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:width="10dp"
android:height="10dp" />
<solid android:color="@android:color/holo_red_light" />
</shape>
\ No newline at end of file
......@@ -3,16 +3,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:paddingTop="@dimen/toolbar_padding_top"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
android:orientation="vertical"
android:paddingTop="@dimen/toolbar_padding_top">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp"
android:drawableTop="@mipmap/ic_logo"
android:drawablePadding="20dp"
android:text="在线课堂教师版"
......@@ -23,16 +23,16 @@
<RelativeLayout
android:id="@+id/rl_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="40dp">
<EditText
android:id="@+id/et_name"
style="@style/loginEditText"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/iv_delete"
android:hint="请输入工号"
android:inputType="textPassword"
android:maxLength="11" />
android:inputType="textPassword" />
<ImageView
android:id="@+id/iv_delete"
......@@ -42,18 +42,25 @@
android:layout_centerVertical="true"
android:padding="5dp"
android:src="@mipmap/ic_et_clear" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="@drawable/login_edit_line" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
android:layout_height="40dp"
android:layout_marginTop="10dp">
<EditText
android:id="@+id/et_pwd"
style="@style/loginEditText"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/iv_eye"
android:hint="请输入密码"
android:inputType="textPassword" />
......@@ -65,6 +72,13 @@
android:layout_centerVertical="true"
android:padding="5dp"
android:src="@mipmap/ic_et_eye_off" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="@drawable/login_edit_line" />
</RelativeLayout>
......@@ -88,7 +102,8 @@
android:gravity="center"
android:text="测试一键登录(lqy62094)"
android:textColor="@android:color/white"
android:textSize="16sp" />
android:textSize="16sp"
android:visibility="visible" />
</LinearLayout>
\ No newline at end of file
......@@ -29,20 +29,27 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/container_list"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="15dp">
android:layout_height="match_parent">
<com.offcn.imclient.view.AnimatedExpandableListView
android:id="@+id/recycler_view"
android:divider="@null"
android:childDivider="@null"
<RelativeLayout
android:id="@+id/container_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="@null" />
android:layout_marginTop="15dp">
</RelativeLayout>
<com.offcn.imclient.view.AnimatedExpandableListView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:childDivider="@null"
android:divider="@null"
android:groupIndicator="@null" />
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
......@@ -9,8 +9,7 @@
android:id="@+id/iv_avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerCrop"
android:src="@mipmap/ic_teacher" />
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tv_name"
......
......@@ -4,28 +4,45 @@
android:layout_width="match_parent"
android:layout_height="50dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_pic"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerCrop"
tools:src="@mipmap/ic_me_on" />
<RelativeLayout
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_title"
android:textSize="12sp"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
tools:text="我的" />
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_pic"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerCrop"
tools:src="@mipmap/ic_chat_tab_off" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:textSize="12sp"
tools:text="我的" />
</LinearLayout>
<TextView
android:id="@+id/dot"
android:layout_width="8dp"
android:layout_height="8dp"
android:layout_alignParentRight="true"
android:layout_marginTop="10dp"
android:background="@drawable/bg_dot"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -35,8 +35,6 @@
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">15sp</item>
<item name="android:background">@null</item>
<item name="android:drawablePadding">10dp</item>
<item name="android:drawableBottom">@drawable/login_edit_line</item>
<item name="android:textColorHint">#888888</item>
</style>
</resources>
\ 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