Commit 8c95cdc8 by konghaorui

Merge branch 'feature/v3' of…

Merge branch 'feature/v3' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into feature/v3
parents c798c1f7 42e6db02
...@@ -8,6 +8,7 @@ import android.os.Build; ...@@ -8,6 +8,7 @@ import android.os.Build;
import android.os.Process; import android.os.Process;
import android.support.annotation.RequiresApi; import android.support.annotation.RequiresApi;
import com.facebook.stetho.Stetho;
import com.meituan.android.walle.WalleChannelReader; import com.meituan.android.walle.WalleChannelReader;
import com.netease.nimlib.sdk.util.NIMUtil; import com.netease.nimlib.sdk.util.NIMUtil;
import com.tencent.bugly.crashreport.CrashReport; import com.tencent.bugly.crashreport.CrashReport;
...@@ -60,6 +61,8 @@ public class DemoAppLifecycles implements IAppLifecycles { ...@@ -60,6 +61,8 @@ public class DemoAppLifecycles implements IAppLifecycles {
Intent intent = new Intent(application, PlayService.class); Intent intent = new Intent(application, PlayService.class);
application.startService(intent); application.startService(intent);
application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle()); application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
Stetho.initializeWithDefaults(application);
} }
} }
......
...@@ -20,7 +20,7 @@ import java.util.List; ...@@ -20,7 +20,7 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
public static String appEnv = YDLConstants.ENV_PROD; public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_TEST; // public static String appEnv = YDLConstants.ENV_TEST;
@Override @Override
......
...@@ -3,6 +3,7 @@ package com.ydl.component.service.web; ...@@ -3,6 +3,7 @@ package com.ydl.component.service.web;
import android.app.Activity; import android.app.Activity;
import com.ydl.webview.H5JsBean; import com.ydl.webview.H5JsBean;
import com.ydl.webview.NewH5Activity;
/** /**
* webview 点击事件监听 抽象类 * webview 点击事件监听 抽象类
...@@ -395,4 +396,19 @@ public class WVClickAbstractListener implements WebViewClientClickListener { ...@@ -395,4 +396,19 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
public void goHome(H5JsBean.H5JsCmd.Params params) { public void goHome(H5JsBean.H5JsCmd.Params params) {
} }
@Override
public void sendUnReadNum(String callbackFuncName, String uid) {
final StringBuffer sb = new StringBuffer();
sb.append(callbackFuncName);
sb.append("('");
sb.append("333");
sb.append("')");
if (mContext instanceof NewH5Activity) {
((NewH5Activity) mContext).callJSFunc(sb.toString());
}
}
} }
...@@ -364,6 +364,9 @@ class WebJavascriptHandler : IJavascriptHandler{ ...@@ -364,6 +364,9 @@ class WebJavascriptHandler : IJavascriptHandler{
"goHome" -> { "goHome" -> {
wvEnventPro?.goHome(jsData.cmd?.params) wvEnventPro?.goHome(jsData.cmd?.params)
} }
"chatUnread" -> {
wvEnventPro?.sendUnReadNum(jsData.cmd!!.callBack, jsData.cmd!!.params?.uid.toString())
}
} }
} }
} }
...@@ -173,4 +173,6 @@ public interface WebViewClientClickListener { ...@@ -173,4 +173,6 @@ public interface WebViewClientClickListener {
void goHome(H5JsBean.H5JsCmd.Params params); void goHome(H5JsBean.H5JsCmd.Params params);
//保存图片 //保存图片
// void storePic(); // void storePic();
void sendUnReadNum(String callbackFuncName, String uid);
} }
...@@ -5,8 +5,8 @@ ext { ...@@ -5,8 +5,8 @@ ext {
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
applicationId: "com.cxzapp.yidianling", applicationId: "com.cxzapp.yidianling",
versionName : "4.0.00", versionName : "4.0.31",
versionCode : 4000, versionCode : 4031,
] ]
xlzx_app = [ xlzx_app = [
...@@ -47,7 +47,7 @@ ext { ...@@ -47,7 +47,7 @@ ext {
"m-consultant" : "0.0.51.3", "m-consultant" : "0.0.51.3",
"m-fm" : "0.0.23.3", "m-fm" : "0.0.23.3",
"m-user" : "0.0.40.3", "m-user" : "0.0.40.3",
"m-home" : "0.0.6.18", "m-home" : "0.0.6.19",
"m-muse" : "0.0.20.3", "m-muse" : "0.0.20.3",
"m-tests" : "0.0.15.2", "m-tests" : "0.0.15.2",
...@@ -66,7 +66,7 @@ ext { ...@@ -66,7 +66,7 @@ ext {
"m-tests-api" : "0.0.1", "m-tests-api" : "0.0.1",
"m-user-api" : "0.0.9", "m-user-api" : "0.0.9",
"m-home-api" : "0.0.3", "m-home-api" : "0.0.3",
"m-im-api" : "0.0.3", "m-im-api" : "0.0.4",
"m-dynamic-api" : "0.0.1", "m-dynamic-api" : "0.0.1",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
...@@ -74,7 +74,7 @@ ext { ...@@ -74,7 +74,7 @@ ext {
"ydl-platform" : "0.0.29.1", "ydl-platform" : "0.0.29.1",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.28.4", "ydl-webview" : "0.0.28.5",
"ydl-media" : "0.0.14.3", "ydl-media" : "0.0.14.3",
"ydl-pay" : "0.0.11.4", "ydl-pay" : "0.0.11.4",
"m-audioim" : "0.0.40.3", "m-audioim" : "0.0.40.3",
...@@ -111,7 +111,7 @@ ext { ...@@ -111,7 +111,7 @@ ext {
"m-tests-api" : "0.0.1", "m-tests-api" : "0.0.1",
"m-user-api" : "0.0.9", "m-user-api" : "0.0.9",
"m-home-api" : "0.0.3", "m-home-api" : "0.0.3",
"m-im-api" : "0.0.3", "m-im-api" : "0.0.4",
"m-dynamic-api" : "0.0.1", "m-dynamic-api" : "0.0.1",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
...@@ -119,7 +119,7 @@ ext { ...@@ -119,7 +119,7 @@ ext {
"ydl-platform" : "0.0.29.1", "ydl-platform" : "0.0.29.1",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.28.3", "ydl-webview" : "0.0.28.5",
"ydl-media" : "0.0.14.3", "ydl-media" : "0.0.14.3",
"ydl-pay" : "0.0.11.4", "ydl-pay" : "0.0.11.4",
"m-audioim" : "0.0.40.3", "m-audioim" : "0.0.40.3",
...@@ -228,8 +228,8 @@ ext { ...@@ -228,8 +228,8 @@ ext {
"ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.3", "ydl-ijkplayer-jjdxm" : "com.ydl:jjdxm-ijkplayer:0.0.3",
"robust" : "com.meituan.robust:robust:0.4.87", "robust" : "com.meituan.robust:robust:0.4.87",
"walle" : "com.meituan.android.walle:library:1.1.5", "walle" : "com.meituan.android.walle:library:1.1.5",
"jpush" : "cn.jiguang.sdk:jpush:3.2.0", "jpush" : "cn.jiguang.sdk:jpush:3.3.6",
"jcore" : "cn.jiguang.sdk:jcore:1.2.7", "jcore" : "cn.jiguang.sdk:jcore:2.1.4",
"eventbus" : "de.greenrobot:eventbus:2.4.0", "eventbus" : "de.greenrobot:eventbus:2.4.0",
"BaseRecyclerViewAdapterHelper": "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34", "BaseRecyclerViewAdapterHelper": "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.34",
"flowlayout" : "cn.lankton:flowlayout:3.1.0", "flowlayout" : "cn.lankton:flowlayout:3.1.0",
......
...@@ -72,8 +72,7 @@ public class TrendsDetailInfoBean { ...@@ -72,8 +72,7 @@ public class TrendsDetailInfoBean {
public ArrayList<IMage> bigAttach;//大图 public ArrayList<IMage> bigAttach;//大图
public int topicId;//话题id public int topicId;//话题id
public String topicTitle;//话题标题 public String topicTitle;//话题标题
@SerializedName(value = "isFocused",alternate = "is_focused") public int isFocused;//1已关注,2未关注
public int is_focused;//1已关注,2未关注
public String uid; public String uid;
public String multitextType;//动态类型 public String multitextType;//动态类型
public ExtAd ext; public ExtAd ext;
......
...@@ -300,7 +300,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -300,7 +300,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
@NotNull @NotNull
@Override @Override
public StatusBarOptions getStatusViewOptions() { public StatusBarOptions getStatusViewOptions() {
return new StatusBarOptions(true,true); return new StatusBarOptions(true, true);
} }
public static Intent newIntent(Activity activity, int trendId, boolean isScrollToZan) { public static Intent newIntent(Activity activity, int trendId, boolean isScrollToZan) {
...@@ -407,8 +407,8 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -407,8 +407,8 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
/** /**
* 获取路由传递的参数 * 获取路由传递的参数
*/ */
private void getParam(){ private void getParam() {
if (null == getIntent() || !getIntent().hasExtra(ROUTER_PARAMS)){ if (null == getIntent() || !getIntent().hasExtra(ROUTER_PARAMS)) {
return; return;
} }
//路由传递的入参 //路由传递的入参
...@@ -421,6 +421,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -421,6 +421,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
...@@ -432,7 +433,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -432,7 +433,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
dismissProgressDialog(); dismissProgressDialog();
if (isFirstLoad) { if (isFirstLoad) {
vLoading.setViewType(LogoLoadingView.TYPE_LOADING, null); vLoading.setViewType(LogoLoadingView.TYPE_LOADING, null);
}else { } else {
showProgressDialog(message); showProgressDialog(message);
} }
} }
...@@ -875,7 +876,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -875,7 +876,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
comments = new ArrayList<>(); comments = new ArrayList<>();
Bundle bundle = getIntent().getBundleExtra(YDLConstants.BUNDLE); Bundle bundle = getIntent().getBundleExtra(YDLConstants.BUNDLE);
if (null != bundle){ if (null != bundle) {
lastId = bundle.getInt(KEY_LAST_ID, 0); lastId = bundle.getInt(KEY_LAST_ID, 0);
isFromSplash = bundle.getBoolean(KEY_IS_SPLASH, false); isFromSplash = bundle.getBoolean(KEY_IS_SPLASH, false);
trendId = bundle.getInt(KEY_TREND_ID, 0); trendId = bundle.getInt(KEY_TREND_ID, 0);
...@@ -1179,7 +1180,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -1179,7 +1180,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
.setRightClick("果断绑定", v -> { .setRightClick("果断绑定", v -> {
startActivity(DynamicIn.INSTANCE.inputPhoneIntent(this, DynamicConstants.BIND_PHONE_ACTION)); startActivity(DynamicIn.INSTANCE.inputPhoneIntent(this, DynamicConstants.BIND_PHONE_ACTION));
}) })
.setMessage("\n" + DynamicConstants.Companion.getBIND_PHONE()+ "\n") .setMessage("\n" + DynamicConstants.Companion.getBIND_PHONE() + "\n")
.show(); .show();
return; return;
} }
...@@ -1388,7 +1389,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -1388,7 +1389,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
linContent.setVisibility(View.VISIBLE); linContent.setVisibility(View.VISIBLE);
relNotExist.setVisibility(View.GONE); relNotExist.setVisibility(View.GONE);
linNullTip.setVisibility(mTrendBody.replyCounter > 0 ? GONE : VISIBLE); linNullTip.setVisibility(mTrendBody.replyCounter > 0 ? GONE : VISIBLE);
tvGuanzhu.setVisibility(mTrendBody.is_focused == 1 || mTrendBody.uid.equals("0") || TextUtils.equals(mTrendBody.uid, DynamicIn.INSTANCE.getUserInfo().getUid()) ? View.GONE : View.VISIBLE); tvGuanzhu.setVisibility(mTrendBody.isFocused == 1 || mTrendBody.uid.equals("0") || TextUtils.equals(mTrendBody.uid, DynamicIn.INSTANCE.getUserInfo().getUid()) ? View.GONE : View.VISIBLE);
ivLike.setImageResource(mTrendBody.isZan == 1 ? R.drawable.dynamic_newsfeed_like_sel : R.drawable.dynamic_newsfeed_like); ivLike.setImageResource(mTrendBody.isZan == 1 ? R.drawable.dynamic_newsfeed_like_sel : R.drawable.dynamic_newsfeed_like);
if (!TextUtils.isEmpty(mTrendBody.content)) { if (!TextUtils.isEmpty(mTrendBody.content)) {
MoonUtil.identifyFaceExpression(this, tvContent, mTrendBody.content, ImageSpan.ALIGN_BOTTOM); MoonUtil.identifyFaceExpression(this, tvContent, mTrendBody.content, ImageSpan.ALIGN_BOTTOM);
...@@ -1614,7 +1615,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -1614,7 +1615,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
// //删除 // //删除
// deleteDialog(2, mTrendBody.id, 0);// // deleteDialog(2, mTrendBody.id, 0);//
// })); // }));
YDLShareDialog dialog = YDLShareDialog.Companion.style2(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5()+ trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png"); YDLShareDialog dialog = YDLShareDialog.Companion.style2(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5() + trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png");
dialog.setCallBack(type -> { dialog.setCallBack(type -> {
if (2 == type) { if (2 == type) {
//删除 //删除
...@@ -1626,7 +1627,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -1626,7 +1627,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
dialog.show(getFragmentManager(), "lose"); dialog.show(getFragmentManager(), "lose");
} else { } else {
//别人帖子 //别人帖子
YDLShareDialog dialog = YDLShareDialog.Companion.style3(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5()+ trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png"); YDLShareDialog dialog = YDLShareDialog.Companion.style3(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5() + trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png");
dialog.setCallBack(type -> { dialog.setCallBack(type -> {
if (3 == type) { if (3 == type) {
if (!DynamicIn.INSTANCE.isLogin()) { if (!DynamicIn.INSTANCE.isLogin()) {
...@@ -1672,7 +1673,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr ...@@ -1672,7 +1673,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
} }
private void backHome() { private void backHome() {
DynamicIn.INSTANCE.mainIntent(this,0); DynamicIn.INSTANCE.mainIntent(this, 0);
} }
/** /**
......
...@@ -253,7 +253,6 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView, ...@@ -253,7 +253,6 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
.burryPoint("topTabClick"); .burryPoint("topTabClick");
if (!DynamicIn.INSTANCE.isLogin()) { if (!DynamicIn.INSTANCE.isLogin()) {
startActivity(DynamicIn.INSTANCE.loginWayIntent(getActivity())); startActivity(DynamicIn.INSTANCE.loginWayIntent(getActivity()));
// startActivity(new Intent(getActivity(), ChooseLoginWayActivity.class));
return; return;
} }
BuryPointUtils.getInstance().trackViewScreen(getActivity(), "动态-关注", "com.cxzapp.yidianling.trends.trendList.TrendsListFragment"); BuryPointUtils.getInstance().trackViewScreen(getActivity(), "动态-关注", "com.cxzapp.yidianling.trends.trendList.TrendsListFragment");
......
...@@ -104,7 +104,6 @@ class HomeConfideRecyleSuspendListener : RecyclerView.OnScrollListener() { ...@@ -104,7 +104,6 @@ class HomeConfideRecyleSuspendListener : RecyclerView.OnScrollListener() {
if (mCurrentPosition != manager.findFirstVisibleItemPosition() && manager.findFirstVisibleItemPosition() != -1) { if (mCurrentPosition != manager.findFirstVisibleItemPosition() && manager.findFirstVisibleItemPosition() != -1) {
mCurrentPosition = manager.findFirstVisibleItemPosition() mCurrentPosition = manager.findFirstVisibleItemPosition()
} }
if (adapter!!.itemCount > mCurrentPosition && mCurrentPosition != 0) {
if (adapter!!.getItemViewType(mCurrentPosition) == YdlHomeViewHolderConstract.CONFIDE_VIEW) { if (adapter!!.getItemViewType(mCurrentPosition) == YdlHomeViewHolderConstract.CONFIDE_VIEW) {
val view = manager.findViewByPosition(mCurrentPosition) val view = manager.findViewByPosition(mCurrentPosition)
if (view != null) { if (view != null) {
...@@ -172,7 +171,6 @@ class HomeConfideRecyleSuspendListener : RecyclerView.OnScrollListener() { ...@@ -172,7 +171,6 @@ class HomeConfideRecyleSuspendListener : RecyclerView.OnScrollListener() {
consultFilterView?.visibility = View.INVISIBLE consultFilterView?.visibility = View.INVISIBLE
} }
} }
}
/** /**
* 移动搜索View * 移动搜索View
......
package com.yidianling.im.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
class UserTypeBean(var userType: String,//用户类型 1 用户 2 专家 3 助理
var chatEvent: Boolean,//私聊常用语弹窗
var collectEvent: Boolean)//收集信息
\ No newline at end of file
package com.yidianling.im.event;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/13
*/
public class MsgPushEvent {
public String toUid;
public String headUrl;
public String content;
public String name;
@Override
public String toString() {
return "MsgPushEvent{" +
"toUid='" + toUid + '\'' +
", headUrl='" + headUrl + '\'' +
", content='" + content + '\'' +
", name='" + name + '\'' +
'}';
}
}
package com.yidianling.im.helper; package com.yidianling.im.helper;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -17,6 +18,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog; ...@@ -17,6 +18,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.common.tools.LogUtil; import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.api.bean.IMExpertBuild;
import com.yidianling.im.bean.DoctorAssistantRespDtoBean; import com.yidianling.im.bean.DoctorAssistantRespDtoBean;
import com.yidianling.im.bean.GetExpert; import com.yidianling.im.bean.GetExpert;
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl; import com.yidianling.im.bridge.P2PCustomActionHandlerImpl;
...@@ -24,7 +26,7 @@ import com.yidianling.im.config.constants.ImConstants; ...@@ -24,7 +26,7 @@ import com.yidianling.im.config.constants.ImConstants;
import com.yidianling.im.http.ImRetrofitApi; import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn; import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.SessionHelper; import com.yidianling.im.session.SessionHelper;
import com.yidianling.im.api.bean.IMExpertBuild; import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
...@@ -67,6 +69,7 @@ public class IMUtil { ...@@ -67,6 +69,7 @@ public class IMUtil {
* @param isFromQingShu 用于判断是否从倾诉流程跳转私聊:1:是 其他:不是 从倾述流程跳转私聊,需要发送自定义消息 * @param isFromQingShu 用于判断是否从倾诉流程跳转私聊:1:是 其他:不是 从倾述流程跳转私聊,需要发送自定义消息
* @param isFromMessageList 用于判断是否来自于聊天列表点击进入 true 是 false,不是 * @param isFromMessageList 用于判断是否来自于聊天列表点击进入 true 是 false,不是
*/ */
@SuppressLint("CheckResult")
public static void startChat(AppCompatActivity context, String toUid, int flag, int canTalk, ExpertDataFetchListener listener, int isFromQingShu, boolean isFromMessageList) { public static void startChat(AppCompatActivity context, String toUid, int flag, int canTalk, ExpertDataFetchListener listener, int isFromQingShu, boolean isFromMessageList) {
if (!ImIn.INSTANCE.isLogin(context, true)) { if (!ImIn.INSTANCE.isLogin(context, true)) {
return; return;
...@@ -77,30 +80,36 @@ public class IMUtil { ...@@ -77,30 +80,36 @@ public class IMUtil {
LogUtil.d("isSaveUserInfo: " + isSaveUserInfo + " isUseUm: " + isUseUm); LogUtil.d("isSaveUserInfo: " + isSaveUserInfo + " isUseUm: " + isUseUm);
LoadingDialogFragment dialog = LoadingDialogFragment.Companion.newInstance(null); LoadingDialogFragment dialog = LoadingDialogFragment.Companion.newInstance(null);
if(context.getSupportFragmentManager() != null && !context.isDestroyed()) { if (context.getSupportFragmentManager() != null && !context.isDestroyed()) {
dialog.show(context.getSupportFragmentManager(), null); dialog.show(context.getSupportFragmentManager(), null);
} }
GetExpert cmd = new GetExpert(Integer.parseInt(toUid), canTalk); GetExpert cmd = new GetExpert(Integer.parseInt(toUid), canTalk);
if (isFromMessageList) {
//先根据uid判断用户类型:专家调一个接口,非专家调另外的接口 //先根据uid判断用户类型:专家调一个接口,非专家调另外的接口
Disposable disposable = ImRetrofitApi.Companion.getImJavaApi().getUserType(toUid) ImRetrofitApi.Companion.getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> { .subscribe(res -> {
if (res.code == 200) { if (res.code == 200 && res.data != null) {
if (TextUtils.equals(res.data, "2")) {//专家 java 接口 if (res.data.getChatEvent()) {//和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", res.data.getChatEvent());
}
if (res.data.getCollectEvent()) {//和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache("collectEvent", res.data.getCollectEvent());
}
if (TextUtils.equals(res.data.getUserType(), "2")) {//专家 java 接口
//如果是从消息列表点击进来的,那么专家还是专家,助理还是助理,不走其他所有逻辑(比如销售代运营) //如果是从消息列表点击进来的,那么专家还是专家,助理还是助理,不走其他所有逻辑(比如销售代运营)
if (isFromMessageList) { if (isFromMessageList) {
startExpertChat(context, toUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu); startExpertChat(context, toUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
return ; return;
} }
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊 //在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
Disposable disposa = ImRetrofitApi.Companion.getImJavaApi().getChatUid((toUid)) ImRetrofitApi.Companion.getImJavaApi().getChatUid((toUid))
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> { .subscribe(resp -> {
...@@ -109,14 +118,14 @@ public class IMUtil { ...@@ -109,14 +118,14 @@ public class IMUtil {
if (bean.getRole() == 1) { if (bean.getRole() == 1) {
//接口返回值是专家,java接口 //接口返回值是专家,java接口
startExpertChat(context, bean.getChatUid(), dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu); startExpertChat(context, bean.getChatUid(), dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
}else { } else {
GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.getChatUid()), canTalk); GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.getChatUid()), canTalk);
//接口返回值是助理,php接口 //接口返回值是助理,php接口
startAssistantChat(context, bean.getChatUid(), cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu); startAssistantChat(context, bean.getChatUid(), cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
} }
},t->{ }, t -> {
HttpErrorUtils.Companion.handleError(context, t); HttpErrorUtils.Companion.handleError(context, t);
}); });
} else {//非专家 php接口 } else {//非专家 php接口
...@@ -134,6 +143,108 @@ public class IMUtil { ...@@ -134,6 +143,108 @@ public class IMUtil {
} }
HttpErrorUtils.Companion.handleError(context, throwable); HttpErrorUtils.Companion.handleError(context, throwable);
}); });
} else {
ImRetrofitApi.Companion.getImJavaApi().getChatUid(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getChatUidResp -> {
DoctorAssistantRespDtoBean bean = getChatUidResp.data;
ImRetrofitApi.Companion.getImJavaApi().getUserType(bean.chatUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userTypeResp -> {
if (userTypeResp.code == 200 && userTypeResp.data != null) {
if (userTypeResp.data.getChatEvent()) {//和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", userTypeResp.data.getChatEvent());
}
if (userTypeResp.data.getCollectEvent()) {//和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache("collectEvent", userTypeResp.data.getCollectEvent());
}
if (TextUtils.equals(userTypeResp.data.getUserType(), "2")) {//专家 java 接口
//接口返回值是专家,java接口
startExpertChat(context, bean.chatUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
} else {
//非专家 php接口
GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.chatUid), canTalk);
startAssistantChat(context, bean.chatUid, cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
}
} else {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
ToastUtil.toastShort(userTypeResp.msg);
}
}, throwable -> {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, throwable);
});
}, t -> {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, t);
});
}
// //先根据uid判断用户类型:专家调一个接口,非专家调另外的接口
// Disposable disposable = ImRetrofitApi.Companion.getImJavaApi().getUserType(toUid)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(res -> {
// if (res.code == 200) {
// if (TextUtils.equals(res.data, "2")) {//专家 java 接口
//
// //如果是从消息列表点击进来的,那么专家还是专家,助理还是助理,不走其他所有逻辑(比如销售代运营)
// if (isFromMessageList) {
// startExpertChat(context, toUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// return ;
// }
//
// //在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
// Disposable disposa = ImRetrofitApi.Companion.getImJavaApi().getChatUid((toUid))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(resp -> {
//
// DoctorAssistantRespDtoBean bean = resp.data;
// if (bean.getRole() == 1) {
// //接口返回值是专家,java接口
// startExpertChat(context, bean.getChatUid(), dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// }else {
//
// GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.getChatUid()), canTalk);
// //接口返回值是助理,php接口
// startAssistantChat(context, bean.getChatUid(), cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// }
//
// },t->{
// HttpErrorUtils.Companion.handleError(context, t);
// });
// } else {//非专家 php接口
// startAssistantChat(context, toUid, cmd, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// }
// } else {
// if (dialog.isVisible()) {
// dialog.dismissAllowingStateLoss();
// }
// ToastUtil.toastShort(res.msg);
// }
// }, throwable -> {
// if (dialog.isVisible()) {
// dialog.dismissAllowingStateLoss();
// }
// HttpErrorUtils.Companion.handleError(context, throwable);
// });
} }
/** /**
......
...@@ -17,6 +17,7 @@ import com.netease.nimlib.sdk.msg.model.RevokeMsgNotification ...@@ -17,6 +17,7 @@ import com.netease.nimlib.sdk.msg.model.RevokeMsgNotification
import com.netease.nimlib.sdk.team.TeamServiceObserver import com.netease.nimlib.sdk.team.TeamServiceObserver
import com.netease.nimlib.sdk.team.model.Team import com.netease.nimlib.sdk.team.model.Team
import com.yidianling.im.api.event.AccountChangeEvent import com.yidianling.im.api.event.AccountChangeEvent
import com.yidianling.im.event.MsgPushEvent
import com.yidianling.im.event.TeamRemoveEvent import com.yidianling.im.event.TeamRemoveEvent
import com.yidianling.im.preference.IMCache import com.yidianling.im.preference.IMCache
import com.yidianling.im.preference.ImTempData import com.yidianling.im.preference.ImTempData
...@@ -30,6 +31,7 @@ import com.yidianling.uikit.api.wrapper.NimMessageRevokeObserver ...@@ -30,6 +31,7 @@ import com.yidianling.uikit.api.wrapper.NimMessageRevokeObserver
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper import com.yidianling.uikit.business.session.helper.MessageListPanelHelper
import com.yidianling.uikit.business.team.helper.TeamMemberAitHelper import com.yidianling.uikit.business.team.helper.TeamMemberAitHelper
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import java.util.concurrent.Executors
/** /**
* Created by haorui on 2019/5/17. * Created by haorui on 2019/5/17.
...@@ -49,16 +51,20 @@ class ImObserversHelper { ...@@ -49,16 +51,20 @@ class ImObserversHelper {
fun registerObserver(register: Boolean) { fun registerObserver(register: Boolean) {
//注册`在线状态变化`观察者 //注册`在线状态变化`观察者
NIMClient.getService(AuthServiceObserver::class.java).observeOnlineStatus(userStatusObserver, register) NIMClient.getService(AuthServiceObserver::class.java)
.observeOnlineStatus(userStatusObserver, register)
//注册`消息撤回`观察者 //注册`消息撤回`观察者
NIMClient.getService(MsgServiceObserve::class.java).observeRevokeMessage(messageRevokeObserver, register) NIMClient.getService(MsgServiceObserve::class.java)
.observeRevokeMessage(messageRevokeObserver, register)
//注册`消息接收`观察者 //注册`消息接收`观察者
NIMClient.getService(MsgServiceObserve::class.java).observeReceiveMessage(incomingMessageObserver, register) NIMClient.getService(MsgServiceObserve::class.java)
.observeReceiveMessage(incomingMessageObserver, register)
//注册`移出群`观察者通知 //注册`移出群`观察者通知
NIMClient.getService(TeamServiceObserver::class.java).observeTeamRemove(teamObserver, register) NIMClient.getService(TeamServiceObserver::class.java)
.observeTeamRemove(teamObserver, register)
//注册`未读消息改变数量`观察者 //注册`未读消息改变数量`观察者
registerMsgUnreadInfoObserver(register) registerMsgUnreadInfoObserver(register)
if (register){ if (register) {
//注册`消息转发`过滤器 //注册`消息转发`过滤器
NimUIKit.setMsgForwardFilter(msgForwardFilter) NimUIKit.setMsgForwardFilter(msgForwardFilter)
//注册`消息撤回`过滤器 //注册`消息撤回`过滤器
...@@ -70,11 +76,13 @@ class ImObserversHelper { ...@@ -70,11 +76,13 @@ class ImObserversHelper {
if (register) { if (register) {
ReminderManager.getInstance().registerUnreadNumChangedCallback(unreadNumChangedCallback) ReminderManager.getInstance().registerUnreadNumChangedCallback(unreadNumChangedCallback)
} else { } else {
ReminderManager.getInstance().unregisterUnreadNumChangedCallback(unreadNumChangedCallback) ReminderManager.getInstance()
.unregisterUnreadNumChangedCallback(unreadNumChangedCallback)
} }
} }
private var unreadNumChangedCallback: ReminderManager.UnreadNumChangedCallback = ReminderManager.UnreadNumChangedCallback() { private var unreadNumChangedCallback: ReminderManager.UnreadNumChangedCallback =
ReminderManager.UnreadNumChangedCallback() {
MsgReceiveHelper.onMessageReceived() MsgReceiveHelper.onMessageReceived()
} }
...@@ -86,9 +94,11 @@ class ImObserversHelper { ...@@ -86,9 +94,11 @@ class ImObserversHelper {
private var messageRevokeObserver: Observer<RevokeMsgNotification> = NimMessageRevokeObserver() private var messageRevokeObserver: Observer<RevokeMsgNotification> = NimMessageRevokeObserver()
private var teamObserver: Observer<Team> = Observer<Team> { t -> EventBus.getDefault().post( private var teamObserver: Observer<Team> = Observer<Team> { t ->
EventBus.getDefault().post(
TeamRemoveEvent(1, t.id) TeamRemoveEvent(1, t.id)
) } )
}
private var incomingMessageObserver = Observer<List<IMMessage>> { messages -> private var incomingMessageObserver = Observer<List<IMMessage>> { messages ->
// 处理新收到的消息,为了上传处理方便,SDK 保证参数 messages 全部来自同一个聊天对象。 // 处理新收到的消息,为了上传处理方便,SDK 保证参数 messages 全部来自同一个聊天对象。
...@@ -96,9 +106,9 @@ class ImObserversHelper { ...@@ -96,9 +106,9 @@ class ImObserversHelper {
if (messages == null || messages.isEmpty()) { if (messages == null || messages.isEmpty()) {
return@Observer return@Observer
} }
if (messages.size > 1){ if (messages.size > 1) {
//漫游消息 nothing //漫游消息 nothing
}else{ } else {
//单/群聊消息 //单/群聊消息
for (m in messages) { for (m in messages) {
//监听在线消息中是否有@我 //监听在线消息中是否有@我
...@@ -112,6 +122,38 @@ class ImObserversHelper { ...@@ -112,6 +122,38 @@ class ImObserversHelper {
flushReceivedMoney(m) flushReceivedMoney(m)
} else { } else {
MsgReceiveHelper.onMessageReceived() MsgReceiveHelper.onMessageReceived()
if (System.currentTimeMillis() - m.time <= 5000) {
Executors.newSingleThreadExecutor().execute {
val userInfo = NimUIKit.getUserInfoProvider().getUserInfo(m.fromAccount)
val event = MsgPushEvent()
event.toUid = m.fromAccount
when (m.msgType) {
MsgTypeEnum.text -> {
event.content = m.content
}
MsgTypeEnum.image -> {
event.content = "[图片]"
}
MsgTypeEnum.audio -> {
event.content = "[语音]"
}
MsgTypeEnum.video -> {
event.content = "[视频]"
}
else -> {
event.content = "[链接]"
}
}
if (userInfo != null) {
event.name = userInfo.name
event.headUrl = userInfo.avatar
}
// LogUtil.e("发送事件:$event")
EventBus.getDefault().post(event)
}
}
} }
} }
} }
...@@ -132,7 +174,8 @@ class ImObserversHelper { ...@@ -132,7 +174,8 @@ class ImObserversHelper {
private var msgRevokeFilter = MsgRevokeFilter { message -> private var msgRevokeFilter = MsgRevokeFilter { message ->
if (message.attachment != null if (message.attachment != null
&& message.attachment is AVChatAttachment && message.attachment is AVChatAttachment
&& message.attachment is CustomAttachRedPacket) { && message.attachment is CustomAttachRedPacket
) {
// 视频通话消息和白板消息 不允许撤回 // 视频通话消息和白板消息 不允许撤回
return@MsgRevokeFilter true return@MsgRevokeFilter true
} else if (IMCache.getAccount() != null && IMCache.getAccount() == message.sessionId) { } else if (IMCache.getAccount() != null && IMCache.getAccount() == message.sessionId) {
...@@ -145,7 +188,9 @@ class ImObserversHelper { ...@@ -145,7 +188,9 @@ class ImObserversHelper {
//如果是收款提醒消息 则更新历史收款消息的状态 //如果是收款提醒消息 则更新历史收款消息的状态
fun flushReceivedMoney(m: IMMessage) { fun flushReceivedMoney(m: IMMessage) {
//跟新收款消息 //跟新收款消息
NIMClient.getService(MsgService::class.java).queryMessageListByType(MsgTypeEnum.custom, m, 100).setCallback(object : RequestCallback<List<IMMessage>> { NIMClient.getService(MsgService::class.java)
.queryMessageListByType(MsgTypeEnum.custom, m, 100)
.setCallback(object : RequestCallback<List<IMMessage>> {
override fun onSuccess(imMessages: List<IMMessage>) { override fun onSuccess(imMessages: List<IMMessage>) {
for (im in imMessages) { for (im in imMessages) {
if (im.attachment is CustomAttachReceivedMoney) { if (im.attachment is CustomAttachReceivedMoney) {
...@@ -159,7 +204,8 @@ class ImObserversHelper { ...@@ -159,7 +204,8 @@ class ImObserversHelper {
money.orPay = 1//设置为已支付 money.orPay = 1//设置为已支付
im.attachment = money im.attachment = money
//更新此消息到sdk //更新此消息到sdk
NIMClient.getService(MsgService::class.java).updateIMMessageStatus(im) NIMClient.getService(MsgService::class.java)
.updateIMMessageStatus(im)
//更新私聊界面聊天信息 //更新私聊界面聊天信息
MessageListPanelHelper.getInstance().notifyModifyMessage(im) MessageListPanelHelper.getInstance().notifyModifyMessage(im)
return return
......
...@@ -5,11 +5,8 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA ...@@ -5,11 +5,8 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.bean.CourseStatusBean
import com.yidianling.im.bean.DoctorAssistantRespDtoBean
import com.yidianling.im.bean.PushConfideStatusBean
import com.yidianling.im.bean.RedPacketDetailBean
import com.yidianling.im.api.bean.IMExpertBuild import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.bean.*
import io.reactivex.Observable import io.reactivex.Observable
import retrofit2.http.* import retrofit2.http.*
...@@ -43,7 +40,7 @@ interface ImRetrofitApi { ...@@ -43,7 +40,7 @@ interface ImRetrofitApi {
//获取用户的状态(用户、专家、助理) //获取用户的状态(用户、专家、助理)
@GET("user/userType") @GET("user/userType")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<String>> fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<UserTypeBean>>
//根据专家uid获取私聊的目标uid(有可能是专家uid,有可能是助理uid) //根据专家uid获取私聊的目标uid(有可能是专家uid,有可能是助理uid)
@GET("doctor/chat-user") @GET("doctor/chat-user")
......
...@@ -197,4 +197,8 @@ class IMServiceImpl : IImService { ...@@ -197,4 +197,8 @@ class IMServiceImpl : IImService {
//这里虽然是倾述流程进入私聊,但不需要发送自定义消息 //这里虽然是倾述流程进入私聊,但不需要发送自定义消息
IMUtil.startChat(context as AppCompatActivity, toUid, 0x001, canTalk, null, 0, false) IMUtil.startChat(context as AppCompatActivity, toUid, 0x001, canTalk, null, 0, false)
} }
override fun getUnReadByUid(uid: String): Int {
return MsgReceiveHelper.getUnNum(uid)
}
} }
\ No newline at end of file
...@@ -47,7 +47,7 @@ public class OrderAction extends BaseAction { ...@@ -47,7 +47,7 @@ public class OrderAction extends BaseAction {
.subscribe(res -> { .subscribe(res -> {
if (res.code == 200) { if (res.code == 200) {
Observable<BaseResponse<IMExpertBuild>> observable; Observable<BaseResponse<IMExpertBuild>> observable;
if (TextUtils.equals(res.data, "2")) {//专家 if (TextUtils.equals(res.data.getUserType(), "2")) {//专家
observable = ImRetrofitApi.Companion.getImJavaApi().getPersonalChat(getAccount()); observable = ImRetrofitApi.Companion.getImJavaApi().getPersonalChat(getAccount());
} else { } else {
observable = ImHttpImpl.Companion.getInstance().getExpert(new ExpertParam(Integer.valueOf(getAccount()), 0)); observable = ImHttpImpl.Companion.getInstance().getExpert(new ExpertParam(Integer.valueOf(getAccount()), 0));
......
...@@ -21,6 +21,7 @@ import android.widget.LinearLayout; ...@@ -21,6 +21,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.netease.nimlib.sdk.NIMClient; import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer; import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.RequestCallback; import com.netease.nimlib.sdk.RequestCallback;
...@@ -42,6 +43,7 @@ import com.ydl.ydlcommon.utils.log.LogHelper; ...@@ -42,6 +43,7 @@ import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.view.CircleImageView; import com.ydl.ydlcommon.view.CircleImageView;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.router.ImIn;
import com.yidianling.nimbase.api.UIKitOptions; import com.yidianling.nimbase.api.UIKitOptions;
import com.yidianling.nimbase.api.model.main.CustomPushContentProvider; import com.yidianling.nimbase.api.model.main.CustomPushContentProvider;
import com.yidianling.nimbase.api.model.session.ModuleProxy; import com.yidianling.nimbase.api.model.session.ModuleProxy;
...@@ -54,22 +56,34 @@ import com.yidianling.nimbase.common.fragment.TFragment; ...@@ -54,22 +56,34 @@ import com.yidianling.nimbase.common.fragment.TFragment;
import com.yidianling.nimbase.impl.cache.NimUserInfoCache; import com.yidianling.nimbase.impl.cache.NimUserInfoCache;
import com.yidianling.uikit.api.NimUIKitImpl; import com.yidianling.uikit.api.NimUIKitImpl;
import com.yidianling.uikit.business.ait.AitManager; import com.yidianling.uikit.business.ait.AitManager;
import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper;
import com.yidianling.uikit.business.session.module.input.InputPanel; import com.yidianling.uikit.business.session.module.input.InputPanel;
import com.yidianling.uikit.business.session.module.list.MessageListPanelEx; import com.yidianling.uikit.business.session.module.list.MessageListPanelEx;
import com.yidianling.uikit.business.session.view.ChatPrivateTips; import com.yidianling.uikit.business.session.view.ChatPrivateTips;
import com.yidianling.uikit.business.session.view.CollectInfoPopupWindow;
import com.yidianling.uikit.business.session.view.CommonQuestionView;
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage; import com.yidianling.uikit.custom.bridge.ActionHandlerStorage;
import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler; import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.ServiceImpl;
import com.yidianling.uikit.custom.http.response.CommonQuestionBean;
import com.yidianling.uikit.custom.http.response.SubmitUserInfoBean;
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean;
import com.yidianling.uikit.custom.widget.ConfideOrderInfoView; import com.yidianling.uikit.custom.widget.ConfideOrderInfoView;
import com.yidianling.uikit.custom.widget.HalfCircleDrawable; import com.yidianling.uikit.custom.widget.HalfCircleDrawable;
import com.yidianling.user.api.service.IUserService; import com.yidianling.user.api.service.IUserService;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/** /**
* 聊天界面基类 * 聊天界面基类
...@@ -114,6 +128,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -114,6 +128,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private int timeCount = 0; private int timeCount = 0;
protected AitManager aitManager; protected AitManager aitManager;
private CollectInfoPopupWindow collectInfoPopupWindow;
private CircleImageView small_head_img; //小头像 private CircleImageView small_head_img; //小头像
private TextView help_num_tv; //帮助人数 private TextView help_num_tv; //帮助人数
...@@ -126,6 +141,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -126,6 +141,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private ImageView qingshuImg; //预约咨询 private ImageView qingshuImg; //预约咨询
private ConstraintLayout top_expert_info_cl; private ConstraintLayout top_expert_info_cl;
private RelativeLayout rl_common_question_enter;
private FrameLayout fl_question_content;
private List<CommonQuestionBean> commonQuestionBeanList;
@SuppressLint("HandlerLeak") @SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() { private Handler mHandler = new Handler() {
...@@ -157,6 +175,51 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -157,6 +175,51 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
qingshu = rootView.findViewById(R.id.action_qingshu); qingshu = rootView.findViewById(R.id.action_qingshu);
qingshuImg = rootView.findViewById(R.id.action_qingshu_img); qingshuImg = rootView.findViewById(R.id.action_qingshu_img);
//和助理私聊时的常用语逻辑
rl_common_question_enter = rootView.findViewById(R.id.rl_common_question);
fl_question_content = rootView.findViewById(R.id.fl_question_content);
rl_common_question_enter.setVisibility(ActionHandlerStorage.getL(sessionId).getUserType() == 3 ? View.VISIBLE : View.GONE);
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
rl_common_question_enter.setOnClickListener(v -> {
if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) {
openOrCloseCommonQuestionLayout(true);
} else {
getCommonQuestionListData();
}
});
if (ChatStatusCacheHelper.getStatusCache("chatEvent")) {
if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) {
rl_common_question_enter.postDelayed(() -> openOrCloseCommonQuestionLayout(true), 300);
} else {
getCommonQuestionListData();
}
ChatStatusCacheHelper.clearDataByKey("chatEvent");
}
if (ChatStatusCacheHelper.getStatusCache("collectEvent")) {
String time = Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.MONTH) + Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
// if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + YdlCommonRouterManager.INSTANCE.getYdlCommonRoute().getUid()))) {
if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), (content, result) -> {
if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()
, time);
} else {
IMMessage textMessage = MessageBuilder.createTextMessage(sessionId, sessionType, content);
if (sendMessage(textMessage)) {
openOrCloseCommonQuestionLayout(false);
}
submitUserCollect(result);
}
});
getUserInfoCollect();
collectInfoPopupWindow.show(top_expert_info_cl);
}
ChatStatusCacheHelper.clearDataByKey("collectEvent");
}
}
// 初始化顶部专家信息栏 // 初始化顶部专家信息栏
if (ActionHandlerStorage.getL(sessionId).getUserType() == 2) { if (ActionHandlerStorage.getL(sessionId).getUserType() == 2) {
top_expert_info_cl.setVisibility(View.VISIBLE); top_expert_info_cl.setVisibility(View.VISIBLE);
...@@ -214,7 +277,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -214,7 +277,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
* 初始化顶部专家信息栏 * 初始化顶部专家信息栏
*/ */
private void initTopCustomBar() { private void initTopCustomBar() {
if (ActionHandlerStorage.getL(sessionId) != null) {
// 头像 // 头像
String headUrl = ActionHandlerStorage.getL(sessionId).getInfo().doctorBriefInfoSmallImage; String headUrl = ActionHandlerStorage.getL(sessionId).getInfo().doctorBriefInfoSmallImage;
if (!TextUtils.isEmpty(headUrl)) { if (!TextUtils.isEmpty(headUrl)) {
...@@ -243,7 +305,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -243,7 +305,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} }
} }
} }
}
private void showTips() { private void showTips() {
mHandler.sendEmptyMessageDelayed(1, 1000); mHandler.sendEmptyMessageDelayed(1, 1000);
...@@ -349,7 +410,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -349,7 +410,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LogHelper.Companion.getInstance().writeLogSync("聊天界面点击常见问题"); LogHelper.Companion.getInstance().writeLogSync("聊天界面点击常见问题");
if (ActionHandlerStorage.getL(sessionId) != null) { if (null != ActionHandlerStorage.getL(sessionId)) {
ActionHandlerStorage.getL(sessionId).startHelp(getActivity()); ActionHandlerStorage.getL(sessionId).startHelp(getActivity());
} }
} }
...@@ -358,7 +419,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -358,7 +419,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LogHelper.Companion.getInstance().writeLogSync("聊天界面点击投诉与反馈"); LogHelper.Companion.getInstance().writeLogSync("聊天界面点击投诉与反馈");
if (ActionHandlerStorage.getL(sessionId) != null) { if (null != ActionHandlerStorage.getL(sessionId)) {
ActionHandlerStorage.getL(sessionId).startFeedback(getActivity()); ActionHandlerStorage.getL(sessionId).startFeedback(getActivity());
} }
} }
...@@ -368,7 +429,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -368,7 +429,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
LogHelper.Companion.getInstance().writeLogSync("聊天界面点击免费热线"); LogHelper.Companion.getInstance().writeLogSync("聊天界面点击免费热线");
if (ActionHandlerStorage.getL(sessionId) != null) { if (null != ActionHandlerStorage.getL(sessionId)) {
ActionHandlerStorage.getL(sessionId).popCallDialog(getActivity()); ActionHandlerStorage.getL(sessionId).popCallDialog(getActivity());
} }
} }
...@@ -402,6 +463,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -402,6 +463,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
NIMClient.getService(MsgService.class).setChattingAccount(sessionId, sessionType); NIMClient.getService(MsgService.class).setChattingAccount(sessionId, sessionType);
getActivity().setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); // 默认使用听筒播放 getActivity().setVolumeControlStream(AudioManager.STREAM_VOICE_CALL); // 默认使用听筒播放
messageListPanel.scrollToBottom();
} }
@Override @Override
...@@ -418,7 +482,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -418,7 +482,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} }
public boolean onBackPressed() { public boolean onBackPressed() {
return inputPanel.collapse(true) || messageListPanel.onBackPressed(); return inputPanel.collapse(true) || messageListPanel.onBackPressed() || openOrCloseCommonQuestionLayout(false);
} }
//刷新消息列表 //刷新消息列表
...@@ -640,11 +704,15 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -640,11 +704,15 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
@Override @Override
public void onInputPanelExpand() { public void onInputPanelExpand() {
messageListPanel.scrollToBottom(); messageListPanel.scrollToBottom();
openOrCloseCommonQuestionLayout(false);
} }
@Override @Override
public void shouldCollapseInputPanel() { public void shouldCollapseInputPanel() {
inputPanel.collapse(false); inputPanel.collapse(false);
openOrCloseCommonQuestionLayout(false);
} }
@Override @Override
...@@ -677,4 +745,108 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -677,4 +745,108 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
return actions; return actions;
} }
} private boolean openOrCloseCommonQuestionLayout(boolean open) {
boolean result = false;
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
if (open) {
inputPanel.collapse(true);
messageListPanel.scrollToBottom();
}
if (rl_common_question_enter != null) {
rl_common_question_enter.setVisibility(open ? View.GONE : View.VISIBLE);
}
if (fl_question_content != null) {
if (fl_question_content.getVisibility() == View.VISIBLE) {
result = true;
}
fl_question_content.setVisibility(open ? View.VISIBLE : View.GONE);
}
}
return result;
}
@SuppressLint("CheckResult")
private void getCommonQuestionListData() {
ServiceImpl.Companion.getInstance().getCommonQuestionList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (res.data != null && res.data.size() > 0) {
if (commonQuestionBeanList == null) {
commonQuestionBeanList = new ArrayList<>();
} else {
commonQuestionBeanList.clear();
}
commonQuestionBeanList.addAll(res.data);
initCommonQuestionLayout();
}
}, throwable -> {
ToastUtil.toastShort(throwable.toString());
});
}
private void initCommonQuestionLayout() {
CommonQuestionView commonQuestionView = new CommonQuestionView(getActivity());
commonQuestionView.setData(commonQuestionBeanList);
commonQuestionView.setListener(new CommonQuestionView.OnSelectItemListener() {
@Override
public void close() {
openOrCloseCommonQuestionLayout(false);
}
@Override
public void onSelect(@NotNull String title, String id) {
IMMessage textMessage = MessageBuilder.createTextMessage(sessionId, sessionType, title);
if (sendMessage(textMessage)) {
openOrCloseCommonQuestionLayout(false);
}
commonQuestionClickCount(id);
}
});
fl_question_content.addView(commonQuestionView);
openOrCloseCommonQuestionLayout(true);
}
@SuppressLint("CheckResult")
private void commonQuestionClickCount(String id) {
ServiceImpl.Companion.getInstance().sendCommonQuestionCount(id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(objectBaseAPIResponse -> {
}, throwable -> {
});
}
@SuppressLint("CheckResult")
private void getUserInfoCollect() {
ServiceImpl.Companion.getInstance().userCollectList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
if (resp.data != null && resp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data);
} else {
collectInfoPopupWindow.dismiss();
}
}, throwable -> {
collectInfoPopupWindow.dismiss();
});
}
@SuppressLint("CheckResult")
private void submitUserCollect(List<UserQuestInfoBean> result) {
SubmitUserInfoBean submitUserInfoBean = new SubmitUserInfoBean();
submitUserInfoBean.userInfoList = result;
ServiceImpl.Companion.getInstance().submitUserCollect(JSON.toJSONString(submitUserInfoBean))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
}, throwable -> {
});
}}
package com.yidianling.uikit.business.session.helper;
import java.util.HashMap;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/11
*/
public class ChatStatusCacheHelper {
private static final HashMap<String, Boolean> statusCache = new HashMap<>();
public static void setStatusCache(String key, boolean value) {
statusCache.put(key, value);
}
public static boolean getStatusCache(String key) {
if (statusCache.containsKey(key)) {
return statusCache.get(key);
}
return false;
}
public static void clearDataByKey(String key) {
if (statusCache.containsKey(key)) {
statusCache.remove(key);
}
}
}
...@@ -213,7 +213,7 @@ public class MessageListPanelEx { ...@@ -213,7 +213,7 @@ public class MessageListPanelEx {
private OnItemClickListener listener = new OnItemClickListener() { private OnItemClickListener listener = new OnItemClickListener() {
@Override @Override
public void onItemClick(IRecyclerView adapter, View view, int position) { public void onItemClick(IRecyclerView adapter, View view, int position) {
container.proxy.shouldCollapseInputPanel();
} }
@Override @Override
......
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import com.yidianling.common.tools.ToastUtil
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) : PopupWindow(mContext) {
private var collectUserInformationView: CollectUserInformationView
private var isFromBack = true
init {
height = ViewGroup.LayoutParams.MATCH_PARENT
width = ViewGroup.LayoutParams.MATCH_PARENT
setBackgroundDrawable(BitmapDrawable())
collectUserInformationView = CollectUserInformationView(mContext, {
listener.sendMsg("", ArrayList())
isFromBack = false
dismiss()
}, { _content, _list ->
listener.sendMsg(_content, _list)
isFromBack = false
dismiss()
})
collectUserInformationView.isFocusableInTouchMode = true
collectUserInformationView.setOnKeyListener { v, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_BACK) {
showSkipDialog()
true
}
false
}
contentView = collectUserInformationView
isFocusable = true
isTouchable = true
isOutsideTouchable = false
}
fun setData(list: List<UserQuestInfoBean>) {
if (list.isEmpty()) {
ToastUtil.toastShort("数据异常,请稍后重试")
return
}
collectUserInformationView.setData(list)
}
override fun dismiss() {
if (isFromBack) {
showSkipDialog()
isFromBack = false
} else {
super.dismiss()
}
}
private fun showSkipDialog() {
collectUserInformationView.showSkipDialog()
}
fun show(v: View) {
v.post { showAtLocation(v, Gravity.BOTTOM, 0, 0) }
}
interface OnSendMsgListener {
fun sendMsg(content: String, result: List<UserQuestInfoBean>)
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.yidianling.im.R
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/11
*/
class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String) -> Unit) : RecyclerView.Adapter<CollectInfoStyleAdapter.InfoStyleHolder>() {
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): InfoStyleHolder {
return InfoStyleHolder(LayoutInflater.from(parent!!.context).inflate(R.layout.im_item_collect_info_question_style, parent, false))
}
override fun getItemCount(): Int {
return if (list.size > 9) 9 else list.size
}
override fun onBindViewHolder(holder: InfoStyleHolder?, position: Int) {
holder!!.bindData(list[position])
holder.itemView.setOnClickListener {
event(list[position])
}
}
inner class InfoStyleHolder(var view: View) : RecyclerView.ViewHolder(view) {
private var textView: TextView = view.findViewById(R.id.tv_title)
fun bindData(title: String) {
textView!!.text = title
}
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.support.v7.widget.GridLayoutManager
import android.text.Spannable
import android.text.SpannableString
import android.text.TextUtils
import android.text.style.AbsoluteSizeSpan
import android.text.style.ForegroundColorSpan
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.ScrollView
import android.widget.TextView
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import kotlinx.android.synthetic.main.im_view_collect_user_infomation.view.*
import java.util.*
import kotlin.collections.ArrayList
/**
* @author jiucheng
* @描述:用户信息采集view
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
@SuppressLint("ViewConstructor")
class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Unit, var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit) : LinearLayout(mContext) {
private var resultInfoList = ArrayList<UserQuestInfoBean>()
private var currentIndex = 0
private var year =1994
//todo CommonDialog的样式要改
private var dialog: CommonDialog? = null
private var ageStr = ""
private var genderStr = ""
private var questionStr = ""
private var questionStyleStr = ""
init {
val params = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
layoutParams = params
View.inflate(mContext, R.layout.im_view_collect_user_infomation, this)
orientation = VERTICAL
tv_skip.setOnClickListener {
showSkipDialog()
}
}
fun setData(list: List<UserQuestInfoBean>) {
resultInfoList.clear()
resultInfoList.addAll(list)
addContentView(resultInfoList[0].question!!, true)
proceedNext(list)
}
private fun proceedNext(list: List<UserQuestInfoBean>) {
tv_start.setOnClickListener {
addContentView(resultInfoList[1].question!!, true)
tv_start.visibility = View.GONE
ll_gender.visibility = View.VISIBLE
}
tv_gender_male.setOnClickListener {
addContentView(tv_gender_male.text.toString(), false)
tv_gender_male.postDelayed({
genderStr = "性别:男"
addContentView(resultInfoList[currentIndex].question!!, true)
ll_gender.visibility = View.GONE
rl_age.visibility = View.VISIBLE
}, 300)
}
tv_gender_fomale.setOnClickListener {
addContentView(tv_gender_fomale.text.toString(), false)
tv_gender_fomale.postDelayed({
genderStr = "性别:女"
addContentView(resultInfoList[currentIndex].question!!, true)
ll_gender.visibility = View.GONE
rl_age.visibility = View.VISIBLE
}, 300)
}
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(2).visibility = View.GONE
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(1).visibility = View.GONE
date_pick.init(
year,
Calendar.getInstance().get(Calendar.MONTH),
Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
) { _, year, _, _ ->
this.year = year
}
date_pick.maxDate = Calendar.getInstance().timeInMillis
tv_age_ensure.setOnClickListener {
ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
addContentView("${year}年", false)
tv_age_ensure.postDelayed({
addContentView(resultInfoList[currentIndex].question!!, true)
rl_age.visibility = View.GONE
rl_question_style.visibility = View.VISIBLE
}, 300)
}
val adapter = CollectInfoStyleAdapter(list[3].answerList!!) {
addContentView(it, false)
rl_question_style.postDelayed({
questionStyleStr = "咨询类型:${it}"
addContentView(resultInfoList[currentIndex].question!!, true, resultInfoList[currentIndex].answerList!![0])
rl_question_style.visibility = View.GONE
ll_input.visibility = View.VISIBLE
rl_question_style.postDelayed({ showInputMethod(et_input) }, 100)
scrollView.postDelayed({
scrollView.fullScroll(ScrollView.FOCUS_DOWN)
}, 300)
}, 300)
}
val layoutManager = GridLayoutManager(mContext, 3)
rl_question_style.layoutManager = layoutManager
rl_question_style.adapter = adapter
tv_send.setOnClickListener {
val content = et_input.text.trim().toString()
if (TextUtils.isEmpty(content)) {
ToastUtil.toastShort("请输入内容")
} else {
questionStr = "问题描述:${content}"
addContentView(content, false)
tv_send.postDelayed({
addContentView(resultInfoList[currentIndex].question!!, true)
ll_input.visibility = View.GONE
tv_finish.visibility = View.VISIBLE
hideInputMethod(et_input)
}, 300)
}
}
tv_finish.setOnClickListener {
val resultContent = ageStr + "\n" + genderStr + "\n" + questionStyleStr + "\n" + questionStr
val genderBean = UserQuestInfoBean(list[1].userInfoType, "", ArrayList(), genderStr.split(":")[1])
val ageBean = UserQuestInfoBean(list[2].userInfoType, "", ArrayList(),"${year}")
val questionStyleBean = UserQuestInfoBean(list[3].userInfoType, "", ArrayList(), questionStyleStr.split(":")[1])
val questionBean = UserQuestInfoBean(list[4].userInfoType, "", ArrayList(), questionStr.split(":")[1])
val resultList = ArrayList<UserQuestInfoBean>()
resultList.add(genderBean)
resultList.add(ageBean)
resultList.add(questionStyleBean)
resultList.add(questionBean)
sendMsgEvent(resultContent, resultList)
}
}
@SuppressLint("RtlHardcoded")
private fun addContentView(title: String, send: Boolean, subtitle: String = "") {
val textView = TextView(mContext)
val params = LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
params.topMargin = RxImageTool.dp2px(18f)
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17f)
textView.setTextColor(Color.parseColor("#242424"))
textView.setPadding(RxImageTool.dp2px(13f), RxImageTool.dp2px(9f), RxImageTool.dp2px(13f), RxImageTool.dp2px(9f))
if (send) {
textView.setBackgroundResource(R.drawable.im_background_collect_info_left)
params.gravity = Gravity.LEFT
} else {
textView.setBackgroundResource(R.drawable.im_background_collect_info_right)
params.gravity = Gravity.RIGHT
}
if (!TextUtils.isEmpty(subtitle)) {
val resultText = "$title\n参考:\n$subtitle"
val sbString = SpannableString(resultText)
sbString.setSpan(ForegroundColorSpan(Color.parseColor("#999999")), title.length + 3, resultText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
sbString.setSpan(AbsoluteSizeSpan(12, true), title.length, resultText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
textView.text = sbString
textView.setLineSpacing(4f, 1f)
} else {
textView.text = title
}
textView.maxWidth = RxImageTool.dp2px(255f)
textView.layoutParams = params
ll_content.addView(textView)
if (send) {
currentIndex++
}
}
// 隐藏键盘布局
private fun hideInputMethod(et: EditText) {
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(et.windowToken, 0)
et.clearFocus()
}
// 显示键盘布局
private fun showInputMethod(editTextMessage: EditText) {
editTextMessage.requestFocus()
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(editTextMessage, 0)
}
fun showSkipDialog() {
if (dialog == null) {
dialog = CommonDialog.create(mContext)
.setLeftOnclick("下次吧") {
skipEvent()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
}
if (!dialog!!.isShowing) {
dialog!!.show()
}
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionAdapter(var mContext: Context, var list: List<CommonQuestionBean>, var event: (title: String, id: String) -> Unit) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return CommonQuestionViewHolder(CommonQuestionItemView(mContext))
}
override fun getItemCount(): Int {
return list.size
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
((holder as CommonQuestionViewHolder).itemView as CommonQuestionItemView).setData(list[position].title, list[position].keyword, position == list.size - 1)
holder.itemView.setOnClickListener {
event(list[position].title, list[position].id)
}
}
inner class CommonQuestionViewHolder(view: CommonQuestionItemView) : RecyclerView.ViewHolder(view)
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableString
import android.text.TextUtils
import android.text.style.ForegroundColorSpan
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.yidianling.im.R
import kotlinx.android.synthetic.main.im_item_view_common_question.view.*
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionItemView(var mContext: Context) : LinearLayout(mContext) {
init {
var parmas = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = parmas
View.inflate(mContext, R.layout.im_item_view_common_question, this)
orientation = VERTICAL
}
fun setData(title: String, keyWords: String?, isLast: Boolean) {
if (TextUtils.isEmpty(keyWords)) {
tv_title.text = title
} else {
if (title.contains(keyWords!!)) {
val temp = title.split(keyWords)
val spanString = SpannableString(temp[0] + keyWords + temp[1])
spanString.setSpan(ForegroundColorSpan(Color.parseColor("#1da1f2")), temp[0].length, (temp[0] + keyWords).length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
tv_title.text = spanString
} else {
tv_title.text = title
}
}
if (isLast) {
view_line.visibility = View.GONE
} else {
view_line.visibility = View.VISIBLE
}
}
}
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import kotlinx.android.synthetic.main.im_view_common_question.view.*
/**
* @author jiucheng
* @描述:私聊常见问题view
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionView(var mContext: Context) : LinearLayout(mContext) {
var listener: OnSelectItemListener? = null
init {
var parmas = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = parmas
View.inflate(mContext, R.layout.im_view_common_question, this)
orientation = VERTICAL
}
fun setData(list: List<CommonQuestionBean>) {
if (list.isEmpty()) {
visibility = View.GONE
return
}
if (list.size > 4) {
var parmas = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(214f))
content_view.layoutParams = parmas
}
val adapter = CommonQuestionAdapter(mContext, list) { title, id ->
listener!!.onSelect(title, id)
listener!!.close()
}
var layoutManager = WrapContentLinearLayoutManager(mContext)
content_view.layoutManager = layoutManager as RecyclerView.LayoutManager?
content_view.adapter = adapter
rl_close.setOnClickListener {
listener!!.close()
}
}
fun show() {
visibility = View.VISIBLE
}
fun hide() {
visibility = View.GONE
}
interface OnSelectItemListener {
fun onSelect(title: String, id: String)
fun close()
}
}
\ No newline at end of file
...@@ -4,11 +4,12 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN ...@@ -4,11 +4,12 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.uikit.custom.http.response.ChatStatusBean import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import io.reactivex.Observable import io.reactivex.Observable
import retrofit2.http.GET import okhttp3.RequestBody
import retrofit2.http.Headers import retrofit2.http.*
import retrofit2.http.Query
/** /**
* Created by xj on 2019/6/26. * Created by xj on 2019/6/26.
...@@ -29,4 +30,25 @@ interface ServiceApi{ ...@@ -29,4 +30,25 @@ interface ServiceApi{
@GET("doctor/recommendSimilarListeners") @GET("doctor/recommendSimilarListeners")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getRecommendExpertList(@Query("doctorUid") doctorUid: Long, @Query("catName") catName: String, @Query("limit") limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>> fun getRecommendExpertList(@Query("doctorUid") doctorUid: Long, @Query("catName") catName: String, @Query("limit") limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>>
//获取常用语
@POST("phrase/list")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getCommonQuestionList(): Observable<BaseAPIResponse<List<CommonQuestionBean>>>
//常用语的点击
@GET("phrase/count")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun sendCommonQuestionCount(@Query("id") id: String): Observable<BaseAPIResponse<Any>>
//信息采集的问题
@GET("user/collect/list")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>
//信息采集的问题
@POST("user/collect/submit")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun submitUserCollect(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
} }
\ No newline at end of file
...@@ -3,8 +3,12 @@ package com.yidianling.uikit.custom.http ...@@ -3,8 +3,12 @@ package com.yidianling.uikit.custom.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.uikit.custom.http.response.ChatStatusBean import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import io.reactivex.Observable import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody
/** /**
* Created by xj on 2019/6/26. * Created by xj on 2019/6/26.
...@@ -35,4 +39,33 @@ class ServiceImpl private constructor(){ ...@@ -35,4 +39,33 @@ class ServiceImpl private constructor(){
fun getRecommendExpertList(doctorUid: Long, catName: String, limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>> { fun getRecommendExpertList(doctorUid: Long, catName: String, limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getRecommendExpertList(doctorUid, catName, limit) return YDLHttpUtils.obtainApi(ServiceApi::class.java).getRecommendExpertList(doctorUid, catName, limit)
} }
/**
* 获取常用语
*/
fun getCommonQuestionList(): Observable<BaseAPIResponse<List<CommonQuestionBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getCommonQuestionList()
}
/**
* 常用语的点击
*/
fun sendCommonQuestionCount(id: String): Observable<BaseAPIResponse<Any>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).sendCommonQuestionCount(id)
}
/**
* 信息采集的问题
*/
fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).userCollectList()
}
/**
* 上传采集的问题
*/
fun submitUserCollect(params: String): Observable<BaseAPIResponse<Any>> {
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), params) as RequestBody
return YDLHttpUtils.obtainApi(ServiceApi::class.java).submitUserCollect(body)
}
} }
\ No newline at end of file
package com.yidianling.uikit.custom.http.response
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionBean(var title: String,var id: String, var keyword: String)
\ No newline at end of file
package com.yidianling.uikit.custom.http.response;
import java.util.List;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/13
*/
public class SubmitUserInfoBean {
public List<UserQuestInfoBean> userInfoList;
}
package com.yidianling.uikit.custom.http.response
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/12
*/
class UserQuestInfoBean(var userInfoType: String, var question: String?, var answerList: List<String>?, var content: String?)
\ No newline at end of file
...@@ -51,4 +51,9 @@ interface IImService : IProvider { ...@@ -51,4 +51,9 @@ interface IImService : IProvider {
fun sendTestResultMessage(uid: String, content: String, title: String?, head: String?, url: String?, id: Int, share_url: String?, callback: IMRequestCallback<Void>) fun sendTestResultMessage(uid: String, content: String, title: String?, head: String?, url: String?, id: Int, share_url: String?, callback: IMRequestCallback<Void>)
fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int) fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int)
/**
* 根据uid获取未读数
*/
fun getUnReadByUid(uid: String): Int
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:radius="17dp" />
<solid android:color="#1A1DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:radius="6dp" />
<solid android:color="@color/platform_color_1DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:topRightRadius="6dp" />
<solid android:color="#EBffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:radius="20dp" />
<solid android:color="#1F1DA1F2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:radius="20dp" />
<gradient
android:endColor="@color/platform_color_1DA1F2"
android:startColor="#23B2FA" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"
android:topRightRadius="6dp" />
<solid android:color="#ffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"
android:topLeftRadius="6dp" />
<solid android:color="#CCEBFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:background="@drawable/im_background_chat_collect_info_question_style"
android:gravity="center"
android:paddingTop="7dp"
android:layout_marginTop="14dp"
android:paddingBottom="7dp"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="15sp"
tools:text="恋爱情感" />
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="11dp"
android:layout_marginEnd="17dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="2"
android:minHeight="44dp"
android:paddingTop="11dp"
android:paddingBottom="11dp"
android:textColor="#242424"
android:textSize="16sp"
tools:text="咨询顾问的服咨询顾问的服咨询顾问的服务收费吗务收费吗咨询顾问的服务收费吗务收费吗?" />
<View
android:id="@+id/view_line"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="11dp"
android:layout_marginEnd="17dp"
android:background="#EBEBEB" />
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/white">
<ImageView
android:id="@+id/iv_close"
android:layout_width="26dp"
android:layout_height="30dp"
android:layout_marginRight="6dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/tv_title"
android:src="@drawable/im_ico_default_avatar" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="咨询前评估"
android:textColor="@color/im_color_242424"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_skip"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="跳过"
android:textColor="@color/im_color_grey_999999"
android:textSize="14sp" />
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/platform_color_F0F0F0">
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="18dp"
android:paddingRight="18dp"
android:paddingBottom="28dp">
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/rl_choose_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:minHeight="56dp">
<!-- 开始-->
<TextView
android:id="@+id/tv_start"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:background="@drawable/im_background_collect_info_bottom_start"
android:gravity="center"
android:text="好的"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="visible"
tools:visibility="gone" />
<!-- 性别-->
<LinearLayout
android:id="@+id/ll_gender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv_gender_male"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@drawable/im_background_collect_info_bottom_gender"
android:gravity="center"
android:text="男"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_gender_fomale"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="@drawable/im_background_collect_info_bottom_gender"
android:gravity="center"
android:text="女"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="16sp" />
</LinearLayout>
<!-- 年龄-->
<RelativeLayout
android:id="@+id/rl_age"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="请选择出生年份"
android:textColor="@color/im_color_242424"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_age_ensure"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingRight="20dp"
android:text="确定"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="17sp" />
<DatePicker
android:id="@+id/date_pick"
android:layout_width="match_parent"
android:layout_height="205dp"
android:layout_below="@+id/title"
android:calendarViewShown="false"
android:datePickerMode="spinner" />
</RelativeLayout>
<!-- 问题类型?-->
<android.support.v7.widget.RecyclerView
android:id="@+id/rl_question_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingTop="6dp"
android:paddingRight="20dp"
android:paddingBottom="20dp"
android:visibility="gone"
tools:layout_height="160dp" />
<!-- 问题输入-->
<LinearLayout
android:id="@+id/ll_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/platform_color_F7F7F7"
android:orientation="horizontal"
android:paddingRight="20dp"
android:visibility="gone"
tools:visibility="visible">
<EditText
android:id="@+id/et_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/im_nim_chat_input_edit_background"
android:hint="放心咨询,信息保密"
android:minHeight="37dp"
android:paddingStart="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp"
android:paddingBottom="5dp"
android:textColor="@color/im_color_242424"
android:textColorHint="@color/platform_color_BFBFBF"
android:textSize="14sp"
tools:text="放心咨询,信放心咨询,信息保密放心咨询,信息保密放心咨询,信息保密放心咨询,信息保密放心咨询,信息保密息保密" />
<TextView
android:id="@+id/tv_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="12dp"
android:background="@drawable/im_background_chat_collect_info_send"
android:gravity="center"
android:padding="5dp"
android:text="@string/send"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
<!-- 开始-->
<TextView
android:id="@+id/tv_finish"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:background="@drawable/im_background_collect_info_bottom_start"
android:gravity="center"
android:text="去沟通"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<android.support.v7.widget.RecyclerView
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_height="200dp" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#EBEBEB" />
<RelativeLayout
android:id="@+id/rl_close"
android:layout_width="match_parent"
android:layout_height="42dp">
<TextView
android:id="@+id/tv_common"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="11dp"
android:layout_marginRight="13dp"
android:gravity="center_vertical"
android:text="常见问题"
android:textColor="#242424"
android:textStyle="bold" />
</RelativeLayout>
</merge>
\ No newline at end of file
...@@ -484,8 +484,37 @@ ...@@ -484,8 +484,37 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="58dp" android:layout_marginTop="58dp"
android:visibility="gone" /> android:visibility="gone" />
<!-- 快捷回复-->
<RelativeLayout
android:id="@+id/rl_common_question"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:paddingRight="13dp"
android:layout_gravity="bottom"
android:background="@drawable/im_background_chat_common_question">
<TextView
android:id="@+id/tv_open_common_question"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="11dp"
android:gravity="center_vertical"
android:text="常见问题"
android:textColor="@color/platform_color_1DA1F2"
android:textStyle="bold" />
</RelativeLayout>
</FrameLayout> </FrameLayout>
<FrameLayout
android:id="@+id/fl_question_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:visibility="gone" />
<include layout="@layout/im_nim_message_activity_bottom_layout" /> <include layout="@layout/im_nim_message_activity_bottom_layout" />
</LinearLayout> </LinearLayout>
...@@ -10,21 +10,22 @@ import com.ydl.ydlcommon.modular.ModularServiceManager ...@@ -10,21 +10,22 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
* Created by Dog on 2015/5/8. * Created by Dog on 2015/5/8.
*/ */
open class BaseCommand { open class BaseCommand {
@JvmField
var uid = "0" var uid = "0"
@JvmField
var accessToken = "" var accessToken = ""
@JvmField
var ts: String var ts: String
@JvmField
var version: String var version: String
@JvmField
var osBuild = var osBuild =
RxDeviceTool.getBuildMANUFACTURER() + "," + RxDeviceTool.getBuildBrandModel() + "," + RxDeviceTool.getOsBuileVersion() + "," + RxDeviceTool.getAppVersionName( RxDeviceTool.getBuildMANUFACTURER() + "," + RxDeviceTool.getBuildBrandModel() + "," + RxDeviceTool.getOsBuileVersion() + "," + RxDeviceTool.getAppVersionName(
BaseApp.getApp() BaseApp.getApp()
) )
@JvmField
var isFromApp = "1"//2表示专家版1表示用户版 var isFromApp = "1"//2表示专家版1表示用户版
@JvmField
var ffrom = PlatformDataManager.getRam().getChannelName()//渠Y道来源 var ffrom = PlatformDataManager.getRam().getChannelName()//渠Y道来源
init { init {
......
...@@ -51,6 +51,8 @@ dependencies { ...@@ -51,6 +51,8 @@ dependencies {
api rootProject.ext.dependencies["ydl-user-router"] api rootProject.ext.dependencies["ydl-user-router"]
api fileTree(dir: 'libs', include: ['*.jar']) api fileTree(dir: 'libs', include: ['*.jar'])
api 'com.tencent.tbs.tbssdk:sdk:43697'
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
//开发时使用 //开发时使用
api project(':ydl-platform') api project(':ydl-platform')
......
...@@ -17,6 +17,7 @@ class H5JsBean { ...@@ -17,6 +17,7 @@ class H5JsBean {
var params: Params? = null var params: Params? = null
var action_name: String? = null var action_name: String? = null
var callBack: String = ""
class Params { class Params {
......
...@@ -247,6 +247,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -247,6 +247,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
* 15秒后发送一条消息通知展示无网络页面 * 15秒后发送一条消息通知展示无网络页面
*/ */
private void sendNetLossMessage() { private void sendNetLossMessage() {
if (null != mTimeOutHandler)
mTimeOutHandler.sendEmptyMessageDelayed(TIME_OUT_TYPE, timeOutLong); mTimeOutHandler.sendEmptyMessageDelayed(TIME_OUT_TYPE, timeOutLong);
} }
...@@ -254,8 +255,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -254,8 +255,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
* 取消预定15秒后发送的消息 * 取消预定15秒后发送的消息
*/ */
private void cancelSendNetLossMessage() { private void cancelSendNetLossMessage() {
if (null != mTimeOutHandler) {
mTimeOutHandler.removeMessages(TIME_OUT_TYPE); mTimeOutHandler.removeMessages(TIME_OUT_TYPE);
} }
}
private void initLoadingView() { private void initLoadingView() {
wv_content.setBackgroundColor(0); wv_content.setBackgroundColor(0);
......
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