Commit f527082a by 刘鹏

feat: 修复我的界面快速点击问题

parent 263d4903
...@@ -8,7 +8,7 @@ ext { ...@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.49.74", "m-confide" : "0.0.49.74",
"m-consultant" : "0.0.60.25", "m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08", "m-fm" : "0.0.30.08",
"m-user" : "0.0.62.09", "m-user" : "0.0.62.10",
"m-home" : "0.0.23.48", "m-home" : "0.0.23.48",
"m-im" : "0.0.21.44", "m-im" : "0.0.21.44",
"m-dynamic" : "0.0.7.73", "m-dynamic" : "0.0.7.73",
...@@ -93,7 +93,7 @@ ext { ...@@ -93,7 +93,7 @@ ext {
"m-confide" : "0.0.49.74", "m-confide" : "0.0.49.74",
"m-consultant" : "0.0.60.25", "m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08", "m-fm" : "0.0.30.08",
"m-user" : "0.0.62.09", "m-user" : "0.0.62.10",
"m-home" : "0.0.23.48", "m-home" : "0.0.23.48",
"m-im" : "0.0.21.44", "m-im" : "0.0.21.44",
"m-dynamic" : "0.0.7.73", "m-dynamic" : "0.0.7.73",
......
package com.yidianling.user.mine; package com.yidianling.user.mine
import android.annotation.SuppressLint; import android.annotation.SuppressLint
import android.app.Activity; import android.app.Activity
import android.content.Intent; import android.content.Intent
import android.os.Bundle; import android.os.Bundle
import androidx.core.content.ContextCompat; import android.text.TextUtils
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import android.view.View
import androidx.cardview.widget.CardView; import androidx.core.content.ContextCompat
import android.text.TextUtils; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import android.view.View; import com.ydl.course.api.ICourseService
import android.widget.Button; import com.ydl.webview.H5Params
import android.widget.ImageView; import com.ydl.webview.NewH5Activity
import android.widget.TextView; import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.base.BaseFragment
import com.ydl.course.api.ICourseService; import com.ydl.ydlcommon.base.config.HttpConfig.Companion.H5_URL
import com.ydl.webview.H5Params; import com.ydl.ydlcommon.base.config.HttpConfig.Companion.MH5_URL
import com.ydl.webview.NewH5Activity; import com.ydl.ydlcommon.base.config.HttpConfig.Companion.YDL_H5
import com.ydl.ydl_image.module.GlideApp; import com.ydl.ydlcommon.data.PlatformRamImpl
import com.ydl.ydlcommon.base.BaseFragment; import com.ydl.ydlcommon.data.http.BaseCommand
import com.ydl.ydlcommon.base.config.HttpConfig; import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.PlatformRamImpl; import com.ydl.ydlcommon.data.http.RxUtils.netCheck
import com.ydl.ydlcommon.data.http.BaseCommand; import com.ydl.ydlcommon.data.http.RxUtils.resultJavaData
import com.ydl.ydlcommon.data.http.RxUtils; import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.data.http.ThrowableConsumer; import com.ydl.ydlcommon.modular.ModularServiceManager.provide
import com.ydl.ydlcommon.modular.ModularServiceManager; import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.BuryPointUtils; import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.Utils; import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.utils.YdlBuryPointUtil; import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils.Companion.count
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils; import com.ydl.ydlcommon.view.dialog.YDLShareDialog.Companion.style4
import com.ydl.ydlcommon.view.JumpTextView; import com.yidianling.consultant.api.IConsultantService
import com.ydl.ydlcommon.view.dialog.YDLShareDialog; import com.yidianling.dynamic.api.IDynamicService
import com.ydl.ydlcommon.view.widgets.BorderCircleImageView; import com.yidianling.im.api.service.IImService
import com.yidianling.consultant.api.IConsultantService; import com.yidianling.im.message.param.MsgListParam
import com.yidianling.dynamic.api.IDynamicService; import com.yidianling.user.BuildConfig
import com.yidianling.im.api.service.IImService; import com.yidianling.user.R
import com.yidianling.im.message.param.MsgListParam; import com.yidianling.user.UserHelper.getUserInfo
import com.yidianling.user.BuildConfig; import com.yidianling.user.UserHelper.getUsetSetting
import com.yidianling.user.R; import com.yidianling.user.UserHelper.isLogin
import com.yidianling.user.UserHelper; import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserResponseBean; import com.yidianling.user.api.event.RefreshRecentContactListEvent
import com.yidianling.user.api.event.RefreshRecentContactListEvent; import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IAppService; import com.yidianling.user.constants.UserBIConstants.UserMyPageEvent
import com.yidianling.user.mine.data.AppDataManager; import com.yidianling.user.mine.bean.CouponNumBean
import com.yidianling.user.mine.http.MineHttpImpl; import com.yidianling.user.mine.data.AppDataManager.getHttp
import com.yidianling.user.route.UserIn; import com.yidianling.user.mine.data.AppDataManager.getLocal
import com.yidianling.user.safePrivate.PrivacyActivity; import com.yidianling.user.mine.http.MineHttpImpl
import com.yidianling.user.ui.login.OneKeyLoginHelp; import com.yidianling.user.route.UserIn.getImService
import com.yidianling.user.safePrivate.PrivacyActivity
import org.jetbrains.annotations.NotNull; import com.yidianling.user.ui.login.OneKeyLoginHelp.startLoginByStatus
import org.jetbrains.annotations.Nullable; import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import java.text.SimpleDateFormat; import io.reactivex.functions.Consumer
import java.util.Date; import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_mine_fragment_mine.*
import de.greenrobot.event.EventBus; import java.text.SimpleDateFormat
import io.reactivex.android.schedulers.AndroidSchedulers; import java.util.*
import io.reactivex.schedulers.Schedulers;
import static com.yidianling.user.constants.UserBIConstants.UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK;
import static com.yidianling.user.constants.UserBIConstants.UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK;
import static com.yidianling.user.constants.UserBIConstants.UserMyPageEvent.YDL_USER_MY_PAGE_STAY_VISIT;
import static com.yidianling.user.constants.UserBIConstants.UserMyPageEvent.YDL_USER_MY_PAGE_VISIT;
import static com.yidianling.user.constants.UserBIConstants.UserMyPageEvent.YDL_USER_MY_TOP_TYPE_CLICK;
/** /**
* 我的Tab * 我的Tab
* Created by softrice on 15/11/23. * Created by softrice on 15/11/23.
*/ */
public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener, View.OnClickListener { class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.OnClickListener {
private var mActivity: Activity? = null
private Activity mActivity; var share_title = "壹点灵-专业心理咨询平台"
String share_title = "壹点灵-专业心理咨询平台"; var share_context = "帮您解决各种恋爱情感、婚姻、生活烦恼"
String share_context = "帮您解决各种恋爱情感、婚姻、生活烦恼"; var share_head = "http://static.ydlcdn.com/v1/images/logo320.png"
String share_head = "http://static.ydlcdn.com/v1/images/logo320.png"; var share_url = "http://m.yidianling.com/app"
String share_url = "http://m.yidianling.com/app"; var userInfoData: UserResponseBean.UserInfo? = null
UserResponseBean.UserInfo userInfoData;
private var startTime: Long = 0
ImageView img_bg; private var endTime: Long = 0
BorderCircleImageView img_head; override fun layoutResId(): Int {
TextView text_userName; return R.layout.user_mine_fragment_mine
JumpTextView jtv_account_privacy;
JumpTextView jtv_account_help;
JumpTextView jtv_about_us;
JumpTextView jtv_account_enter;
TextView tishi;
private TextView mAttentionTv;
private CardView mDurationCardView;
private TextView mTendNumTv;
private TextView mDurationTv;
private TextView mFansNumTv;
private View mNewCoupon;
private ImageView mLogoView;
private TextView mTestRecordNumTv;
//debug包下切换环境的按钮
private Button mChangeBtn;
/**
* debug包下任意门入口
* 可在这个按钮点击事件中去到任何你想去的地方
*/
private JumpTextView jtv_test;
private SwipeRefreshLayout swipeRefreshLayout;
private long startTime=0 ;
private long endTime=0;
@Override
public int layoutResId() {
return R.layout.user_mine_fragment_mine;
} }
@Override override fun onCreate(savedInstanceState: Bundle?) {
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState)
super.onCreate(savedInstanceState); mActivity = requireActivity()
mActivity = requireActivity();
} }
@Override override fun initDataAndEvent() {
public void initDataAndEvent() {
if (!EventBus.getDefault().isRegistered(this)) { if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this); EventBus.getDefault().register(this)
} }
swipeRefreshLayout = getRootView().findViewById(R.id.swipe_refresh_layout); swipe_refresh_layout?.setColorSchemeColors(
swipeRefreshLayout.setColorSchemeColors(ContextCompat.getColor(requireContext(), R.color.platform_main_theme)); ContextCompat.getColor(
swipeRefreshLayout.setProgressViewOffset(false, 0, 200); requireContext(),
R.color.platform_main_theme
img_bg = getRootView().findViewById(R.id.img_bg); )
img_head = getRootView().findViewById(R.id.img_head); )
text_userName = getRootView().findViewById(R.id.text_userName); swipe_refresh_layout.setProgressViewOffset(false, 0, 200)
mDurationTv = getRootView().findViewById(R.id.tv_duration); img_head.setOnClickListener(this)
mDurationCardView = getRootView().findViewById(R.id.cv_duration); //debug包下切换环境的按钮
mAttentionTv = getRootView().findViewById(R.id.tv_attention_num); btn_change.setOnClickListener(this)
mChangeBtn = getRootView().findViewById(R.id.btn_change); jtv_account_privacy.setOnClickListener(this)
mTendNumTv = getRootView().findViewById(R.id.tv_trend_num); jtv_account_help.setOnClickListener(this)
mFansNumTv = getRootView().findViewById(R.id.tv_fans_tv); jtv_about_us.setOnClickListener(this)
mTestRecordNumTv = getRootView().findViewById(R.id.tv_test_record_num); jtv_account_enter.setOnClickListener(this)
jtv_account_privacy = getRootView().findViewById(R.id.jtv_account_privacy); cv_duration.setOnClickListener(this)
jtv_account_help = getRootView().findViewById(R.id.jtv_account_help); text_userName.setOnClickListener(this)
jtv_about_us = getRootView().findViewById(R.id.jtv_about_us); jtv_test.setOnClickListener(this)
jtv_account_enter = getRootView().findViewById(R.id.jtv_account_enter); swipe_refresh_layout.setOnRefreshListener(this)
jtv_test = getRootView().findViewById(R.id.jtv_test); rootView.findViewById<View>(R.id.ll_trade_order).setOnClickListener(this)
tishi = getRootView().findViewById(R.id.tishi); rootView.findViewById<View>(R.id.jtv_introduce).setOnClickListener(this)
mNewCoupon = getRootView().findViewById(R.id.view_new_coupon); rootView.findViewById<View>(R.id.iv_edit_info).setOnClickListener(this)
mLogoView = getRootView().findViewById(R.id.iv_mine_logo);
img_head.setOnClickListener(this);
mChangeBtn.setOnClickListener(this);
jtv_account_privacy.setOnClickListener(this);
jtv_account_help.setOnClickListener(this);
jtv_about_us.setOnClickListener(this);
jtv_account_enter.setOnClickListener(this);
mDurationCardView.setOnClickListener(this);
text_userName.setOnClickListener(this);
jtv_test.setOnClickListener(this);
swipeRefreshLayout.setOnRefreshListener(this);
getRootView().findViewById(R.id.ll_trade_order).setOnClickListener(this);
getRootView().findViewById(R.id.jtv_introduce).setOnClickListener(this);
getRootView().findViewById(R.id.iv_edit_info).setOnClickListener(this);
//分享 //分享
getRootView().findViewById(R.id.iv_share).setOnClickListener(this); rootView.findViewById<View>(R.id.iv_share).setOnClickListener(this)
getRootView().findViewById(R.id.ll_my_courses).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_my_courses).setOnClickListener(this)
getRootView().findViewById(R.id.ll_red_packet).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_red_packet).setOnClickListener(this)
getRootView().findViewById(R.id.ll_call_order).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_call_order).setOnClickListener(this)
getRootView().findViewById(R.id.ll_account).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_account).setOnClickListener(this)
getRootView().findViewById(R.id.ll_guanzhu).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_guanzhu).setOnClickListener(this)
getRootView().findViewById(R.id.ll_my_trends).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_my_trends).setOnClickListener(this)
getRootView().findViewById(R.id.ll_fans).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_fans).setOnClickListener(this)
getRootView().findViewById(R.id.ll_my_test_log).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_my_test_log).setOnClickListener(this)
//客服 //客服
getRootView().findViewById(R.id.ll_service).setOnClickListener(this); rootView.findViewById<View>(R.id.ll_service).setOnClickListener(this)
init(); init()
GlideApp.with(this).load("https://static.yidianling.com/banner/bottombanner@2x.png")
.into(iv_mine_logo)
GlideApp.with(this).load("https://static.yidianling.com/banner/bottombanner@2x.png").into(mLogoView);
// jtv_test.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
refreshCouponData();
}
@Override
public void initDataAndEventLazy() {
refreshCouponData()
} }
void init() { override fun initDataAndEventLazy() {}
if (null != PlatformRamImpl.Companion.getInstance().getGlobalInfo() && null != PlatformRamImpl.Companion.getInstance().getGlobalInfo().info && null != PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.app_share) { fun init() {
share_title = PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.app_share.title; if (null != PlatformRamImpl.getInstance()
share_context = PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.app_share.descrip; .getGlobalInfo() && null != PlatformRamImpl.getInstance()
share_head = PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.app_share.cover_url; .getGlobalInfo()?.info && null != PlatformRamImpl.getInstance()
share_url = PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.app_share.dl_url; .getGlobalInfo()?.info?.app_share
) {
share_title = PlatformRamImpl.getInstance().getGlobalInfo()?.info?.app_share?.title.toString()
share_context = PlatformRamImpl.getInstance().getGlobalInfo()?.info?.app_share?.descrip.toString()
share_head = PlatformRamImpl.getInstance().getGlobalInfo()?.info?.app_share?.cover_url.toString()
share_url = PlatformRamImpl.getInstance().getGlobalInfo()?.info?.app_share?.dl_url.toString()
} }
} }
@Override override fun onResume() {
public void onResume() { super.onResume()
super.onResume(); updateUI()
updateUI();
} }
@Override override fun setUserVisibleHint(isVisibleToUser: Boolean) {
public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser)
super.setUserVisibleHint(isVisibleToUser); if (isVisibleToUser && isResumed) {
if (isVisibleToUser && isResumed()) { startTime = System.currentTimeMillis()
startTime=System.currentTimeMillis(); count(UserMyPageEvent.YDL_USER_MY_PAGE_VISIT)
ActionCountUtils.Companion.count(YDL_USER_MY_PAGE_VISIT); showConsultAssistantDialog()
showConsultAssistantDialog();
} else { } else {
if (startTime!=0L){ if (startTime != 0L) {
endTime=System.currentTimeMillis(); endTime = System.currentTimeMillis()
ActionCountUtils.Companion.count(YDL_USER_MY_PAGE_STAY_VISIT,String.valueOf(endTime-startTime)); count(UserMyPageEvent.YDL_USER_MY_PAGE_STAY_VISIT, (endTime - startTime).toString())
} }
hideConsultAssistantDialog(); hideConsultAssistantDialog()
} }
if (isVisibleToUser && isResumed()) { if (isVisibleToUser && isResumed) {
onResume(); onResume()
} }
} }
@Override override fun onPause() {
public void onPause() { super.onPause()
super.onPause(); if (startTime != 0L) {
if (startTime!=0L){ endTime = System.currentTimeMillis()
endTime=System.currentTimeMillis(); count(UserMyPageEvent.YDL_USER_MY_PAGE_STAY_VISIT, (endTime - startTime).toString())
ActionCountUtils.Companion.count(YDL_USER_MY_PAGE_STAY_VISIT,String.valueOf(endTime-startTime));
} }
} }
private void showConsultAssistantDialog() { private fun showConsultAssistantDialog() {
ActionCountUtils.Companion.count("daoyi_advertisement_page|daoyi_advertisement_visit","4"); count("daoyi_advertisement_page|daoyi_advertisement_visit", "4")
ModularServiceManager.INSTANCE.provide(IConsultantService.class).showConsultAssistantMineDialog(getActivity()); mActivity?.let { provide(IConsultantService::class.java).showConsultAssistantMineDialog(it) }
} }
private void hideConsultAssistantDialog() { private fun hideConsultAssistantDialog() {
ModularServiceManager.INSTANCE.provide(IConsultantService.class).hideConsultAssistantMineDialog(); provide(
IConsultantService::class.java
).hideConsultAssistantMineDialog()
} }
/** /**
* DEBUG包中:增加切换环境功能,线上包会自动隐藏此按钮 * DEBUG包中:增加切换环境功能,线上包会自动隐藏此按钮
*/ */
private void debugChangeEnvironment() { private fun debugChangeEnvironment() {
//debug包、未登录前提下才能切换环境 //debug包、未登录前提下才能切换环境
if (BuildConfig.DEBUG && !UserHelper.INSTANCE.isLogin()) { if (BuildConfig.DEBUG && !isLogin()) {
mChangeBtn.setVisibility(View.VISIBLE); btn_change?.visibility = View.VISIBLE
} else { } else {
mChangeBtn.setVisibility(View.GONE); btn_change?.visibility = View.GONE
} }
} }
override fun onRefresh() {
@Override updateUserInfo()
public void onRefresh() { refreshCouponData()
updateUserInfo();
refreshCouponData();
} }
/** /**
* 更新优惠券信息 * 更新优惠券信息
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void refreshCouponData() { private fun refreshCouponData() {
UserResponseBean userInfo = UserHelper.INSTANCE.getUserInfo(); val userInfo = getUserInfo() ?: return
//获取用户信息 //获取用户信息
if (userInfo == null) { MineHttpImpl.getInstance().getNewCoupon(BaseCommand())
return; .compose(netCheck())
} .subscribeOn(Schedulers.io())
MineHttpImpl.Companion.getInstance().getNewCoupon(new BaseCommand()) .observeOn(AndroidSchedulers.mainThread())
.compose(RxUtils.netCheck()) .subscribe({ response: BaseResponse<CouponNumBean> ->
.subscribeOn(Schedulers.io()) if (response.data != null) {
.observeOn(AndroidSchedulers.mainThread()) if (response.data?.count ?: 0 > 0) {
.subscribe(response -> { view_new_coupon.visibility = View.VISIBLE
if (response.data != null) { } else {
if (response.data.count > 0) { view_new_coupon.visibility = View.INVISIBLE
mNewCoupon.setVisibility(View.VISIBLE);
} else {
mNewCoupon.setVisibility(View.INVISIBLE);
}
} }
}, throwable -> { }
}); }) { throwable: Throwable? -> }
} }
/** /**
* 更新用户信息 * 更新用户信息
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void updateUserInfo() { private fun updateUserInfo() {
UserResponseBean userInfo = UserHelper.INSTANCE.getUserInfo(); val userInfo = getUserInfo()
//获取用户信息 //获取用户信息
if (userInfo == null) { if (userInfo == null) {
swipeRefreshLayout.setRefreshing(false); swipe_refresh_layout.isRefreshing = false
return; return
} }
if (userInfo.getUid() == null || userInfo.getAccessToken() == null) { if (userInfo.uid == null || userInfo.accessToken == null) {
swipeRefreshLayout.setRefreshing(false); swipe_refresh_layout.isRefreshing = false
return; return
} }
AppDataManager.INSTANCE.getHttp().getUserInfo() getHttp().getUserInfo()
.compose(RxUtils.resultJavaData()) .compose(resultJavaData())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(response -> { .subscribe(Consumer { response: UserResponseBean ->
swipeRefreshLayout.setRefreshing(false); swipe_refresh_layout.isRefreshing = false
try { try {
//此处后端返回信息,只有userinfo,其它数据为空,切勿整体赋值 //此处后端返回信息,只有userinfo,其它数据为空,切勿整体赋值
UserHelper.INSTANCE.getUserInfo().setUserInfo(response.getUserInfo()); getUserInfo()?.userInfo = response.userInfo
updateUI(); updateUI()
} catch (Exception e) { } catch (e: Exception) {
} }
}, new ThrowableConsumer() { }, object : ThrowableConsumer() {
@Override override fun accept(msg: String) {
public void accept(@NotNull String msg) { swipe_refresh_layout.isRefreshing = false
swipeRefreshLayout.setRefreshing(false); }
} })
});
} }
/** /**
* 获取用户信息成功后调用此方法更新 ui * 获取用户信息成功后调用此方法更新 ui
*/ */
public void updateUI() { fun updateUI() {
initdata(); initdata()
if (AppDataManager.INSTANCE.getLocal().hasUpdate()) { if (getLocal().hasUpdate()) {
jtv_about_us.setLeftRedDotVisibility(View.VISIBLE); jtv_about_us?.setLeftRedDotVisibility(View.VISIBLE)
} else { } else {
jtv_about_us.setLeftRedDotVisibility(View.GONE); jtv_about_us?.setLeftRedDotVisibility(View.GONE)
} }
//切换环境按钮逻辑 //切换环境按钮逻辑
debugChangeEnvironment(); debugChangeEnvironment()
} }
private fun initdata() {
private void initdata() { if (isLogin()) {
if (UserHelper.INSTANCE.isLogin()) { setUserInfo(getUserInfo()?.userInfo)
setUserInfo(UserHelper.INSTANCE.getUserInfo().getUserInfo());
} else { } else {
text_userName.setText("未登录"); text_userName?.text = "未登录"
mDurationTv.setText("点击登录/注册"); tv_duration?.text = "点击登录/注册"
img_head.setImageResource(R.drawable.platform_head_place_hold_pic); img_head?.setImageResource(R.drawable.platform_head_place_hold_pic)
mAttentionTv.setText("0"); tv_attention_num?.text = "0"
mTendNumTv.setText("0"); tv_trend_num?.text = "0"
mFansNumTv.setText("0"); tv_fans_tv?.text = "0"
mTestRecordNumTv.setText("0"); tv_test_record_num?.text = "0"
view_new_coupon?.visibility = View.INVISIBLE
mNewCoupon.setVisibility(View.INVISIBLE);
} }
} }
private void setUserInfo(UserResponseBean.UserInfo userInfo) { private fun setUserInfo(userInfo: UserResponseBean.UserInfo?) {
this.userInfoData = userInfo; userInfoData = userInfo
if (userInfo == null) { if (userInfo == null) {
return; return
} }
val nick_name = userInfo.nick_name
String nick_name = userInfo.getNick_name();
if (!TextUtils.isEmpty(nick_name)) { if (!TextUtils.isEmpty(nick_name)) {
text_userName.setText(nick_name); text_userName?.text = nick_name
} else { } else {
text_userName.setText("昵称未设置"); text_userName?.text = "昵称未设置"
} }
tv_attention_num?.text = userInfo.attentionNum.toString()
mAttentionTv.setText(String.valueOf(userInfo.getAttentionNum())); tv_trend_num?.text = userInfo.trendNum.toString()
mTendNumTv.setText(String.valueOf(userInfo.getTrendNum())); tv_fans_tv?.text = userInfo.fansNum.toString()
mFansNumTv.setText(String.valueOf(userInfo.getFansNum())); tv_test_record_num?.text = userInfo.testRecordNum.toString()
mTestRecordNumTv.setText(String.valueOf(userInfo.getTestRecordNum())); tv_duration?.text = userInfo.registTime
mDurationTv.setText(userInfo.getRegistTime()); cv_duration?.visibility = View.VISIBLE
mDurationCardView.setVisibility(View.VISIBLE); if (userInfo.head != null) {
if (userInfo.getHead() != null) {
GlideApp.with(this) GlideApp.with(this)
.load(userInfo.getHead()) .load(userInfo.head)
.dontAnimate() .dontAnimate()
.placeholder(R.drawable.platform_head_place_hold_pic) .placeholder(R.drawable.platform_head_place_hold_pic)
.error(R.drawable.platform_head_place_hold_pic) .error(R.drawable.platform_head_place_hold_pic)
.into(img_head); .into(img_head)
} }
} }
@Override override fun onClick(v: View) {
public void onClick(View v) { val id = v.id //切换环境逻辑按钮
int id = v.getId();//切换环境逻辑按钮 if (Utils.isFastClick()) {
//防止连击
return
}
if (id == R.id.text_userName || id == R.id.cv_duration) { if (id == R.id.text_userName || id == R.id.cv_duration) {
OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true); mActivity?.let { startLoginByStatus(it, true) }
} else if (id == R.id.iv_edit_info) { } else if (id == R.id.iv_edit_info) {
//账号设置 //账号设置
ActionCountUtils.Companion.count(YDL_USER_MY_BOTTOM_TYPE_CLICK,"设置"); count(UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK, "设置")
//点击消息 未登录请先登录 //点击消息 未登录请先登录
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { mActivity?.let { activity ->
return; if (!startLoginByStatus(activity, true)) {
} return
startActivity(new Intent(getActivity(), AccountSettingActivity.class)); }
} else if (id == R.id.img_head) {//头像 startActivity(Intent(activity, AccountSettingActivity::class.java))
if (Utils.isFastClick()) {
return;
}
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) {
return;
} }
ActionCountUtils.Companion.count(YDL_USER_MY_TOP_TYPE_CLICK,"头像"); } else if (id == R.id.img_head) { //头像
if (userInfoData != null) { mActivity?.let { activity ->
Intent intentuser = new Intent(getActivity(), PersonalInfoActivity.class); if (!startLoginByStatus(activity, true)) {
startActivity(intentuser); return
}
count(UserMyPageEvent.YDL_USER_MY_TOP_TYPE_CLICK, "头像")
if (userInfoData != null) {
val intentuser = Intent(activity, PersonalInfoActivity::class.java)
startActivity(intentuser)
}
} }
} else if (id == R.id.ll_account) {//账户余额
ActionCountUtils.Companion.count(YDL_USER_MY_MIDDLE_TYPE_CLICK,"账号余额"); } else if (id == R.id.ll_account) { //账户余额
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { count(UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK, "账号余额")
return; mActivity?.let { activity ->
if (!startLoginByStatus(activity, true)) {
return
}
startActivity(Intent(activity, AccountHistoryActivity::class.java))
} }
startActivity(new Intent(getActivity(), AccountHistoryActivity.class));
} else if (id == R.id.ll_red_packet) {//我的红包 } else if (id == R.id.ll_red_packet) { //我的红包
ActionCountUtils.Companion.count(YDL_USER_MY_MIDDLE_TYPE_CLICK,"红包卡券"); count(UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK, "红包卡券")
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { mActivity?.let { activity ->
return; if (!startLoginByStatus(activity, true)) {
return
}
clearCouponStatus()
provide(IAppService::class.java).myRedPockIntent(activity)
} }
clearCouponStatus();
ModularServiceManager.INSTANCE.provide(IAppService.class).myRedPockIntent(mActivity); } else if (id == R.id.ll_fans) { //粉丝
} else if (id == R.id.ll_fans) {//粉丝 count(UserMyPageEvent.YDL_USER_MY_TOP_TYPE_CLICK, "我的粉丝")
ActionCountUtils.Companion.count(YDL_USER_MY_TOP_TYPE_CLICK,"我的粉丝"); mActivity?.let { activity ->
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { if (!startLoginByStatus(activity, true)) {
return; return
}
val h5Params = H5Params(H5_URL + "mine/fans-list", null)
NewH5Activity.start(activity, h5Params)
} }
H5Params h5Params = new H5Params(HttpConfig.Companion.getH5_URL() + "mine/fans-list", null); } else if (id == R.id.ll_guanzhu) { //我关注的
NewH5Activity.start(getActivity(), h5Params); count(UserMyPageEvent.YDL_USER_MY_TOP_TYPE_CLICK, "我的关注")
} else if (id == R.id.ll_guanzhu) {//我关注的 mActivity?.let { activity ->
ActionCountUtils.Companion.count(YDL_USER_MY_TOP_TYPE_CLICK,"我的关注"); if (!startLoginByStatus(activity, true)) {
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { return
return; }
val h5Params1 = H5Params(H5_URL + "mine/follow-per", null)
NewH5Activity.start(activity, h5Params1)
} }
H5Params h5Params1 = new H5Params(HttpConfig.Companion.getH5_URL() + "mine/follow-per", null);
NewH5Activity.start(getActivity(), h5Params1);
} else if (id == R.id.ll_my_trends) { } else if (id == R.id.ll_my_trends) {
ActionCountUtils.Companion.count(YDL_USER_MY_TOP_TYPE_CLICK,"我的动态"); count(UserMyPageEvent.YDL_USER_MY_TOP_TYPE_CLICK, "我的动态")
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { mActivity?.let { activity ->
return; if (!startLoginByStatus(activity, true)) {
} return
BuryPointUtils.getInstance().createMap() }
BuryPointUtils.getInstance().createMap()
.put("mine_name", "我的动态") .put("mine_name", "我的动态")
.burryPoint("mine"); .burryPoint("mine")
try { try {
Intent intentm = ModularServiceManager.INSTANCE.provide(IDynamicService.class).getMyTrendsActivityIntent(mActivity); val intentm = provide(IDynamicService::class.java).getMyTrendsActivityIntent(activity)
startActivity(intentm); startActivity(intentm)
} catch (Exception e) { } catch (e: Exception) {
} e.printStackTrace()
} else if (id == R.id.jtv_account_privacy) {// 未登录请先登录 }
ActionCountUtils.Companion.count(YDL_USER_MY_BOTTOM_TYPE_CLICK,"帮助中心");
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) {
return;
} }
UserHelper.INSTANCE.getUsetSetting().setMeSafePrivateIsClick(true);
jtv_account_privacy.setLeftRedDotVisibility(View.GONE); } else if (id == R.id.jtv_account_privacy) { // 未登录请先登录
startActivity(new Intent(getActivity(), PrivacyActivity.class)); count(UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK, "帮助中心")
} else if (id == R.id.ll_trade_order) {//预约 mActivity?.let { activity ->
ActionCountUtils.Companion.count(YDL_USER_MY_MIDDLE_TYPE_CLICK,"预约订单"); if (!startLoginByStatus(activity, true)) {
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { return
return; }
getUsetSetting()?.meSafePrivateIsClick = true
jtv_account_privacy?.setLeftRedDotVisibility(View.GONE)
startActivity(Intent(activity, PrivacyActivity::class.java))
} }
BuryPointUtils.getInstance().createMap()
} else if (id == R.id.ll_trade_order) { //预约
count(UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK, "预约订单")
mActivity?.let { activity ->
if (!startLoginByStatus(activity, true)) {
return
}
BuryPointUtils.getInstance().createMap()
.put("mine_name", "预约订单") .put("mine_name", "预约订单")
.burryPoint("mine"); .burryPoint("mine")
H5Params h5Params3 = new H5Params(HttpConfig.Companion.getMH5_URL() + "wb/user/order/list?needOrderHelperAlert=1", null); val h5Params3 = H5Params(MH5_URL + "wb/user/order/list?needOrderHelperAlert=1", null)
NewH5Activity.start(getActivity(), h5Params3); NewH5Activity.start(activity, h5Params3)
} else if (id == R.id.ll_my_courses) {//我的课程
ActionCountUtils.Companion.count(YDL_USER_MY_MIDDLE_TYPE_CLICK,"我的课程");
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) {
return;
} }
ModularServiceManager.INSTANCE.provide(ICourseService.class).startMyCourseActivity(mActivity);
} else if (id == R.id.ll_call_order) {//倾诉 } else if (id == R.id.ll_my_courses) { //我的课程
ActionCountUtils.Companion.count(YDL_USER_MY_MIDDLE_TYPE_CLICK,"倾诉记录"); count(UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK, "我的课程")
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { mActivity?.let { activity ->
return; if (!startLoginByStatus(activity, true)) {
return
}
provide(ICourseService::class.java).startMyCourseActivity(activity)
} }
BuryPointUtils.getInstance().createMap()
} else if (id == R.id.ll_call_order) { //倾诉
count(UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK, "倾诉记录")
mActivity?.let { activity ->
if (!startLoginByStatus(activity, true)) {
return
}
BuryPointUtils.getInstance().createMap()
.put("mine_name", "倾诉记录") .put("mine_name", "倾诉记录")
.burryPoint("mine"); .burryPoint("mine")
H5Params h5Paramsqing = new H5Params(HttpConfig.Companion.getYDL_H5() + "confideOrderList", null); val h5Paramsqing = H5Params(YDL_H5 + "confideOrderList", null)
NewH5Activity.start(getActivity(), h5Paramsqing); NewH5Activity.start(activity, h5Paramsqing)
} else if (id == R.id.jtv_account_help) {//帮助
ActionCountUtils.Companion.count(YDL_USER_MY_BOTTOM_TYPE_CLICK,"帮助中心");
H5Params params = new H5Params(HttpConfig.Companion.getH5_URL() + "help/", "");
params.setShowMenu(true);
NewH5Activity.start(getActivity(), params);
} else if (id == R.id.jtv_account_enter) {//专家入驻
ActionCountUtils.Companion.count(YDL_USER_MY_BOTTOM_TYPE_CLICK,"专家入驻");
if (PlatformRamImpl.Companion.getInstance().getGlobalInfo() != null &&
PlatformRamImpl.Companion.getInstance().getGlobalInfo().info != null &&
!TextUtils.isEmpty(PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.join_doctor_url)) {
H5Params h5Paramzhuan = new H5Params(PlatformRamImpl.Companion.getInstance().getGlobalInfo().info.join_doctor_url, null);
NewH5Activity.start(getActivity(), h5Paramzhuan);
} else {
H5Params h5Paramzhuan = new H5Params("http://m.yidianling.com/enter?", null);
NewH5Activity.start(getActivity(), h5Paramzhuan);
} }
} else if (id == R.id.ll_my_test_log) {//测试记录
ActionCountUtils.Companion.count(YDL_USER_MY_TOP_TYPE_CLICK,"测试记录"); } else if (id == R.id.jtv_account_help) { //帮助
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { count(UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK, "帮助中心")
return; val params = H5Params(H5_URL + "help/", "")
params.isShowMenu = true
NewH5Activity.start(activity, params)
} else if (id == R.id.jtv_account_enter) { //专家入驻
count(UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK, "专家入驻")
var joinDoctorUrl = PlatformRamImpl.getInstance().getGlobalInfo()?.info?.join_doctor_url
if (joinDoctorUrl.isNullOrEmpty()) {
joinDoctorUrl= "http://m.yidianling.com/enter?"
} }
BuryPointUtils.getInstance().createMap() val h5Paramzhuan = H5Params(joinDoctorUrl, null)
NewH5Activity.start(activity, h5Paramzhuan)
} else if (id == R.id.ll_my_test_log) { //测试记录
count(UserMyPageEvent.YDL_USER_MY_TOP_TYPE_CLICK, "测试记录")
mActivity?.let { activity ->
if (!startLoginByStatus(activity, true)) {
return
}
BuryPointUtils.getInstance().createMap()
.put("mine_name", "测试记录") .put("mine_name", "测试记录")
.burryPoint("mine"); .burryPoint("mine")
H5Params testParam = new H5Params(HttpConfig.Companion.getMH5_URL() + "ceshi/my-test", "测试记录"); val testParam = H5Params(MH5_URL + "ceshi/my-test", "测试记录")
NewH5Activity.start(getActivity(), testParam); NewH5Activity.start(activity, testParam)
} else if (id == R.id.iv_share) {//分享 }
ActionCountUtils.Companion.count(YDL_USER_MY_BOTTOM_TYPE_CLICK,"分享");
share(); } else if (id == R.id.iv_share) { //分享
count(UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK, "分享")
share()
} else if (id == R.id.jtv_about_us) { } else if (id == R.id.jtv_about_us) {
startActivity(new Intent(getActivity(), AboutUsActivity.class)); startActivity(Intent(activity, AboutUsActivity::class.java))
} else if (id == R.id.ll_service) { } else if (id == R.id.ll_service) {
if (!OneKeyLoginHelp.INSTANCE.startLoginByStatus(mActivity,true)) { mActivity?.let { activity ->
return; if (!startLoginByStatus(activity, true)) {
return
}
getImService().startP2PXiaoYi(activity)
} }
UserIn.INSTANCE.getImService().startP2PXiaoYi(mActivity);
} else if (id == R.id.jtv_introduce) { } else if (id == R.id.jtv_introduce) {
ActionCountUtils.Companion.count(YDL_USER_MY_BOTTOM_TYPE_CLICK,"壹点灵介绍"); count(UserMyPageEvent.YDL_USER_MY_BOTTOM_TYPE_CLICK, "壹点灵介绍")
H5Params params1 = new H5Params("https://m.yidianling.com/about", "网站介绍"); val params1 = H5Params("https://m.yidianling.com/about", "网站介绍")
NewH5Activity.start(getActivity(), params1); NewH5Activity.start(activity, params1)
}else if (id == R.id.btn_change) { } else if (id == R.id.btn_change) {
} else if (id == R.id.jtv_test) {//debug下任意门入口 } else if (id == R.id.jtv_test) { //debug下任意门入口
SimpleDateFormat sdf = new SimpleDateFormat(); jtv_test?.postDelayed({ YdlBuryPointUtil.sendPv("PvEvent") }, 300)
sdf.applyPattern("yyyy-MM-dd HH:mm:ss"); jtv_test?.postDelayed({ YdlBuryPointUtil.sendClick("ClickEvent") }, 500)
Date date = new Date();
jtv_test.postDelayed(new Runnable() {
@Override
public void run() {
YdlBuryPointUtil.sendPv("PvEvent");
}
}, 300);
jtv_test.postDelayed(new Runnable() {
@Override
public void run() {
YdlBuryPointUtil.sendClick("ClickEvent");
}
}, 500);
} }
} }
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private void clearCouponStatus() { private fun clearCouponStatus() {
MineHttpImpl.Companion.getInstance().getSysMsgList(new MsgListParam(1 + "", 1)) MineHttpImpl.getInstance().getSysMsgList(MsgListParam(1.toString() + "", 1))
.compose(RxUtils.netCheck()) .compose(netCheck())
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(response -> { .subscribe({ response: BaseResponse<String>? ->
if (response != null && response.code == 0) { if (response != null && response.code == 0) {
mNewCoupon.setVisibility(View.INVISIBLE); view_new_coupon.visibility = View.INVISIBLE
} }
}, throwable -> { }) { throwable: Throwable? -> }
});
} }
private void share() { private fun share() {
YDLShareDialog dialog = YDLShareDialog.Companion.style4(mActivity, share_title, share_url, share_context, share_head); val dialog = mActivity?.let {activity ->
dialog.show(getActivity().getFragmentManager(), "lose"); style4(activity, share_title, share_url, share_context, share_head)
}
dialog?.show(activity?.fragmentManager, "lose")
} }
/** /**
* 收到照片选取事件 * 收到照片选取事件
*/ */
public void onEventBackgroundThread(UserResponseBean event) { fun onEventBackgroundThread(event: UserResponseBean?) {
if (event != null && event.getUserInfo() != null) { if (event?.userInfo != null) {
userInfoData = event.getUserInfo(); userInfoData = event.userInfo
} }
} }
public void onEvent(RefreshRecentContactListEvent event) { fun onEvent(event: RefreshRecentContactListEvent?) {
refreshCouponData(); refreshCouponData()
} }
public void onEvent(UserChangeEvent event) { fun onEvent(event: UserChangeEvent) {
boolean change_flag = event.isChange_flag(); val changeFlag = event.isChange_flag
if (change_flag) { if (changeFlag) {
initdata(); initdata()
try { try {
ModularServiceManager.INSTANCE.provide(IImService.class).updateUserHead(UserHelper.INSTANCE.getUserInfo().getUserInfo().getHead()); provide(
} catch (Exception e) { IImService::class.java
).updateUserHead(getUserInfo()?.userInfo?.head)
} catch (e: Exception) {
} }
} }
} }
......
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