Commit e0a4873f by fengquan

feat: 聊天页面咨询服务弹框样式修改

parent fdcdb8bf
......@@ -98,12 +98,14 @@ 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.NewUserMesBean;
import com.yidianling.uikit.custom.http.response.ServiceItemBean;
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean;
import com.yidianling.uikit.custom.widget.ConfideOrderInfoView;
import com.yidianling.uikit.custom.widget.ExpertInfoDialog;
import com.yidianling.uikit.custom.widget.TitleBarBottom;
import com.yidianling.uikit.custom.widget.UserInfoDialog;
import com.yidianling.uikit.custom.widget.expertConsultService.view.ExpertConsultServiceListDialog;
import com.yidianling.uikit.custom.widget.expertConsultService.view.ExpertConsultServiceListDialog2;
import com.yidianling.user.api.service.IUserService;
import org.jetbrains.annotations.NotNull;
......@@ -154,6 +156,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private RelativeLayout rl_contain;
private boolean initHeightFinish;
public TitleBarBottom titleBar;
private List<ServiceItemBean> serviceItemBeanList;
public InputPanel getInputPanel() {
return inputPanel;
}
......@@ -208,6 +214,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private ExpertInfoDialog expertInfoDialog;
private ExpertConsultServiceListDialog expertConsultServiceListDialog;
private ExpertConsultServiceListDialog2 expertConsultServiceListDialog2;
private int IN_OUT_DURATION = 400;
......@@ -930,26 +937,22 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private void initMenu() {
rela_zixun.setOnClickListener(view -> {
if (sessionId != null && ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (expertConsultServiceListDialog == null) {
ServiceImpl.Companion.getInstance().serviceList(ActionHandlerStorage.getL(sessionId).getInfo().doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (res.data != null && res.data.size() > 0) {
if (getActivity() != null && expertConsultServiceListDialog == null) {
expertConsultServiceListDialog = new ExpertConsultServiceListDialog(getActivity(), res.data,isBusy,sessionId,
ActionHandlerStorage.getL(sessionId).getInfo().doctorId
);
expertConsultServiceListDialog.show();
if (serviceItemBeanList == null || serviceItemBeanList.size() == 0) {
ServiceImpl.Companion.getInstance().serviceList(ActionHandlerStorage.getL(sessionId).getInfo().doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (res.data != null && res.data.size() > 0) {
serviceItemBeanList = res.data;
showConsultService(res.data,isBusy,sessionId, ActionHandlerStorage.getL(sessionId).getInfo().doctorId);
} else {
ToastUtil.toastShort("咨询师暂未发布服务");
}
} else {
ToastUtil.toastShort("咨询师暂未发布服务");
}
}, throwable -> {
});
} else {
expertConsultServiceListDialog.show();
}
}, throwable -> {
});
} else {
showConsultService(serviceItemBeanList, isBusy, sessionId, ActionHandlerStorage.getL(sessionId).getInfo().doctorId);
}
} else {
ToastUtil.toastShort("请退出聊天重试");
}
......@@ -1093,6 +1096,8 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
comment_banner_view.onDestory();
EventBus.getDefault().unregister(this);
super.onDestroy();
serviceItemBeanList.clear();
serviceItemBeanList = null;
messageListPanel.onDestroy();
registerObservers(false);
if (inputPanel != null) {
......@@ -1175,7 +1180,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
}
public void onEvent(CloseBottomWebviewEvent event){
expertConsultServiceListDialog.changeItem();
expertConsultServiceListDialog2.changeItem();
}
private void updateLocalMsg(Integer position,ArrayList<String> selectedPosition) {
IMMessage message=ImIn.INSTANCE.getImMessage();
......@@ -1604,4 +1609,15 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
ActionCountUtils.Companion.count("under_age_alert_page|under_age_alert_page_visit");
}
private void showConsultService(List<ServiceItemBean> list, Boolean mIsBusy,
String toUid, String doctorID) {
if (getActivity() != null) {
expertConsultServiceListDialog2 = new ExpertConsultServiceListDialog2(getActivity(), list, isBusy, sessionId,
ActionHandlerStorage.getL(sessionId).getInfo().doctorId);
expertConsultServiceListDialog2.show();
}
}
}
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.*
import android.widget.FrameLayout
import androidx.fragment.app.FragmentActivity
import androidx.viewpager.widget.PagerAdapter
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.netease.nimlib.sdk.NIMClient
import com.netease.nimlib.sdk.RequestCallback
import com.netease.nimlib.sdk.msg.MessageBuilder
import com.netease.nimlib.sdk.msg.MsgService
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.im.R
import com.yidianling.im.session.extension.CustomAttachSubScriptTime
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_list_dialog_layout.dialog_bottom_scroll_view
import kotlinx.android.synthetic.main.im_expert_consult_service_list_fragment_layout.*
class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<ServiceItemBean>, val mIsBusy: Boolean,
val toUid:String, val doctorID:String) : BottomSheetDialogFragment() {
private var mConsultServiceListView: ExpertConsultServiceView? = null
private var mWebviewView: ExpertConsultWebview? = null
private var mViewList: ArrayList<View> = ArrayList()
private var mSelectType: String = "全部"
var bottomSheet: FrameLayout? = null
private var behavior: BottomSheetBehavior<*>? = null
fun changeItem(){
dialog_bottom_scroll_view.currentItem = 0
}
@SuppressLint("WrongConstant")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.AppBottomSheet)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.im_expert_consult_service_list_fragment_layout, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
var typeList:ArrayList<String> = ArrayList()
typeList.add(mSelectType)//默认选中
mList.forEach { item ->
typeList.add(item.cateName)
}
mConsultServiceListView = ExpertConsultServiceView(mContext,mIsBusy)
(mConsultServiceListView as ExpertConsultServiceView).setDataAndClick(typeList, mList, object :
ConsultServiceViewCallback {
override fun onCloseClick() {
dismiss()
}
override fun onItemClick(serviceBean: ServiceItemBean.ProductsBean) {
// if (mConsultServiceDetailView != null) {
// mConsultServiceDetailView?.updateData(serviceBean)
// dialog_bottom_scroll_view.currentItem = 1
// }
mWebviewView?.setData(serviceBean)
dialog_bottom_scroll_view.currentItem = 1
}
override fun addTime() { // 提醒添加时间回调
dismiss()
// 埋点
ActionCountUtils.baiDuCountSign3("ydl_user_product_page","remind_add_click",toUid,
ActionHandlerStorage.getL(toUid).info.name,"")
// 发送提醒消息
val customTime = CustomAttachSubScriptTime("请尽快添加可预约时间")
val message = MessageBuilder.createCustomMessage(toUid, SessionTypeEnum.P2P, "请尽快添加可预约时间", customTime)
NIMClient.getService(MsgService::class.java).sendMessage(message, false).setCallback(object :
RequestCallback<Void> {
override fun onSuccess(param: Void?) {
MessageListPanelHelper.getInstance().notifyAddMessage(message)
}
override fun onException(exception: Throwable?) {
}
override fun onFailed(code: Int) {
}
})
}
})
consult_service_dialog_close.setOnTouchListener { v, event ->
when(event.action){
MotionEvent.ACTION_DOWN ->{
behavior?.isHideable = true
}
}
true
}
mViewList.add(mConsultServiceListView as View)
// mConsultServiceDetailView = ExpertConsultServiceDetailView(mContext, object : ConsultServiceViewCallback {
// override fun onBackClick() {
// dialog_bottom_scroll_view.currentItem = 0
// }
// },mIsBusy,toUid)
// mViewList.add(mConsultServiceDetailView as View)
mWebviewView= ExpertConsultWebview(mContext,doctorID =doctorID )
mViewList.add(mWebviewView as View)
dialog_bottom_scroll_view.adapter = ConsultServicePagerAdapter()
dialog_bottom_scroll_view.currentItem = 0
}
override fun setCancelable(cancelable: Boolean) {
val dialog = dialog
val touchOutsideView =
dialog?.window?.decorView?.findViewById<View>(com.google.android.material.R.id.touch_outside)
val bottomSheetView =
dialog?.window?.decorView?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
if (cancelable) {
touchOutsideView?.setOnClickListener(View.OnClickListener {
if (dialog.isShowing) {
dialog.cancel()
}
})
BottomSheetBehavior.from<View>(bottomSheetView!!).setHideable(true)
} else {
touchOutsideView?.setOnClickListener(null)
// if false 按返回键也无法取消
// dialog.setCancelable(false)
BottomSheetBehavior.from<View>(bottomSheetView!!).setHideable(false)
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
dialog.setOnShowListener {
val layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
behavior = BottomSheetBehavior.from(bottomSheet!!)
behavior?.peekHeight = RxDeviceTool.getScreenHeight(mContext) - RxImageTool.dp2px(100f)
behavior?.isHideable = false
setMaxHeight(RxDeviceTool.getScreenHeight(mContext) - RxImageTool.dp2px(100f))
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
// behavior?.skipCollapsed=true
behavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
when (newState) {
BottomSheetBehavior.STATE_EXPANDED -> {
behavior?.state = BottomSheetBehavior.STATE_COLLAPSED
behavior?.isHideable = false
}
BottomSheetBehavior.STATE_DRAGGING -> {
}
BottomSheetBehavior.STATE_COLLAPSED -> {
behavior?.isHideable = false
}
}
}
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
})
}
return dialog
}
private fun setMaxHeight(height: Int) {
bottomSheet?.layoutParams?.height = height
bottomSheet?.requestLayout()
}
internal inner class ConsultServicePagerAdapter : PagerAdapter() {
override fun getCount(): Int {
return mViewList.size
}
override fun isViewFromObject(view: View, `object`: Any): Boolean {
return view === `object`
}
override fun instantiateItem(container: ViewGroup, position: Int): Any {
val view = mViewList[position]
container.addView(view)
return view
}
override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
container.removeView(`object` as View)
}
}
fun show() {
if (mContext is FragmentActivity){
show(mContext.supportFragmentManager, "consult_bottom_showdialog")
}
}
}
\ No newline at end of file
......@@ -78,9 +78,9 @@ class ExpertConsultServiceView : LinearLayout {
listener: ConsultServiceViewCallback?
) {
mListener = listener
consult_service_dialog_close.setOnClickListener {
mListener?.onCloseClick()
}
// consult_service_dialog_close.setOnClickListener {
// mListener?.onCloseClick()
// }
// 设置顶部滚动类型数据
if (typeList == null || typeList.size == 0) {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#D7D7D7"/>
<corners android:radius="2dp"/>
</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:shape="rectangle">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
<solid android:color="#ffffff"/>
<solid android:color="@color/white"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/im_expert_conslt_service_list_top_bg">
<LinearLayout
android:id="@+id/consult_service_dialog_close"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_29"
android:orientation="vertical">
<View
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_5"
android:layout_marginTop="@dimen/platform_dp_12"
android:paddingLeft="@dimen/platform_dp_10"
android:paddingRight="@dimen/platform_dp_10"
android:background="@drawable/bg_consult_service_close"
android:layout_gravity="center" />
</LinearLayout>
<com.ydl.ydlcommon.view.NoScrollViewPager
android:id="@+id/dialog_bottom_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"></com.ydl.ydlcommon.view.NoScrollViewPager>
</LinearLayout>
\ No newline at end of file
......@@ -6,19 +6,11 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="24dp"
>
<ImageView
android:id="@+id/consult_service_dialog_close"
android:layout_width="16dp"
android:layout_height="16dp"
android:src="@drawable/im_expert_service_list_left_delete"
android:layout_marginLeft="14dp"
android:scaleType="centerCrop"
android:layout_centerVertical="true"/>
android:layout_marginTop="@dimen/platform_dp_5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="咨询服务"
android:text="选择服务主题"
android:textColor="#242424"
android:textSize="18dp"
android:textStyle="bold"
......@@ -29,7 +21,7 @@
android:id="@+id/expert_consult_service_top_scroll"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="6dp"
android:layout_marginTop="@dimen/platform_dp_10"
android:paddingLeft="15dp"
android:clipToPadding="false"
android:scrollbars="none">
......@@ -43,11 +35,6 @@
</LinearLayout>
</HorizontalScrollView>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#EBEBEB"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
......
......@@ -138,5 +138,11 @@
<attr name="maxHeight" format="dimension" />
</declare-styleable>
<style name="AppBottomSheet" parent="Theme.Design.BottomSheetDialog">
<item name="bottomSheetStyle">@style/AppBottomSheetStyle</item>
</style>
<style name="AppBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="backgroundTint">@android:color/transparent</item>
</style>
</resources>
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