Commit 48552ba6 by konghaorui

Merge branch 'dev' into feature/组件化_ending

# Conflicts:
#	app/src/main/java/com/ydl/component/MainActivity.kt
#	config.gradle
#	m-im/src/main/java/com/yidianling/uikit/business/session/view/ImCommentBannerView.kt
#	m-im/src/main/res_uikit/layout/im_ydl_nim_message_fragment.xml
#	m-user/src/main/AndroidManifest.xml
#	m-user/src/main/java/com/yidianling/user/http/UserApi.kt
#	m-user/src/main/java/com/yidianling/user/http/UserHttp.kt
#	m-user/src/main/java/com/yidianling/user/http/UserHttpImpl.kt
#	m-user/src/main/java/com/yidianling/user/ui/SmsLoginActivity.kt
#	m-user/src/main/java/com/yidianling/user/ui/login/presenter/InputPassWordPresenterImpl.kt
#	m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
#	m-user/src/main/java/com/yidianling/user/ui/login/presenter/VerificationCodePresenterImpl.kt
#	m-user/src/main/res/layout/user_activity_secret.xml
#	m-user/src/main/res/layout/user_dialog_secret.xml
#	m-user/src/xlzx/res/values/colors.xml
#	m-user/src/ydl/res/values/colors.xml
#	ydl-flutter-base/src/main/java/com/channel/ydl_flutter_base/plugin/YDLCommonPlugin.kt
#	ydl-platform/src/main/res/drawable/platform_ydl_common_dialog_sure_btn_ydl_bg.xml
parents 903a8813 1430860e
......@@ -183,11 +183,11 @@ dependencies {
api project(':m-tests')
api project(':m-consultant')
implementation modularPublication('com.ydl:m-consultant-api')
// implementation project(':m-confide')
implementation project(':m-confide')
api project(':m-home')
api project(':m-confide')
// api project(':m-confide')
// api "com.ydl:m-consultant-api:0.0.2"
// api 'com.ydl:m-consultant-module-ydl:0.0.18@aar'
......
package com.ydl.component
//import com.ydl.confide.home.ConfideHomeActivity
//import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME
import android.Manifest
import android.annotation.SuppressLint
import android.content.ComponentName
......@@ -10,28 +8,33 @@ import android.content.Intent
import android.content.ServiceConnection
import android.net.Uri
import android.os.IBinder
import android.os.Process
import android.provider.Settings
import android.util.Log
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent
import com.ydl.audioim.YDLavManager
import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.media.audio.PlayService
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.ActivityManager.Companion.finishAll
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.fm.api.service.IFMService
import com.yidianling.user.widget.SecretDescriptionDialog
import com.yidianling.user.widget.SecretDescriptionDialog.OnSecretDescriptionDialogListener
import com.yidianling.user.widget.SecretDialog
import com.yidianling.user.widget.SecretDialog.OnSecretDialogListener
import kotlinx.android.synthetic.main.activity_main.*
import com.ydl.ydlcommon.utils.ResUtil.getResources
import android.support.v4.app.SupportActivity
import android.support.v4.app.SupportActivity.ExtraData
import com.ydl.component.mvp.DemoContract
/**
* Created by haorui on 2019-09-01 .
......@@ -40,8 +43,9 @@ import kotlinx.android.synthetic.main.activity_main.*
@Route(path = "/main/main")
class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(),
DemoContract.View {
private var secretDescriptionDialog: SecretDescriptionDialog? = null
private var serviceConnection: ServiceConnection? = null
private var secretDialog: SecretDialog? = null
protected var playService: PlayService? = null
override fun getContentViewId(): Int {
......@@ -105,18 +109,37 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
FragmentContainerActivity.start(this, "TrendsHomeFragment")
}
bt_to_tests.setOnClickListener {
// startActivity(Intent(this, NewTestHomeActivity::class.java))
FragmentContainerActivity.start(this, "NewTestHomeFragment")
// startActivity(Intent(this, NewTestHomeActivity::class.java))
// SecretActivity.Companion.startProtocol(this, it.data.getContent());
secretDescriptionDialog = SecretDescriptionDialog(
this@MainActivity,
"122342453653456345674356",
object : OnSecretDescriptionDialogListener {
override fun onCancel() {
secretDescriptionDialog!!.dismiss()
showEnsureDialog()
}
override fun onSure() {
secretDescriptionDialog!!.dismiss()
}
})
secretDescriptionDialog!!.setCanceledOnTouchOutside(false)
secretDescriptionDialog!!.show()
}
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))
// YDLavManager.instances.login("1193016")
// startActivity(Intent(this, ConfideHomeActivity::class.java))
}
bt_to_muse.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE_CENTER,
YDLRouterParams().putExtra
("url", "http://video.yidianling.com/2019/05/30/746851e2f335baf5f44499f4fb49d3a9.mp3"))
// YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE_CENTER,
// YDLRouterParams().putExtra
// ("url", "http://video.yidianling.com/2019/05/30/746851e2f335baf5f44499f4fb49d3a9.mp3"))
// YDLRouterManager.router(
// IYDLRouterConstant.ROUTER_MUSE,
......@@ -163,29 +186,33 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
}
bt_to_privacy.setOnClickListener {
val dialog = SecretDescriptionDialog(this@MainActivity, "感谢您信任并使用壹点灵旗下的APP,\\n\n" +
"我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\\n\\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\\n\n" +
"2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\\n\n" +
"3. 我们会采业界先进的安全措施保护您的信息安全;\\n\n" +
"4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\\n\n" +
"5. 您可以查询、更正、删除您的个人信息。", object : SecretDescriptionDialog.OnSecretDescriptionDialogListener {
override fun onCancel() {
val secretDialog = SecretDialog(this@MainActivity, object : SecretDialog.OnSecretDialogListener {
override fun onCancel() {
ToastUtil.toastShort("onCancel")
}
override fun onSure() {
ToastUtil.toastShort("nextStep")
}
})
secretDialog?.show()
}
override fun onSure() {
ToastUtil.toastShort("nextStep")
val dialog = SecretDescriptionDialog(this@MainActivity,
"感谢您信任并使用壹点灵旗下APP,\\n\n" +
"我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\\n\\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\\n\n" +
"2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\\n\n" +
"3. 我们会采业界先进的安全措施保护您的信息安全;\\n\n" +
"4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\\n\n" +
"5. 您可以查询、更正、删除您的个人信息。",
object : SecretDescriptionDialog.OnSecretDescriptionDialogListener {
override fun onCancel() {
val secretDialog = SecretDialog(
this@MainActivity,
object : SecretDialog.OnSecretDialogListener {
override fun onCancel() {
ToastUtil.toastShort("onCancel")
}
override fun onSure() {
ToastUtil.toastShort("nextStep")
}
})
secretDialog?.show()
}
override fun onSure() {
ToastUtil.toastShort("nextStep")
}
}
}
)
dialog.show()
}
......@@ -233,14 +260,15 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
super.onResume()
MobclickAgent.onResume(this)
ModularServiceManager.provide(IConsultantService::class.java)
.showConsultAssistantDialog(this)
// ModularServiceManager.provide(IConsultantService::class.java)
// .
// (this)
}
override fun onPause() {
super.onPause()
ModularServiceManager.provide(IConsultantService::class.java).hideConsultAssistantDialog()
// ModularServiceManager.provide(IConsultantService::class.java).hideConsultAssistantDialog()
}
......@@ -261,4 +289,22 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
}
}
private fun showEnsureDialog() {
secretDialog = SecretDialog(this, object : OnSecretDialogListener {
override fun onCancel() {
secretDialog!!.dismiss()
// finishAll()
// Process.killProcess(Process.myPid())
// System.exit(0)
}
override fun onSure() {
secretDialog!!.dismiss()
}
})
secretDialog!!.setCanceledOnTouchOutside(false)
secretDialog!!.show()
}
}
......@@ -8,6 +8,7 @@ import com.ydl.component.mvp.DemoPresenter
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.yidianling.consultant.ExpertSearchFragment
//import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
import com.yidianling.home.ui.fragment.YdlHomeFragment
//import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
......
......@@ -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"
......
......@@ -43,16 +43,16 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.48.8",
"m-consultant" : "0.0.58.3",
"m-fm" : "0.0.29.2",
"m-user" : "0.0.59.21",
"m-consultant" : "0.0.58.4",
"m-fm" : "0.0.29.3",
"m-user" : "0.0.60.1",
"m-home" : "0.0.20.3",
"m-im" : "0.0.16.7",
"m-dynamic" : "0.0.7.4",
"m-im" : "0.0.17.0",
"m-dynamic" : "0.0.7.5",
"m-muse" : "0.0.28.8",
"m-tests" : "0.0.23.11",
"m-course" : "0.0.41.10",
"m-muse" : "0.0.28.9",
"m-tests" : "0.0.24.0",
"m-course" : "0.0.42.0",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
......@@ -72,10 +72,10 @@ ext {
"ydl-platform" : "0.0.39.17",
//第二步 若干
"ydl-webview" : "0.0.38.13",
"ydl-webview" : "0.0.38.24",
"ydl-media" : "0.0.21.3",
"ydl-pay" : "0.0.18.6",
"m-audioim" : "0.0.48.0",
"m-audioim" : "0.0.48.2.7",
"ydl-flutter-base": "0.0.14.4",
//以下 几乎不会动
......@@ -115,14 +115,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.9",
"ydl-platform" : "0.0.39.16",
//第二步 若干
"ydl-webview" : "0.0.38.12",
"ydl-webview" : "0.0.38.24",
"ydl-media" : "0.0.21.3",
"ydl-pay" : "0.0.18.6",
"m-audioim" : "0.0.48.0",
"ydl-flutter-base": "0.0.10.8",
"m-audioim" : "0.0.48.2.7",
"ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -287,6 +287,7 @@ ext {
"ydl-m-muse-api" : "com.ydl:m-muse-api:${ydlCompileVersion["m-muse-api"]}",
"ydl-m-fm-api" : "com.ydl:m-fm-api:${ydlCompileVersion["m-fm-api"]}",
"ydl-m-tests-api" : "com.ydl:m-tests-api:${ydlCompileVersion["m-tests-api"]}",
"ydl-m-audioim-api" : "com.ydl:m-audioim-api:${ydlCompileVersion["m-audioim-api"]}",
"ydl-m-im-api" : "com.ydl:m-im-api:${ydlCompileVersion["m-im-api"]}",
"ydl-m-home-api" : "com.ydl:m-home-api:${ydlCompileVersion["m-home-api"]}",
"ydl-m-consultant-api" : "com.ydl:m-consultant-api:${ydlCompileVersion["m-consultant-api"]}",
......
......@@ -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
......
......@@ -75,7 +75,7 @@ dependencies {
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api "com.alibaba:arouter-api:$arouter_api"
api ('com.ydl:ydl-av:1.1.9@aar'){
api ('com.ydl:ydl-av:1.2.1@aar'){
transitive = true
}
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.audioim" >
package="com.ydl.audioim">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.VIBRATE"/>
<application>
<activity
android:name=".AudioHomeActivity"
android:screenOrientation="portrait" />
android:name=".AudioHomeActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:screenOrientation="portrait"/>
</application>
</manifest>
......@@ -40,14 +40,10 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.ydl_av.messge_service.ChannelManager
import com.ydl.ydl_av.messge_service.YDLRTMClient
import com.ydl.ydl_av.messge_service.bean.RTMMesssage
import com.ydl.ydl_av.messge_service.callback.CallListener
import com.ydl.ydl_av.messge_service.callback.ChannelListener
import com.ydl.ydl_av.messge_service.response.CallLocalResponse
import com.ydl.ydl_av.messge_service.response.CallRemoteResponse
import com.ydl.ydl_av.messge_service.response.ChannelMember
import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydl_image.config.SimpleImageOpConfiger
......@@ -57,11 +53,13 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtc.IRtcEngineEventHandler
import io.agora.rtm.RtmStatusCode
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
......@@ -78,7 +76,8 @@ import java.util.concurrent.TimeUnit
* @date 2018/10/30
*/
@Route(path = "/av/AudioHomeActivity")
class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(),
class AudioHomeActivity :
BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(),
IAudioHomeActivityContract.View, SensorEventListener {
/**
......@@ -158,6 +157,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//电源锁
private var localWakeLock: PowerManager.WakeLock? = null
private var sensorManager: SensorManager? = null
private var sendDoctocrMsg: String? = null
private var axbPhone: String? = null
//是否跳转到拨号页面
private var isJumpDail: Boolean = false
......@@ -168,7 +168,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private var voiceManage: YDLVoiceManager? = null
//频道管理器
private var channelManager: ChannelManager? = null
// private var channelManager: ChannelManager? = null
private var isLeavelChannel: Boolean = false
private var hasUpLoadLog = false
......@@ -249,7 +249,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onApiCallExecuted(error: Int, api: String?, result: String?) {
super.onApiCallExecuted(error, api, result)
LogUtil.e("[agora]$api 已执行回调 $result")
// LogUtil.e("[agora]$api 已执行回调 $result")
}
......@@ -257,7 +257,14 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 用户声网加入频道成功:channel=$channel")
//更新ui
onJoinChannelSuccess()
// onJoinChannelSuccess()
//更新:现在专家先加入频道,所以不会有等待的过程,
runOnUiThread {
//自己加入频道成功
connectSuccess()
}
}
override fun onRtcStats(stats: IRtcEngineEventHandler.RtcStats?) {
......@@ -291,7 +298,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onLastmileQuality(quality: Int) {
super.onLastmileQuality(quality)
LogUtil.e("[agora]网络质量报告回调${quality}")
// LogUtil.e("[agora]网络质量报告回调${quality}")
}
override fun onConnectionInterrupted() {
......@@ -302,11 +309,6 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户/主播加入频道回调")
runOnUiThread {
//另一方加入频道成功
connectSuccess()
}
}
override fun onUserOffline(uid: Int, elapsed: Int) {
......@@ -327,17 +329,6 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
//
/**
* 上传错误日志
*/
private fun uploadException(message: String) {
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, "2", "99", payLoad)
getPresenter().connectException(connectException)
}
override fun createPresenter(): IAudioHomeActivityContract.Presenter {
return AudioHomePresenterImpl()
}
......@@ -372,7 +363,10 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager?
localPowerManager = getSystemService(POWER_SERVICE) as PowerManager?
localWakeLock = localPowerManager!!.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "yidianling")
localWakeLock = localPowerManager!!.newWakeLock(
PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK,
"yidianling"
)
}
private fun initIntentData() {
......@@ -452,9 +446,15 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
tv_change_route.setOnClickListener { showChooseDialog(1) }
//挂断
iv_hang_up.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
if (isConnectSuccess) {
updateExpertStatus(false, 1)
userCloseCalling()
// userCloseCalling()
leaveChannel()
uploadLog()
} else {
userCloseCalling()
}
......@@ -484,18 +484,22 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
private fun setCallBack() {
//RTC 回调
YDLRTMClient.instances.setCallListener(object : CallListener {
override fun onCallRecivedByPeer(response: CallLocalResponse?) {
playWaitingMusic()
//返回给主叫:被叫已收到呼叫邀请
LogUtil.i("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}")
}
override fun onCallAccepted(response: CallLocalResponse?) {
override fun onCallAccepted(response: CallLocalResponse?, msg: String?) {
//返回给主叫
LogUtil.i("[agora]${response?.calleeId}已接收呼叫邀请")
LogUtil.i("[agora]${response?.calleeId}已接受呼叫邀请")
//加入声网频道时机修改:用户收到专家接受邀请的回调后再加入声网频道
joinChannel()
}
override fun onCallRefused(response: CallLocalResponse?) {
override fun onCallRefused(response: CallLocalResponse?, msg: String?) {
//返回给主叫
LogUtil.i("[agora]${response?.calleeId}已拒绝呼叫邀请")
ToastUtil.showToast(applicationContext, "对方已挂断")
......@@ -509,9 +513,20 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
LogUtil.i("[agora]主叫已取消呼叫邀请")
}
override fun onCallFailure(response: CallLocalResponse?) {
override fun onCallFailure(response: CallLocalResponse?, errorCode: Int) {
//返回给主叫
LogUtil.i("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
//专家离线或者30 秒后仍未收到专家响应,重新再邀请一次
when (errorCode) {
//被叫不在线 呼叫邀请发出 30 秒后被叫仍未 ACK 响应呼叫邀请
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_PEER_OFFLINE,
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_PEER_NO_RESPONSE -> {
YDLRTMClient.instances.call(listenerUid!!, channelId, sendDoctocrMsg)
}
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> {//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
}
}
}
override fun onRemoteInvitationReceived(response: CallRemoteResponse?) {
......@@ -534,7 +549,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
LogUtil.i("[agora]主叫${response?.callerId}已取消呼叫邀请")
}
override fun onRemoteInvitationFailure(response: CallRemoteResponse?) {
override fun onRemoteInvitationFailure(response: CallRemoteResponse?, errorCode: Int) {
//返回给被叫
LogUtil.i("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
}
......@@ -543,26 +558,27 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
LogUtil.i("[agora]其它消息:${error}")
}
})
channelManager = YDLRTMClient.instances.createChannelManager(channelId, object : ChannelListener {
override fun onMemberCountUpdated(memberCount: Int) {
//频道人数更新
LogUtil.i("[agora]当前频道人数:$memberCount")
}
override fun onMessageReceived(message: RTMMesssage?, member: ChannelMember?) {
//接到频道消息
LogUtil.i("[agora]接到${member?.channelId}频道${member?.userId}的消息:" + message?.text)
}
override fun onMemberJoined(member: ChannelMember?) {
//新用户加入频道
LogUtil.i("[agora]新用户加入${member?.channelId}频道:${member?.userId}")
}
override fun onMemberLeft(member: ChannelMember?) {
LogUtil.i("[agora]有用户离开${member?.channelId}频道:${member?.userId}")
}
})
// channelManager = YDLRTMClient.instances.createChannelManager(channelId, object : ChannelListener {
// override fun onMemberCountUpdated(memberCount: Int) {
// //频道人数更新
// LogUtil.i("[agora]当前频道人数:$memberCount")
// }
//
// override fun onMessageReceived(message: RTMMesssage?, member: ChannelMember?) {
// //接到频道消息
// LogUtil.i("[agora]接到${member?.channelId}频道${member?.userId}的消息:" + message?.text)
// }
//
// override fun onMemberJoined(member: ChannelMember?) {
// //新用户加入频道
// LogUtil.i("[agora]新用户加入${member?.channelId}频道:${member?.userId}")
// }
//
// override fun onMemberLeft(member: ChannelMember?) {
// LogUtil.i("[agora]有用户离开${member?.channelId}频道:${member?.userId}")
// }
// })
}
/**
......@@ -608,20 +624,42 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
null,
channelId
)
YDLRTMClient.instances.call(listenerUid!!, channelId, Gson().toJson(msgBean))
//开始25s等待倒计时
Observable.interval(0, 100, TimeUnit.MILLISECONDS)
sendDoctocrMsg = Gson().toJson(msgBean)
YDLRTMClient.instances.call(listenerUid!!, channelId, sendDoctocrMsg)
// Observable.interval(0, 100, TimeUnit.MILLISECONDS)
// .subscribeOn(Schedulers.computation())
// .take(303)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe({
// var result = it.toFloat() / 2.5f
// progress_view.setProgress(result)
// if (result >= 100f && !iv_hang_up.isEnabled) {
// //挂断按钮可点击
// iv_hang_up.isEnabled = true
// iv_hang_up.setImageResource(R.drawable.audioim_img_hang_up)
// }
// }, {}, {})
//开始60s等待倒计时
waitDisposable = Observable.interval(0, 100, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.computation())
.take(253)
.take(603)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
progress_view.setProgress(it.toFloat() / 2.5f)
var result = it.toFloat() / 2.5f
progress_view.setProgress(result)
if (result >= 100f && !iv_hang_up.isEnabled) {
//挂断按钮可点击
iv_hang_up.isEnabled = true
iv_hang_up.setImageResource(R.drawable.audioim_img_hang_up)
}
}, {
LogUtil.d(it.message)
}, {
waittingStatus()
if (!isConnectSuccess) {
// iv_hang_up.setImageResource(R.mipmap.audioim_ico_close)
//关闭音乐
stopPlaying()
//提示切换传统线路
......@@ -633,8 +671,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
showChooseDialog(2)
}
})
//加入频道135
joinChannel()
//双重保险:加入频道成功,通过服务端发推送给专家
noticeServerPush(true)
}
......@@ -716,19 +753,24 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
*/
private fun showChooseDialog(type: Int) {
val dialog = AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
switchAXB()
}
val dialog =
AxbConfirmDialog(mContext, type, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
//是手动切换且连接成功
if (type == 1 && isConnectSuccess) {
uploadException("", "zhu")
}
switchAXB()
}
override fun onClose() {
// 如果声网未连接成功,切换axb的弹框是自动弹出的,当关闭弹框的时候,执行用户挂断操作
// 如果声网连接成功,点击右上角按钮弹出切换axb弹框,但是关闭时用户不执行挂断操作
if (!isConnectSuccess) {
userCloseCalling()
override fun onClose() {
// 如果声网未连接成功,切换axb的弹框是自动弹出的,当关闭弹框的时候,执行用户挂断操作
// 如果声网连接成功,点击右上角按钮弹出切换axb弹框,但是关闭时用户不执行挂断操作
if (!isConnectSuccess) {
userCloseCalling()
}
}
}
})
})
dialog.show()
}
......@@ -771,7 +813,7 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
/**
* 30s等待完成,专家未接听
* 60s等待完成,专家未接听
*/
private fun waittingStatus() {
//挂断按钮可点击
......@@ -891,9 +933,9 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
//通知服务端,此次通话已经接通,服务端开始订单
updateExpertStatus(false, 0)
if (waitDisposable != null) {
waitDisposable!!.dispose()
}
// if (waitDisposable != null) {
// waitDisposable!!.dispose()
// }
if (disposable != null) {
disposable!!.dispose()
}
......@@ -927,11 +969,19 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
if (localRemainTime!! <= 60) {
if (tv_change_route.isEnabled) {
tv_change_route.isEnabled = false
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.audioim_color_50ffffff))
tv_change_route.setTextColor(
ContextCompat.getColor(
this,
R.color.audioim_color_50ffffff
)
)
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(this, R.drawable.audioim_img_choose_arrow_unuse),
ContextCompat.getDrawable(
this,
R.drawable.audioim_img_choose_arrow_unuse
),
null
)
}
......@@ -1086,6 +1136,21 @@ class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudi
}
}
/**
* 上传错误日志
* zhu 洪平要的,判别是移动端主动调的还是声网返的
*/
private fun uploadException(message: String, zhu: String = "") {
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)
getPresenter().connectException(connectException)
}
override fun finishActivity() {
leaveChannel()
}
......
package com.ydl.audioim.presenter
import android.annotation.SuppressLint
import com.ydl.audioim.BuildConfig
import com.ydl.ydl_av.chat.config.YDLChatParam
import com.ydl.audioim.contract.IAudioHomeActivityContract
......@@ -65,6 +66,7 @@ class AudioHomePresenterImpl : BasePresenter<IAudioHomeActivityContract.View, IA
// })
// }
@SuppressLint("CheckResult")
override fun connectException(param: ConnectExceptionCommand) {
mModel.connectException(param)
.subscribeOn(Schedulers.io())
......@@ -106,6 +108,7 @@ class AudioHomePresenterImpl : BasePresenter<IAudioHomeActivityContract.View, IA
/**
* 获取axb电话
*/
@SuppressLint("CheckResult")
override fun getAXBPhone(cmd: ConnectCommand) {
mModel.getAXBPhone(cmd)
.subscribeOn(Schedulers.io())
......@@ -113,7 +116,7 @@ class AudioHomePresenterImpl : BasePresenter<IAudioHomeActivityContract.View, IA
.doOnSubscribe { mView.showProgressView() }
.doAfterTerminate { mView.dismissProgressView() }
.subscribe({
if ("200".equals(it.code)){
if ("200" == it.code){
if(0==it.data?.dialDetail?.dialStatus?:-1){
//连接成功
if(it.data?.dialDetail?.callConnectType?:-1==1){
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_color_80353535">
<TextView
android:id="@+id/tv_change_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:background="?android:attr/selectableItemBackground"
android:drawableRight="@drawable/audioim_img_choose_arrow_unuse"
android:drawablePadding="6dp"
android:padding="5dp"
android:text="切换至传统电话"
android:textColor="@color/platform_color_50FFFFFF"
android:textSize="13sp"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/rl_head"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp">
<com.ydl.ydlcommon.view.WaveView
android:id="@+id/wave_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true" />
<ImageView
android:layout_width="126dp"
android:layout_height="126dp"
android:layout_centerInParent="true"
android:background="@drawable/audioim_head_background" />
<ImageView
android:id="@+id/iv_head"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/audioim_head_place_hold_pic" />
</RelativeLayout>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_head"
android:layout_centerHorizontal="true"
android:layout_marginTop="-20dp"
android:textColor="@color/white"
android:textSize="26sp"
tools:text="留意" />
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="6dp"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp"
tools:text="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
<!-- 倾诉剩余时间-->
<RelativeLayout
android:id="@+id/rl_remain_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_marginBottom="20dp"
android:visibility="gone">
<TextView
android:id="@+id/tv_notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="您的倾诉时间还有"
android:textColor="@color/platform_color_30FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_remain_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_notes"
android:layout_centerHorizontal="true"
android:text="23:23"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_change_doctor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:gravity="center"
android:text="聆听者长时间未接听,\n您可以点击右上角切换线路,或者挂断换一位"
android:textColor="@color/white"
android:visibility="gone" />
<TextView
android:id="@+id/tv_waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:text="正在等待聆听者接受邀请…"
android:textColor="@color/platform_color_70FFFFFF"
android:textSize="12sp"
android:visibility="visible" />
<!--挂断按钮-->
<RelativeLayout
android:id="@+id/rl_hang_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="72dp"
android:layout_marginBottom="18dp">
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressWidth="2dp" />
<ImageView
android:id="@+id/iv_hang_up"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="1dp"
android:src="@drawable/audioim_img_hang_up_unuse"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="挂断"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
<!-- 免提按钮-->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="72dp"
android:layout_marginBottom="18dp">
<ImageView
android:id="@+id/iv_hands_free"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audioim_img_hands_free_unuse" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="免提"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
<!--自定义弹窗-->
<TextView
android:id="@+id/tv_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_tips"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:background="@drawable/audioim_toast_view_background"
android:elevation="6dp"
android:paddingLeft="11dp"
android:paddingTop="4dp"
android:paddingRight="11dp"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:visibility="gone"
tools:text="已接通" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_color_80353535">
<TextView
android:id="@+id/tv_change_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:background="?android:attr/selectableItemBackground"
android:drawableRight="@drawable/audioim_img_choose_arrow_unuse"
android:drawablePadding="6dp"
android:padding="5dp"
android:text="切换至传统电话"
android:textColor="@color/platform_color_50FFFFFF"
android:textSize="13sp"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/rl_head"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp">
<com.ydl.ydlcommon.view.WaveView
android:id="@+id/wave_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true" />
<ImageView
android:layout_width="126dp"
android:layout_height="126dp"
android:layout_centerInParent="true"
android:background="@drawable/audioim_head_background" />
<ImageView
android:id="@+id/iv_head"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/audioim_head_place_hold_pic" />
</RelativeLayout>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_head"
android:layout_centerHorizontal="true"
android:layout_marginTop="-20dp"
android:textColor="@color/white"
android:textSize="26sp"
tools:text="留意" />
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="6dp"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp"
tools:text="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
<!-- 倾诉剩余时间-->
<RelativeLayout
android:id="@+id/rl_remain_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_marginBottom="20dp"
android:visibility="gone">
<TextView
android:id="@+id/tv_notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="您的倾诉时间还有"
android:textColor="@color/platform_color_30FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_remain_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_notes"
android:layout_centerHorizontal="true"
android:text="23:23"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_change_doctor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:gravity="center"
android:text="聆听者长时间未接听,\n您可以点击右上角切换线路,或者挂断换一位"
android:textColor="@color/white"
android:visibility="gone" />
<TextView
android:id="@+id/tv_waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:text="正在等待聆听者接受邀请…"
android:textColor="@color/platform_color_70FFFFFF"
android:textSize="12sp"
android:visibility="visible" />
<!--挂断按钮-->
<RelativeLayout
android:id="@+id/rl_hang_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="72dp"
android:layout_marginBottom="18dp">
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressWidth="2dp" />
<ImageView
android:id="@+id/iv_hang_up"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="1dp"
android:src="@drawable/audioim_img_hang_up_unuse"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="挂断"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
<!-- 免提按钮-->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="72dp"
android:layout_marginBottom="18dp">
<ImageView
android:id="@+id/iv_hands_free"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audioim_img_hands_free_unuse" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="免提"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
<!--自定义弹窗-->
<TextView
android:id="@+id/tv_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_tips"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:background="@drawable/audioim_toast_view_background"
android:elevation="6dp"
android:paddingLeft="11dp"
android:paddingTop="4dp"
android:paddingRight="11dp"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:visibility="gone"
tools:visibility="visible"
tools:text="已接通"
/>
</RelativeLayout>
......@@ -68,7 +68,7 @@ class DynamicConstants {
open var TOPIC_DETAIL_H5 = HttpConfig.H5_URL+ "active/topic-members/"
open var TRENF_INFO_SHARE_H5 = HttpConfig.H5_URL + "ask/"
open var TRENF_INFO_SHARE_H5 = HttpConfig.MH5_URL + "ask/"
const val PUBLISH_TYPE = "publish_type"
......
......@@ -320,7 +320,7 @@ public class BrowsePicturesActivity extends BaseActivity implements ViewPager.On
Uri uri = FileUtils.INSTANCE.getUriByPath(container.getContext(), mImages.get(position).getImage_url());
GlideApp.with(mContext)
.load(uri)
.load(mImages.get(position).getImage_url())
.error(R.drawable.dynamic_default_img)
.into(mDatas.get(position));
mDatas.get(position).setOnPhotoTapListener((imageView, v, v1) -> finish());
......
......@@ -86,165 +86,84 @@ public class IMUtil {
GetExpert cmd = new GetExpert(Integer.parseInt(toUid), canTalk);
ImRetrofitApi.Companion.getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (res.code == 200 && res.data != null) {
if (res.data.getChatEvent()) {//和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", res.data.getChatEvent());
}
if (res.data.getCollectEvent()) {//和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache("collectEvent", res.data.getCollectEvent());
}
if (isFromMessageList) {
//先根据uid判断用户类型:专家调一个接口,非专家调另外的接口
ImRetrofitApi.Companion.getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (res.code == 200 && res.data != null) {
if (res.data.getChatEvent()) {//和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", res.data.getChatEvent());
}
if (res.data.getCollectEvent()) {//和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache("collectEvent", res.data.getCollectEvent());
}
if (TextUtils.equals(res.data.getUserType(), "2")) {//专家 java 接口
//如果是从消息列表点击进来的,那么专家还是专家,助理还是助理,不走其他所有逻辑(比如销售代运营)
if (isFromMessageList) {
startExpertChat(context, toUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
return;
}
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
ImRetrofitApi.Companion.getImJavaApi().getChatUid((toUid))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
DoctorAssistantRespDtoBean bean = resp.data;
if (bean.getRole() == 1) {
//接口返回值是专家,java接口
startExpertChat(context, bean.getChatUid(), dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
} else {
GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.getChatUid()), canTalk);
//接口返回值是助理,php接口
startAssistantChat(context, bean.getChatUid(), cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
}
}, t -> {
HttpErrorUtils.Companion.handleError(context, t);
});
} else {//非专家 php接口
startAssistantChat(context, toUid, cmd, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
if (TextUtils.equals(res.data.getUserType(), "2")) {//专家
if (isFromMessageList) {
startExpertChat(context, toUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
return;
}
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
ImRetrofitApi.Companion.getImJavaApi().getChatUid((toUid))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
DoctorAssistantRespDtoBean bean = resp.data;
ImRetrofitApi.Companion.getImJavaApi().getUserType(bean.chatUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userTypeResp -> {
if (userTypeResp.code == 200 && userTypeResp.data != null) {
if (userTypeResp.data.getChatEvent()) {//和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", userTypeResp.data.getChatEvent());
}
if (userTypeResp.data.getCollectEvent()) {//和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache("collectEvent", userTypeResp.data.getCollectEvent());
}
if (TextUtils.equals(userTypeResp.data.getUserType(), "2")) {//专家 java 接口
//接口返回值是专家,java接口
startExpertChat(context, bean.chatUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
} else {
//非专家 php接口
GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.chatUid), canTalk);
startAssistantChat(context, bean.chatUid, cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
}
} else {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
ToastUtil.toastShort(userTypeResp.msg);
}
}, throwable -> {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, throwable);
});
}, t -> {
HttpErrorUtils.Companion.handleError(context, t);
});
} else {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
ToastUtil.toastShort(res.msg);
startAssistantChat(context, toUid, cmd, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
}
}, throwable -> {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, throwable);
});
} else {
ImRetrofitApi.Companion.getImJavaApi().getChatUid(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(getChatUidResp -> {
DoctorAssistantRespDtoBean bean = getChatUidResp.data;
ImRetrofitApi.Companion.getImJavaApi().getUserType(bean.chatUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(userTypeResp -> {
if (userTypeResp.code == 200 && userTypeResp.data != null) {
if (userTypeResp.data.getChatEvent()) {//和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", userTypeResp.data.getChatEvent());
}
if (userTypeResp.data.getCollectEvent()) {//和助理私聊需要打开信息采集弹窗
ChatStatusCacheHelper.setStatusCache("collectEvent", userTypeResp.data.getCollectEvent());
}
if (TextUtils.equals(userTypeResp.data.getUserType(), "2")) {//专家 java 接口
//接口返回值是专家,java接口
startExpertChat(context, bean.chatUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
} else {
//非专家 php接口
GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.chatUid), canTalk);
startAssistantChat(context, bean.chatUid, cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
}
} else {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
ToastUtil.toastShort(userTypeResp.msg);
}
}, throwable -> {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, throwable);
});
}, t -> {
} else {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, t);
});
}
ToastUtil.toastShort(res.msg);
}
// //先根据uid判断用户类型:专家调一个接口,非专家调另外的接口
// Disposable disposable = ImRetrofitApi.Companion.getImJavaApi().getUserType(toUid)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(res -> {
// if (res.code == 200) {
// if (TextUtils.equals(res.data, "2")) {//专家 java 接口
//
// //如果是从消息列表点击进来的,那么专家还是专家,助理还是助理,不走其他所有逻辑(比如销售代运营)
// if (isFromMessageList) {
// startExpertChat(context, toUid, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// return ;
// }
//
// //在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
// Disposable disposa = ImRetrofitApi.Companion.getImJavaApi().getChatUid((toUid))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(resp -> {
//
// DoctorAssistantRespDtoBean bean = resp.data;
// if (bean.getRole() == 1) {
// //接口返回值是专家,java接口
// startExpertChat(context, bean.getChatUid(), dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// }else {
//
// GetExpert cmd1 = new GetExpert(Integer.parseInt(bean.getChatUid()), canTalk);
// //接口返回值是助理,php接口
// startAssistantChat(context, bean.getChatUid(), cmd1, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// }
//
// },t->{
// HttpErrorUtils.Companion.handleError(context, t);
// });
// } else {//非专家 php接口
// startAssistantChat(context, toUid, cmd, dialog, listener, isUseUm, isSaveUserInfo, isFromQingShu);
// }
// } else {
// if (dialog.isVisible()) {
// dialog.dismissAllowingStateLoss();
// }
// ToastUtil.toastShort(res.msg);
// }
// }, throwable -> {
// if (dialog.isVisible()) {
// dialog.dismissAllowingStateLoss();
// }
// HttpErrorUtils.Companion.handleError(context, throwable);
// });
}, throwable -> {
if (dialog.isVisible()) {
dialog.dismissAllowingStateLoss();
}
HttpErrorUtils.Companion.handleError(context, throwable);
});
}
/**
......
package com.yidianling.uikit.business.session.fragment;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Intent;
......@@ -44,8 +45,10 @@ import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.ydl.ydlcommon.utils.LogUtil;
import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils;
import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.view.CircleImageView;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.router.ImIn;
......@@ -82,8 +85,6 @@ import com.yidianling.user.api.service.IUserService;
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
......@@ -113,6 +114,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
//快捷菜单
protected RelativeLayout lin_actions;
protected RelativeLayout rl_doctor_name;
private LinearLayout ll_actions_yi;
......@@ -159,13 +161,17 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private ImRedStarGradeView good_num_icons;
private TextView im_focus_btn;
private TextView tv_from;
private TextView tv_doctor_name;
private LinearLayout top_view_container;
private LinearLayout constraint_ll;
private LinearLayout ll_info_detail;
private RelativeLayout rela_zixun;
private ValueAnimator anim_out;
private ObjectAnimator sourceLayoutAnim;
private ValueAnimator anim_in;
private Boolean expertInfoViewIsIn = true;
private Boolean expertInfoViewIsAnimating = false;
......@@ -219,6 +225,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
im_focus_btn = rootView.findViewById(R.id.im_focus_btn);
good_num_icons = rootView.findViewById(R.id.good_num_icons);
rela_zixun = rootView.findViewById(R.id.rela_zixun);
rl_doctor_name = rootView.findViewById(R.id.rl_doctor_name);
tv_from = rootView.findViewById(R.id.tv_from);
ll_info_detail = rootView.findViewById(R.id.ll_info_detail);
tv_doctor_name = rootView.findViewById(R.id.tv_doctor_name);
//和助理私聊时的常用语逻辑
rl_common_question_enter = rootView.findViewById(R.id.rl_common_question);
......@@ -239,7 +249,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
} else {
try {
YdlBuryPointUtil.sendPv("common_question_pager");
}catch (Exception e){
} catch (Exception e) {
}
getCommonQuestionListData();
......@@ -250,32 +260,36 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if (ChatStatusCacheHelper.getStatusCache("collectEvent")) {
String time = Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.MONTH) + Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
// if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + YdlCommonRouterManager.INSTANCE.getYdlCommonRoute().getUid()))) {
if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), (content, result) -> {
if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()
, time);
} else {
IMMessage textMessage = MessageBuilder.createTextMessage(sessionId, sessionType, content);
if (sendMessage(textMessage)) {
openOrCloseCommonQuestionLayout(false);
collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), new CollectInfoPopupWindow.OnSendMsgListener() {
@Override
public void sendMsg(@NotNull String content, @NotNull List<UserQuestInfoBean> result) {
if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()
, time);
} else {
IMMessage textMessage = MessageBuilder.createTextMessage(sessionId, sessionType, content);
if (sendMessage(textMessage)) {
openOrCloseCommonQuestionLayout(false);
}
submitUserCollect(result);
}
submitUserCollect(result);
}
@Override
public void finishPage() {
getActivity().finish();
}
});
getUserInfoCollect();
if (!getActivity().isFinishing()) {
try {
YdlBuryPointUtil.sendPv("user_collect_pager");
}catch (Exception e){
} catch (Exception e) {
}
collectInfoPopupWindow.show(top_expert_info_cl);
}
}
ChatStatusCacheHelper.clearDataByKey("collectEvent");
}
......@@ -359,6 +373,49 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
}, throwable -> {
});
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 1 && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 3) {
ServiceImpl.Companion.getInstance().getSourceDoctor(ActionHandlerStorage.getL(sessionId).getInfo().toUid, ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUid())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (TextUtils.equals(res.code, "200") && res.data != null && !TextUtils.isEmpty(res.data.name)) {
addSourceLayoutScrollListener();
rl_doctor_name.setVisibility(View.VISIBLE);
tv_doctor_name.setText(res.data.name);
} else {
rl_doctor_name.setVisibility(View.GONE);
}
}, throwable -> {
rl_doctor_name.setVisibility(View.GONE);
});
}
if (ActionHandlerStorage.getL(sessionId) != null && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 1) {
if (TextUtils.isEmpty(SharedPreferencesEditor.getString("chat_age_ensure_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
ServiceImpl.Companion.getInstance().getNewUserMes()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
for (UserQuestInfoBean bean : hasCollectedInResp.data) {
if (TextUtils.equals(bean.getUserInfoType(), "age")) {
try {
String year = bean.getContent();
if ((Calendar.getInstance().get(Calendar.YEAR) - Integer.valueOf(year)) <= 16) {
if (!getActivity().isFinishing()) {
showCheckAgeDialog();
}
}
} catch (Exception e) {
}
}
}
}
}, throwable -> {
});
}
}
}
private void addScrollListener() {
......@@ -372,7 +429,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy < 0 && Math.abs(dy) > 15) {
hasUpScroll = true;
// 下滑
......@@ -393,6 +449,26 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
});
}
private void addSourceLayoutScrollListener() {
messageListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
sourceDoctorLayoutIn();
} else {
sourceDoctorLayoutOut();
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
}
});
}
private void initTopViewHeight() {
top_expert_info_ll.getViewTreeObserver().addOnGlobalLayoutListener(() -> expertInfoViewHeight = top_expert_info_ll.getHeight());
......@@ -473,6 +549,27 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
return anim;
}
private void sourceDoctorLayoutIn() {
if (rl_doctor_name.getVisibility() == View.VISIBLE) {
if (sourceLayoutAnim == null) {
sourceLayoutAnim = ObjectAnimator.ofFloat(ll_info_detail, "translationX", 0.0f, -tv_from.getMeasuredWidth());
sourceLayoutAnim.setDuration(250);
}
sourceLayoutAnim.reverse();
}
}
private void sourceDoctorLayoutOut() {
if (rl_doctor_name.getVisibility() == View.VISIBLE) {
if (sourceLayoutAnim == null) {
sourceLayoutAnim = ObjectAnimator.ofFloat(ll_info_detail, "translationX", 0.0f, -tv_from.getMeasuredWidth());
sourceLayoutAnim.setDuration(250);
}
sourceLayoutAnim.start();
}
}
/**
* 初始化顶部专家信息栏
*/
......@@ -1127,7 +1224,18 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
if (resp.data != null && resp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data);
ServiceImpl.Companion.getInstance().getNewUserMes()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data, hasCollectedInResp.data);
} else {
collectInfoPopupWindow.setData(resp.data, null);
}
}, throwable -> {
collectInfoPopupWindow.setData(resp.data, null);
});
} else {
collectInfoPopupWindow.dismiss();
}
......@@ -1147,4 +1255,20 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}, throwable -> {
});
}
private void showCheckAgeDialog() {
CommonDialog.create(getActivity())
.setLeftOnclick("返回", v -> {
getActivity().finish();
ActionCountUtils.Companion.count("under_age_alert_page|under_age_alert_return_click");
})
.setRightClick("继续", v -> {
SharedPreferencesEditor.putString("chat_age_ensure_" + ImIn.INSTANCE.getUserInfo().getUid(), "ensure");
ActionCountUtils.Companion.count("under_age_alert_page|under_age_alert_continue_clcik");})
.setMessage("由于您未满16周岁,如需咨询需要在家长陪同下进行")
.setCancelAble(false)
.show();
ActionCountUtils.Companion.count("under_age_alert_page|under_age_alert_page_visit");
}
}
......@@ -18,7 +18,8 @@ import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
* @Company 壹点灵
* @date 2019/12/10
*/
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) : PopupWindow(mContext) {
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) :
PopupWindow(mContext) {
private var collectUserInformationView: CollectUserInformationView
private var isFromBack = true
......@@ -30,6 +31,9 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
listener.sendMsg("", ArrayList())
isFromBack = false
dismiss()
}, {
dismiss()
listener.finishPage()
}, { _content, _list ->
listener.sendMsg(_content, _list)
isFromBack = false
......@@ -49,12 +53,12 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
isOutsideTouchable = false
}
fun setData(list: List<UserQuestInfoBean>) {
fun setData(list: List<UserQuestInfoBean>, hasCompleteInfoList: List<UserQuestInfoBean>?) {
if (list.isEmpty()) {
ToastUtil.toastShort("数据异常,请稍后重试")
return
}
collectUserInformationView.setData(list)
collectUserInformationView.setData(list, hasCompleteInfoList)
}
......@@ -78,6 +82,8 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
interface OnSendMsgListener {
fun sendMsg(content: String, result: List<UserQuestInfoBean>)
fun finishPage()
}
}
\ No newline at end of file
......@@ -18,11 +18,14 @@ import android.widget.EditText
import android.widget.LinearLayout
import android.widget.ScrollView
import android.widget.TextView
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.im.router.ImIn.getUserInfo
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import kotlinx.android.synthetic.main.im_view_collect_user_infomation.view.*
import java.util.*
......@@ -37,19 +40,28 @@ import kotlin.collections.ArrayList
* @date 2019/12/10
*/
@SuppressLint("ViewConstructor")
class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Unit, var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit) : LinearLayout(mContext) {
class CollectUserInformationView(
var mContext: Context,
var skipEvent: () -> Unit,
var backEvent: () -> Unit,
var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit
) : LinearLayout(mContext) {
private var resultInfoList = ArrayList<UserQuestInfoBean>()
private var hasAge = false
private var hasGender = false
private var currentIndex = 0
private var year =1994
//todo CommonDialog的样式要改
private var isNeedShowCheckAgeDialog = false
private var year = 1994
private var dialog: CommonDialog? = null
private var ensureAgeDialog: CommonDialog? = null
private var ageStr = ""
private var genderStr = ""
private var questionStr = ""
private var questionStyleStr = ""
init {
val params = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
val params =
LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
layoutParams = params
View.inflate(mContext, R.layout.im_view_collect_user_infomation, this)
orientation = VERTICAL
......@@ -64,9 +76,31 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
}
fun setData(list: List<UserQuestInfoBean>) {
fun setData(list: List<UserQuestInfoBean>, hasCompleteInfoList: List<UserQuestInfoBean>?) {
resultInfoList.clear()
resultInfoList.addAll(list)
if (hasCompleteInfoList != null && hasCompleteInfoList.isNotEmpty()) {
repeat(hasCompleteInfoList.size) {
if (TextUtils.equals("age", hasCompleteInfoList[it].userInfoType)) {
if (!TextUtils.isEmpty(hasCompleteInfoList[it].content)) {
hasAge = true
year = try {
hasCompleteInfoList[it].content!!.toInt()
} catch (e: Exception) {
1994
}
ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
}
}
if (TextUtils.equals("gener", hasCompleteInfoList[it].userInfoType)) {
if (!TextUtils.isEmpty(hasCompleteInfoList[it].content)) {
hasGender = true
genderStr = "性别:${hasCompleteInfoList[it].content}"
}
}
}
}
addContentView(resultInfoList[0].question!!, true)
proceedNext(list)
}
......@@ -79,14 +113,18 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
//防止连击
return@setOnClickListener
}
addContentView(resultInfoList[1].question!!, true)
if (hasGender || hasAge) {
addContentView(resultInfoList[3].question!!, true)
currentIndex += 2
rl_question_style.visibility = View.VISIBLE
} else {
addContentView(resultInfoList[1].question!!, true)
ll_gender.visibility = View.VISIBLE
}
tv_start.visibility = View.GONE
ll_gender.visibility = View.VISIBLE
}
//性别
tv_gender_male.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
......@@ -116,12 +154,15 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
}
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(2).visibility = View.GONE
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(1).visibility = View.GONE
//年龄
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(2)
.visibility = View.GONE
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(1)
.visibility = View.GONE
date_pick.init(
year,
Calendar.getInstance().get(Calendar.MONTH),
Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
year,
Calendar.getInstance().get(Calendar.MONTH),
Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
) { _, year, _, _ ->
this.year = year
}
......@@ -132,6 +173,9 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
return@setOnClickListener
}
ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
if ((Calendar.getInstance().get(Calendar.YEAR) - year) <= 16) {
isNeedShowCheckAgeDialog = true
}
addContentView("${year}年", false)
tv_age_ensure.postDelayed({
......@@ -141,13 +185,17 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
}, 300)
}
if (list.size >= 3){
if (list.size >= 3) {
val adapter = CollectInfoStyleAdapter(list[3].answerList!!) {
addContentView(it, false)
rl_question_style.postDelayed({
questionStyleStr = "咨询类型:${it}"
addContentView(resultInfoList[currentIndex].question!!, true, resultInfoList[currentIndex].answerList!![0])
addContentView(
resultInfoList[currentIndex].question!!,
true,
resultInfoList[currentIndex].answerList!![0]
)
rl_question_style.visibility = View.GONE
ll_input.visibility = View.VISIBLE
......@@ -162,8 +210,8 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
val layoutManager = GridLayoutManager(mContext, 3)
rl_question_style.layoutManager = layoutManager
rl_question_style.adapter = adapter
}else{
rl_question_style.visibility = View.GONE
} else {
rl_question_style.visibility = View.GONE
}
tv_send.setOnClickListener {
......@@ -191,20 +239,37 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
//防止连击
return@setOnClickListener
}
val resultContent = ageStr + "\n" + genderStr + "\n" + questionStyleStr + "\n" + questionStr
val genderBean = UserQuestInfoBean(list[1].userInfoType, "", ArrayList(), genderStr.split(":")[1])
val ageBean = UserQuestInfoBean(list[2].userInfoType, "", ArrayList(),"${year}")
val questionStyleBean = UserQuestInfoBean(list[3].userInfoType, "", ArrayList(), questionStyleStr.split(":")[1])
val questionBean = UserQuestInfoBean(list[4].userInfoType, "", ArrayList(), questionStr.split(":")[1])
val resultContent =
ageStr + "\n" + genderStr + "\n" + questionStyleStr + "\n" + questionStr
val genderBean =
UserQuestInfoBean(list[1].userInfoType, "", ArrayList(), genderStr.split(":")[1])
val ageBean = UserQuestInfoBean(list[2].userInfoType, "", ArrayList(), "$year")
val questionStyleBean = UserQuestInfoBean(
list[3].userInfoType,
"",
ArrayList(),
questionStyleStr.split(":")[1]
)
val questionBean =
UserQuestInfoBean(list[4].userInfoType, "", ArrayList(), questionStr.split(":")[1])
val resultList = ArrayList<UserQuestInfoBean>()
resultList.add(genderBean)
resultList.add(ageBean)
if (!hasGender) {
resultList.add(genderBean)
}
if (!hasAge) {
resultList.add(ageBean)
}
resultList.add(questionStyleBean)
resultList.add(questionBean)
sendMsgEvent(resultContent, resultList)
if (isNeedShowCheckAgeDialog) {
showCheckAgeEnsure(resultContent, resultList)
} else {
sendMsgEvent(resultContent, resultList)
}
}
}
......@@ -212,11 +277,17 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
@SuppressLint("RtlHardcoded")
private fun addContentView(title: String, send: Boolean, subtitle: String = "") {
val textView = TextView(mContext)
val params = LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
val params =
LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
params.topMargin = RxImageTool.dp2px(18f)
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17f)
textView.setTextColor(Color.parseColor("#242424"))
textView.setPadding(RxImageTool.dp2px(13f), RxImageTool.dp2px(9f), RxImageTool.dp2px(13f), RxImageTool.dp2px(9f))
textView.setPadding(
RxImageTool.dp2px(13f),
RxImageTool.dp2px(9f),
RxImageTool.dp2px(13f),
RxImageTool.dp2px(9f)
)
if (send) {
textView.setBackgroundResource(R.drawable.im_background_collect_info_left)
params.gravity = Gravity.LEFT
......@@ -227,8 +298,18 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
if (!TextUtils.isEmpty(subtitle)) {
val resultText = "$title\n参考:\n$subtitle"
val sbString = SpannableString(resultText)
sbString.setSpan(ForegroundColorSpan(Color.parseColor("#999999")), title.length + 3, resultText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
sbString.setSpan(AbsoluteSizeSpan(12, true), title.length, resultText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
sbString.setSpan(
ForegroundColorSpan(Color.parseColor("#999999")),
title.length + 3,
resultText.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
sbString.setSpan(
AbsoluteSizeSpan(12, true),
title.length,
resultText.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.text = sbString
textView.setLineSpacing(4f, 1f)
} else {
......@@ -258,18 +339,45 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
imm.showSoftInput(editTextMessage, 0)
}
private fun showCheckAgeEnsure(content: String, list: List<UserQuestInfoBean>) {
if (ensureAgeDialog == null) {
ensureAgeDialog = CommonDialog.create(mContext)
.setLeftOnclick("返回") {
backEvent()
ensureAgeDialog!!.dismiss()
ActionCountUtils.count("under_age_alert_page|under_age_alert_return_click")
}
.setRightClick("继续") {
SharedPreferencesEditor.putString(
"chat_age_ensure_${getUserInfo()!!.uid}",
"ensure"
)
sendMsgEvent(content, list)
ensureAgeDialog!!.dismiss()
ActionCountUtils.count("under_age_alert_page|under_age_alert_continue_clcik")
}
.setMessage("由于您未满16周岁,如需咨询需要在家长陪同下进行")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(false)
}
if (!ensureAgeDialog!!.isShowing) {
ensureAgeDialog!!.show()
ActionCountUtils.count("under_age_alert_page|under_age_alert_page_visit")
}
}
fun showSkipDialog() {
if (dialog == null) {
dialog = CommonDialog.create(mContext)
.setLeftOnclick("下次吧") {
skipEvent()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
.setLeftOnclick("下次吧") {
skipEvent()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
}
if (!dialog!!.isShowing) {
dialog!!.show()
......
......@@ -207,7 +207,7 @@ class ImCommentBannerView : LinearLayout {
//获取经过加密的名字 : 徐**
private fun getName(name: String?): String {
var nameBuffer = StringBuffer()
if (name!=null&&!TextUtils.isEmpty(name)){
if (name != null && !TextUtils.isEmpty(name)) {
nameBuffer.append(name[0])
}
nameBuffer.append("**:")
......
......@@ -3,7 +3,6 @@ package com.yidianling.uikit.custom.http
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
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.uikit.custom.http.response.*
import io.reactivex.Observable
import okhttp3.RequestBody
......@@ -12,7 +11,7 @@ import retrofit2.http.*
/**
* Created by xj on 2019/6/26.
*/
interface ServiceApi{
interface ServiceApi {
//获取专家状态信息
@GET("chat/status")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
......@@ -27,7 +26,11 @@ interface ServiceApi{
//获取推荐专家列表信息
@GET("doctor/recommendSimilarListeners")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getRecommendExpertList(@Query("doctorUid") doctorUid: Long, @Query("catName") catName: String, @Query("limit") limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>>
fun getRecommendExpertList(
@Query("doctorUid") doctorUid: Long, @Query("catName") catName: String, @Query(
"limit"
) limit: Int
): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>>
//获取常用语
@POST("phrase/list")
......@@ -45,6 +48,12 @@ interface ServiceApi{
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>
//获取新用户收集的信息
@POST("user/getNewUserMes")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getNewUserMes(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>
//信息采集的问题
@POST("user/collect/submit")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
......@@ -64,4 +73,12 @@ interface ServiceApi{
@GET("systemconfig/get-chat-view-config")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getChatViewConfig(): Observable<BaseAPIResponse<SystemInfoBean>>
//获取代运营关联的专家的信息
@GET("chat/get-source-doctor")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
//注意:这个接口返回的还有很多字段,但是暂时不需要,就先取这两个字段
fun getSourceDoctor(@Query("scene") scene: Int,@Query("userUid") userUid: String,@Query("assistantUid") assistantUid: String): Observable<BaseAPIResponse<SourceDoctorInfoBean>>
}
\ No newline at end of file
......@@ -64,6 +64,13 @@ class ServiceImpl private constructor() {
}
/**
* 获取新用户收集的信息
*/
fun getNewUserMes(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getNewUserMes()
}
/**
* 上传采集的问题
*/
fun submitUserCollect(params: String): Observable<BaseAPIResponse<Any>> {
......@@ -94,4 +101,13 @@ class ServiceImpl private constructor() {
fun getChatViewConfig(): Observable<BaseAPIResponse<SystemInfoBean>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getChatViewConfig()
}
/**
* 获取代运营关联的专家的信息
*/
fun getSourceDoctor(userUid: String, assistantUid: String): Observable<BaseAPIResponse<SourceDoctorInfoBean>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getSourceDoctor(1, userUid, assistantUid)
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.http.response;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/2/21
*/
public class SourceDoctorInfoBean {
//注意:这个接口返回的还有很多字段,但是暂时不需要,就先取这两个字段
public String name;//专家name
public String uid;//专家uid
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:bottomRightRadius="17dp"
android:topRightRadius="17dp" />
<solid android:color="@color/white" />
</shape>
\ No newline at end of file
......@@ -219,8 +219,7 @@
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:visibility="gone"
>
android:visibility="gone">
<TextView
android:id="@+id/im_focus_btn"
......@@ -257,10 +256,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="1dp"
android:lines="1"
android:textColor="@color/platform_main_theme"
android:textSize="12dp"
android:layout_marginBottom="1dp"
android:text="(" />
<TextView
......@@ -403,9 +402,7 @@
android:id="@+id/rl_contain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_height="50dp">
</RelativeLayout>
tools:layout_height="50dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/messageListView"
......@@ -430,37 +427,6 @@
android:layout_marginTop="14dp"
android:visibility="visible">
<!-- <RelativeLayout-->
<!-- android:id="@+id/rela_qingsu"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="36dp"-->
<!-- android:background="@drawable/im_bg_im_confide_action"-->
<!-- android:gravity="center"-->
<!-- android:paddingLeft="14dp"-->
<!-- android:paddingRight="17dp">-->
<!-- <ImageView-->
<!-- android:id="@+id/action_qingshu_img"-->
<!-- android:layout_width="12dp"-->
<!-- android:layout_height="12dp"-->
<!-- android:layout_centerVertical="true"-->
<!-- android:src="@mipmap/im_chat_ico_call" />-->
<!-- <TextView-->
<!-- android:id="@+id/action_qingshu"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_toRightOf="@+id/action_qingshu_img"-->
<!-- android:gravity="center"-->
<!-- android:paddingLeft="5dp"-->
<!-- android:text="即时倾诉"-->
<!-- android:textColor="@color/platform_main_theme"-->
<!-- android:textSize="12dp"-->
<!-- android:textStyle="bold" />-->
<!-- </RelativeLayout>-->
<RelativeLayout
android:id="@+id/rela_zixun"
android:layout_width="wrap_content"
......@@ -485,6 +451,56 @@
</RelativeLayout>
<!--和助理聊天时,显示关联的咨询师的信息-->
<RelativeLayout
android:id="@+id/rl_doctor_name"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:id="@+id/ll_info_detail"
android:layout_width="wrap_content"
android:layout_height="34dp"
android:layout_toRightOf="@+id/view_empty"
android:background="@drawable/im_background_chat_assistant_to_doctor_name"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingRight="12dp">
<TextView
android:id="@+id/tv_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingRight="3dp"
android:text="来自"
android:textColor="@color/platform_color_242424"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_doctor_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:textColor="@color/im_main_theme"
android:textSize="12sp"
tools:text="雷水寿" />
</LinearLayout>
<View
android:id="@+id/view_empty"
android:layout_width="12dp"
android:layout_height="34dp"
android:background="@color/white" />
</RelativeLayout>
</RelativeLayout>
......
......@@ -193,6 +193,16 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
android:theme="@style/platform_NoTitleTheme"/>
<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
......@@ -84,5 +97,46 @@ object LoginUtils {
UserHelper.setUserinfo(null)
}
@JvmStatic
fun LoginSuccessOperate(activity: Activity) {
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
if (StatusUtils.isFirstLogin && StatusUtils.isFromGuide) {
activity.startActivity(Intent(activity, CollectSexAndBirthActivity::class.java))
}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 && StatusUtils.isFromGuide) {
activity.startActivity(Intent(activity, CollectSexAndBirthActivity::class.java))
} else {
UserIn.mainIntent(activity)
}
}
}
}
}
\ No newline at end of file
package com.yidianling.user;
/**
* 部分实时状态记录类
* isFirstLogin && isFromGuide 表示为注册前置且进行了注册
*/
public class StatusUtils {
/**
* 是否是注册
*/
public static boolean isFirstLogin = false;
/**
* 是否是第一次打开App
*/
public static boolean isFromGuide = 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 com.yidianling.user.mine.bean.RedPackDataForRegister
import com.yidianling.user.mine.bean.RedPacketId
......@@ -184,4 +185,20 @@ interface UserApi {
@FormUrlEncoded
@POST("uc/ready-bonus")
fun getRedPacketId(@FieldMap params: Map<String, String>): Observable<BaseResponse<RedPacketId>>
//上传用户信息数据接口
@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,6 +7,7 @@ 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
......@@ -15,6 +16,7 @@ import com.yidianling.user.http.response.SecretResponse
import com.yidianling.user.mine.bean.RedPackDataForRegister
import com.yidianling.user.mine.bean.RedPacketId
import com.yidianling.user.mine.bean.RedPacketIdCmd
import com.yidianling.user.http.response.*
import io.reactivex.Observable
/**
......@@ -69,4 +71,10 @@ interface UserHttp {
fun getSecretData(): Observable<BaseResponse<SecretResponse>>
fun getRedPacketId(param: RedPacketIdCmd): Observable<BaseResponse<RedPacketId>>
fun userInfoCollectUpload(param: UserInfoCollectUploadParam): Observable<BaseAPIResponse<Any>>
fun getFocusData(): Observable<BaseAPIResponse<List<CollectFocusItemBean>>>
fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>>
}
\ No newline at end of file
......@@ -12,9 +12,10 @@ import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.user.UserHelper
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
......@@ -203,6 +204,20 @@ class UserHttpImpl private constructor() : UserHttp {
.flatMap { getUserApi().getRedPacketId(it) }
}
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; // "gener"性别 "age"年龄 "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
......@@ -17,6 +17,7 @@ import com.ydl.ydlcommon.utils.remind.ToastHelper
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
......@@ -148,15 +149,17 @@ class SmsLoginActivity : BaseActivity() {
//关闭手势解锁页面与指纹解锁页面
finishFinger()
if (it.firstLogin == 1) {
StatusUtils.isFirstLogin = 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.content.Intent
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.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.StatusBarUtils
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()
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() {
isYfd = intent.getBooleanExtra(IS_YFD, false)
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 }.map { it.id }.joinToString(","),
"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({ res ->
if (res.isNotEmpty()) {
mList.addAll(res.filter { it.des.isNotEmpty() })
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,
mList[index + 1].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() {
var cateIds = mList.filter { it.isFocus }.map { it.id }.joinToString(",")
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?cateIds=$cateIds&barHeight=" + StatusBarUtils.getStatusBarHeight(
this
).toString(), H5Params.BackLimit.NEW_USER_PAGE, true
)
NewH5Activity.start(this, h5Params)
finish()
}
}, 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.support.v4.content.ContextCompat
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.StatusBarUtils
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 nowYear: Int = 0
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()
nowYear = 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.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.value = selectedYear
//更新用户选择的年份
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 "女",
"gener"
)
)
userInfoBean.userInfoList.add(UserInfoCollectParam("$selectedYear", "age"))
UserHttpImpl.getInstance().userInfoCollectUpload(userInfoBean)
.compose(RxUtils.resultJavaData())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
CollectFocusActivity.start(this, nowYear - selectedYear <= 16)
finish()
}, {
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?barHeight=" + StatusBarUtils.getStatusBarHeight(
this
).toString(), H5Params.BackLimit.NEW_USER_PAGE, true
)
NewH5Activity.start(this, h5Params)
finish()
}
}, {
})
}
@SuppressLint("ResourceAsColor")
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(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)
} 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(ContextCompat.getColor(mContext, R.color.user_main_theme))
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.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.support.v4.content.ContextCompat
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)
}
@SuppressLint("ResourceAsColor")
fun setFocus(focus: Boolean) {
if (focus) {
user_focus_title.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
user_focus_desc.setTextColor(ContextCompat.getColor(mContext, R.color.user_main_theme))
user_focus_title.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
setBackgroundResource(R.drawable.user_collect_select_bg)
} else {
user_focus_title.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
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
......@@ -17,6 +17,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
......@@ -277,38 +278,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,7 +38,9 @@ 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.StatusUtils
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.AliAuthBean
......@@ -126,6 +128,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun initDataAndEvent() {
isUmengLoginState = intent.getBooleanExtra(BIND_PHONE, false)
isFromGuide = intent.getBooleanExtra(IS_FROM_GUIDE, false)
StatusUtils.isFromGuide = isFromGuide
setWindowStatusBarColor()
initAuthHelper()
......@@ -467,10 +470,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)
}
}
......@@ -567,13 +567,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)
}
......
......@@ -15,6 +15,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
......@@ -273,37 +274,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)
}
/**
......
......@@ -2,7 +2,6 @@ package com.yidianling.user.ui.login.presenter
import android.annotation.SuppressLint
import android.text.TextUtils
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StringUtils
......@@ -11,6 +10,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
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
......@@ -58,7 +58,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
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点
//view.baiduActionBury()
} else {
......@@ -95,7 +95,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
} else {
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
mView.baiduActionBury()
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_PWD_LOGIN)
......
......@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.text.TextUtils
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.YDLCacheUtils
......@@ -12,6 +11,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
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
......@@ -70,7 +70,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
//绑定手机号
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
mView.baiduActionBury(it.data.uid, UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_DIRECT_LOGIN)
......@@ -192,24 +192,24 @@ 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
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_QQ_REGISTER_CLICK)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
}
} else {
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = 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!!)
......
......@@ -8,6 +8,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
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
......@@ -144,7 +145,7 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
mView.baiduActionBury()
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_CODE_LOGIN)
......
......@@ -64,14 +64,14 @@ class SecretDescriptionDialog(
spannableString.setSpan(
object : ClickableSpan() {
override fun onClick(widget: View?) {
if (Utils.isFastClick()){
if (Utils.isFastClick()) {
return
}
H5Activity.start(mContext, false)
}
override fun updateDrawState(ds: TextPaint?) {
ds?.color=Color.parseColor("#159CEF")
ds?.color = Color.parseColor("#159CEF")
}
}, 5,
13, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
......@@ -79,14 +79,14 @@ class SecretDescriptionDialog(
spannableString.setSpan(
object : ClickableSpan() {
override fun onClick(widget: View?) {
if (Utils.isFastClick()){
if (Utils.isFastClick()) {
return
}
H5Activity.start(mContext, true)
}
override fun updateDrawState(ds: TextPaint?) {
ds?.color=Color.parseColor("#159CEF")
ds?.color = Color.parseColor("#159CEF")
}
}, str.length - 8,
str.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
......
<?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="@color/user_main_theme_bright"/>
</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"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#ffffff">
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#ffffff">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/user_secret_top_bg" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/user_secret_top_bg" />
<RelativeLayout
android:id="@+id/user_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
android:id="@+id/user_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/secrey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="40dp"
android:text="壹点灵"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold" />
android:id="@+id/secrey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="40dp"
android:text="壹点灵"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/secrey_title"
android:layout_marginLeft="25dp"
android:text="隐私政策概要"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/secrey_title"
android:layout_marginLeft="25dp"
android:text="隐私政策概要"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold" />
</RelativeLayout>
<ScrollView
android:layout_below="@+id/user_top_rl"
android:layout_alignBottom="@+id/secret_bottom_text"
android:layout_below="@+id/user_top_rl"
android:layout_alignBottom="@+id/secret_bottom_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="42dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="42dp">
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:orientation="vertical">
<LinearLayout
<TextView
android:id="@+id/user_secret_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:orientation="vertical">
<TextView
android:id="@+id/user_secret_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineHeight="20dp"
tools:text="感谢您信任并使用壹点灵旗下的APP,\n
android:layout_marginTop="30dp"
android:lineHeight="20dp"
tools:text="感谢您信任并使用壹点灵APP,\n
我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\n\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n
2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\n
3. 我们会采业界先进的安全措施保护您的信息安全;\n
4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\n
5. 您可以查询、更正、删除您的个人信息。"
android:textColor="#444444"
android:textSize="14dp" />
android:textColor="#444444"
android:textSize="14dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/secret_bottom_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_marginBottom="185dp"
android:layout_marginLeft="@dimen/platform_dp_25">
android:id="@+id/secret_bottom_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_marginBottom="185dp"
android:layout_marginLeft="@dimen/platform_dp_25">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="阅读完整版"
android:textColor="#444444"
android:textSize="14dp" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="阅读完整版"
android:textColor="#444444"
android:textSize="14dp" />
<TextView
android:id="@+id/user_use_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《用户使用协议》"
android:textColor="#159CEF"
android:textSize="14dp" />
android:id="@+id/user_use_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《用户使用协议》"
android:textColor="#159CEF"
android:textSize="14dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="、"
android:textColor="#444444"
android:textSize="14dp" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="、"
android:textColor="#444444"
android:textSize="14dp" />
<TextView
android:id="@+id/user_secret_protect_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《隐私保护政策》"
android:textColor="#159CEF"
android:textSize="14dp" />
android:id="@+id/user_secret_protect_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《隐私保护政策》"
android:textColor="#159CEF"
android:textSize="14dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginBottom="40dp"
android:orientation="horizontal"
android:background="#ffffff">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginBottom="40dp"
android:orientation="horizontal"
android:background="#ffffff">
<TextView
android:id="@+id/user_secret_no_agree"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginRight="5.5dp"
android:layout_weight="1"
android:background="@drawable/user_secret_left_btn_bg"
android:gravity="center"
android:text="不同意并退出"
android:textColor="#999999"
android:textSize="16dp" />
android:id="@+id/user_secret_no_agree"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginRight="5.5dp"
android:layout_weight="1"
android:background="@drawable/user_secret_left_btn_bg"
android:gravity="center"
android:text="不同意并退出"
android:textColor="#999999"
android:textSize="16dp" />
<TextView
android:id="@+id/user_secret_agree"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginLeft="5.5dp"
android:layout_weight="1"
android:background="@drawable/user_secret_right_btn_bg"
android:gravity="center"
android:text="同意并继续"
android:textColor="#FFFFFF"
android:textSize="16dp" />
android:id="@+id/user_secret_agree"
android:layout_width="0dp"
android:layout_height="44dp"
android:layout_marginLeft="5.5dp"
android:layout_weight="1"
android:background="@drawable/user_secret_right_btn_bg"
android:gravity="center"
android:text="同意并继续"
android:textColor="#FFFFFF"
android:textSize="16dp" />
</LinearLayout>
......
<?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="22dp"
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_horizontal">
<com.yidianling.user.ui.collect.widget.CustomNumberPicker
android:id="@+id/user_collect_date_pick"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</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_horizontal">
<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:layout_marginTop="10dp"
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"
xmlns:myapp="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="34dp"
android:layout_marginRight="34dp"
android:background="@drawable/user_secret_dialog_bg">
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
myapp:pa_borderRadius="12dp"
myapp:pa_type="pa_round"
android:adjustViewBounds="true"
android:src="@drawable/user_secret_top_bg"/>
<RelativeLayout
android:id="@+id/user_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/secrey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="40dp"
android:text="隐私政策"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/secrey_title"
android:layout_marginLeft="25dp"
android:text="及使用协议说明"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout android:layout_width="match_parent" android:layout_height="194dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="194dp"
android:scrollbars="none"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
>
<TextView
android:id="@+id/user_secret_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineHeight="20dp"
tools:text="感谢您信任并使用壹点灵旗下的APP,\n
我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\n\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n
2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\n
3. 我们会采业界先进的安全措施保护您的信息安全;\n
4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\n
5. 您可以查询、更正、删除您的个人信息。"
android:textColor="#444444"
android:textSize="14dp"/>
</RelativeLayout>
</ScrollView>
<View
android:background="@drawable/user_secret_dectription_bg"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_height="30dp"/>
</RelativeLayout>
<TextView
android:id="@+id/tv_content"
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="阅读完整版《用户使用协议》、《隐私保护政策》"
android:textColor="#444444"
android:textSize="14dp"/>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="阅读完整版"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_use_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《用户使用协议》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="、"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_secret_protect_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《隐私保护政策》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="24dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:orientation="vertical"
android:background="#ffffff">
<TextView
android:id="@+id/user_secret_agree"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_weight="1"
android:background="@drawable/user_secret_right_btn_bg"
android:gravity="center"
android:text="同意并继续"
android:textColor="#FFFFFF"
android:textSize="16dp"/>
<TextView
android:id="@+id/user_secret_no_agree"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:gravity="center"
android:text="仍不同意并退出"
android:textColor="#999999"
android:textSize="16dp"/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:myapp="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="34dp"
android:layout_marginRight="34dp"
android:background="@drawable/user_secret_dialog_bg">
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">
<com.ydl.ydlcommon.view.widgets.RoundImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
myapp:pa_borderRadius="12dp"
myapp:pa_type="pa_round"
android:adjustViewBounds="true"
android:src="@drawable/user_secret_top_bg"/>
<RelativeLayout
android:id="@+id/user_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="@+id/secrey_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="40dp"
android:text="隐私政策"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/secrey_title"
android:layout_marginLeft="25dp"
android:text="及使用协议说明"
android:textColor="#242424"
android:textSize="28dp"
android:textStyle="bold"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout android:layout_width="match_parent" android:layout_height="194dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="194dp"
android:scrollbars="none"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
>
<TextView
android:id="@+id/user_secret_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:lineHeight="20dp"
tools:text="感谢您信任并使用壹点灵APP,\n
我们深知个人隐私的重要性,为了您更好的使用本APP,希望您着重关注:\n\n1. 为向您提供交易相关基本功能,我们会收集、使用必要的信息;\n
2. 基于您的明示授权,我们可能会获取您的位置(为您提供附近的咨询师等)、设备号信息(以保障您账号与交易安全)等信息,您有权拒绝或取消授权;\n
3. 我们会采业界先进的安全措施保护您的信息安全;\n
4. 未经您同意,我们不会从第三方处获取、共享或向其提供您的信息;\n
5. 您可以查询、更正、删除您的个人信息。"
android:textColor="#444444"
android:textSize="14dp"/>
</RelativeLayout>
</ScrollView>
<View
android:background="@drawable/user_secret_dectription_bg"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_height="30dp"/>
</RelativeLayout>
<TextView
android:id="@+id/tv_content"
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:text="阅读完整版《用户使用协议》、《隐私保护政策》"
android:textColor="#444444"
android:textSize="14dp"/>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="阅读完整版"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_use_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《用户使用协议》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="、"-->
<!--android:textColor="#444444"-->
<!--android:textSize="14dp"/>-->
<!--<TextView-->
<!--android:id="@+id/user_secret_protect_btn"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="《隐私保护政策》"-->
<!--android:textColor="#159CEF"-->
<!--android:textSize="14dp"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="24dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:orientation="vertical"
android:background="#ffffff">
<TextView
android:id="@+id/user_secret_agree"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_weight="1"
android:background="@drawable/user_secret_right_btn_bg"
android:gravity="center"
android:text="同意并继续"
android:textColor="#FFFFFF"
android:textSize="16dp"/>
<TextView
android:id="@+id/user_secret_no_agree"
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:gravity="center"
android:text="仍不同意并退出"
android:textColor="#999999"
android:textSize="16dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ 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" />
<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" />
</LinearLayout>
\ 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="@color/user_main_theme"
android:endColor="@color/user_main_theme"/>
</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="@color/user_main_theme_66"
android:endColor="@color/user_main_theme_66"/>
</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="#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
......@@ -99,7 +99,6 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
}
ACTION_PUSH_EVENT_TRACKING_TAP -> {
val map = methodCall.arguments as HashMap<*, *>
LogUtil.i("flutter click:"+GsonProvider.getGson().toJson(map))
val clickPath = map["path"] as String
if (!TextUtils.isEmpty(clickPath)) {
......@@ -109,11 +108,17 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
field.isAccessible = true
val property = field.get(ownerClass)
if (property is Boolean && property) {
var activity:Activity ?= mActivity
var activity: Activity?= mActivity
if (mActivity==null&&mFragment!=null){
activity = mFragment?.activity!!
}
BuryPointHelper.showEditDialog(activity, MD5Util.md5(clickPath), null)
activity?.let {
BuryPointHelper.showEditDialog(
activity,
MD5Util.md5(clickPath),
null
)
}
}
} catch (e: Exception) {
LogUtil.e("flutter click exception:$e")
......
......@@ -2,18 +2,24 @@ package com.ydl.ydlcommon.base
import android.app.Activity
import android.content.res.Resources
import android.graphics.Color
import android.os.Bundle
import android.support.annotation.LayoutRes
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.trello.rxlifecycle2.android.ActivityEvent
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.lifecycle.IActivityLifecycleable
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.ui.LoadingDialogFragment
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.AndroidSystemHelper
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.common.tools.RxImageTool
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
import kotlin.properties.Delegates
......@@ -24,7 +30,7 @@ import kotlin.properties.Delegates
* e-mail : zhangwch@yidianling.com
* time : 2018/01/27
*/
abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable {
abstract class BaseActivity : AppCompatActivity(), IActivityLifecycleable {
private val mLifecycleSubject = BehaviorSubject.create<ActivityEvent>()
var mContext: Activity by Delegates.notNull()
......@@ -57,19 +63,49 @@ abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable {
override fun setContentView(@LayoutRes layoutResID: Int) {
if (getStatusViewOptions()?.isAddStatusView) {
val returnViews = StatusBarUtils.initStatusBarView(this, layoutResID, getStatusViewOptions())
val options = getStatusViewOptions()
options.bottomStatusColor = getDefaultBottomColor()
val returnViews =
StatusBarUtils.initStatusBarView(this, layoutResID, getStatusViewOptions())
if(returnViews.size > 1){
if (returnViews.size > 1) {
statusView = returnViews[1];
}
super.setContentView(returnViews[0])
AndroidSystemHelper.fixAndroidBug5497Workaround(this)
} else {
super.setContentView(layoutResID)
//判定是否有底部小横条
if (StatusBarUtils.hasBottomNavigatorLine(this)) {
val containerView =
View.inflate(this, R.layout.platform_layout_bottom_fit_root, null) as ViewGroup
val rootView = containerView.findViewById<FrameLayout>(R.id.ll_bottom_fit_root);
val layoutView = View.inflate(this, layoutResID, null)
val params =
ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
rootView.addView(layoutView, params)
val bottomView = containerView.findViewById<View>(R.id.ll_bottom_fit_v)
bottomView.visibility = View.VISIBLE
bottomView.setBackgroundColor(getDefaultBottomColor())
super.setContentView(containerView)
} else {
super.setContentView(layoutResID)
}
}
}
open fun getDefaultBottomColor(): Int {
return Color.parseColor("#00000000")
}
override fun onDestroy() {
super.onDestroy()
ActivityManager.getInstance().removeStack(this)
......@@ -88,7 +124,7 @@ abstract class BaseActivity : AppCompatActivity(),IActivityLifecycleable {
return AndroidSystemHelper.fixResourcesScale(res)
}
open fun getStatusViewOptions():StatusBarOptions{
open fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions()
}
......
......@@ -55,7 +55,7 @@ abstract class BaseFragment : Fragment() ,IFragmentLifecycleable{
layoutResId != 0 -> {
val childView = inflater.inflate(layoutResId, container, false)
if (getStatusViewOptions().isAddStatusView){
val returnViews = StatusBarUtils.initStatusBarView(activity!!, childView, getStatusViewOptions())
val returnViews = StatusBarUtils.initStatusBarView(activity!!, childView, getStatusViewOptions(), true)
return returnViews[0]
}else{
......
package com.ydl.ydlcommon.bean
import android.graphics.Color
import android.os.Build
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseApp
......@@ -23,6 +24,7 @@ class StatusBarOptions {
return BaseApp.getApp().resources.getString(0+R.color.platform_main_theme);
}
}
var bottomStatusColor: Int = Color.parseColor("#00000000") //底部颜色默认透明色,个别页面自己设置即可
constructor(isAddStatusView: Boolean = false, statusBarDarkMode: Boolean= false) {
this.isAddStatusView = isAddStatusView
......
package com.ydl.ydlcommon.utils
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog
import android.os.Bundle
......@@ -36,22 +37,24 @@ class ApkUpdateDialog : Dialog{
this.activity = activity
}
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.platform_dialog_update_layout)
tv_update_content.text = updateData?.title
tv_update_content.setMovementMethod(ScrollingMovementMethod.getInstance());
tv_update_content.movementMethod = ScrollingMovementMethod.getInstance();
text_version.text = "v${updateData?.ver}"
text_desc.text = updateData?.content
text_desc.setMovementMethod(ScrollingMovementMethod.getInstance());
text_desc.movementMethod = ScrollingMovementMethod.getInstance();
v_downpress.setSize(28,14,6,9,4)
v_downpress.setTextSize(10)
// v_downpress.setProgress(0)
listener = object : ApkInstallTool.UpdateProgressListener {
@SuppressLint("CheckResult")
override fun startLoad() {
Observable.just(1)
.observeOn(AndroidSchedulers.mainThread())
......@@ -66,6 +69,7 @@ class ApkUpdateDialog : Dialog{
},{})
}
@SuppressLint("CheckResult")
override fun progress(progress: Int) {
Observable.just(1)
.observeOn(AndroidSchedulers.mainThread())
......
......@@ -15,6 +15,7 @@ import android.support.v4.widget.DrawerLayout
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.bean.StatusBarOptions
......@@ -997,25 +998,38 @@ class StatusBarUtils {
return initStatusBarView(
context,
child,
statusBarOptions
statusBarOptions,
false
)
}
fun initStatusBarView(
context: Activity,child:View,
statusBarOptions: StatusBarOptions
context: Activity,
child:View,
statusBarOptions: StatusBarOptions,
isFragment: Boolean = false
): Array<View> {
var returnView = arrayOfNulls<View>(2)
val containerView = View.inflate(context, R.layout.platform_layout_root, null) as ViewGroup
val rootView = containerView.findViewById<LinearLayout>(R.id.ll_root);
val rootView = containerView.findViewById<FrameLayout>(R.id.ll_root)
val statusView =
initStatus(context, rootView, statusBarOptions);
initStatus(context, containerView, statusBarOptions)
val params =
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
rootView.addView(child, params)
if (!isFragment && hasBottomNavigatorLine(context)) {
val bottomView = containerView.findViewById<View>(R.id.ll_bottom_v)
bottomView.visibility = View.VISIBLE
bottomView.setBackgroundColor(statusBarOptions.bottomStatusColor)
}
returnView[0] = containerView
if (statusView != null){
......@@ -1025,21 +1039,39 @@ class StatusBarUtils {
return returnView as Array<View>
}
/**
* 判定是否含有底部小横条,当底部导航高度像素小于50时,认为是有小横条
*/
fun hasBottomNavigatorLine(context: Context): Boolean {
return try {
val clazz = Class.forName("com.android.internal.R\$dimen")
val `object` = clazz.newInstance()
val heightStr = clazz.getField("navigation_bar_height").get(`object`).toString()
val height = Integer.parseInt(heightStr)
val bottomNavigatorHeight = context.resources.getDimensionPixelSize(height)
bottomNavigatorHeight < 50
} catch (e: Exception) {
false
}
}
fun initStatus(
context: Activity,
rootView: View,
containerView: View,
statusBarOptions: StatusBarOptions
):View? {
var statusView:View ?=null
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
statusView = rootView.findViewById<View>(R.id.view_status_place_holder)
statusView = containerView.findViewById<View>(R.id.view_status_place_holder)
statusView?.setBackgroundColor(Color.parseColor(statusBarOptions.statusColor))
val statusBarHeight =
getStatusBarHeight(context)
val layoutParams = statusView?.getLayoutParams() as LinearLayout.LayoutParams
layoutParams.height = statusBarHeight
statusView?.layoutParams = layoutParams
statusView?.let {
val layoutParams = statusView?.getLayoutParams() as LinearLayout.LayoutParams
layoutParams.height = statusBarHeight
statusView?.layoutParams = layoutParams
}
setTransparentForImageView(context, null)
}
if (statusBarOptions.statusBarDarkMode) {
......
......@@ -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 {
......
......@@ -3,8 +3,9 @@
android:shape="rectangle">
<gradient
android:endColor="#fdbd00"
android:startColor="#FFEC8C"/>
android:angle="0"
android:startColor="#fdbd00"
android:endColor="#fdbd00"/>
<corners android:bottomRightRadius="8dp" />
......
......@@ -3,6 +3,7 @@
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="@color/platform_main_gradient_end_color"
android:startColor="@color/platform_main_gradient_start_color"/>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/ll_bottom_fit_root"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<View
android:id="@+id/ll_bottom_fit_v"
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="gone">
</View>
</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:id="@+id/ll_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -11,4 +10,19 @@
android:background="@color/platform_white"
android:layout_height="0dp"/>
<FrameLayout
android:id="@+id/ll_root"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<View
android:id="@+id/ll_bottom_v"
android:layout_width="match_parent"
android:layout_height="10dp"
android:visibility="gone">
</View>
</LinearLayout>
\ No newline at end of file
......@@ -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: BackLimit, hasBackLimit: Boolean): super() {
this.url =url
if (hasBackLimit) {
this.backLimit = backLimit
}
}
constructor(url: String, title: String?, share: ShareData?) : super() {
this.url = url
this.shareData = share
......@@ -60,4 +67,13 @@ class H5Params : Serializable {
* 倾诉拨打电话
*/
var phone: String? = null
/**
* h5页面返回按钮限制
*/
var backLimit: BackLimit? = null
enum class BackLimit {
NEW_USER_PAGE // 新用户引导页面
}
}
\ No newline at end of file
......@@ -40,7 +40,9 @@ import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp;
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.ToastUtil;
import com.yidianling.dynamic.api.IDynamicService;
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;
......@@ -632,7 +635,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
}
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
}
finish();
}
});
......@@ -825,7 +832,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title.setImageListener(v -> {
if (wv_content.canGoBack()) {
wv_content.goBack();
} else {
}
else {
finish();
}
});
......@@ -839,7 +847,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.getShowUrlTitle()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
}
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
}
finish();
}
});
......@@ -1112,7 +1124,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();
}
......@@ -1128,7 +1142,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if (h5Params.isSplash()) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
finish();
} else {
}
else {
if (ActivityManager.Companion.getInstance().getActivitys().size() == 1) {
WebModularServiceUtils.Companion.startMain(NewH5Activity.this);
}
finish();
}
});
......@@ -1259,12 +1277,20 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
/**
* 新用户侧滑按钮限制
*/
if (h5Params.getBackLimit() != null && h5Params.getBackLimit() == H5Params.BackLimit.NEW_USER_PAGE) {
return true;
}
/**
* 增加逻辑:在高级题测试页面,按物理返回键直接finish当前页面,不走webview.goback()逻辑
*/
if (h5Params.isControlBack()) {
finish();
}
back("key");
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