Commit 509e7fbb by 徐健

删除H5返回按钮拦截,增加新用户侧滑返回拦截

parent b400651e
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = true dev_mode = false
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -45,9 +45,9 @@ ext { ...@@ -45,9 +45,9 @@ ext {
"m-confide" : "0.0.48.6", "m-confide" : "0.0.48.6",
"m-consultant" : "0.0.57.4", "m-consultant" : "0.0.57.4",
"m-fm" : "0.0.29.3", "m-fm" : "0.0.29.3",
"m-user" : "0.0.59.23", "m-user" : "0.0.59.28",
"m-home" : "0.0.19.1", "m-home" : "0.0.19.1",
"m-im" : "0.0.16.9", "m-im" : "0.0.16.10",
"m-dynamic" : "0.0.6.1", "m-dynamic" : "0.0.6.1",
"m-muse" : "0.0.28.9", "m-muse" : "0.0.28.9",
...@@ -72,7 +72,7 @@ ext { ...@@ -72,7 +72,7 @@ ext {
"ydl-platform" : "0.0.39.16", "ydl-platform" : "0.0.39.16",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.15", "ydl-webview" : "0.0.38.24",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.1", "m-audioim" : "0.0.48.1",
...@@ -118,7 +118,7 @@ ext { ...@@ -118,7 +118,7 @@ ext {
"ydl-platform" : "0.0.39.16", "ydl-platform" : "0.0.39.16",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.15", "ydl-webview" : "0.0.38.24",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.1", "m-audioim" : "0.0.48.1",
......
...@@ -2,6 +2,7 @@ package com.yidianling.user.ui.collect ...@@ -2,6 +2,7 @@ package com.yidianling.user.ui.collect
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Intent
import android.view.KeyEvent import android.view.KeyEvent
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
...@@ -13,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivity ...@@ -13,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.config.HttpConfig import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.YDLCommonDialog import com.ydl.ydlcommon.view.dialog.YDLCommonDialog
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
...@@ -40,8 +42,23 @@ class CollectFocusActivity : BaseActivity() { ...@@ -40,8 +42,23 @@ class CollectFocusActivity : BaseActivity() {
private var selectedNumber: Int = 0 private var selectedNumber: Int = 0
private var mList: ArrayList<CollectFocusItemBean> = ArrayList() private var mList: ArrayList<CollectFocusItemBean> = ArrayList()
private var isYfd: Boolean = false //是否是云凤蝶
companion object {
private const val IS_YFD = "is_yfd" //是否是云凤蝶key
fun start(context: Context, isYFD: Boolean) {
val intent = Intent(context, CollectFocusActivity::class.java)
intent.putExtra(IS_YFD, isYFD)
context.startActivity(intent)
}
}
override fun initDataAndEvent() { override fun initDataAndEvent() {
isYfd = intent.getBooleanExtra(IS_YFD, false)
ActionCountUtils.count(UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_PAGE_VISIT) ActionCountUtils.count(UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_PAGE_VISIT)
// 获取关注数据 // 获取关注数据
...@@ -234,8 +251,13 @@ class CollectFocusActivity : BaseActivity() { ...@@ -234,8 +251,13 @@ class CollectFocusActivity : BaseActivity() {
upload_focus_info_btn.postDelayed({ upload_focus_info_btn.postDelayed({
completeDialog?.dismiss() completeDialog?.dismiss()
if (!isFinishing) { if (!isFinishing) {
val h5Params = H5Params("$it?cateIds=$cateIds", H5Params.BackLimit.NewUserBackLimit) val h5Params = H5Params(
"$it?cateIds=$cateIds?barHeight=" + StatusBarUtils.getStatusBarHeight(
this
).toString(), H5Params.BackLimit.NEW_USER_PAGE, true
)
NewH5Activity.start(this, h5Params) NewH5Activity.start(this, h5Params)
finish()
} }
}, 1000) }, 1000)
} }
......
...@@ -15,6 +15,7 @@ import com.ydl.ydl_router.manager.YDLRouterParams ...@@ -15,6 +15,7 @@ import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.YDLCommonDialog import com.ydl.ydlcommon.view.dialog.YDLCommonDialog
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
...@@ -38,7 +39,8 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -38,7 +39,8 @@ class CollectSexAndBirthActivity : BaseActivity() {
private var selectedSex = -1 // 1 男 2 女 private var selectedSex = -1 // 1 男 2 女
private var selectedYear = 1995 private var selectedYear = 1995
private var originYear =1900 private var originYear = 1900
private var nowYear: Int = 0
private var collectOutDialog: YDLCommonDialog? = null private var collectOutDialog: YDLCommonDialog? = null
private var yearList: ArrayList<String> = ArrayList() private var yearList: ArrayList<String> = ArrayList()
...@@ -59,49 +61,64 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -59,49 +61,64 @@ class CollectSexAndBirthActivity : BaseActivity() {
if (selectedSex != 1) { if (selectedSex != 1) {
selectedSex = 1 selectedSex = 1
checkUpSelect() checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_MAN_CLICK, "1") ActionCountUtils.count(
}else { UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_MAN_CLICK,
"1"
)
} else {
selectedSex = -1 selectedSex = -1
checkUpSelect() checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_MAN_CLICK, "2") ActionCountUtils.count(
UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_MAN_CLICK,
"2"
)
} }
} }
female_rl.setOnClickListener { female_rl.setOnClickListener {
if (selectedSex != 2) { if (selectedSex != 2) {
selectedSex = 2 selectedSex = 2
checkUpSelect() checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_FEMALE_CLICK, "1") ActionCountUtils.count(
UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_FEMALE_CLICK,
"1"
)
}else { } else {
selectedSex = -1 selectedSex = -1
checkUpSelect() checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_FEMALE_CLICK, "2") ActionCountUtils.count(
UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_FEMALE_CLICK,
"2"
)
} }
} }
sex_and_birth_out.setOnClickListener { sex_and_birth_out.setOnClickListener {
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_EXIT_CLICK) ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_EXIT_CLICK)
if (null == collectOutDialog) { if (null == collectOutDialog) {
collectOutDialog = YDLCommonDialog(this, object : YDLCommonDialog.OnYDLCommonDialogListener { collectOutDialog =
override fun onCancel() { YDLCommonDialog(this, object : YDLCommonDialog.OnYDLCommonDialogListener {
// 这是左侧按钮 - 确定 override fun onCancel() {
collectOutDialog?.dismiss() // 这是左侧按钮 - 确定
jumpToNewUserH5() collectOutDialog?.dismiss()
} jumpToNewUserH5()
}
override fun onSure() {
// 这是右侧按钮 - 取消 override fun onSure() {
collectOutDialog?.dismiss() // 这是右侧按钮 - 取消
} collectOutDialog?.dismiss()
}
}).setNullTitleDesc("确定要退出吗?\n" +
"很多人在这里得到了帮助哦").setCancelText("确定").setSureText("取消") }).setNullTitleDesc(
"确定要退出吗?\n" +
"很多人在这里得到了帮助哦"
).setCancelText("确定").setSureText("取消")
} }
collectOutDialog?.show() collectOutDialog?.show()
} }
//年份选择器 //年份选择器
val date = Calendar.getInstance() val date = Calendar.getInstance()
val nowYear: Int = date.get(Calendar.YEAR) nowYear = date.get(Calendar.YEAR)
while (originYear <= nowYear) { while (originYear <= nowYear) {
yearList.add("$originYear") yearList.add("$originYear")
originYear++ originYear++
...@@ -112,7 +129,10 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -112,7 +129,10 @@ class CollectSexAndBirthActivity : BaseActivity() {
user_collect_date_pick.post { user_collect_date_pick.post {
if (user_collect_date_pick.measuredHeight > RxImageTool.dp2px(175f)) { if (user_collect_date_pick.measuredHeight > RxImageTool.dp2px(175f)) {
val param = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(175f)) val param = RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RxImageTool.dp2px(175f)
)
user_collect_date_pick.layoutParams = param user_collect_date_pick.layoutParams = param
user_collect_date_pick?.value = selectedYear user_collect_date_pick?.value = selectedYear
...@@ -123,7 +143,8 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -123,7 +143,8 @@ class CollectSexAndBirthActivity : BaseActivity() {
user_collect_date_pick.displayedValues = yearList.toTypedArray() user_collect_date_pick.displayedValues = yearList.toTypedArray()
user_collect_date_pick.minValue = 1900 user_collect_date_pick.minValue = 1900
user_collect_date_pick.maxValue = nowYear user_collect_date_pick.maxValue = nowYear
user_collect_date_pick.descendantFocusability = NumberPicker.FOCUS_BLOCK_DESCENDANTS // 关闭编辑功能 user_collect_date_pick.descendantFocusability =
NumberPicker.FOCUS_BLOCK_DESCENDANTS // 关闭编辑功能
user_collect_date_pick.wrapSelectorWheel = false // 关闭循环 user_collect_date_pick.wrapSelectorWheel = false // 关闭循环
user_collect_date_pick.value = selectedYear user_collect_date_pick.value = selectedYear
...@@ -135,18 +156,26 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -135,18 +156,26 @@ class CollectSexAndBirthActivity : BaseActivity() {
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun uploadSexAndBirth() { private fun uploadSexAndBirth() {
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_NEXT_CLICK, "$selectedYear") ActionCountUtils.count(
UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_NEXT_CLICK,
"$selectedYear"
)
val userInfoBean = UserInfoCollectUploadParam() val userInfoBean = UserInfoCollectUploadParam()
userInfoBean.userInfoList = ArrayList() userInfoBean.userInfoList = ArrayList()
userInfoBean.userInfoList.add(UserInfoCollectParam(if (selectedSex == 1) "男" else "女", "gener")) userInfoBean.userInfoList.add(
UserInfoCollectParam(
if (selectedSex == 1) "男" else "女",
"gener"
)
)
userInfoBean.userInfoList.add(UserInfoCollectParam("$selectedYear", "age")) userInfoBean.userInfoList.add(UserInfoCollectParam("$selectedYear", "age"))
UserHttpImpl.getInstance().userInfoCollectUpload(userInfoBean) UserHttpImpl.getInstance().userInfoCollectUpload(userInfoBean)
.compose(RxUtils.resultJavaData()) .compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread()) .subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
var intent = Intent(this, CollectFocusActivity::class.java) CollectFocusActivity.start(this, nowYear - selectedYear <= 16)
startActivity(intent) finish()
}, { }, {
Log.i("上传数据异常", it.toString()) Log.i("上传数据异常", it.toString())
}) })
...@@ -160,8 +189,13 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -160,8 +189,13 @@ class CollectSexAndBirthActivity : BaseActivity() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe({ .subscribe({
if (!isFinishing) { if (!isFinishing) {
val h5Params = H5Params(it, "mainPage") val h5Params = H5Params(
"$it?barHeight=" + StatusBarUtils.getStatusBarHeight(
this
).toString(), H5Params.BackLimit.NEW_USER_PAGE, true
)
NewH5Activity.start(this, h5Params) NewH5Activity.start(this, h5Params)
finish()
} }
}, { }, {
}) })
...@@ -174,12 +208,12 @@ class CollectSexAndBirthActivity : BaseActivity() { ...@@ -174,12 +208,12 @@ class CollectSexAndBirthActivity : BaseActivity() {
female_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg) female_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg)
male_img.setImageResource(R.drawable.user_male_selected) male_img.setImageResource(R.drawable.user_male_selected)
female_img.setImageResource(R.drawable.user_female_unselected) female_img.setImageResource(R.drawable.user_female_unselected)
male_txt.setTextColor(Color.parseColor("#1DA1F2")) male_txt.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
female_txt.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme)) female_txt.setTextColor(Color.parseColor("#242424"))
sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg) sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg)
} else if (selectedSex == 2) { } else if (selectedSex == 2) {
male_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg) male_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg)
female_rl.setBackgroundResource(R.drawable.user_collect_select_bg) female_rl.setBackgroundResource(R.drawable.user_collect_select_bg)
male_img.setImageResource(R.drawable.user_male_unselected) male_img.setImageResource(R.drawable.user_male_unselected)
female_img.setImageResource(R.drawable.user_female_selected) female_img.setImageResource(R.drawable.user_female_selected)
......
...@@ -14,9 +14,9 @@ class H5Params : Serializable { ...@@ -14,9 +14,9 @@ class H5Params : Serializable {
this.title = title this.title = title
} }
constructor(url: String, backLimit: BackLimit, boolean: Boolean = true): super() { constructor(url: String, backLimit: BackLimit, hasBackLimit: Boolean): super() {
this.url =url this.url =url
if (boolean) { if (hasBackLimit) {
this.backLimit = backLimit this.backLimit = backLimit
} }
} }
...@@ -68,12 +68,12 @@ class H5Params : Serializable { ...@@ -68,12 +68,12 @@ class H5Params : Serializable {
*/ */
var phone: String? = null var phone: String? = null
/** /**
* h5页面返回按钮限制(根据传入的backLimit判断返回至哪个页面) * h5页面返回按钮限制
*/ */
var backLimit: BackLimit = BackLimit.NewUserBackLimit var backLimit: BackLimit? = null
enum class BackLimit{ enum class BackLimit {
NewUserBackLimit //新用户H5页面返回拦截 NEW_USER_PAGE // 新用户引导页面
} }
} }
\ No newline at end of file
...@@ -819,7 +819,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -819,7 +819,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title.setImageListener(v -> { tb_title.setImageListener(v -> {
if (wv_content.canGoBack()) { if (wv_content.canGoBack()) {
wv_content.goBack(); wv_content.goBack();
} else { }
else {
finish(); finish();
} }
}); });
...@@ -833,7 +834,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -833,7 +834,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.getShowUrlTitle()) { if (h5Params.getShowUrlTitle()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish(); finish();
} else { }
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) { if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
} }
...@@ -1127,7 +1129,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1127,7 +1129,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.isSplash()) { if (h5Params.isSplash()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish(); finish();
} else { }
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) { if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this); WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
} }
...@@ -1261,21 +1264,19 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1261,21 +1264,19 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
/** /**
* 增加逻辑:在高级题测试页面,按物理返回键直接finish当前页面,不走webview.goback()逻辑 * 新用户侧滑按钮限制
*/ */
if (h5Params.isControlBack()) { if (h5Params.getBackLimit() != null && h5Params.getBackLimit() == H5Params.BackLimit.NEW_USER_PAGE) {
finish(); return true;
} }
back("key");
/** /**
* 如果进行返回按钮限制,则判断限制类型 * 增加逻辑:在高级题测试页面,按物理返回键直接finish当前页面,不走webview.goback()逻辑
*/ */
if (H5Params.BackLimit.NewUserBackLimit.equals(h5Params.getBackLimit())) { if (h5Params.isControlBack()) {
callJSFunc("showGuideModal"); finish();
return false;
} }
back("key");
return true; return true;
} }
......
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