Commit f1cb71bc by 徐健

新用户项目基本完成

parent d08c89c5
......@@ -30,6 +30,7 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.tests.home.NewTestHomeActivity
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
import com.yidianling.user.widget.SecretDescriptionDialog
import com.yidianling.user.widget.SecretDialog
import kotlinx.android.synthetic.main.activity_main.*
......@@ -108,6 +109,9 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
bt_to_tests.setOnClickListener {
startActivity(Intent(this, NewTestHomeActivity::class.java))
}
bt_to_collect_info.setOnClickListener {
startActivity(Intent(this, CollectSexAndBirthActivity::class.java))
}
bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016")
startActivity(Intent(this, ConfideHomeActivity::class.java))
......
......@@ -184,6 +184,15 @@
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="动态" />
<Button
android:id="@+id/bt_to_collect_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="10dp"
android:layout_marginRight="10dp"
android:text="信息收集" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
......
......@@ -45,7 +45,7 @@ ext {
"m-confide" : "0.0.48.3",
"m-consultant" : "0.0.57.4",
"m-fm" : "0.0.28",
"m-user" : "0.0.58.2",
"m-user" : "0.0.59.6",
"m-home" : "0.0.19.1",
"m-im" : "0.0.14.1",
"m-dynamic" : "0.0.6.1",
......@@ -69,10 +69,10 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.38.2",
"ydl-platform" : "0.0.39.6",
//第二步 若干
"ydl-webview" : "0.0.37.1",
"ydl-webview" : "0.0.38.5",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.47.7",
......@@ -115,10 +115,10 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.38.2",
"ydl-platform" : "0.0.39.6",
//第二步 若干
"ydl-webview" : "0.0.37.1",
"ydl-webview" : "0.0.38.5",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.47.7",
......
......@@ -9,7 +9,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
......
......@@ -331,11 +331,11 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
* 上传错误日志
* zhu 洪平要的,判别是移动端主动调的还是声网返的
*/
private fun uploadException(message: String, zhu: String = "") {
private fun uploadException(message: String, zhu: String = "", eventType: String = "99") {
var time: String = (System.currentTimeMillis() / 1000).toString()
var uid: String = ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid!!
var payLoad = PayLoad(channelId ?: "0", time, uid, "1", "999", message)
var connectException = ConnectExceptionCommand(time + zhu, "2", "99", payLoad)
var connectException = ConnectExceptionCommand(time + zhu, "2", eventType, payLoad)
getPresenter().connectException(connectException)
}
......@@ -721,7 +721,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onClickEnsure() {
//是手动切换且连接成功
if (type == 1 && isConnectSuccess) {
uploadException("", "zhu")
uploadException("", "zhu", "108")
}
switchAXB()
}
......
......@@ -90,6 +90,16 @@
android:exported="true"
android:launchMode="singleTop" />
<activity
android:name=".ui.collect.CollectSexAndBirthActivity"
android:exported="true"
android:launchMode="singleTop" />
<activity
android:name=".ui.collect.CollectFocusActivity"
android:exported="true"
android:launchMode="singleTop" />
</application>
</manifest>
\ No newline at end of file
package com.yidianling.user
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.tencent.bugly.crashreport.CrashReport
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.api.bean.UserResponseBean
......@@ -12,6 +17,14 @@ import com.yidianling.user.api.event.UserLogoutEvent
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.Logout
import com.yidianling.user.route.UserIn
import com.yidianling.user.safePrivate.FingerPrintCheckActivity
import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.LoginActivity
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
import com.yidianling.user.ui.login.InputPassWordActivity
import com.yidianling.user.ui.login.RegisterAndLoginActivity
import com.yidianling.user.ui.login.VerificationCodeActivity
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -86,5 +99,46 @@ object LoginUtils {
UserHelper.setUserinfo(null)
}
@JvmStatic
fun LoginSuccessOperate(activity: Activity, isFromGuide: Boolean = false) {
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
if (StatusUtils.isFirstLogin) {
}else {
UserIn.mainIntent(activity)
}
} else {//需要判断stack中是否有MainActivity
//这里不能引用到MainActivity 想别的办法
var flag = 0
//判断stack中activity是否属于登录相关的三个页面
for (activity in ActivityManager.getInstance().getActivitys()) {
if (activity is RegisterAndLoginActivity
|| activity is VerificationCodeActivity
|| activity is InputPassWordActivity
|| activity is FingerPrintCheckActivity
|| activity is HandUnlockCheckActivity
) {
flag++
}
}
//flag小于size:则stack中必然有其他的activity
if (flag < size) {
ActivityManager.getInstance().finishActivity(VerificationCodeActivity::class.java)
ActivityManager.getInstance().finishActivity(InputPassWordActivity::class.java)
ActivityManager.getInstance().finishActivity(RegisterAndLoginActivity::class.java)
ActivityManager.getInstance().finishActivity(FingerPrintCheckActivity::class.java)
ActivityManager.getInstance().finishActivity(HandUnlockCheckActivity::class.java)
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
} else {
ActivityManager.finishAll()
if (StatusUtils.isFirstLogin) {
activity.startActivity(Intent(activity, CollectSexAndBirthActivity::class.java))
} else {
UserIn.mainIntent(activity)
}
}
}
}
}
\ No newline at end of file
package com.yidianling.user;
/**
* 部分实时状态记录类
*/
public class StatusUtils {
/**
* 是否是第一次登录状态记录
*/
public static boolean isFirstLogin = false;
}
package com.yidianling.user.bean
/**
* 用户信息收集关注数据bean
*/
class CollectFocusItemBean (
val id: String, //id
val cateName: String, //标题
val des: String, //描述二级标题
var isFocus: Boolean = false //是否关注
)
\ No newline at end of file
......@@ -37,6 +37,21 @@ class UserBIConstants {
//登录主页浏览事件(不包含随便逛逛)
const val POSITION_LOGIN_TWO_PAGE_VISIT = "login_main_two_page_visit"
//百度监测 用户信息收集页面
const val COLLECT_USER_INFO_PAGE = "collect_user_info_page"
const val COLLECT_USER_INFO_PAGE_VISIT = "collect_user_info_page_visit" //百度监测 用户信息收集页面--页面浏览事件
const val COLLECT_USER_INFO_SEX_MAN_CLICK = "collect_user_info_sex_man_click" // (sign1存储状态(1代表选中,2代表取消),String) //百度监测 用户信息收集页面--性别男按钮点击
const val COLLECT_USER_INFO_SEX_FEMALE_CLICK = "collect_user_info_sex_female_click" // (sign1存储状态(1代表选中,2代表取消),String) //百度监测 用户信息收集页面--性别女按钮点击
const val COLLECT_USER_INFO_NEXT_CLICK= "collect_user_info_next_click" //百度监测 用户信息收集页面--下一步点击
const val COLLECT_USER_INFO_EXIT_CLICK= "collect_user_info_exit_click" //百度监测 用户信息收集页面--退出点击
//百度监测 收集感兴趣话题页
const val COLLECT_TOPIC_PAGE = "collect_topic_page"
const val COLLECT_TOPIC_PAGE_VISIT = "collect_topic_page_visit" //百度监测 页面浏览事件
const val COLLECT_TOPIC_CLICK = "collect_topic_click" //百度监测 话题点击 ( sign1存储话题,例如:情绪压力)
const val COLLECT_TOPIC_SUBMIT_CLICK = "collect_topic_submit_click" //百度监测 提交点击
const val COLLECT_TOPIC_INFO_EXIT_CLICK = "collect_topic_info_exit_click" //百度监测 退出点击
/**
* action type
......
......@@ -7,6 +7,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.http.response.*
import io.reactivex.Observable
import okhttp3.RequestBody
......@@ -177,4 +178,20 @@ interface UserApi {
//获取隐私政策数据
@GET("site/get-privacy-content")
fun getSecretData(): Observable<BaseResponse<SecretResponse>>
//上传用户信息数据接口
@POST("user/collect/submit")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun uploadUserInfo(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
//获取关注问题数据接口
@GET("cate/list-parentId")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getFocusData(@Query("parentId") parentId: String = "0"): Observable<BaseAPIResponse<List<CollectFocusItemBean>>>
//获取新用户引导页面url
@POST("user/getNewUserJumpUrl")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>>
}
\ No newline at end of file
......@@ -7,11 +7,9 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
import com.yidianling.user.http.response.CountryResponse
import com.yidianling.user.http.response.ExistResponse
import com.yidianling.user.http.response.SecretResponse
import com.yidianling.user.http.response.*
import io.reactivex.Observable
/**
......@@ -64,4 +62,10 @@ interface UserHttp {
fun unBindThirdLogin(param: UnBindThirdLoginParam): Observable<BaseResponse<Any>>
fun getSecretData(): Observable<BaseResponse<SecretResponse>>
fun userInfoCollectUpload(param: UserInfoCollectUploadParam): Observable<BaseAPIResponse<Any>>
fun getFocusData(): Observable<BaseAPIResponse<List<CollectFocusItemBean>>>
fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>>
}
\ No newline at end of file
......@@ -15,11 +15,9 @@ import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.UserHelper
import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
import com.yidianling.user.http.response.CountryResponse
import com.yidianling.user.http.response.ExistResponse
import com.yidianling.user.http.response.SecretResponse
import com.yidianling.user.http.response.*
import com.yidianling.user.rxlogin.LoginObservable
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
......@@ -195,6 +193,19 @@ class UserHttpImpl private constructor() : UserHttp {
return getUserApi().getSecretData()
}
override fun userInfoCollectUpload(param: UserInfoCollectUploadParam): Observable<BaseAPIResponse<Any>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().uploadUserInfo(body)
}
override fun getFocusData(): Observable<BaseAPIResponse<List<CollectFocusItemBean>>> {
return getUserApi().getFocusData()
}
override fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>> {
return getUserApi().getNewUserJumpUrl()
}
private object Holder {
val INSTANCE = UserHttpImpl()
......
package com.yidianling.user.http.request;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/2/15
*/
public class UserInfoCollectParam {
public UserInfoCollectParam(String content, String userInfoType) {
this.content = content;
this.userInfoType = userInfoType;
}
public String content; //"男","女"
public String userInfoType; // "gender"性别 "borthDate"年龄 "consultAttention"关注话题
public String getContent() {
return content;
}
public String getUserInfoType() {
return userInfoType;
}
public void setContent(String content) {
this.content = content;
}
public void setUserInfoType(String userInfoType) {
this.userInfoType = userInfoType;
}
}
package com.yidianling.user.http.request;
import java.util.ArrayList;
public class UserInfoCollectUploadParam {
public ArrayList<UserInfoCollectParam> userInfoList;
}
package com.yidianling.user.http.response
class CollectFocusResponseBean (
val id: String,
val cateName: String,
val des: String,
val isFocus: Boolean = false
)
\ No newline at end of file
......@@ -19,6 +19,7 @@ import com.yidianling.home.api.service.IHomeService
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
import com.yidianling.user.UserConstants
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
......@@ -150,16 +151,18 @@ class SmsLoginActivity : BaseActivity() {
//关闭手势解锁页面与指纹解锁页面
finishFinger()
if (it.firstLogin == 1) {
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
baiduActionBury()
}else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.uid!!,UserBIConstants.ACTION_TYPE_CODE_LOGIN)
}
ActivityManager.finishActivity(LoginActivity::class.java)
if (ActivityManager.getActivitySize() <= 1) {
UserIn.mainIntent(this)
}
finish()
// ActivityManager.finishActivity(LoginActivity::class.java)
// if (ActivityManager.getActivitySize() <= 1) {
// UserIn.mainIntent(this)
// }
// finish()
LoginUtils.LoginSuccessOperate(this)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
dismissProgressDialog()
......
package com.yidianling.user.ui.collect
import android.annotation.SuppressLint
import android.content.Context
import android.view.KeyEvent
import android.view.ViewGroup
import android.widget.LinearLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.YDLCommonDialog
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.R
import com.yidianling.user.bean.CollectFocusItemBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.UserInfoCollectParam
import com.yidianling.user.http.request.UserInfoCollectUploadParam
import com.yidianling.user.ui.collect.dialog.CompleteCollectUserInfoDialog
import com.yidianling.user.ui.collect.widget.CollectFocusView
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_focus_layout.*
/**
* 收集用户关注问题页面
*/
class CollectFocusActivity : BaseActivity() {
private var completeDialog: CompleteCollectUserInfoDialog? = null
private var collectOutDialog: YDLCommonDialog? = null
private var selectedNumber: Int = 0
private var mList: ArrayList<CollectFocusItemBean> = ArrayList()
override fun initDataAndEvent() {
ActionCountUtils.count(UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_PAGE_VISIT)
// 获取关注数据
getFocusData()
//上传关注数据
upload_focus_info_btn.setOnClickListener {
uploadFocusData()
ActionCountUtils.count(UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_SUBMIT_CLICK)
}
// 退出
collect_focus_out_btn.setOnClickListener {
ActionCountUtils.count(UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_INFO_EXIT_CLICK)
if (null == collectOutDialog) {
collectOutDialog =
YDLCommonDialog(this, object : YDLCommonDialog.OnYDLCommonDialogListener {
override fun onCancel() {
// 这是左侧按钮 - 确定
collectOutDialog?.dismiss()
jumpToNewUserH5()
}
override fun onSure() {
// 这是右侧按钮 - 取消
collectOutDialog?.dismiss()
}
}).setNullTitleDesc(
"确定要退出吗?\n" +
"很多人在这里得到了帮助哦~"
).setCancelText("确定").setSureText("取消")
}
collectOutDialog?.show()
}
}
/**
* 上传关注问题数据
*/
@SuppressLint("CheckResult")
private fun uploadFocusData() {
if (selectedNumber > 0) {
if (completeDialog == null) {
completeDialog = CompleteCollectUserInfoDialog(this)
completeDialog?.show()
}
val userInfoBean = UserInfoCollectUploadParam()
userInfoBean.userInfoList = ArrayList()
userInfoBean.userInfoList.add(
UserInfoCollectParam(
mList.filter { it.isFocus }.joinToString { it.id },
"consultAttention"
)
)
UserHttpImpl.getInstance().userInfoCollectUpload(userInfoBean)
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (!isFinishing) {
jumpToNewUserH5()
}
}, {
completeDialog?.dismiss()
})
} else {
ToastUtil.toastShort("至少选择1项")
}
}
/**
* 获取关注数据
*/
@SuppressLint("CheckResult")
private fun getFocusData() {
UserHttpImpl.getInstance().getFocusData()
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.isNotEmpty()) {
mList.addAll(it)
initScrollViewData()
}
}, {
})
}
override fun layoutResId(): Int {
return R.layout.user_activity_focus_layout
}
private fun initScrollViewData() {
if (!this.isFinishing) {
mList.forEachIndexed { index, item: CollectFocusItemBean ->
if (index % 2 == 0) {
var ll = getHLinearLayout(this)
// 添加左侧布局
var leftItem = getLeftFocusItem()
leftItem.setData(item.cateName, item.des)
leftItem.setOnClickListener {
item.isFocus = !item.isFocus
leftItem.setFocus(item.isFocus)
calculateSelectedNumber(item.isFocus)
ActionCountUtils.count(
UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_CLICK,
item.cateName
)
}
ll.addView(leftItem)
if (mList.lastIndex >= index + 1) {
// 添加右侧布局
var rightItem = getRightFocusItem()
rightItem.setData(mList[index + 1].cateName, mList[index + 1].des)
rightItem.setOnClickListener {
mList[index + 1].isFocus = !mList[index + 1].isFocus
rightItem.setFocus(mList[index + 1].isFocus)
calculateSelectedNumber(mList[index + 1].isFocus)
ActionCountUtils.count(
UserBIConstants.COLLECT_TOPIC_PAGE + "|" + UserBIConstants.COLLECT_TOPIC_CLICK,
item.cateName
)
}
ll.addView(rightItem)
}
focus_scrollview_ll.addView(ll)
}
}
}
}
private fun calculateSelectedNumber(isFocus: Boolean) {
if (isFocus) {
selectedNumber++
upload_focus_info_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg)
} else {
selectedNumber--
if (selectedNumber == 0) {
upload_focus_info_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_un_bg)
}
}
}
private fun getLeftFocusItem(): CollectFocusView {
var item = CollectFocusView(this)
var params = item.layoutParams as ViewGroup.MarginLayoutParams
params.setMargins(RxImageTool.dp2px(20f), 0, 0, 0)
item.layoutParams = params
return item
}
private fun getRightFocusItem(): CollectFocusView {
var item = CollectFocusView(this)
var params = item.layoutParams as ViewGroup.MarginLayoutParams
params.setMargins(RxImageTool.dp2px(19f), 0, 0, 0)
item.layoutParams = params
return item
}
private fun getHLinearLayout(mContext: Context): LinearLayout {
val params = LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
val ll = LinearLayout(mContext)
ll.layoutParams = params
var marginParams = ll.layoutParams as ViewGroup.MarginLayoutParams
marginParams.setMargins(0, RxImageTool.dp2px(20f), 0, 0)
ll.layoutParams = marginParams
ll.orientation = LinearLayout.HORIZONTAL
return ll
}
@SuppressLint("CheckResult")
private fun jumpToNewUserH5() {
UserHttpImpl.getInstance().getNewUserJumpUrl()
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (!isFinishing) {
upload_focus_info_btn.postDelayed({
completeDialog?.dismiss()
if (!isFinishing) {
val h5Params = H5Params(it, "mainPage")
NewH5Activity.start(this, h5Params)
}
}, 1000)
}
}, {
})
}
/**
* 当前页面不能退出
*/
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true
}
return super.onKeyDown(keyCode, event)
}
}
\ No newline at end of file
package com.yidianling.user.ui.collect
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.util.Log
import android.view.KeyEvent
import android.widget.NumberPicker
import android.widget.RelativeLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.YDLCommonDialog
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.R
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.UserInfoCollectParam
import com.yidianling.user.http.request.UserInfoCollectUploadParam
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_sex_birth_layout.*
import java.util.*
/**
* 收集用户性别与出生年页面
*/
class CollectSexAndBirthActivity : BaseActivity() {
private var selectedSex = -1 // 1 男 2 女
private var selectedYear = 1995
private var originYear =1900
private var collectOutDialog: YDLCommonDialog? = null
private var yearList: ArrayList<String> = ArrayList()
override fun initDataAndEvent() {
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_PAGE_VISIT)
sex_and_birth_upload_btn.setOnClickListener {
// 只需要选择了性别即可点击上传数据,因为年份默认就是有选择的
if (selectedSex != -1) {
uploadSexAndBirth()
} else {
ToastUtil.toastShort("请选择性别")
}
}
male_rl.setOnClickListener {
if (selectedSex != 1) {
selectedSex = 1
checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_MAN_CLICK, "1")
}else {
selectedSex = -1
checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_MAN_CLICK, "2")
}
}
female_rl.setOnClickListener {
if (selectedSex != 2) {
selectedSex = 2
checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_FEMALE_CLICK, "1")
}else {
selectedSex = -1
checkUpSelect()
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_SEX_FEMALE_CLICK, "2")
}
}
sex_and_birth_out.setOnClickListener {
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_EXIT_CLICK)
if (null == collectOutDialog) {
collectOutDialog = YDLCommonDialog(this, object : YDLCommonDialog.OnYDLCommonDialogListener {
override fun onCancel() {
// 这是左侧按钮 - 确定
collectOutDialog?.dismiss()
jumpToNewUserH5()
}
override fun onSure() {
// 这是右侧按钮 - 取消
collectOutDialog?.dismiss()
}
}).setNullTitleDesc("确定要退出吗?\n" +
"很多人在这里得到了帮助哦~").setCancelText("确定").setSureText("取消")
}
collectOutDialog?.show()
}
//年份选择器
val date = Calendar.getInstance()
val nowYear: Int = date.get(Calendar.YEAR)
while (originYear <= nowYear) {
yearList.add("$originYear")
originYear++
}
user_collect_date_pick.setDividerColor("#CCCCCC")
user_collect_date_pick.setNumberPickerDividerHeight(1)
user_collect_date_pick.post {
if (user_collect_date_pick.measuredHeight > RxImageTool.dp2px(175f)) {
val param = RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(175f))
user_collect_date_pick.layoutParams = param
user_collect_date_pick.value = selectedYear
}
}
user_collect_date_pick.displayedValues = yearList.toTypedArray()
user_collect_date_pick.value = selectedYear
user_collect_date_pick.minValue = 1900
user_collect_date_pick.maxValue = nowYear
user_collect_date_pick.descendantFocusability = NumberPicker.FOCUS_BLOCK_DESCENDANTS // 关闭编辑功能
user_collect_date_pick.wrapSelectorWheel = false // 关闭循环
//更新用户选择的年份
user_collect_date_pick.setOnValueChangedListener { _, _, newVal -> selectedYear = newVal }
}
@SuppressLint("CheckResult")
private fun uploadSexAndBirth() {
ActionCountUtils.count(UserBIConstants.COLLECT_USER_INFO_PAGE + "|" + UserBIConstants.COLLECT_USER_INFO_NEXT_CLICK, "$selectedYear")
val userInfoBean = UserInfoCollectUploadParam()
userInfoBean.userInfoList = ArrayList()
userInfoBean.userInfoList.add(UserInfoCollectParam(if (selectedSex == 1) "男" else "女", "gender"))
userInfoBean.userInfoList.add(UserInfoCollectParam("$selectedYear", "borthDate"))
UserHttpImpl.getInstance().userInfoCollectUpload(userInfoBean)
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
var intent = Intent(this, CollectFocusActivity::class.java)
startActivity(intent)
}, {
Log.i("上传数据异常", it.toString())
})
}
@SuppressLint("CheckResult")
private fun jumpToNewUserH5() {
UserHttpImpl.getInstance().getNewUserJumpUrl()
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (!isFinishing) {
val h5Params = H5Params(it, "mainPage")
NewH5Activity.start(this, h5Params)
}
}, {
})
}
private fun checkUpSelect() {
if (selectedSex == 1) {
male_rl.setBackgroundResource(R.drawable.user_collect_select_bg)
female_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg)
male_img.setImageResource(R.drawable.user_male_selected)
female_img.setImageResource(R.drawable.user_female_unselected)
male_txt.setTextColor(Color.parseColor("#1DA1F2"))
female_txt.setTextColor(Color.parseColor("#242424"))
sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg)
} else if (selectedSex == 2) {
male_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg)
female_rl.setBackgroundResource(R.drawable.user_collect_select_bg)
male_img.setImageResource(R.drawable.user_male_unselected)
female_img.setImageResource(R.drawable.user_female_selected)
male_txt.setTextColor(Color.parseColor("#242424"))
female_txt.setTextColor(Color.parseColor("#1DA1F2"))
sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_bg)
} else {
male_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg)
female_rl.setBackgroundResource(R.drawable.user_collect_unselect_bg)
male_img.setImageResource(R.drawable.user_male_unselected)
female_img.setImageResource(R.drawable.user_female_unselected)
male_txt.setTextColor(Color.parseColor("#242424"))
female_txt.setTextColor(Color.parseColor("#242424"))
sex_and_birth_upload_btn.setBackgroundResource(R.drawable.user_collect_bottom_btn_un_bg)
}
}
/**
* 当前页面不能退出
*/
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true
}
return super.onKeyDown(keyCode, event)
}
override fun layoutResId(): Int {
return R.layout.user_activity_sex_birth_layout
}
}
\ No newline at end of file
package com.yidianling.user.ui.collect.dialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import com.yidianling.user.R
class CompleteCollectUserInfoDialog(context: Context): Dialog(context, R.style.platform_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.user_complete_collect_dialog_layout)
setCanceledOnTouchOutside(false)
}
}
\ No newline at end of file
package com.yidianling.user.ui.collect.widget
import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.view.Gravity
import android.view.View
import android.widget.LinearLayout
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.user.R
import kotlinx.android.synthetic.main.user_item_focus_layout.view.*
class CollectFocusView : LinearLayout {
constructor(context: Context) : super(context) {
mContext = context
initView()
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
mContext = context
initView()
}
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
context,
attrs,
defStyle
) {
mContext = context
initView()
}
private var mContext: Context? = null
private fun initView() {
View.inflate(mContext, R.layout.user_item_focus_layout, this)
val mWidth: Int = RxDeviceTool.getScreenWidth(mContext) / 2 - RxImageTool.dp2px(20f + 9.5f)
val params = LinearLayout.LayoutParams(
mWidth,
RxImageTool.dp2px(68f)
)
layoutParams = params
setFocus(false)
}
fun setFocus(focus: Boolean) {
if (focus) {
user_focus_title.setTextColor(Color.parseColor("#1DA1F2"))
user_focus_desc.setTextColor(Color.parseColor("#1DA1F2"))
setBackgroundResource(R.drawable.user_collect_select_bg)
} else {
user_focus_title.setTextColor(Color.parseColor("#242424"))
user_focus_desc.setTextColor(Color.parseColor("#666666"))
setBackgroundResource(R.drawable.user_collect_unselect_bg)
}
}
fun setData(title: String, desc: String) {
user_focus_title.text = title
user_focus_desc.text = desc
}
}
\ No newline at end of file
package com.yidianling.user.ui.collect.widget
import android.content.Context
import android.content.res.Resources
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
import android.widget.NumberPicker
/**
* 自定义数字选择器
*/
class CustomNumberPicker: NumberPicker {
constructor(context: Context): super(context)
constructor(context: Context, attrs: AttributeSet): super(context, attrs)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int): super(context, attrs, defStyleAttr)
override fun addView(child: View) {
updateView(child)
}
override fun addView(child: View, width: Int, height: Int) {
super.addView(child, width, height)
updateView(child)
}
override fun addView(child: View, index: Int, params: ViewGroup.LayoutParams) {
super.addView(child, index, params)
updateView(child)
}
override fun addView(child: View, params: ViewGroup.LayoutParams) {
super.addView(child, params)
updateView(child)
}
fun updateView(view: View) {
if (view is EditText) {
//这里修改显示字体的属性,主要修改颜色和大小
// view.setTextColor(Color.parseColor("#242424"))
view.textSize = 22f
}
}
/**
* 设置picker分割线的颜色
*/
public fun setDividerColor(colorString: String) {
val field = NumberPicker::class.java.getDeclaredField("mSelectionDivider")
if (field != null) {
field.isAccessible = true
field.set(this, ColorDrawable(Color.parseColor(colorString)))
}
}
/**
* 设置picker分割线的宽度
*/
public fun setNumberPickerDividerHeight(height: Int) {
val fields = NumberPicker::class.java.declaredFields
for (f in fields) {
if (f.name == "mSelectionDividerHeight") {
f.isAccessible = true
f.set(this, height)
break
}
}
}
/**
* 设置picker分割线透明
*/
public fun setNumberPickerDividerColorTransparent() {
val pickerFields = NumberPicker::class.java.declaredFields
for (pf in pickerFields) {
if (pf.name.equals("mSelectionDivider")) {
pf.isAccessible = true
try {
//设置分割线的颜色值 透明
pf.set(
this,
ColorDrawable(this.resources.getColor(android.R.color.transparent))
)
} catch (e: IllegalArgumentException) {
e.printStackTrace()
} catch (e: Resources.NotFoundException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
break
}
}
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.route.UserIn
......@@ -276,38 +277,10 @@ class InputPassWordActivity : BaseMvpActivity<IInputPassWordContract.View,IInput
}
override fun closeActivity() {
RxKeyboardTool.hideSoftInput(this)
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
UserIn.mainIntent(this)
} else {//需要判断stack中是否有MainActivity
//这里不能引用到MainActivity 想别的办法
var flag = 0
//判断stack中activity是否属于登录相关的三个页面
for (activity in ActivityManager.getInstance().getActivitys()) {
if (activity is RegisterAndLoginActivity
|| activity is VerificationCodeActivity
|| activity is InputPassWordActivity
|| activity is FingerPrintCheckActivity
|| activity is HandUnlockCheckActivity
) {
flag++
}
}
//flag小于size:则stack中必然有其他的activity
if (flag < size) {
ActivityManager.getInstance().finishActivity(VerificationCodeActivity::class.java)
ActivityManager.getInstance().finishActivity(InputPassWordActivity::class.java)
ActivityManager.getInstance().finishActivity(RegisterAndLoginActivity::class.java)
ActivityManager.getInstance().finishActivity(FingerPrintCheckActivity::class.java)
ActivityManager.getInstance().finishActivity(HandUnlockCheckActivity::class.java)
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
} else {
ActivityManager.finishAll()
UserIn.mainIntent(this)
}
}
LoginUtils.LoginSuccessOperate(this)
}
private fun closeAnim(hasAnim: Boolean) {
......
......@@ -38,6 +38,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
......@@ -467,10 +468,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
tv_reg_title.text = "手机号绑定"
tv_protocol.visibility = View.GONE
} else {
finishPrePage()
if (isFromGuide) {
UserIn.mainIntent(this)
}
LoginUtils.LoginSuccessOperate(this, isFromGuide)
}
}
......@@ -567,13 +565,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun autoLoginSuccess() {
ll_success.visibility = View.VISIBLE
handler!!.postDelayed({
val size = ActivityManager.getActivitySize()
if (size == 1) {
ActivityManager.finishAll()
UserIn.mainIntent(this)
} else {
finishPrePage()
}
LoginUtils.LoginSuccessOperate(this)
}, 3000)
}
......
......@@ -14,6 +14,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.UserHelper
import com.yidianling.user.constants.UserBIConstants
......@@ -272,37 +273,7 @@ class VerificationCodeActivity : BaseMvpActivity<IVerificationCodeContract.View,
override fun closeActivity() {
RxKeyboardTool.hideSoftInput(this)
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
UserIn.mainIntent(this)
} else {//需要判断stack中是否有MainActivity
//这里不能引用到MainActivity 想别的办法
var flag = 0
//判断stack中activity是否属于登录相关的三个页面
for (activity in ActivityManager.getInstance().getActivitys()) {
if (activity is RegisterAndLoginActivity
|| activity is VerificationCodeActivity
|| activity is InputPassWordActivity
|| activity is FingerPrintCheckActivity
|| activity is HandUnlockCheckActivity
) {
flag++
}
}
//flag小于size:则stack中必然有其他的activity
if (flag < size) {
ActivityManager.getInstance().finishActivity(VerificationCodeActivity::class.java)
ActivityManager.getInstance().finishActivity(InputPassWordActivity::class.java)
ActivityManager.getInstance().finishActivity(RegisterAndLoginActivity::class.java)
ActivityManager.getInstance().finishActivity(FingerPrintCheckActivity::class.java)
ActivityManager.getInstance().finishActivity(HandUnlockCheckActivity::class.java)
FingerPrintUtil.instance().setCurrentUnLockTime(System.currentTimeMillis())
} else {
ActivityManager.finishAll()
UserIn.mainIntent(this)
}
}
LoginUtils.LoginSuccessOperate(this)
}
/**
......
......@@ -12,6 +12,7 @@ import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.api.service.IHomeService
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.PhoneLoginPwdParam
......@@ -59,6 +60,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
saveUserData(it.data)
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_RESET_PWD)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点
//view.baiduActionBury()
......@@ -96,6 +98,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
} else {
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury()
} else {
......
......@@ -13,6 +13,7 @@ import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.api.service.IHomeService
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.UserHttpImpl
......@@ -71,6 +72,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
//绑定手机号
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury(it.data.uid, UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK)
} else {
......@@ -193,11 +195,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
ToastUtil.toastShort(it.msg)
return@subscribe
}
LoginUtils.onLogin(it.data)
mView.thirdLoginSuccess(it.data.userInfo!!)
LogHelper.getInstance().writeLogSync(media.getName() + "登录成功")
if (media == SHARE_MEDIA.QQ) {
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_QQ_REGISTER_CLICK)
} else {
......@@ -205,12 +205,16 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
}
} else {
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_WX_REGISTER_CLICK)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
}
}
LoginUtils.onLogin(it.data)
mView.thirdLoginSuccess(it.data.userInfo!!)
LogHelper.getInstance().writeLogSync(media.getName() + "登录成功")
}, {
mView.dismissProgressView()
YdlCommonOut.showToast(it.message!!)
......
......@@ -9,6 +9,7 @@ import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.api.service.IHomeService
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.BindPhoneJavaParam
......@@ -145,6 +146,7 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
ModularServiceManager.provide(IHomeService::class.java).setDouble11ShowType(true)
mView.baiduActionBury()
} else {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="22dp"/>
<gradient
android:angle="180"
android:startColor="#159CEF"
android:endColor="#22BFFF"/>
</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">
<corners android:radius="22dp"/>
<gradient
android:angle="180"
android:startColor="#66159CEF"
android:endColor="#6622BFFF"/>
</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">
<corners android:radius="4dp"/>
<stroke android:width="1dp"
android:color="@color/user_main_theme"/>
<solid
android:color="#EDF8FF"/>
</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">
<corners android:radius="4dp"/>
<stroke android:width="0.5dp"
android:color="#CCCCCC"/>
</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">
<solid android:color="#ffffff"/>
<corners android:radius="8dp" />
</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:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">
<TextView
android:id="@+id/collect_focus_out_btn"
android:layout_width="68dp"
android:layout_height="60dp"
android:gravity="center"
android:text="退出"
android:textSize="14dp"
android:textColor="#999999"
android:layout_gravity="right"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="选择您关注的问题"
android:textColor="@color/user_main_theme"
android:textStyle="bold"
android:textSize="28dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="为您推荐平台精选"
android:textSize="16dp"
android:textColor="#999999"
android:layout_marginTop="2dp"/>
<ScrollView
android:id="@+id/focus_scrollview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="20dp"
android:paddingBottom="20dp">
<LinearLayout
android:id="@+id/focus_scrollview_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- 这里添加接口获取的关注数据视图 -->
</LinearLayout>
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#ebebeb"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="64dp"
android:gravity="center">
<TextView
android:id="@+id/upload_focus_info_btn"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_width="match_parent"
android:layout_height="44dp"
android:gravity="center"
android:text="提交(可多选)"
android:textSize="17dp"
android:textColor="#ffffff"
android:background="@drawable/user_collect_bottom_btn_un_bg"/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">
<TextView
android:id="@+id/sex_and_birth_out"
android:layout_width="68dp"
android:layout_height="60dp"
android:gravity="center"
android:text="退出"
android:textSize="14dp"
android:textColor="#999999"
android:layout_gravity="right"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="欢迎来到壹点灵"
android:textColor="@color/user_main_theme"
android:textStyle="bold"
android:textSize="28dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="请完善信息,以便我们为您提供更好的服务"
android:textSize="16dp"
android:textColor="#999999"
android:layout_marginTop="2dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="您的性别是?"
android:textSize="18dp"
android:textColor="#242424"
android:layout_marginTop="40dp"
android:layout_marginBottom="17dp"
android:textStyle="bold"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RelativeLayout
android:id="@+id/male_rl"
android:layout_marginRight="25dp"
android:layout_width="97dp"
android:layout_height="116dp"
android:gravity="center"
android:background="@drawable/user_collect_unselect_bg">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
<ImageView
android:id="@+id/male_img"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerCrop"
android:src="@drawable/user_male_unselected"/>
<TextView
android:id="@+id/male_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="男"
android:textColor="#242424"
android:textSize="18dp"
android:layout_marginTop="13dp"
/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/female_rl"
android:layout_marginLeft="25dp"
android:layout_width="97dp"
android:layout_height="116dp"
android:gravity="center"
android:background="@drawable/user_collect_unselect_bg">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
<ImageView
android:id="@+id/female_img"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerCrop"
android:src="@drawable/user_female_unselected"/>
<TextView
android:id="@+id/female_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女"
android:textColor="#242424"
android:textSize="18dp"
android:layout_marginTop="13dp"
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="您是哪年出生的?"
android:textSize="18dp"
android:textColor="#242424"
android:layout_marginTop="45dp"
android:textStyle="bold"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="22dp"
android:layout_marginBottom="2dp"
android:gravity="center">
<com.yidianling.user.ui.collect.widget.CustomNumberPicker
android:id="@+id/user_collect_date_pick"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.yidianling.user.ui.collect.widget.CustomNumberPicker>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="#ebebeb"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="64dp"
android:gravity="center">
<TextView
android:id="@+id/sex_and_birth_upload_btn"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_width="match_parent"
android:layout_height="44dp"
android:gravity="center"
android:text="确定"
android:textSize="17dp"
android:textColor="#ffffff"
android:background="@drawable/user_collect_bottom_btn_un_bg"/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="174dp"
android:background="@color/transparent">
<LinearLayout
android:layout_width="295dp"
android:layout_height="133dp"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:orientation="vertical"
android:layout_marginTop="41dp"
android:background="@drawable/user_complete_dialog_bg">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提交成功!"
android:textColor="#242424"
android:textSize="18dp"
android:textStyle="bold"
android:layout_marginTop="43dp"/>
<TextView
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="正在前往为您定制的专区…"
android:textColor="#242424"
android:textSize="14dp"/>
</LinearLayout>
<ImageView
android:layout_width="82dp"
android:layout_height="82dp"
android:src="@drawable/collect_success_top_icon"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/user_focus_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="情绪压力"
android:textColor="#242424"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:id="@+id/user_focus_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:ellipsize="end"
android:maxLines="1"
android:text="#焦虑#困惑#失眠多梦#"
android:textColor="#666666"
android:textSize="12dp"
android:textStyle="bold" />
</LinearLayout>
\ No newline at end of file
......@@ -4,6 +4,7 @@ import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.router.YdlCommonOut
......@@ -14,6 +15,7 @@ class YDLCommonDialog: Dialog {
private var mContext: Context? = null
private var mListener: OnYDLCommonDialogListener? = null
private var hasTitle = true // 默认为有标题弹窗
private var mTitle: String = ""
private var mDesc: String = ""
private var mLeftText: String = ""
......@@ -35,8 +37,18 @@ class YDLCommonDialog: Dialog {
window.setGravity(Gravity.CENTER)
window.attributes = params
ydl_common_dialog_title.text = mTitle
ydl_common_dialog_desc.text = mDesc
if (hasTitle) {
ydl_common_dialog_title.visibility = View.VISIBLE
ydl_common_dialog_desc.visibility = View.VISIBLE
ydl_common_dialog_title.text = mTitle
ydl_common_dialog_desc.text = mDesc
ydl_common_dialog_null_title_desc.visibility = View.GONE
}else {
ydl_common_dialog_title.visibility = View.GONE
ydl_common_dialog_desc.visibility = View.GONE
ydl_common_dialog_null_title_desc.visibility = View.VISIBLE
ydl_common_dialog_null_title_desc.text = mDesc
}
ydl_common_dialog_cancel.text = mLeftText
ydl_common_dialog_sure.text = mRightText
......@@ -73,6 +85,15 @@ class YDLCommonDialog: Dialog {
}
/**
* 设置无标题弹窗描述
*/
fun setNullTitleDesc(desc: String): YDLCommonDialog {
hasTitle = false
mDesc = desc
return this
}
/**
* 左侧按钮
*/
fun setCancelText(cancelText: String): YDLCommonDialog {
......
......@@ -39,6 +39,20 @@
android:layout_marginTop="8dp"
android:layout_marginBottom="34dp"/>
<TextView
android:id="@+id/ydl_common_dialog_null_title_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="确定要退出吗?
很多人在这里得到了帮助哦~"
android:layout_marginLeft="44dp"
android:layout_marginRight="44dp"
android:textSize="16dp"
android:gravity="center"
android:textColor="#242424"
android:layout_marginTop="30dp"
android:layout_marginBottom="24dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
......
......@@ -14,6 +14,13 @@ class H5Params : Serializable {
this.title = title
}
constructor(url: String, backLimit: String, boolean: Boolean = true): super() {
this.url =url
if (boolean) {
this.backLimit = backLimit
}
}
constructor(url: String, title: String?, share: ShareData?) : super() {
this.url = url
this.shareData = share
......@@ -60,4 +67,9 @@ class H5Params : Serializable {
* 倾诉拨打电话
*/
var phone: String? = null
/**
* h5页面返回按钮限制(根据传入的backLimit判断返回至哪个页面)
* mainPage -- 首页
*/
var backLimit: String = ""
}
\ No newline at end of file
......@@ -40,7 +40,9 @@ import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.bean.StatusBarOptions;
import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.ui.LogoLoadingView;
import com.ydl.ydlcommon.utils.ActivityManager;
import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.ydl.ydlcommon.utils.LogUtil;
import com.ydl.ydlcommon.utils.NetWorkSpeedUtils;
......@@ -55,6 +57,7 @@ import com.yidianling.common.tools.RxImageTool;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.user.api.event.UserBindPhoneEvent;
import com.yidianling.user.api.event.UserLoginEvent;
import com.yidianling.user.api.service.IAppService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......@@ -619,7 +622,15 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
}
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
}
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
}
finish();
}
});
......@@ -812,6 +823,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title.setImageListener(v -> {
if (wv_content.canGoBack()) {
wv_content.goBack();
}
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
finish();
}
......@@ -826,7 +841,15 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.getShowUrlTitle()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
}
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
}
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
}
finish();
}
});
......@@ -1099,7 +1122,9 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title.setLeftTextVisible(VISIBLE);
if ("top".equals(type)) {
setTitle(wv_content.getTitle());
tb_title.setImageListener(v -> wv_content.goBack());
tb_title.setImageListener(v ->
wv_content.goBack()
);
} else {
wv_content.goBack();
}
......@@ -1115,7 +1140,14 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.isSplash()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
}
else if ("mainPage".equals(h5Params.getBackLimit())) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
}else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
}
finish();
}
});
......@@ -1252,6 +1284,15 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
finish();
}
back("key");
/**
* 如果进行返回按钮限制,则判断限制类型
*/
if ("mainPage".equals(h5Params.getBackLimit())) {
ModularServiceManager.INSTANCE.provide(IAppService.class).mainIntent(this);
}
return true;
}
return super.onKeyDown(keyCode, event);
......
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