Commit 779f8e13 by 严久程
parents caed21b3 b5135122
......@@ -180,12 +180,12 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
}
// override fun onDestroy() {
// if (serviceConnection != null) {
// unbindService(serviceConnection)
// }
// super.onDestroy()
// }
override fun onDestroy() {
if (serviceConnection != null) {
unbindService(serviceConnection)
}
super.onDestroy()
}
private inner class PlayServiceConnection : ServiceConnection {
override fun onServiceConnected(name: ComponentName, service: IBinder) {
......
......@@ -110,6 +110,8 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
void initPlayMode() {
int mode = AudioPlayer.Companion.get().getPlayMode().value();
ivMode.setImageLevel(mode);
AudioPlayer.Companion.get().play();
showFloatView();
}
@Override
......@@ -156,11 +158,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
break;
case R.id.iv_play:
play();
if(!PlayerFloatHelper.Companion.isShow(getActivity())) {
PlayerFloatHelper.Companion.show(getActivity(), PlayTypeEnum.PLAY_TYPE_FM,new HashMap<>());
}else {
PlayerFloatHelper.Companion.showIfPlaying(getActivity());
}
showFloatView();
break;
case R.id.iv_next:
next();
......@@ -171,6 +169,14 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
}
}
private void showFloatView() {
if(!PlayerFloatHelper.Companion.isShow(getActivity())) {
PlayerFloatHelper.Companion.show(getActivity(), PlayTypeEnum.PLAY_TYPE_FM,new HashMap<>());
}else {
PlayerFloatHelper.Companion.showIfPlaying(getActivity());
}
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (seekBar == sbProgress) {
......
......@@ -78,8 +78,8 @@
android:id="@+id/bt_to_other"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="登录" />
<Button
......@@ -87,23 +87,16 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="咨询" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingBottom="20dp">
<Button
android:id="@+id/bt_to_music"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="音乐" />
<Button
......@@ -111,6 +104,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="冥想" />
</LinearLayout>
......@@ -126,8 +120,9 @@
android:id="@+id/bt_to_fm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="电台" />
<Button
......@@ -135,46 +130,26 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="倾诉" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingBottom="20dp">
<Button
android:id="@+id/bt_to_tests"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="测评" />
<Button
android:id="@+id/bt_to_course"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="invisible" />
</LinearLayout>
android:layout_marginRight="10dp"
android:text="课程" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/bt_to_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="Jump to Course" />
</LinearLayout>
</LinearLayout>
......
......@@ -41,14 +41,14 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
"m-audioim" : "0.0.12",
"m-confide" : "0.0.15",
"m-consultant" : "0.0.22",
"m-course" : "0.0.8",
"m-fm" : "0.0.11",
"m-muse" : "0.0.7",
"m-tests" : "0.0.4",
"m-user" : "0.0.25",
//第三步 若干
"m-confide" : "0.0.16",
"m-consultant" : "0.0.23",
"m-course" : "0.0.9",
"m-fm" : "0.0.12",
"m-muse" : "0.0.8",
"m-tests" : "0.0.5",
"m-user" : "0.0.26",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.1",
"m-confide-api" : "0.0.1",
......@@ -59,19 +59,23 @@ ext {
"m-tests-api" : "0.0.1",
"m-user-api" : "0.0.5",
//-------------- 功能组件 --------------
"ydl-flutter-base": "0.0.3",
"ydl-media" : "0.0.9",
//第一步
"ydl-platform" : "0.0.21",
//第二步 若干
"ydl-webview" : "0.0.21",
"ydl-media" : "0.0.10",
"ydl-pay" : "0.0.7",
"m-audioim" : "0.0.13",
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.1",
"ydl-pay" : "0.0.6",
"ydl-platform" : "0.0.20",
"ydl-utils" : "0.0.2",
"ydl-webview" : "0.0.20",
"router" : "0.0.1",
"ydl-flutter-base": "0.0.3",
]
ydlCompileVersion = [
// -------------- 业务模块 --------------
"m-audioim" : "0.0.12",
//第三步 若干
"m-confide" : "0.0.15",
"m-consultant" : "0.0.22",
"m-course" : "0.0.8",
......@@ -89,14 +93,18 @@ ext {
"m-tests-api" : "0.0.1",
"m-user-api" : "0.0.5",
//-------------- 功能组件 --------------
"ydl-flutter-base": "0.0.3",
"ydl-media" : "0.0.9",
//第一步
"ydl-platform" : "0.0.21",
//第二步 若干
"ydl-webview" : "0.0.21",
"ydl-media" : "0.0.10",
"ydl-pay" : "0.0.7",
"m-audioim" : "0.0.13",
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.1",
"ydl-pay" : "0.0.6",
"ydl-platform" : "0.0.20",
"ydl-utils" : "0.0.2",
"ydl-webview" : "0.0.20",
"router" : "0.0.1",
"ydl-flutter-base": "0.0.3",
]
dependencies = [
......
......@@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import com.yidianling.router.RouterManager
import com.yidianling.router.user.UserResponse
/**
* author : Zhangwenchao
......@@ -17,8 +16,6 @@ object PhoneCallIn {
return RouterManager.getUserRouter()?.isLogin()?:false
}
fun getUserInfo(): UserResponse.UserInfo? = RouterManager.getUserRouter()?.getUserInfo()
fun rechargeIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.rechargeIntent(activity)
}
......
......@@ -31,12 +31,24 @@ class ConsultAssistantDialogUtils private constructor() {
* origin 展示请求来源 首页 home_index 咨询列表 doctor_list
*/
fun fitRequest(activity: Activity, origin: String) {
if (ConsultantIn.isLogin() &&
ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1
/** WalleChannelReader.getChannel(BaseApp.Companion.getApp()) == "android_huawei" */
) {
shouldShowDialog(activity, origin)
when (origin) {
"home_index" -> {
if (ConsultantIn.isLogin() &&
ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1
/** WalleChannelReader.getChannel(BaseApp.Companion.getApp()) == "android_huawei" */
) {
shouldShowDialog(activity, origin)
}
}
"doctor_list" -> {
if (ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1
/** WalleChannelReader.getChannel(BaseApp.Companion.getApp()) == "android_huawei" */
) {
shouldShowDialog(activity, origin)
}
}
}
}
/**
......@@ -101,7 +113,7 @@ class ConsultAssistantDialogUtils private constructor() {
expertSearchPageHasShown = true
}
}
}, 10000)
}, 5000)
} else {
showDialog(activity)
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_40"/>
<corners android:radius="@dimen/platform_dp_40"/>
<solid android:color="#F2faff"/>
<stroke
android:width="1dp"
......
......@@ -7,8 +7,8 @@
<corners android:radius="@dimen/platform_dp_13" />
<padding
android:bottom="@dimen/platform_dp_3"
android:left="@dimen/dp_10"
android:right="@dimen/dp_10"
android:left="@dimen/platform_dp_10"
android:right="@dimen/platform_dp_10"
android:top="@dimen/platform_dp_3" />
<stroke android:color="#F0F0F0"/>
</shape>
\ No newline at end of file
......@@ -92,7 +92,7 @@
android:id="@+id/img_activity"
android:layout_width="42dp"
android:layout_height="12dp"
android:layout_marginStart="@dimen/dp_4"
android:layout_marginStart="@dimen/platform_dp_4"
android:visibility="gone"/>
<!--公益图标-->
<ImageView
......@@ -111,7 +111,7 @@
android:layout_marginLeft="@dimen/platform_dp_4"
android:scaleType="fitCenter"
tools:background="@drawable/consultant_new_enter"
android:layout_marginStart="@dimen/dp_4" />
android:layout_marginStart="@dimen/platform_dp_4" />
<!--优质图标-->
<ImageView
android:id="@+id/imgAbilityLevel"
......
......@@ -20,7 +20,7 @@
android:orientation="vertical"
android:text="@string/platform_no_search_result"
android:textColor="@color/platform_text_gray"
android:textSize="@dimen/sp_14" />
android:textSize="@dimen/platform_sp_14" />
<Button
android:id="@+id/btnSearchByCat"
......
......@@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Intent
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.service.IUserService
/**
......@@ -18,10 +17,6 @@ object CourseIn {
return ModularServiceManager.provide(IUserService::class.java).isLogin()
}
fun getUserInfo(): UserResponse.UserInfo? {
return RouterManager.getUserRouter()?.getUserInfo()
}
fun loginWayIntent(activity: Activity): Intent? {
return ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
}
......
......@@ -32,7 +32,7 @@
android:layout_marginTop="9dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginEnd="@dimen/platform_dp_10"
android:padding="5dp"
android:src="@drawable/course_confideredpacket_close"
tools:ignore="OnClick" />
......
......@@ -216,7 +216,7 @@
android:layout_weight="1"
android:text=""
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_10" />
android:textSize="@dimen/platform_dp_10" />
<TextView
android:id="@+id/tv_allTime"
......@@ -228,7 +228,7 @@
android:layout_weight="1"
android:text=""
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_10" />
android:textSize="@dimen/platform_dp_10" />
<SeekBar
android:id="@+id/fm_progress"
......
......@@ -16,7 +16,7 @@
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/platform_color_333333"
android:textSize="@dimen/sp_16"
android:textSize="@dimen/platform_sp_16"
android:textStyle="bold"
tools:text="你的心理足够成熟么你的心理足够成熟么"
/>
......
......@@ -15,7 +15,7 @@
android:layout_marginRight="146dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="@dimen/sp_16"
android:textSize="@dimen/platform_sp_16"
android:textStyle="bold"
android:textColor="@color/platform_color_333333"
tools:text="你的心理足够成熟么你的心理足够成熟么"/>
......
......@@ -79,9 +79,6 @@
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<!--<meta-data-->
<!--android:name="com.yidianling.user.base.UserGlobalConfig"-->
<!--android:value="ModuleConfig"/>-->
<activity
android:name=".wxapi.WXEntryActivity"
android:exported="true"
......
......@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.LoginParam
import io.reactivex.Observable
......@@ -19,7 +19,7 @@ interface LoginContract {
// 开始登录
fun startLogin()
// 登录成功
fun loginSuccess(userInfo: UserResponse?)
fun loginSuccess(userInfo: UserResponseBean?)
// 登录失败
fun loginFail(msg: String)
// 登录完成
......@@ -29,7 +29,7 @@ interface LoginContract {
}
interface Model: IModel {
fun login(param: LoginParam): Observable<BaseResponse<UserResponse>>
fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>>
}
interface Presenter: IPresenter<View> {
......
......@@ -6,7 +6,7 @@ import com.ydl.ydlcommon.data.http.ThrowableConsumer;
import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.ydl.ydlcommon.utils.JPushUtils;
import com.ydl.ydlcommon.utils.log.LogHelper;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.api.event.UserLoginEvent;
import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl;
......@@ -48,7 +48,7 @@ public class LoginHelper {
}
}
public static void login(UserResponse response) {
public static void login(UserResponseBean response) {
UserHelper.INSTANCE.setUserinfo(response);
EventBus.getDefault().post(new UserLoginEvent("login",response.getUid()));
......
package com.yidianling.user
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.UserHttp
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.LoginParam
......@@ -14,7 +14,7 @@ import io.reactivex.Observable
*/
class LoginModel: LoginContract.Model {
override fun login(param: LoginParam): Observable<BaseResponse<UserResponse>> {
override fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>> {
val userHttp: UserHttp = UserHttpImpl.getInstance()
return userHttp.login(param)
}
......
......@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.LoginParam
import com.yidianling.user.route.UserIn
import de.greenrobot.event.EventBus
......@@ -64,7 +64,7 @@ class LoginPresenter(view: LoginContract.View): BasePresenter<LoginContract.View
})
}
private fun setHXInfo(userInfo: UserResponse?) {
private fun setHXInfo(userInfo: UserResponseBean?) {
try {
if (userInfo != null) {
UserIn.imSetAccount(userInfo.uid.toString())
......
......@@ -2,22 +2,17 @@ package com.yidianling.user
import com.tencent.bugly.crashreport.CrashReport
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.JPushUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.event.UserLoginEvent
import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.ChannelIdParam
import com.yidianling.user.http.request.Logout
import com.yidianling.user.route.UserIn
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
/**
......@@ -28,12 +23,12 @@ import io.reactivex.functions.Consumer
object LoginUtils {
@JvmStatic
fun saveData(userInfo: UserResponse?) {
fun saveData(userInfo: UserResponseBean?) {
UserHelper.setUserinfo(userInfo)
}
@JvmStatic
fun onLogin(userInfo: UserResponse?) {
fun onLogin(userInfo: UserResponseBean?) {
//设置异常用户ID
CrashReport.setUserId(userInfo?.uid)
//登录IM聊天
......@@ -43,22 +38,22 @@ object LoginUtils {
val loginEvent = UserLoginEvent("login", userInfo?.uid!!)
EventBus.getDefault().post(loginEvent)
BuryPointUtils.bindUid(userInfo?.uid ?: "")
val channelId = JPushUtils.getRegistrationID()
UserHttpImpl.getInstance().channelId(ChannelIdParam(channelId))
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
if (it["upload_log"] == "1") {
LogHelper.getInstance().uploadLog(false)
}
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
// ToastHelper.show(msg)
}
})
// val channelId = JPushUtils.getRegistrationID()
// UserHttpImpl.getInstance().channelId(ChannelIdParam(channelId))
// .compose(RxUtils.resultData())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(Consumer {
// if (it["upload_log"] == "1") {
// LogHelper.getInstance().uploadLog(false)
// }
// }, object : ThrowableConsumer() {
// override fun accept(msg: String) {
// // ToastHelper.show(msg)
// }
// })
}
private fun loginIm(userInfo: UserResponse?) {
private fun loginIm(userInfo: UserResponseBean?) {
val info = IMLoginInfo(userInfo?.uid ?: "", userInfo?.hxpwd ?: "")
val callback = object : IMRequestCallback<IMLoginInfo> {
override fun onSuccess(t: IMLoginInfo?) {
......
......@@ -5,8 +5,8 @@ import com.google.gson.Gson
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.yidianling.router.user.UserResponse
import com.yidianling.router.user.UserSetting
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
/**
* 用户信息辅助类
......@@ -24,13 +24,13 @@ object UserHelper {
private val user_setting_key_sp = "ydl_user_setting_key"
//用户信息//缓存
private var userTemp: UserResponse? = null
private var userTemp: UserResponseBean? = null
//用户设置信息缓存
private var userSetting: UserSetting? = null
private var userSetting: UserSettingBean? = null
//存储用户信息
fun setUserinfo(userInfo: UserResponse?) {
fun setUserinfo(userInfo: UserResponseBean?) {
try {
userTemp = userInfo
var str = gson.toJson(userTemp)
......@@ -46,24 +46,34 @@ object UserHelper {
}
//获取用户设置信息
fun getUserInfo(): UserResponse? {
fun getUserInfo(): UserResponseBean? {
if (userTemp != null) return userTemp!!
try {
var obj = SharedPreferencesEditor.getFileString(user_info_name_sp, user_info_key_sp)
var app: UserResponse = gson.fromJson(obj, UserResponse::class.java)
var app: UserResponseBean = gson.fromJson(obj, UserResponseBean::class.java)
userTemp = app
return userTemp!!
} catch (e: Exception) {
userTemp = UserResponse()
userTemp = UserResponseBean()
}
return userTemp
}
fun updateUserinfo(userInfo: UserResponse.UserInfo?) {
fun getUserInfoStr(): String? {
if (userTemp != null) return gson.toJson(userTemp)
try {
return SharedPreferencesEditor.getFileString(user_info_name_sp, user_info_key_sp)
} catch (e: Exception) {
userTemp = UserResponseBean()
}
return gson.toJson(userTemp)
}
fun updateUserinfo(userInfo: UserResponseBean.UserInfo?) {
getUserInfo()?.userInfo = userInfo
}
fun updateUserSetting(userseting: UserSetting?) {
fun updateUserSetting(userseting: UserSettingBean?) {
setUserSetting(userseting)
}
......@@ -96,7 +106,7 @@ object UserHelper {
/**
* 存储用户设置信息
*/
fun setUserSetting(userseting: UserSetting?) {
fun setUserSetting(userseting: UserSettingBean?) {
try {
userSetting = userseting
var str = gson.toJson(userSetting)
......@@ -109,18 +119,28 @@ object UserHelper {
/**
* 获取用户设置信息
*/
fun getUsetSetting(): UserSetting? {
fun getUsetSetting(): UserSettingBean? {
if (userSetting != null) return userSetting!!
try {
var obj = SharedPreferencesEditor.getFileString(user_setting_name_sp, user_setting_key_sp)
if (TextUtils.isEmpty(obj)) {
setUserSetting(UserSetting())
setUserSetting(UserSettingBean())
}
var app: UserSetting = gson.fromJson(obj, UserSetting::class.java)
var app: UserSettingBean = gson.fromJson(obj, UserSettingBean::class.java)
userSetting = app
return userSetting
} catch (e: Exception) {
}
return userSetting
}
fun getUserSettingStr(): String? {
if (userSetting != null) return gson.toJson(userSetting)
try {
return SharedPreferencesEditor.getFileString(user_setting_name_sp, user_setting_key_sp)
} catch (e: Exception) {
userSetting = UserSettingBean()
}
return gson.toJson(userSetting)
}
}
\ No newline at end of file
package com.yidianling.user.base
import android.app.Application
import android.content.Context
import com.umeng.commonsdk.UMConfigure
import com.umeng.socialize.UMShareAPI
import com.ydl.ydlcommon.base.delegate.IAppLifecycles
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.user.api.event.UserSetEvent
import com.yidianling.user.api.service.IUserService
import com.yidianling.user.modular_service.UserServiceImp
import de.greenrobot.event.EventBus
/**
* Created by haorui on 2019-09-02.
* Des:
*/
class UserAppLifecycles : IAppLifecycles {
override fun attachBaseContext(base: Context) {
}
override fun onCreate(application: Application) {
EventBus.getDefault().register(this)
UMConfigure.init(application, "56970affe0f55a9cda001e24", "android_yidianling", UMConfigure.DEVICE_TYPE_PHONE, null)
UMShareAPI.init(application, "56970affe0f55a9cda001e24")
}
override fun onTerminate(application: Application) {
EventBus.getDefault().unregister(this)
}
open fun onEvent(event:UserSetEvent){
if (event.userResponse!=null){
ModularServiceManager.provide(IUserService::class.java).setUserResponse(event.userResponse)
} else if (event.userInfo!=null){
ModularServiceManager.provide(IUserService::class.java).updateUserInfoSp(event.userInfo)
}else if (event.userSetting!=null){
ModularServiceManager.provide(IUserService::class.java).updateUserSetingSp(event.userSetting)
}
}
}
package com.yidianling.user.base
import android.content.Context
import com.ydl.ydlcommon.base.config.GlobalConfig
import com.ydl.ydlcommon.base.config.IConfigModule
import com.ydl.ydlcommon.base.delegate.IAppLifecycles
/**
* Created by haorui on 2019-09-01 .
* Des:
*/
class UserGlobalConfig : IConfigModule {
override fun injectAppLifecycle(context: Context, lifecycles: MutableList<IAppLifecycles>) {
lifecycles.add(UserAppLifecycles())
}
override fun applyOptions(context: Context, builder: GlobalConfig.Builder) {}
}
......@@ -3,7 +3,7 @@ package com.yidianling.user.http
import com.google.gson.Gson
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.ChcekPhoneResponeBean
import com.yidianling.user.http.response.PhoneAuthResponseBean
......@@ -48,7 +48,7 @@ class LoginApiRequestUtil {
/**
* 一键登录
*/
fun autoLogin(param: PhoneLoginAutoParam): Observable<BaseResponse<UserResponse>> {
fun autoLogin(param: PhoneLoginAutoParam): Observable<BaseResponse<UserResponseBean>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().autoLogin(body)
......@@ -57,7 +57,7 @@ class LoginApiRequestUtil {
/**
* 手机号密码登录
*/
fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponse>> {
fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponseBean>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().loginByPassword(body)
......@@ -66,7 +66,7 @@ class LoginApiRequestUtil {
/**
* 重新设置密码
*/
fun resetPwd(param: PhoneResetPwdParam): Observable<BaseResponse<UserResponse>> {
fun resetPwd(param: PhoneResetPwdParam): Observable<BaseResponse<UserResponseBean>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().resetPwd(body)
......@@ -82,7 +82,7 @@ class LoginApiRequestUtil {
/**
* 验证码登录
*/
fun loginByMsgCode(param: PhoneLoginCodeParam): Observable<BaseResponse<UserResponse>> {
fun loginByMsgCode(param: PhoneLoginCodeParam): Observable<BaseResponse<UserResponseBean>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().loginByMsgCode(body)
......
......@@ -6,7 +6,7 @@ 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.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.response.*
import io.reactivex.Observable
import okhttp3.RequestBody
......@@ -22,7 +22,7 @@ interface UserApi {
//登录
@FormUrlEncoded
@POST("user/user")
fun login(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponse>>
fun login(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
//国家列表
@FormUrlEncoded
......@@ -42,7 +42,7 @@ interface UserApi {
//绑定手机号
@FormUrlEncoded
@POST("user/bind-phone")
fun bindPhone(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponse>>
fun bindPhone(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
//忘记密码
@FormUrlEncoded
......@@ -62,7 +62,7 @@ interface UserApi {
//第三方登录
@POST("user/user_q_w")
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponse>>
fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponseBean>>
//设置用户信息
@FormUrlEncoded
......@@ -126,17 +126,17 @@ interface UserApi {
//一键登录
@POST("user/login_direct")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun autoLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponse>>
fun autoLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//手机号密码登录
@POST("user/login_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun loginByPassword(@Body body: RequestBody): Observable<BaseResponse<UserResponse>>
fun loginByPassword(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//重新设置密码
@POST("user/reset_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun resetPwd(@Body body: RequestBody): Observable<BaseResponse<UserResponse>>
fun resetPwd(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//验证重置密码的短信验证码
@GET("user/precheck_reset_sms")
......@@ -161,12 +161,12 @@ interface UserApi {
//验证码登录
@POST("user/login_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun loginByMsgCode(@Body body: RequestBody): Observable<BaseResponse<UserResponse>>
fun loginByMsgCode(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//第三方登录获取用户信息
@POST("user/user_q_w")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun thirdPartJavaLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponse>>
fun thirdPartJavaLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
//第三方登录解绑
......
......@@ -5,7 +5,7 @@ import com.google.gson.internal.LinkedTreeMap
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword
......@@ -20,7 +20,7 @@ import io.reactivex.Observable
*/
interface UserHttp {
fun login(param: LoginParam): Observable<BaseResponse<UserResponse>>
fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>>
fun countryList(): Observable<BaseResponse<CountryResponse>>
......@@ -28,7 +28,7 @@ interface UserHttp {
fun code(param: CodeParam): Observable<BaseResponse<Any>>
fun bindPhone(param: BindPhoneParam): Observable<BaseResponse<UserResponse>>
fun bindPhone(param: BindPhoneParam): Observable<BaseResponse<UserResponseBean>>
fun forget(param: ForgetParam): Observable<BaseResponse<Any>>
......@@ -36,7 +36,7 @@ interface UserHttp {
fun channelId(param: ChannelIdParam): Observable<BaseResponse<LinkedTreeMap<String, String>>>
fun thirdPartLogin(param: ThirdLoginParam): Observable<BaseAPIResponse<UserResponse>>
fun thirdPartLogin(param: ThirdLoginParam): Observable<BaseAPIResponse<UserResponseBean>>
fun setUserInfo(param: UserInfoParam): Observable<BaseResponse<Any>>
......@@ -56,7 +56,7 @@ interface UserHttp {
fun privacyAgree(uid: String): Observable<BaseResponse<Any>>
fun thirdPartJavaLogin(param: ThirdLoginParam): Observable<BaseResponse<UserResponse>>
fun thirdPartJavaLogin(param: ThirdLoginParam): Observable<BaseResponse<UserResponseBean>>
// 友盟第三方登录
fun umLogin(activity: Activity, media: SHARE_MEDIA): Observable<ThirdLoginParam>
......
......@@ -12,7 +12,7 @@ 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.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.UserHelper
import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.http.request.*
......@@ -56,7 +56,7 @@ class UserHttpImpl private constructor() : UserHttp {
// .create(UserApi::class.java)
// }
override fun login(param: LoginParam): Observable<BaseResponse<UserResponse>> {
override fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>> {
return RxUtils.mapObservable(param)
.flatMap { getUserApi().login(it) }
}
......@@ -77,7 +77,7 @@ class UserHttpImpl private constructor() : UserHttp {
}
override fun bindPhone(param: BindPhoneParam): Observable<BaseResponse<UserResponse>> {
override fun bindPhone(param: BindPhoneParam): Observable<BaseResponse<UserResponseBean>> {
return RxUtils.mapObservable(param)
.flatMap { getUserApi().bindPhone(it) }
}
......@@ -97,7 +97,7 @@ class UserHttpImpl private constructor() : UserHttp {
.flatMap { getUserApi().setChannelId(it) }
}
override fun thirdPartLogin(param: ThirdLoginParam): Observable<BaseAPIResponse<UserResponse>> {
override fun thirdPartLogin(param: ThirdLoginParam): Observable<BaseAPIResponse<UserResponseBean>> {
var param: String = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), param)
......@@ -178,7 +178,7 @@ class UserHttpImpl private constructor() : UserHttp {
return LoginObservable(activity, media)
}
override fun thirdPartJavaLogin(param: ThirdLoginParam): Observable<BaseResponse<UserResponse>> {
override fun thirdPartJavaLogin(param: ThirdLoginParam): Observable<BaseResponse<UserResponseBean>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().thirdPartJavaLogin(body)
......
......@@ -7,10 +7,10 @@ import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.ydlcommon.base.BaseApp
import com.yidianling.common.tools.RxAppTool
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
import com.yidianling.user.api.service.IUserService
import com.yidianling.user.modular_service.utils.UserServiceHelper
import com.yidianling.user.route.UserIn
import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.PrivacyActivity
......@@ -32,64 +32,64 @@ public class UserServiceImp : IUserService {
}
override fun getUserSetting(): UserSettingBean? {
return UserServiceHelper.getUsetSetting()
return UserHelper.getUsetSetting()
}
override fun updateUserInfoSp(userInfo: UserResponseBean.UserInfo?) {
UserServiceHelper.updateUserinfo(userInfo)
UserHelper.updateUserinfo(userInfo)
}
override fun updateUserSetingSp(userSetting: UserSettingBean?) {
UserServiceHelper.updateUserSetting(userSetting)
UserHelper.updateUserSetting(userSetting)
}
override fun setChatTeamHisShowed(showed: Boolean) {
UserServiceHelper.getUsetSetting()?.chatTeamHisShowed = showed
UserHelper.getUsetSetting()?.chatTeamHisShowed = showed
}
override fun setUserResponse(userInfo: UserResponseBean?) {
UserServiceHelper.setUserinfo(userInfo)
UserHelper.setUserinfo(userInfo)
}
override fun getUserResponse(): UserResponseBean? {
return UserServiceHelper.getUserInfo()
return UserHelper.getUserInfo()
}
override fun isLogin(): Boolean {
return UserServiceHelper.isLogin()
return UserHelper.isLogin()
}
override fun isFirstLogin(): Boolean {
return UserServiceHelper.getUserInfo()?.firstLogin==1
return UserHelper.getUserInfo()?.firstLogin==1
}
override fun setFirstLogin(first: Boolean) {
var value : Int = if (first) 1 else 2 //1是2否
UserServiceHelper.getUserInfo()?.firstLogin = value
UserHelper.getUserInfo()?.firstLogin = value
}
override fun isSafePrivacyClicked(): Boolean {
return UserServiceHelper.getUsetSetting()?.meSafePrivateIsClick?:true
return UserHelper.getUsetSetting()?.meSafePrivateIsClick?:true
}
override fun putSafePrivacyClicked(clicked: Boolean) {
UserServiceHelper.getUsetSetting()?.meSafePrivateIsClick = clicked
UserHelper.getUsetSetting()?.meSafePrivateIsClick = clicked
}
override fun getUserInfo(): UserResponseBean.UserInfo? {
return UserServiceHelper.getUserInfo()?.userInfo
return UserHelper.getUserInfo()?.userInfo
}
override fun isBindPhone(): Boolean {
return !TextUtils.isEmpty(UserServiceHelper.getUserInfo()?.userInfo?.phone)
return !TextUtils.isEmpty(UserHelper.getUserInfo()?.userInfo?.phone)
}
override fun putUnlockCheckSuccessTime(time: Long) {
UserServiceHelper.getUsetSetting()?.unLockCheckSuccessTime = time
UserHelper.getUsetSetting()?.unLockCheckSuccessTime = time
}
override fun getChatTeamHisShow(): Boolean {
return UserServiceHelper.getUsetSetting()?.chatTeamHisShowed?:true
return UserHelper.getUsetSetting()?.chatTeamHisShowed?:true
}
override fun privacyIntent(activity: Activity): Intent {
......@@ -106,7 +106,7 @@ public class UserServiceImp : IUserService {
override fun safeTipViewGone(): Boolean {
//如果是非登录状态 或者 app指纹开启 或者 手势密码不为空 或者 已提示过安全解锁 -> 隐藏 设置密码提示
return !UserServiceHelper.isLogin() || FingerPrintUtil.instance().fingerPrintIsOpen()
return !UserHelper.isLogin() || FingerPrintUtil.instance().fingerPrintIsOpen()
|| !TextUtils.isEmpty(FingerPrintUtil.instance().getHandPass())
|| FingerPrintUtil.instance().getTrendsSafeTip()
}
......@@ -120,17 +120,17 @@ public class UserServiceImp : IUserService {
}
override fun isFirstStart(): Boolean {
val lastVersionCode : Int = UserServiceHelper.getUsetSetting()?.lastVersionCode?:0
val lastVersionCode : Int = UserHelper.getUsetSetting()?.lastVersionCode?:0
val currentVersionCode : Int = RxAppTool.getAppVersionCode(BaseApp.getApp())
if (lastVersionCode < currentVersionCode) {
UserServiceHelper.getUsetSetting()?.lastVersionCode = currentVersionCode
UserHelper.getUsetSetting()?.lastVersionCode = currentVersionCode
return true
}
return false
}
override fun clearUserInfo() {
UserServiceHelper.setUserinfo(null)
UserHelper.setUserinfo(null)
UserIn.clearImData()
}
}
\ No newline at end of file
package com.yidianling.user.modular_service.utils
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
/**
* 用户信息辅助类
*/
object UserServiceHelper {
val gson: Gson = Gson()
//用户信息存储
private val user_info_name_sp = "ydl_user_info"
private val user_info_key_sp = "ydl_user_info_key"
//用户设置存储
private val user_setting_name_sp = "ydl_user_setting"
private val user_setting_key_sp = "ydl_user_setting_key"
//用户信息//缓存
private var userTemp: UserResponseBean? = null
//用户设置信息缓存
private var userSettingBean: UserSettingBean? = null
//存储用户信息
fun setUserinfo(userInfo: UserResponseBean?) {
try {
userTemp = userInfo
var str = gson.toJson(userTemp)
SharedPreferencesEditor.putFileString(user_info_name_sp, user_info_key_sp, str)
UserInfoCache.getInstance().saveYDLUser("\"" + userInfo?.uid + "\"",
userInfo?.userInfo?.nick_name, userInfo?.userInfo?.head)
YdlBuryPointUtil.reLogin()
} catch (e: Exception) {
e.printStackTrace()
}
}
//获取用户设置信息
fun getUserInfo(): UserResponseBean? {
if (userTemp != null) return userTemp!!
try {
var obj = SharedPreferencesEditor.getFileString(user_info_name_sp, user_info_key_sp)
var app: UserResponseBean = gson.fromJson(obj, UserResponseBean::class.java)
userTemp = app
return userTemp!!
} catch (e: Exception) {
userTemp = UserResponseBean()
}
return userTemp
}
fun updateUserinfo(userInfo: UserResponseBean.UserInfo?) {
getUserInfo()?.userInfo = userInfo
}
fun updateUserSetting(userseting: UserSettingBean?) {
setUserSettingBean(userseting)
}
/**
* 是否登录
*/
fun isLogin(): Boolean {
try {
var user = getUserInfo()?.userInfo
if (TextUtils.isEmpty(user?.uid)) {
return false
}
var uid: Int = user?.uid?.toInt() ?: 0
if (uid > 0) {
return true
}
} catch (e: Exception) {
e.printStackTrace()
}
return false
}
/**
* 是否绑定手机
*/
fun isBindPhone(): Boolean {
return !TextUtils.isEmpty(getUserInfo()?.userInfo?.phone)
}
/**
* 存储用户设置信息
*/
fun setUserSettingBean(userseting: UserSettingBean?) {
try {
userSettingBean = userseting
var str = gson.toJson(userSettingBean)
SharedPreferencesEditor.putFileString(user_setting_name_sp, user_setting_key_sp, str)
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 获取用户设置信息
*/
fun getUsetSetting(): UserSettingBean? {
if (userSettingBean != null) return userSettingBean!!
try {
var obj = SharedPreferencesEditor.getFileString(user_setting_name_sp, user_setting_key_sp)
if (TextUtils.isEmpty(obj)) {
setUserSettingBean(UserSettingBean())
}
var app: UserSettingBean = gson.fromJson(obj, UserSettingBean::class.java)
userSettingBean = app
return userSettingBean
} catch (e: Exception) {
}
return userSettingBean
}
}
\ No newline at end of file
......@@ -4,13 +4,15 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseApp
import com.yidianling.common.tools.RxAppTool
import com.yidianling.router.user.IUserRouter
import com.yidianling.router.user.UserResponse
import com.yidianling.router.user.UserSetting
import com.yidianling.user.UserHelper
import com.yidianling.user.modular_service.utils.UserServiceHelper
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.PrivacyActivity
import com.yidianling.user.ui.InputPhoneActivity
......@@ -23,16 +25,20 @@ import com.yidianling.user.ui.login.RegisterAndLoginActivity
* time : 2018/04/13
*/
class UserRouterImp : IUserRouter {
override fun getUserSetting(): UserSetting? {
return UserHelper.getUsetSetting()
val gson: Gson = Gson()
override fun getUserSetting(): UserSetting {
return gson.fromJson(UserHelper.getUserSettingStr(), UserSetting::class.java)
}
override fun updateUserInfoSp(userInfo: UserResponse.UserInfo?) {
UserHelper.updateUserinfo(userInfo)
val info:UserResponseBean.UserInfo = gson.fromJson(gson.toJson(userInfo), UserResponseBean.UserInfo::class.java)
UserHelper.updateUserinfo(info)
}
override fun updateUserSetingSp(userSetting: UserSetting?) {
UserHelper.updateUserSetting(userSetting)
val info:UserSettingBean= gson.fromJson(gson.toJson(userSetting), UserSettingBean::class.java)
UserHelper.updateUserSetting(info)
}
override fun setChatTeamHisShowed(showed: Boolean) {
......@@ -40,11 +46,12 @@ class UserRouterImp : IUserRouter {
}
override fun setUserResponse(userInfo: UserResponse?) {
UserHelper.setUserinfo(userInfo)
val info:UserResponseBean = gson.fromJson(gson.toJson(userInfo), UserResponseBean::class.java)
UserHelper.setUserinfo(info)
}
override fun getUserResponse(): UserResponse? {
return UserHelper.getUserInfo()
override fun getUserResponse(): UserResponse {
return gson.fromJson(UserHelper.getUserInfoStr(), UserResponse::class.java)
}
override fun isLogin(): Boolean {
......@@ -69,7 +76,7 @@ class UserRouterImp : IUserRouter {
}
override fun getUserInfo(): UserResponse.UserInfo? {
return UserHelper.getUserInfo()?.userInfo
return gson.fromJson(UserHelper.getUserInfoStr(), UserResponse::class.java)?.userInfo
}
override fun isBindPhone(): Boolean {
......
......@@ -37,7 +37,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.ThreeLinesDialog;
import com.yidianling.common.tools.RxFileTool;
import com.yidianling.common.tools.RxImageTool;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.*;
import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl;
......@@ -342,7 +342,7 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(this::dismissProgressDialog)
.subscribe(o -> {
UserResponse userInfo = UserHelper.INSTANCE.getUserInfo();
UserResponseBean userInfo = UserHelper.INSTANCE.getUserInfo();
if (userInfo != null) {
userInfo.getUserInfo().setHead(head);
userInfo.getUserInfo().setGender(gender);
......
......@@ -21,7 +21,7 @@ import com.ydl.ydlcommon.view.TitleBar;
import com.yidianling.router.RouterManager;
import com.yidianling.router.im.IMLoginInfo;
import com.yidianling.router.im.IMRequestCallback;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.LoginHelper;
import com.yidianling.user.R;
import com.yidianling.user.UserConstants;
......@@ -410,7 +410,7 @@ public class GetIdentifyingCodeActivity extends BaseActivity implements View.OnC
}
//用户信息 获取登陆信息
public void setHXinfo(UserResponse userInfo) {
public void setHXinfo(UserResponseBean userInfo) {
try {
if (userInfo != null) {
......
......@@ -15,7 +15,7 @@ import com.ydl.ydlcommon.view.DeleteEditTextView;
import com.ydl.ydlcommon.view.JumpTextView;
import com.ydl.ydlcommon.view.RoundCornerButton;
import com.ydl.ydlcommon.view.TitleBar;
import com.yidianling.router.user.UserResponse;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.user.LoginContract;
import com.yidianling.user.LoginPresenter;
import com.yidianling.user.R;
......@@ -140,7 +140,7 @@ public class LoginActivity extends BaseMvpActivity<LoginContract.View,LoginContr
}
@Override
public void loginSuccess(UserResponse userInfo) {
public void loginSuccess(UserResponseBean userInfo) {
finishFinger();
int size = ActivityManager.Companion.getActivitySize();
if (size == 2 || size == 1) {
......
......@@ -16,7 +16,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.LoginUtils
import com.yidianling.user.UserConstants
import com.yidianling.user.constants.UserBIConstants
......@@ -181,7 +181,7 @@ class SmsLoginActivity : BaseActivity() {
// 登录 IM
private fun loginIM(info: UserResponse) {
private fun loginIM(info: UserResponseBean) {
val loginInfo = IMLoginInfo(info.uid.toString(), info.hxpwd!!)
val callback = object : IMRequestCallback<IMLoginInfo> {
override fun onSuccess(loginInfo: IMLoginInfo?) {
......@@ -201,7 +201,7 @@ class SmsLoginActivity : BaseActivity() {
}
//用户信息 获取登陆信息
fun setHXInfo(userInfo: UserResponse.UserInfo?) {
fun setHXInfo(userInfo: UserResponseBean.UserInfo?) {
try {
if (userInfo != null) {
UserIn.imSetAccount(userInfo.uid.toString())
......
......@@ -34,7 +34,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.BuildConfig
import com.yidianling.user.R
import com.yidianling.user.UserHelper
......@@ -438,7 +438,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
/**
*三方登录成功
*/
override fun thirdLoginSuccess(userInfo: UserResponse.UserInfo) {
override fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo) {
var bindPhone = userInfo.bind_phone
if (bindPhone != 1) {
countryCode = userInfo.country_code
......
......@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.PhoneLoginPwdParam
import com.yidianling.user.http.request.PhoneResetPwdParam
import io.reactivex.Observable
......@@ -60,11 +60,11 @@ interface IInputPassWordContract {
/**
* 手机号密码登录
*/
fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponse>>
fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponseBean>>
/**
* 重新设置密码
*/
fun resetPwd(param: PhoneResetPwdParam): Observable<BaseResponse<UserResponse>>
fun resetPwd(param: PhoneResetPwdParam): Observable<BaseResponse<UserResponseBean>>
}
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.CheckAliAuthParam
import com.yidianling.user.http.request.PhoneLoginAutoParam
......@@ -44,7 +44,7 @@ interface ILoginContract {
/**
* 三方登录成功
*/
fun thirdLoginSuccess(userInfo: UserResponse.UserInfo)
fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo)
/**
* 弹窗
......@@ -136,7 +136,7 @@ interface ILoginContract {
/**
* 通过一键认证服务登陆
*/
fun autoLogin(bean: PhoneLoginAutoParam): Observable<BaseResponse<UserResponse>>
fun autoLogin(bean: PhoneLoginAutoParam): Observable<BaseResponse<UserResponseBean>>
/**
*
......
......@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginCodeParam
import io.reactivex.Observable
......@@ -93,7 +93,7 @@ interface IVerificationCodeContract {
/**
* 验证码验证码登录
*/
fun loginByMsgCode(param: PhoneLoginCodeParam): Observable<BaseResponse<UserResponse>>
fun loginByMsgCode(param: PhoneLoginCodeParam): Observable<BaseResponse<UserResponseBean>>
/**
* 重置密码的验证码
......
package com.yidianling.user.ui.login.model
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.LoginApiRequestUtil
import com.yidianling.user.http.request.PhoneLoginPwdParam
import com.yidianling.user.http.request.PhoneResetPwdParam
......@@ -19,14 +19,14 @@ class InputPassWordModelImpl : IInputPassWordContract.Model {
/**
* 重新设置密码
*/
override fun resetPwd(param: PhoneResetPwdParam): Observable<BaseResponse<UserResponse>> {
override fun resetPwd(param: PhoneResetPwdParam): Observable<BaseResponse<UserResponseBean>> {
return LoginApiRequestUtil.resetPwd(param)
}
/**
* 手机号密码登录
*/
override fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponse>> {
override fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponseBean>> {
return LoginApiRequestUtil.userLoginByPassword(param)
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ package com.yidianling.user.ui.login.model
import android.app.Activity
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.LoginApiRequestUtil
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.CheckAliAuthParam
......@@ -34,7 +34,7 @@ class LoginModelImpl : ILoginContract.Model {
/**
* 通过一键认证服务登陆
*/
override fun autoLogin(bean: PhoneLoginAutoParam): Observable<BaseResponse<UserResponse>> {
override fun autoLogin(bean: PhoneLoginAutoParam): Observable<BaseResponse<UserResponseBean>> {
return LoginApiRequestUtil.autoLogin(bean)
}
......
package com.yidianling.user.ui.login.model
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.http.LoginApiRequestUtil
import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginCodeParam
......@@ -42,7 +42,7 @@ class VerificationCodeModelImpl : IVerificationCodeContract.Model {
/**
* 验证码验证码登录
*/
override fun loginByMsgCode(param: PhoneLoginCodeParam): Observable<BaseResponse<UserResponse>> {
override fun loginByMsgCode(param: PhoneLoginCodeParam): Observable<BaseResponse<UserResponseBean>> {
return LoginApiRequestUtil.loginByMsgCode(param)
}
......
......@@ -10,7 +10,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.LoginUtils
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.PhoneLoginPwdParam
......@@ -111,7 +111,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
/**
* 保存登录信息
*/
private fun saveUserData(userResponse: UserResponse) {
private fun saveUserData(userResponse: UserResponseBean) {
if (!TextUtils.isEmpty(userResponse.userInfo!!.phone)) {
YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone)
YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code)
......
......@@ -11,7 +11,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.LoginUtils
import com.yidianling.user.UserHelper
import com.yidianling.user.constants.UserBIConstants
......@@ -91,7 +91,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
/**
* 保存登录信息
*/
private fun saveUserData(userResponse: UserResponse) {
private fun saveUserData(userResponse: UserResponseBean) {
if (!TextUtils.isEmpty(userResponse.userInfo!!.phone)) {
YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone)
YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code)
......
......@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.LoginUtils
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.BindPhoneJavaParam
......@@ -161,7 +161,7 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base
/**
* 保存登录信息
*/
private fun saveUserData(userResponse: UserResponse) {
private fun saveUserData(userResponse: UserResponseBean) {
if (!TextUtils.isEmpty(userResponse.userInfo!!.phone)) {
YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone)
YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code)
......
package com.yidianling.user.api.bean
import com.google.gson.annotations.SerializedName
import com.yidianling.user.api.event.UserSetEvent
import de.greenrobot.event.EventBus
import com.yidianling.user.api.utils.UserApiServiceUtils
/**
......@@ -18,7 +17,7 @@ class UserResponseBean {
var userInfo: UserResponseBean.UserInfo? = UserInfo()
set(value) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().setUserResponse(this)
}
inner class UserInfo {
......@@ -51,7 +50,7 @@ class UserResponseBean {
set(value) {
if (value != bind_weixin) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
@field:SerializedName("bindQq")
......@@ -60,7 +59,7 @@ class UserResponseBean {
set(value) {
if (value != bind_qq) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
@field:SerializedName("userType")
......@@ -71,14 +70,14 @@ class UserResponseBean {
set(value) {
if (value != profession) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
var marriage: Int = 0
set(value) {
if (value != marriage) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
@field:SerializedName("countryCode")
......@@ -89,7 +88,7 @@ class UserResponseBean {
set(value) {
if (!(value?.equals(home_bg) ?: false)) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
//是否同意过隐私权限 1同意过 0未同意
......@@ -97,7 +96,7 @@ class UserResponseBean {
set(value) {
if (value != privacyAgreementStatus) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
......@@ -106,7 +105,7 @@ class UserResponseBean {
set(value) {
if (!(value?.equals(description) ?: false)) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
@field:SerializedName("isSilenced")
......@@ -114,7 +113,7 @@ class UserResponseBean {
set(value) {
if (value != is_silenced) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
var hasCoupon: Int = 0
......@@ -122,7 +121,7 @@ class UserResponseBean {
set(value) {
if (value != firstLogin) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
......@@ -130,7 +129,7 @@ class UserResponseBean {
set(value) {
if (value != trendNum) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
......@@ -139,7 +138,7 @@ class UserResponseBean {
set(value) {
if (value != fansNum) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
var testRecordNum: Int = 0
......@@ -147,7 +146,7 @@ class UserResponseBean {
set(value) {
if (value != testRecordNum) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
var attentionNum: Int = 0
......@@ -155,7 +154,7 @@ class UserResponseBean {
set(value) {
if (value != attentionNum) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
var registTime: String? = null
......@@ -163,7 +162,7 @@ class UserResponseBean {
set(value) {
if (!(value?.equals(registTime) ?: false)) {
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
}
}
......
package com.yidianling.user.api.bean
import com.yidianling.user.api.event.UserSetEvent
import de.greenrobot.event.EventBus
import com.yidianling.user.api.utils.UserApiServiceUtils
/**
......@@ -15,7 +14,7 @@ class UserSettingBean {
set(value) {
if (fingerPrintStatus!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
......@@ -24,7 +23,7 @@ class UserSettingBean {
set(value) {
if (unLockCheckSuccessTime!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
//指纹多次错误被禁止使用的时间戳
......@@ -32,7 +31,7 @@ class UserSettingBean {
set(value) {
if (fingerErrorTime!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
//手势密码
......@@ -40,7 +39,7 @@ class UserSettingBean {
set(value) {
if (!value.equals(gesturePassword)){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
//设置群聊历史记录
......@@ -48,7 +47,7 @@ class UserSettingBean {
set(value) {
if (chatTeamHisShowed!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
//获取动态页面是否提示过安全解锁
......@@ -56,7 +55,7 @@ class UserSettingBean {
set(value) {
if (trendsIsClick!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
//我的页面隐私安全是否点击过
......@@ -64,7 +63,7 @@ class UserSettingBean {
set(value) {
if (meSafePrivateIsClick!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
//最后一次登录的版本号
......@@ -72,7 +71,7 @@ class UserSettingBean {
set(value) {
if (lastVersionCode!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
/**
......@@ -82,7 +81,7 @@ class UserSettingBean {
set(value) {
if (hasVoice!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
/**
......@@ -92,7 +91,7 @@ class UserSettingBean {
set(value) {
if (hasShake!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
......@@ -100,7 +99,7 @@ class UserSettingBean {
set(value) {
if (time!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
/**
......@@ -110,7 +109,7 @@ class UserSettingBean {
set(value){
if (phoneStatusPermissionIsShow!=value){
field = value
EventBus.getDefault().post(UserSetEvent(this))
UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
}
}
}
\ No newline at end of file
package com.yidianling.user.api.event
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean
/**
* Created by haorui on 2019-10-07.
* Des:
*/
class UserSetEvent {
var userResponse: UserResponseBean?=null
var userInfo: UserResponseBean.UserInfo?=null
var userSetting: UserSettingBean?=null
constructor(userResponse: UserResponseBean?) {
this.userResponse = userResponse
}
constructor(userInfo: UserResponseBean.UserInfo) {
this.userInfo = userInfo
}
constructor(userSettingBean: UserSettingBean) {
this.userSetting = userSettingBean
}
}
package com.yidianling.user.api.utils
import com.alibaba.android.arouter.exception.NoRouteFoundException
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.yidianling.user.api.service.IUserService
/**
* Created by haorui on 2019-09-21 .
* Des:查找 Arouter 服务封装类
*/
object UserApiServiceUtils {
private val routerMap: HashMap<String, IProvider> = HashMap()
fun provideUserApiService(): IUserService {
return provide(IUserService::class.java)
}
private fun <T : IProvider> provide(clz: Class<T>): T {
var provider: IProvider? = null
val simpleName = clz.simpleName;
if (routerMap[simpleName]!=null){
return routerMap[simpleName] as T
}
try {
provider = ARouter.getInstance().navigation(clz)
if (provider == null){
throw NoRouteFoundException("Please check if you are dependent on the module containing $simpleName")
}
routerMap[simpleName] = provider
} catch (e: Exception) {
System.out.print(e.message)
}
return provider as T
}
}
\ No newline at end of file
package com.yidianling.router.user
import com.yidianling.router.RouterManager
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/26
*/
class UserSetting {
//是否开启指纹
var fingerPrintStatus: Boolean = false
set(value) {
if (fingerPrintStatus!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//指纹或手势验证成功时间
var unLockCheckSuccessTime: Long = 0L
set(value) {
if (unLockCheckSuccessTime!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//指纹多次错误被禁止使用的时间戳
var fingerErrorTime: Long = 0
set(value) {
if (fingerErrorTime!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//手势密码
var gesturePassword: String = ""
set(value) {
if (!value.equals(gesturePassword)){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//设置群聊历史记录
var chatTeamHisShowed: Boolean = false
set(value) {
if (chatTeamHisShowed!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//获取动态页面是否提示过安全解锁
var trendsIsClick: Boolean = false
set(value) {
if (trendsIsClick!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//我的页面隐私安全是否点击过
var meSafePrivateIsClick = false
set(value) {
if (meSafePrivateIsClick!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
//最后一次登录的版本号
var lastVersionCode = 0
set(value) {
if (lastVersionCode!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
/**
* 消息语音提醒
*/
var hasVoice: Boolean = true
set(value) {
if (hasVoice!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
/**
* 消息震动提醒
*/
var hasShake: Boolean = true
set(value) {
if (hasShake!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
var time: Long = 0L
set(value) {
if (time!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
/**
* 手机识别吗是否已经提示过
*/
var phoneStatusPermissionIsShow : Boolean = false
set(value){
if (phoneStatusPermissionIsShow!=value){
field = value
RouterManager.getUserRouter()?.updateUserSetingSp(this)
}
}
}
\ No newline at end of file
......@@ -99,6 +99,10 @@ class AudioPlayer private constructor() {
* 是否自动保存播放进度
*/
var autoSaveProgress = false
/**
* 是否显示通知栏
*/
var isShowNotify = false
private object SingletonHolder {
val instance = AudioPlayer()
......@@ -255,7 +259,7 @@ class AudioPlayer private constructor() {
for (listener in listeners) {
listener.onChange(music)
}
if (playMode != PlayModeEnum.SINGLE) {
if (isShowNotify) {
NotifyManager.get().showPlay(music)
MediaSessionManager.get().updateMetaData(music)
MediaSessionManager.get().updatePlaybackState()
......@@ -313,7 +317,7 @@ class AudioPlayer private constructor() {
mediaPlayer!!.start()
state = STATE_PLAYING
handler!!.post(mPublishRunnable)
if (playMode != PlayModeEnum.SINGLE) {
if (isShowNotify) {
NotifyManager.get().showPlay(playMusic)
MediaSessionManager.get().updatePlaybackState()
}
......@@ -336,8 +340,10 @@ class AudioPlayer private constructor() {
mediaPlayer!!.pause()
state = STATE_PAUSE
handler!!.removeCallbacks(mPublishRunnable)
NotifyManager.get().showPause(playMusic)
MediaSessionManager.get().updatePlaybackState()
if(isShowNotify){
NotifyManager.get().showPause(playMusic)
MediaSessionManager.get().updatePlaybackState()
}
context!!.unregisterReceiver(noisyReceiver)
if (abandonAudioFocus) {
audioFocusManager!!.abandonAudioFocus()
......
......@@ -80,6 +80,7 @@ dependencies {
api rootProject.ext.dependencies["ydl-js"]
api rootProject.ext.dependencies["ydl-net"]
api rootProject.ext.dependencies["ydl-js"]
api rootProject.ext.dependencies["ptr-lib-release"]
api(rootProject.ext.dependencies["ydl-device"]) {
transitive = true
}
......@@ -114,17 +115,12 @@ dependencies {
api rootProject.ext.dependencies["glide"]
api rootProject.ext.dependencies["glide-transformations"]
api rootProject.ext.dependencies["constraint-layout"]
api rootProject.ext.dependencies["ptr-lib-release"]
api rootProject.ext.dependencies["cube"]
api rootProject.ext.dependencies["support-multidex"]
api rootProject.ext.dependencies["tablayout"]
api rootProject.ext.dependencies["xrecyclerview"]
api rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
api rootProject.ext.dependencies["flowlayout"]
api rootProject.ext.dependencies["androidanimations"]
api rootProject.ext.dependencies["exoplayer"]
//====================Tools====================
api rootProject.ext.dependencies["robust"]
api rootProject.ext.dependencies["walle"]
......
package com.ydl.ydlcommon.base
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
......@@ -12,7 +11,7 @@ import com.ydl.ydlcommon.mvp.delegate.MvpFragmentDelegateImpl
* Created by haorui on 2019-08-14.
* Des:基础 MVP Fragment
*/
abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : Fragment(), MvpDelegateCallback<V, P>,
abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : BaseFragment(), MvpDelegateCallback<V, P>,
IView {
protected var mPresenter: P ?= null
......@@ -27,8 +26,8 @@ abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : Fragment(), MvpDe
abstract override fun createPresenter(): P
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mvpDelegate?.onViewCreated(view, savedInstanceState)
super.onViewCreated(view, savedInstanceState)
}
override fun onDestroyView() {
......@@ -37,8 +36,8 @@ abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : Fragment(), MvpDe
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mvpDelegate?.onCreate(savedInstanceState)
super.onCreate(savedInstanceState)
}
override fun onDestroy() {
......
......@@ -19,6 +19,12 @@
<dimen name="platform_title_bar_height">45dp</dimen>
<dimen name="platform_action_bar_height">48dip</dimen>
<!--Common SP -->
<dimen name="platform_sp_12">12sp</dimen>
<dimen name="platform_sp_14">14sp</dimen>
<dimen name="platform_sp_16">16sp</dimen>
<!--Common DP-->
<dimen name="platform_dp_05">0.5dp</dimen>
<dimen name="platform_dp_1">1dp</dimen>
<dimen name="platform_dp_2">2dp</dimen>
......@@ -58,6 +64,7 @@
<dimen name="platform_dp_36">36dp</dimen>
<dimen name="platform_dp_37">37dp</dimen>
<dimen name="platform_dp_38">38dp</dimen>
<dimen name="platform_dp_40">40dp</dimen>
<dimen name="platform_dp_48">48dp</dimen>
<dimen name="platform_dp_60">60dp</dimen>
<dimen name="platform_dp_64">64dp</dimen>
......
......@@ -1217,7 +1217,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
dialog.setCallBack(type -> {
if (1 == type) {
if (!WebModularServiceUtils.Companion.getUserRouter().isLogin()) {
if (!WebModularServiceUtils.Companion.getUserService().isLogin()) {
isToTrend = true;
ARouter.getInstance().build("/user/login").navigation();
} else {
......
......@@ -44,15 +44,15 @@ class SafeTipView : LinearLayout {
.duration(400)
.onEnd { visibility = View.GONE }
.playOn(this@SafeTipView)
WebModularServiceUtils.getUserRouter().setTrendsSafeTip(true)
WebModularServiceUtils.getUserService().setTrendsSafeTip(true)
}
tvTip.setOnClickListener {
WebModularServiceUtils.getUserRouter().privacyIntent(context as Activity)
WebModularServiceUtils.getUserService().privacyIntent(context as Activity)
}
}
fun updateVisibility() {
if (WebModularServiceUtils.getUserRouter().safeTipViewGone()) {
if (WebModularServiceUtils.getUserService().safeTipViewGone()) {
this.visibility = View.GONE
} else {
this.visibility = View.VISIBLE
......
......@@ -3,8 +3,6 @@ package com.ydl.webview
import android.app.Activity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.yidianling.router.RouterManager
import com.yidianling.router.user.IUserRouter
import com.yidianling.user.api.service.IUserService
/**
......@@ -14,10 +12,6 @@ import com.yidianling.user.api.service.IUserService
class WebModularServiceUtils {
companion object {
fun getUserRouter(): IUserRouter {
return RouterManager.getUserRouter()!!
}
fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java)
}
......
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