Commit 21ee27cc by 洪国微

merge

parents d8ac396e 69d550ff
...@@ -180,12 +180,12 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -180,12 +180,12 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
} }
// override fun onDestroy() { override fun onDestroy() {
// if (serviceConnection != null) { if (serviceConnection != null) {
// unbindService(serviceConnection) unbindService(serviceConnection)
// } }
// super.onDestroy() super.onDestroy()
// } }
private inner class PlayServiceConnection : ServiceConnection { private inner class PlayServiceConnection : ServiceConnection {
override fun onServiceConnected(name: ComponentName, service: IBinder) { override fun onServiceConnected(name: ComponentName, service: IBinder) {
......
...@@ -9,6 +9,7 @@ import com.ydl.devicesidlib.DeviceIDHelper; ...@@ -9,6 +9,7 @@ import com.ydl.devicesidlib.DeviceIDHelper;
import com.ydl.media.audio.PlayService; import com.ydl.media.audio.PlayService;
import com.ydl.ydlcommon.base.delegate.IAppLifecycles; import com.ydl.ydlcommon.base.delegate.IAppLifecycles;
import com.ydl.ydlcommon.utils.YdlBuryPointUtil; import com.ydl.ydlcommon.utils.YdlBuryPointUtil;
import com.yidianling.course.lifeCallback.CoursePlayLifecycle;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -37,6 +38,8 @@ public class DemoAppLifecycles implements IAppLifecycles { ...@@ -37,6 +38,8 @@ public class DemoAppLifecycles implements IAppLifecycles {
Intent intent = new Intent(application, PlayService.class); Intent intent = new Intent(application, PlayService.class);
application.startService(intent); application.startService(intent);
application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
} }
@Override @Override
......
...@@ -27,7 +27,7 @@ public final class DemoGlobalConfig implements IConfigModule { ...@@ -27,7 +27,7 @@ public final class DemoGlobalConfig implements IConfigModule {
public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) { public void applyOptions(@NotNull Context context, @NotNull GlobalConfig.Builder builder) {
builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX) builder.setFrom( "ydl".equals(BuildConfig.FLAVOR) ?YDLConstants.FROM_YDL :YDLConstants.FROM_XLZX)
.addUrl("github", APP_DOMAIN) .addUrl("github", APP_DOMAIN)
.setEnv(YDLConstants.ENV_TEST) .setEnv(YDLConstants.ENV_PROD)
.setDebug(BuildConfig.DEBUG); .setDebug(BuildConfig.DEBUG);
} }
} }
...@@ -20,7 +20,9 @@ import com.ydl.media.audio.model.Music; ...@@ -20,7 +20,9 @@ import com.ydl.media.audio.model.Music;
import com.ydl.media.audio.utils.CoverImageUtils; import com.ydl.media.audio.utils.CoverImageUtils;
import com.ydl.media.view.PlayTypeEnum; import com.ydl.media.view.PlayTypeEnum;
import com.ydl.media.view.PlayerFloatHelper; import com.ydl.media.view.PlayerFloatHelper;
import com.ydl.ydlcommon.utils.LogUtil;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
import com.yidianling.user.LoginUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
...@@ -108,6 +110,8 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -108,6 +110,8 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
void initPlayMode() { void initPlayMode() {
int mode = AudioPlayer.Companion.get().getPlayMode().value(); int mode = AudioPlayer.Companion.get().getPlayMode().value();
ivMode.setImageLevel(mode); ivMode.setImageLevel(mode);
AudioPlayer.Companion.get().play();
showFloatView();
} }
@Override @Override
...@@ -154,11 +158,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -154,11 +158,7 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
break; break;
case R.id.iv_play: case R.id.iv_play:
play(); play();
if(!PlayerFloatHelper.Companion.isShow(getActivity())) { showFloatView();
PlayerFloatHelper.Companion.show(getActivity(), PlayTypeEnum.PLAY_TYPE_FM,new HashMap<>());
}else {
PlayerFloatHelper.Companion.showIfPlaying(getActivity());
}
break; break;
case R.id.iv_next: case R.id.iv_next:
next(); next();
...@@ -169,6 +169,14 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -169,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 @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (seekBar == sbProgress) { if (seekBar == sbProgress) {
...@@ -291,6 +299,6 @@ public class PlayFragment extends Fragment implements View.OnClickListener, ...@@ -291,6 +299,6 @@ public class PlayFragment extends Fragment implements View.OnClickListener,
@Override @Override
public void onComplete() { public void onComplete() {
LogUtil.e("onComplete");
} }
} }
...@@ -78,8 +78,8 @@ ...@@ -78,8 +78,8 @@
android:id="@+id/bt_to_other" android:id="@+id/bt_to_other"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="登录" /> android:text="登录" />
<Button <Button
...@@ -87,23 +87,16 @@ ...@@ -87,23 +87,16 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="咨询" /> 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 <Button
android:id="@+id/bt_to_music" android:id="@+id/bt_to_music"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="音乐" /> android:text="音乐" />
<Button <Button
...@@ -111,6 +104,7 @@ ...@@ -111,6 +104,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="冥想" /> android:text="冥想" />
</LinearLayout> </LinearLayout>
...@@ -126,8 +120,9 @@ ...@@ -126,8 +120,9 @@
android:id="@+id/bt_to_fm" android:id="@+id/bt_to_fm"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="电台" /> android:text="电台" />
<Button <Button
...@@ -135,46 +130,26 @@ ...@@ -135,46 +130,26 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="倾诉" /> 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 <Button
android:id="@+id/bt_to_tests" android:id="@+id/bt_to_tests"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="10dp"
android:text="测评" /> android:text="测评" />
<Button <Button
android:id="@+id/bt_to_course"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:visibility="invisible" /> android:layout_marginRight="10dp"
</LinearLayout> 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>
</LinearLayout> </LinearLayout>
......
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = false dev_mode = true
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -28,10 +28,10 @@ ext { ...@@ -28,10 +28,10 @@ ext {
version = [ version = [
androidSupportSdkVersion: "28.0.0", androidSupportSdkVersion: "28.0.0",
retrofitSdkVersion : "2.3.0", retrofitSdkVersion : "2.6.0",
dagger2SdkVersion : "2.23.2", dagger2SdkVersion : "2.23.2",
glideSdkVersion : "4.3.1", glideSdkVersion : "4.3.1",
butterknifeSdkVersion : "9.0.0", butterknifeSdkVersion : "8.8.1",
rxlifecycleSdkVersion : "1.0", rxlifecycleSdkVersion : "1.0",
rxlifecycle2SdkVersion : "2.2.2", rxlifecycle2SdkVersion : "2.2.2",
espressoSdkVersion : "3.0.1", espressoSdkVersion : "3.0.1",
...@@ -41,14 +41,15 @@ ext { ...@@ -41,14 +41,15 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
"m-audioim" : "0.0.12", //第三步 若干
"m-confide" : "0.0.15", "m-confide" : "0.0.18",
"m-consultant" : "0.0.22", "m-consultant" : "0.0.25",
"m-course" : "0.0.14", "m-course" : "0.0.14",
"m-fm" : "0.0.11", "m-fm" : "0.0.14",
"m-muse" : "0.0.11", "m-muse" : "0.0.11",
"m-tests" : "0.0.4", "m-tests" : "0.0.7",
"m-user" : "0.0.25", "m-user" : "0.0.28",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.1", "m-audioim-api" : "0.0.1",
"m-confide-api" : "0.0.1", "m-confide-api" : "0.0.1",
...@@ -57,20 +58,27 @@ ext { ...@@ -57,20 +58,27 @@ ext {
"m-fm-api" : "0.0.2", "m-fm-api" : "0.0.2",
"m-muse-api" : "0.0.1", "m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.1", "m-tests-api" : "0.0.1",
"m-user-api" : "0.0.5", "m-user-api" : "0.0.7",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
"ydl-media" : "0.0.9",
"ydl-net" : "0.0.1", //第一步
"ydl-pay" : "0.0.6", "ydl-platform" : "0.0.24",
"ydl-platform" : "0.0.21", //第二步 若干
"ydl-utils" : "0.0.2", "ydl-webview" : "0.0.24",
"ydl-webview" : "0.0.20", "ydl-media" : "0.0.12",
"ydl-pay" : "0.0.9",
"m-audioim" : "0.0.15",
//以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.2",
"ydl-utils" : "0.0.2",
"ydl-flutter-base": "0.0.3",
] ]
ydlCompileVersion = [ ydlCompileVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
"m-audioim" : "0.0.12", //第三步 若干
"m-confide" : "0.0.15", "m-confide" : "0.0.15",
"m-consultant" : "0.0.22", "m-consultant" : "0.0.22",
"m-course" : "0.0.8", "m-course" : "0.0.8",
...@@ -86,15 +94,22 @@ ext { ...@@ -86,15 +94,22 @@ ext {
"m-fm-api" : "0.0.2", "m-fm-api" : "0.0.2",
"m-muse-api" : "0.0.1", "m-muse-api" : "0.0.1",
"m-tests-api" : "0.0.1", "m-tests-api" : "0.0.1",
"m-user-api" : "0.0.5", "m-user-api" : "0.0.7",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
"ydl-media" : "0.0.9",
"ydl-net" : "0.0.1", //第一步
"ydl-pay" : "0.0.6", "ydl-platform" : "0.0.24",
"ydl-platform" : "0.0.21", //第二步 若干
"ydl-utils" : "0.0.2", "ydl-webview" : "0.0.24",
"ydl-webview" : "0.0.20", "ydl-media" : "0.0.12",
"ydl-pay" : "0.0.9",
"m-audioim" : "0.0.15",
//以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.2",
"ydl-utils" : "0.0.2",
"ydl-flutter-base": "0.0.3",
] ]
dependencies = [ dependencies = [
...@@ -115,7 +130,7 @@ ext { ...@@ -115,7 +130,7 @@ ext {
"retrofit-converter-scalars" : "com.squareup.retrofit2:converter-scalars:${version["retrofitSdkVersion"]}", "retrofit-converter-scalars" : "com.squareup.retrofit2:converter-scalars:${version["retrofitSdkVersion"]}",
"okhttp3" : "com.squareup.okhttp3:okhttp:3.12.3", "okhttp3" : "com.squareup.okhttp3:okhttp:3.12.3",
"okhttp4" : "com.squareup.okhttp3:okhttp:4.0.0", "okhttp4" : "com.squareup.okhttp3:okhttp:4.0.0",
"okhttp3-logging" : "com.squareup.okhttp3:logging-interceptor:3.8.0", "okhttp3-logging" : "com.squareup.okhttp3:logging-interceptor:3.12.2",
"okhttp-urlconnection" : "com.squareup.okhttp:okhttp-urlconnection:2.0.0", "okhttp-urlconnection" : "com.squareup.okhttp:okhttp-urlconnection:2.0.0",
"glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}", "glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}",
"glide-compiler" : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}", "glide-compiler" : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}",
...@@ -148,7 +163,7 @@ ext { ...@@ -148,7 +163,7 @@ ext {
"rxerrorhandler" : "me.jessyan:rxerrorhandler:1.0.1", "rxerrorhandler" : "me.jessyan:rxerrorhandler:1.0.1",
//rx2 //rx2
"rxandroid2" : "io.reactivex.rxjava2:rxandroid:2.0.1", "rxandroid2" : "io.reactivex.rxjava2:rxandroid:2.1.1",
"rxjava2" : "io.reactivex.rxjava2:rxjava:2.2.10", "rxjava2" : "io.reactivex.rxjava2:rxjava:2.2.10",
"rxlifecycle2" : "com.trello.rxlifecycle2:rxlifecycle:${version["rxlifecycle2SdkVersion"]}", "rxlifecycle2" : "com.trello.rxlifecycle2:rxlifecycle:${version["rxlifecycle2SdkVersion"]}",
"rxlifecycle2-android" : "com.trello.rxlifecycle2:rxlifecycle-android:${version["rxlifecycle2SdkVersion"]}", "rxlifecycle2-android" : "com.trello.rxlifecycle2:rxlifecycle-android:${version["rxlifecycle2SdkVersion"]}",
...@@ -166,7 +181,6 @@ ext { ...@@ -166,7 +181,6 @@ ext {
"androideventbus" : "org.simple:androideventbus:1.0.5.1", "androideventbus" : "org.simple:androideventbus:1.0.5.1",
"otto" : "com.squareup:otto:1.3.8", "otto" : "com.squareup:otto:1.3.8",
"gson" : "com.google.code.gson:gson:2.8.5", "gson" : "com.google.code.gson:gson:2.8.5",
"multidex" : "com.android.support:multidex:1.0.3",
"javax.annotation" : "javax.annotation:jsr250-api:1.0", "javax.annotation" : "javax.annotation:jsr250-api:1.0",
"arouter" : "com.alibaba:arouter-api:1.4.1", "arouter" : "com.alibaba:arouter-api:1.4.1",
"progressmanager" : "me.jessyan:progressmanager:1.5.0", "progressmanager" : "me.jessyan:progressmanager:1.5.0",
...@@ -226,10 +240,10 @@ ext { ...@@ -226,10 +240,10 @@ ext {
"imagepicker" : "com.ydl:imagepicker:1.0.6", "imagepicker" : "com.ydl:imagepicker:1.0.6",
"protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar", "protector" : "com.ydl:protector:1.0.1-SNAPSHOT@aar",
"ydl-hnet" : "com.ydl:h-net:0.0.8", "ydl-hnet" : "com.ydl:h-net:0.0.8",
"ydl-utils" : "com.ydl:ydl-utils:0.0.2",
"ydl-net" : "com.ydl:ydl-net:0.0.1",
"ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar", "ydl-user-router" : "com.ydl:router:1.0.0-SNAPSHOT@aar",
"ydl-device" : "com.ydl:device-id:0.0.7@aar", "ydl-device" : "com.ydl:device-id:0.0.7@aar",
"ydl-net" : "com.ydl:ydl-net:${ydlCompileVersion["ydl-net"]}",
"ydl-utils" : "com.ydl:ydl-utils:${ydlCompileVersion["ydl-utils"]}",
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块 //flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.12@aar", "ydl-flutter" : "com.ydl:ydl-flutter:0.0.12@aar",
......
...@@ -4,7 +4,6 @@ import android.app.Activity ...@@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import com.yidianling.router.RouterManager import com.yidianling.router.RouterManager
import com.yidianling.router.user.UserResponse
/** /**
* author : Zhangwenchao * author : Zhangwenchao
...@@ -17,8 +16,6 @@ object PhoneCallIn { ...@@ -17,8 +16,6 @@ object PhoneCallIn {
return RouterManager.getUserRouter()?.isLogin()?:false return RouterManager.getUserRouter()?.isLogin()?:false
} }
fun getUserInfo(): UserResponse.UserInfo? = RouterManager.getUserRouter()?.getUserInfo()
fun rechargeIntent(activity: Activity): Intent? { fun rechargeIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.rechargeIntent(activity) return RouterManager.getAppRouter()?.rechargeIntent(activity)
} }
......
...@@ -31,12 +31,24 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -31,12 +31,24 @@ class ConsultAssistantDialogUtils private constructor() {
* origin 展示请求来源 首页 home_index 咨询列表 doctor_list * origin 展示请求来源 首页 home_index 咨询列表 doctor_list
*/ */
fun fitRequest(activity: Activity, origin: String) { fun fitRequest(activity: Activity, origin: String) {
if (ConsultantIn.isLogin() && when (origin) {
ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1 "home_index" -> {
/** WalleChannelReader.getChannel(BaseApp.Companion.getApp()) == "android_huawei" */ if (ConsultantIn.isLogin() &&
) { ConsultantIn.getUserImpl().getUserInfo()?.user_type == 1
shouldShowDialog(activity, origin) /** 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() { ...@@ -101,7 +113,7 @@ class ConsultAssistantDialogUtils private constructor() {
expertSearchPageHasShown = true expertSearchPageHasShown = true
} }
} }
}, 10000) }, 5000)
} else { } else {
showDialog(activity) showDialog(activity)
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <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"/> <solid android:color="#F2faff"/>
<stroke <stroke
android:width="1dp" android:width="1dp"
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
<corners android:radius="@dimen/platform_dp_13" /> <corners android:radius="@dimen/platform_dp_13" />
<padding <padding
android:bottom="@dimen/platform_dp_3" android:bottom="@dimen/platform_dp_3"
android:left="@dimen/dp_10" android:left="@dimen/platform_dp_10"
android:right="@dimen/dp_10" android:right="@dimen/platform_dp_10"
android:top="@dimen/platform_dp_3" /> android:top="@dimen/platform_dp_3" />
<stroke android:color="#F0F0F0"/> <stroke android:color="#F0F0F0"/>
</shape> </shape>
\ No newline at end of file
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
android:id="@+id/img_activity" android:id="@+id/img_activity"
android:layout_width="42dp" android:layout_width="42dp"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_marginStart="@dimen/dp_4" android:layout_marginStart="@dimen/platform_dp_4"
android:visibility="gone"/> android:visibility="gone"/>
<!--公益图标--> <!--公益图标-->
<ImageView <ImageView
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
android:layout_marginLeft="@dimen/platform_dp_4" android:layout_marginLeft="@dimen/platform_dp_4"
android:scaleType="fitCenter" android:scaleType="fitCenter"
tools:background="@drawable/consultant_new_enter" tools:background="@drawable/consultant_new_enter"
android:layout_marginStart="@dimen/dp_4" /> android:layout_marginStart="@dimen/platform_dp_4" />
<!--优质图标--> <!--优质图标-->
<ImageView <ImageView
android:id="@+id/imgAbilityLevel" android:id="@+id/imgAbilityLevel"
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
android:orientation="vertical" android:orientation="vertical"
android:text="@string/platform_no_search_result" android:text="@string/platform_no_search_result"
android:textColor="@color/platform_text_gray" android:textColor="@color/platform_text_gray"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/platform_sp_14" />
<Button <Button
android:id="@+id/btnSearchByCat" android:id="@+id/btnSearchByCat"
......
...@@ -62,16 +62,10 @@ dependencies { ...@@ -62,16 +62,10 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
kapt 'com.alibaba:arouter-compiler:1.2.2' kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation 'com.jakewharton:butterknife:8.8.1'
api 'com.github.princekin-f:EasyFloat:1.1.2'
// api 'com.dou361.ijkplayer-armv5:jjdxm-ijkplayer-armv5:1.0.0'
// api 'com.dou361.ijkplayer-arm64:jjdxm-ijkplayer-arm64:1.0.0'
// api 'com.dou361.ijkplayer-x86:jjdxm-ijkplayer-x86:1.0.0'
// api 'com.dou361.ijkplayer-x86_64:jjdxm-ijkplayer-x86_64:1.0.0'
// api('com.dou361.ijkplayer:jjdxm-ijkplayer:1.0.6') {
// exclude group: 'com.android.support', module: 'appcompat-v7'
// }
api rootProject.ext.dependencies["ydl-user-router"] api rootProject.ext.dependencies["ydl-user-router"]
api rootProject.ext.dependencies["butterknife"]
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
//开发时使用 //开发时使用
implementation modularPublication('com.ydl:m-user-api') implementation modularPublication('com.ydl:m-user-api')
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yidianling.course"> xmlns:tools="http://schemas.android.com/tools"
package="com.yidianling.course">
<uses-sdk tools:overrideLibrary="com.lzf.easyfloat"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application> <application>
<!--课程首页--> <!--课程首页-->
<activity <activity
...@@ -42,6 +48,7 @@ ...@@ -42,6 +48,7 @@
android:name=".course_special_list.activity.CourseSpecialListActivity" android:name=".course_special_list.activity.CourseSpecialListActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<service android:name="com.lzf.easyfloat.service.FloatService" />
</application> </application>
</manifest> </manifest>
...@@ -68,26 +68,26 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface { ...@@ -68,26 +68,26 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
playView?.listener = object : HPlayStatusListener { playView?.listener = object : HPlayStatusListener {
override fun isCanPlay(data: Music?): Boolean { override fun isCanPlay(data: Music?): Boolean {
var canPlay = false var canPlay = false
//非试听 //非试听
if (courseExtra!!.isBuy) { if (courseExtra!!.isBuy) {
//已购买 //已购买
canPlay = true canPlay = true
} else { } else {
//未购买,判断是否是试听课程 //未购买,判断是否是试听课程
//即未购买,也不是试听,弹窗提示 //即未购买,也不是试听,弹窗提示
if (activity == null) return false if (activity == null) return false
CommonDialog(activity) CommonDialog(activity)
.setMessage("\n购买课程,获取完整课程内容\n") .setMessage("\n购买课程,获取完整课程内容\n")
.setLeftOnclick("放弃") { .setLeftOnclick("放弃") {
} }
.setRightClick("购买") { .setRightClick("购买") {
//跳转支付页 //跳转支付页
activity?.addCourseOrder() activity?.addCourseOrder()
} }
.setCancelAble(false) .setCancelAble(false)
.show() .show()
} }
return canPlay return canPlay
} }
...@@ -102,7 +102,12 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface { ...@@ -102,7 +102,12 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
/** /**
* 设置显示数据 * 设置显示数据
*/ */
override fun setData(index: Int, list: ArrayList<CourseMediaBean>, courseExtra: CourseExtraBean, from: Int) { override fun setData(
index: Int,
list: ArrayList<CourseMediaBean>,
courseExtra: CourseExtraBean,
from: Int
) {
if (list.isEmpty()) return if (list.isEmpty()) return
playList.clear() playList.clear()
...@@ -110,8 +115,6 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface { ...@@ -110,8 +115,6 @@ class CoursePlayItemViewAudio : RelativeLayout, PlayViewInterface {
this.courseExtra = courseExtra this.courseExtra = courseExtra
currentIndex = index currentIndex = index
// YDLMusicHelper.course_id = courseExtra.id.toInt()
if (courseExtra.isBuy) { if (courseExtra.isBuy) {
playView?.setAutoNext(true) playView?.setAutoNext(true)
} else { } else {
......
...@@ -208,9 +208,12 @@ class CourseSearchActivity : BaseActivity(), CourseSearchAdapter.OnItemClick, IC ...@@ -208,9 +208,12 @@ class CourseSearchActivity : BaseActivity(), CourseSearchAdapter.OnItemClick, IC
hideUnusualPage() hideUnusualPage()
if (type) { if (type) {
courseList.clear() courseList.clear()
courseList.addAll(it.data.list)
courseSearchAdapterWrapper!!.notifyDataSetChanged()
} else {
courseList.addAll(it.data.list)
courseSearchAdapterWrapper!!.insertData()
} }
courseList.addAll(it.data.list)
courseSearchAdapterWrapper!!.insertData()
} else { } else {
if (!type) { if (!type) {
courseSearchAdapterWrapper!!.noMoreData() courseSearchAdapterWrapper!!.noMoreData()
......
package com.yidianling.course.courseSearch.http package com.yidianling.course.courseSearch.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.BaseAPIResponse
import com.yidianling.course.courseSearch.CourseSearchBean import com.yidianling.course.courseSearch.CourseSearchBean
import io.reactivex.Observable import io.reactivex.Observable
...@@ -16,5 +18,6 @@ interface CourseSearchListApi{ ...@@ -16,5 +18,6 @@ interface CourseSearchListApi{
//专家课程搜索列表 //专家课程搜索列表
@GET("auth/course/getList") @GET("auth/course/getList")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun courseSearchList(@Query("page")page: Int, @Query("keyWord")keyWord: String): Observable<BaseAPIResponse<CourseSearchBean>> fun courseSearchList(@Query("page")page: Int, @Query("keyWord")keyWord: String): Observable<BaseAPIResponse<CourseSearchBean>>
} }
\ No newline at end of file
import android.app.AlertDialog
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Handler import android.os.Handler
import android.text.TextUtils import android.text.TextUtils
import com.example.fm_plugin.base.BaseFlutterFragment import com.example.fm_plugin.base.BaseFlutterFragment
import com.lzf.easyfloat.permission.PermissionUtils
import com.ydl.media.audio.AudioPlayer import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayTypeEnum import com.ydl.media.view.PlayTypeEnum
...@@ -16,13 +18,14 @@ import com.ydl.ydlcommon.data.PlatformDataManager ...@@ -16,13 +18,14 @@ import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.course.BuildConfig import com.yidianling.common.tools.ToastUtil
import com.yidianling.course.CourseConstants import com.yidianling.course.CourseConstants
import com.yidianling.course.bean.ScrollStatusChangeEvent import com.yidianling.course.bean.ScrollStatusChangeEvent
import com.yidianling.course.courseNew.mine.MyCourseActivity import com.yidianling.course.courseNew.mine.MyCourseActivity
import com.yidianling.course.course_special_list.activity.CourseSpecialListActivity import com.yidianling.course.course_special_list.activity.CourseSpecialListActivity
import com.yidianling.course.flutterPlugin.CourseSendPlugin import com.yidianling.course.flutterPlugin.CourseSendPlugin
import com.yidianling.course.router.CourseIn import com.yidianling.course.router.CourseIn
import com.yidianling.course.widget.VideoFloatHelper
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel import io.flutter.plugin.common.MethodChannel
...@@ -66,7 +69,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -66,7 +69,7 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser() val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
val mMap = mutableMapOf<String, Any>() val mMap = mutableMapOf<String, Any>()
var uid = loginBean?.userId ?: "" var uid = loginBean?.userId ?: ""
mMap["isDevelopment"] = BuildConfig.DEBUG mMap["isDevelopment"] = false
mMap["uid"] = if (TextUtils.isEmpty(uid)) "0" else uid mMap["uid"] = if (TextUtils.isEmpty(uid)) "0" else uid
mMap["accessToken"] = loginBean?.token ?: "" mMap["accessToken"] = loginBean?.token ?: ""
?: "" ?: ""
...@@ -92,11 +95,21 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -92,11 +95,21 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
return return
} }
when { when {
jumpUrl!!.contains("user/login") -> mFragment!!.startActivity( jumpUrl!!.contains("user/login") -> {
CourseIn.loginWayIntent( //TODO flutter 登录状态判断需要更改
mFragment!!.activity!! val loginBean =
) ModularServiceManager.getPlatformUserService()?.getUser()
) if (loginBean == null || TextUtils.isEmpty(loginBean.userId) || TextUtils.equals(
loginBean.userId,
"0"
)
) {
mFragment!!.startActivity(CourseIn.loginWayIntent(mFragment!!.activity!!))
} else {
MyCourseActivity.start(mFragment!!.activity)
}
}
jumpUrl.contains("course/myCourse") -> MyCourseActivity.start(mFragment!!.activity) jumpUrl.contains("course/myCourse") -> MyCourseActivity.start(mFragment!!.activity)
jumpUrl.contains("course/specialList") -> //跳转专题列表页 jumpUrl.contains("course/specialList") -> //跳转专题列表页
mFragment!!.activity!!.startActivity( mFragment!!.activity!!.startActivity(
...@@ -177,20 +190,29 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -177,20 +190,29 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
if (demoType == 1) { if (demoType == 1) {
music.path = url music.path = url
val hashMap = HashMap<String, String>()
hashMap["course_id"] = fileInfo["courseId"].toString()
AudioPlayer.get().singlePlay(music) AudioPlayer.get().singlePlay(music)
PlayerFloatHelper.show( PlayerFloatHelper.show(
mFragment!!.activity, mFragment!!.activity,
playTypeEnum = PlayTypeEnum.PLAY_TYPE_COURSE playTypeEnum = PlayTypeEnum.PLAY_TYPE_COURSE,
playData = hashMap
) )
VideoFloatHelper.dismissFloat(mFragment!!.activity)
} }
if (demoType == 2) { if (demoType == 2) {
//todo 视屏播放 VideoFloatHelper.setVideoInfo(
// YDLMusicHelper.playType = 1 fileInfo["courseId"].toString(),
// YDLMusicHelper.courseVideoUlr = url fileInfo["url"].toString(),
// false
// PlayerFloatHelper.show(mFragment!!.activity) )
checkPermission()
if (PlayerFloatHelper.isShow(mFragment!!.activity!!)) {
PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mFragment!!.activity!!)
AudioPlayer.get().stopPlayer()
}
} }
Handler().postDelayed({ CourseSendPlugin.sendMsg(true) }, 300) Handler().postDelayed({ CourseSendPlugin.sendMsg(true) }, 300)
...@@ -215,4 +237,28 @@ class CoursePlugin : MethodChannel.MethodCallHandler { ...@@ -215,4 +237,28 @@ class CoursePlugin : MethodChannel.MethodCallHandler {
} }
}) })
} }
/**
* 检测浮窗权限是否开启,若没有给与申请提示框(非必须,申请依旧是EasyFloat内部内保进行)
*/
private fun checkPermission() {
if (PermissionUtils.checkPermission(mFragment!!.activity)) {
VideoFloatHelper.showVideoFloat(mFragment!!.activity)
} else {
AlertDialog.Builder(mFragment!!.activity)
.setMessage("使用浮窗功能,需要您授权悬浮窗权限。")
.setPositiveButton("去开启") { _, _ ->
VideoFloatHelper.showVideoFloat(mFragment!!.activity)
}
.setNegativeButton("取消") { _, _ ->
ToastUtil.toastLong(
mFragment!!.activity,
"App正常工作需要内部存储使用权限,请开启"
)
}
.show()
}
}
} }
\ No newline at end of file
package com.yidianling.course.lifeCallback
import android.app.Activity
import android.app.Application
import android.os.Bundle
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayTypeEnum
import com.ydl.media.view.PlayerFloatHelper
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/11/19
*/
class CoursePlayLifecycle : Application.ActivityLifecycleCallbacks {
override fun onActivityPaused(activity: Activity?) {
}
override fun onActivityResumed(activity: Activity?) {
if (!PlayerFloatHelper.isCanClick) {
PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(activity!!)
AudioPlayer.get().stopPlayer()
} else {
PlayerFloatHelper.showIfPlaying(activity!!)
PlayerFloatHelper.playingType = PlayTypeEnum.PLAY_TYPE_COURSE
}
}
override fun onActivityStarted(activity: Activity?) {
}
override fun onActivityDestroyed(activity: Activity?) {
}
override fun onActivitySaveInstanceState(activity: Activity?, outState: Bundle?) {
}
override fun onActivityStopped(activity: Activity?) {
}
override fun onActivityCreated(activity: Activity?, savedInstanceState: Bundle?) {
}
}
\ No newline at end of file
...@@ -4,7 +4,6 @@ import android.app.Activity ...@@ -4,7 +4,6 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager import com.yidianling.router.RouterManager
import com.yidianling.router.user.UserResponse
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
/** /**
...@@ -18,10 +17,6 @@ object CourseIn { ...@@ -18,10 +17,6 @@ object CourseIn {
return ModularServiceManager.provide(IUserService::class.java).isLogin() return ModularServiceManager.provide(IUserService::class.java).isLogin()
} }
fun getUserInfo(): UserResponse.UserInfo? {
return RouterManager.getUserRouter()?.getUserInfo()
}
fun loginWayIntent(activity: Activity): Intent? { fun loginWayIntent(activity: Activity): Intent? {
return ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity) return ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
} }
......
package com.yidianling.course.uitls
import android.content.Context
import android.text.TextUtils
/**
* 工具类
* Created by hgw on 2018/3/31.
*/
object VideoProgressUtil {
/**
* 保存播放进度
*/
fun saveProgress(context: Context?, url: String?, progress: Int) {
if (TextUtils.isEmpty(url)) return
val shared = context?.getSharedPreferences("COURSE_VIDEO_PROGRESS", Context.MODE_PRIVATE)
val edit = shared?.edit()
edit?.putInt(url, progress)
edit?.apply()
}
/**
* 获取进度
*/
fun getProgress(context: Context?, url: String?): Int {
if (TextUtils.isEmpty(url)) return 0
val shared = context?.getSharedPreferences("COURSE_VIDEO_PROGRESS", Context.MODE_PRIVATE)
return shared?.getInt(url, 0) ?: 0
}
}
\ No newline at end of file
package com.yidianling.course.widget package com.yidianling.course.widget
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity
import android.app.AlertDialog
import android.content.Context import android.content.Context
import android.graphics.Paint import android.graphics.Paint
import android.support.constraint.ConstraintLayout import android.support.constraint.ConstraintLayout
...@@ -8,6 +10,7 @@ import android.text.TextUtils ...@@ -8,6 +10,7 @@ import android.text.TextUtils
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.lzf.easyfloat.permission.PermissionUtils
import com.ydl.media.audio.AudioPlayer import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayTypeEnum import com.ydl.media.view.PlayTypeEnum
...@@ -19,6 +22,7 @@ import com.ydl.ydl_image.module.GlideApp ...@@ -19,6 +22,7 @@ import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.actionutil.BIConstants import com.ydl.ydlcommon.utils.actionutil.BIConstants
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.course.CourseConstants import com.yidianling.course.CourseConstants
import com.yidianling.course.R import com.yidianling.course.R
import com.yidianling.course.bean.Course import com.yidianling.course.bean.Course
...@@ -228,14 +232,30 @@ class CourseItemNewView : ConstraintLayout { ...@@ -228,14 +232,30 @@ class CourseItemNewView : ConstraintLayout {
PlayerFloatHelper.playingType=PlayTypeEnum.PLAY_TYPE_COURSE PlayerFloatHelper.playingType=PlayTypeEnum.PLAY_TYPE_COURSE
music.path=course.demoFile music.path=course.demoFile
val hashMap = HashMap<String, String>()
hashMap["course_id"] =course.id.toString()
AudioPlayer.get().singlePlay(music) AudioPlayer.get().singlePlay(music)
PlayerFloatHelper.show(
mContext,
playTypeEnum = PlayTypeEnum.PLAY_TYPE_COURSE,
playData = hashMap
)
VideoFloatHelper.dismissFloat(mContext as Activity)
} }
if (course.demoType == 2) { if (course.demoType == 2) {
//todo 视屏播放 VideoFloatHelper.setVideoInfo(
// YDLMusicHelper.playType = 1 course.id.toString(),
// YDLMusicHelper.courseVideoUlr = course.demoFile course.demoFile,
// false
// PlayerFloatHelper.show(mContext) )
checkPermission()
if (PlayerFloatHelper.isShow(mContext)) {
PlayerFloatHelper.hide()
PlayerFloatHelper.removeView(mContext)
AudioPlayer.get().stopPlayer()
}
} }
...@@ -269,4 +289,27 @@ class CourseItemNewView : ConstraintLayout { ...@@ -269,4 +289,27 @@ class CourseItemNewView : ConstraintLayout {
fun hideListenerButton() { fun hideListenerButton() {
tv_view_course.visibility = View.GONE tv_view_course.visibility = View.GONE
} }
/**
* 检测浮窗权限是否开启,若没有给与申请提示框(非必须,申请依旧是EasyFloat内部内保进行)
*/
private fun checkPermission() {
if (PermissionUtils.checkPermission(mContext)) {
VideoFloatHelper.showVideoFloat(mContext as Activity)
} else {
AlertDialog.Builder(mContext)
.setMessage("使用浮窗功能,需要您授权悬浮窗权限。")
.setPositiveButton("去开启") { _, _ ->
VideoFloatHelper.showVideoFloat(mContext as Activity)
}
.setNegativeButton("取消") { _, _ ->
ToastUtil.toastLong(
mContext,
"App正常工作需要内部存储使用权限,请开启"
)
}
.show()
}
}
} }
\ No newline at end of file
package com.yidianling.course.widget package com.yidianling.course.widget
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.os.Handler import android.os.Handler
import android.view.View import android.view.View
...@@ -36,8 +37,8 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -36,8 +37,8 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
fun init() { fun init() {
if (mContext == null) return if (mContext == null) return
View.inflate(context, R.layout.course_play_music_view, this) View.inflate(context, R.layout.course_play_music_view, this)
AudioPlayer.get().addOnPlayEventListener(this)
play_icon.setOnClickListener { play_icon.setOnClickListener {
AudioPlayer.get().playPause() AudioPlayer.get().playPause()
...@@ -48,8 +49,6 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -48,8 +49,6 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
} }
} }
AudioPlayer.get().addOnPlayEventListener(this)
pro_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { pro_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) { override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
if (p2) { if (p2) {
...@@ -114,9 +113,9 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -114,9 +113,9 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
} }
fun play(index: Int) { fun play(index: Int) {
updateButton() PlayerFloatHelper.playingType = PlayTypeEnum.PLAY_TYPE_COURSE
PlayerFloatHelper.playingType=PlayTypeEnum.PLAY_TYPE_COURSE
AudioPlayer.get().play(index) AudioPlayer.get().play(index)
updateButton()
} }
fun setImageBackground(url: String?) { fun setImageBackground(url: String?) {
...@@ -127,14 +126,23 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -127,14 +126,23 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
* 设置自动播放下一曲 * 设置自动播放下一曲
*/ */
fun setAutoNext(auto: Boolean) { fun setAutoNext(auto: Boolean) {
if(!auto){ if (!auto) {
AudioPlayer.get().playMode=PlayModeEnum.SINGLE AudioPlayer.get().playMode = PlayModeEnum.SINGLE
} else {
AudioPlayer.get().playMode = PlayModeEnum.LIST_LOOP
} }
} }
@SuppressLint("SetTextI18n")
override fun onChange(music: Music) { override fun onChange(music: Music) {
if (mContext != null) {
Glide.with(mContext).asGif().load(R.drawable.course_loading5).into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_play)
pro_progress.progress = 0
text_start_time.text = "00:00"
} }
override fun onPlayerStart() { override fun onPlayerStart() {
...@@ -142,21 +150,18 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -142,21 +150,18 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
} }
override fun onPlayerPause() { override fun onPlayerPause() {
if (AudioPlayer.get().isPlaying){ if (AudioPlayer.get().isPlaying) {
setGifVisibity(true) setGifVisibity(true)
}else{ } else {
setGifVisibity(false) setGifVisibity(false)
} }
} }
override fun onPublish(percent: Int, currentPosition: Long) { override fun onPublish(percent: Int, currentPosition: Long) {
mHandler?.postDelayed({ if (!seekBarIsDown) {
//拖动seekbar时不进行以下操作 pro_progress.progress = currentPosition.toInt()
if (!seekBarIsDown) { text_start_time.text = getStringTime(currentPosition.toInt())
pro_progress.progress = progress }
text_start_time.text = getStringTime(progress)
}
}, 0)
} }
override fun onBufferingUpdate(percent: Int) { override fun onBufferingUpdate(percent: Int) {
...@@ -170,7 +175,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -170,7 +175,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
mHandler?.postDelayed({ mHandler?.postDelayed({
pro_progress.max = duration.toInt() pro_progress.max = duration.toInt()
text_end_time.text = getStringTime(pro_progress.max) text_end_time.text = getStringTime(pro_progress.max)
var index=AudioPlayer.get().getMusicList()?.indexOf(AudioPlayer.get().playMusic)?:0 var index = AudioPlayer.get().getMusicList()?.indexOf(AudioPlayer.get().playMusic) ?: 0
listener?.onPrepared( listener?.onPrepared(
AudioPlayer.get().playMusic, index AudioPlayer.get().playMusic, index
) )
...@@ -186,11 +191,12 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -186,11 +191,12 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
private fun showBufferLoading(show: Boolean) { private fun showBufferLoading(show: Boolean) {
mHandler?.postDelayed({ mHandler?.postDelayed({
if (show) { if (show) {
if (mContext != null) { if (!AudioPlayer.get().isPlaying) {
Glide.with(mContext).asGif().load(R.drawable.course_loading5).into(img_gif) if (mContext != null) {
Glide.with(mContext).asGif().load(R.drawable.course_loading5).into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_play)
} }
play_icon.setImageResource(R.drawable.course_ico_course_play)
} else { } else {
if (mContext != null) { if (mContext != null) {
Glide.with(mContext).asGif().load(R.drawable.course_audio_play).into(img_gif) Glide.with(mContext).asGif().load(R.drawable.course_audio_play).into(img_gif)
...@@ -202,17 +208,14 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -202,17 +208,14 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
//显示或隐藏播放动画 //显示或隐藏播放动画
private fun setGifVisibity(show: Boolean) { private fun setGifVisibity(show: Boolean) {
if (context == null) return if (mContext == null) return
mHandler?.postDelayed({ mHandler?.postDelayed({
if (show) { if (show) {
if (mContext != null) { Glide.with(mContext).asGif().load(R.drawable.course_audio_play).into(img_gif)
Glide.with(mContext).asGif().load(R.drawable.course_audio_play).into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_pause) play_icon.setImageResource(R.drawable.course_ico_course_pause)
} else { } else {
if (mContext != null) { Glide.with(mContext).asBitmap().load(R.drawable.course_ico_course_bg_pause)
Glide.with(mContext).asBitmap().load(R.drawable.course_ico_course_bg_pause).into(img_gif) .into(img_gif)
}
play_icon.setImageResource(R.drawable.course_ico_course_play) play_icon.setImageResource(R.drawable.course_ico_course_play)
} }
}, 0) }, 0)
...@@ -225,7 +228,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener { ...@@ -225,7 +228,7 @@ class HPlayView : RelativeLayout, OnPlayerEventListener {
if (AudioPlayer.get().isPlaying) { if (AudioPlayer.get().isPlaying) {
setGifVisibity(true) setGifVisibity(true)
} }
}, 0) }, 300)
} }
......
package com.yidianling.course.widget
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.View
import android.widget.ImageView
import com.alibaba.android.arouter.launcher.ARouter
import com.dou361.ijkplayer.widget.PlayStateParams
import com.dou361.ijkplayer.widget.PlayerView
import com.lzf.easyfloat.EasyFloat
import com.lzf.easyfloat.enums.ShowPattern
import com.lzf.easyfloat.interfaces.OnInvokeView
import com.ydl.media.audio.utils.PlayProgressUtil
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.course.R
import com.yidianling.course.coursePlay.CoursePlayActivity
import com.yidianling.course.flutterPlugin.CourseSendPlugin
import com.yidianling.course.uitls.VideoProgressUtil
import java.util.*
/**
* @author jiucheng
* @描述:视频悬浮窗
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/11/19
*/
object VideoFloatHelper {
private const val courseTag = "course_video_play"
var courseVideoUrl = ""
var courseId = ""
var isCanClick = true
var isCurrentVideoPlaying = true
//视频播放器view
@SuppressLint("StaticFieldLeak")
private var videoView: PlayerView? = null
private var timer: Timer? = null
var defaultShowPattern = ShowPattern.CURRENT_ACTIVITY
fun setVideoInfo(
courseId: String,
courseVideoUrl: String,
isCanClick: Boolean
): VideoFloatHelper {
this.courseId = courseId
this.courseVideoUrl = courseVideoUrl
this.isCanClick = isCanClick
return this
}
fun showVideoFloat(activity: Activity) {
val x = RxDeviceTool.getScreenWidth(activity) - RxImageTool.dp2px(220f)
val y = RxDeviceTool.getScreenHeight(activity) * 3 / 4
EasyFloat.with(activity)
.setTag(courseTag)
.setShowPattern(defaultShowPattern)
.setLocation(x, y)
.setAppFloatAnimator(null)
.setFilter(CoursePlayActivity::class.java)
.setLayout(R.layout.course_float_video_view, OnInvokeView {
it.findViewById<ImageView>(R.id.iv_video_close).setOnClickListener {
dismissFloat(activity)
}
val videoFullScreen = it.findViewById<ImageView>(R.id.iv_video_full_screen)
if (isCanClick) {
videoFullScreen.visibility = View.VISIBLE
} else {
videoFullScreen.visibility = View.INVISIBLE
}
videoFullScreen.setOnClickListener {
if (isCanClick) {
startCoursePlayActivity(activity, 1, 1, courseVideoUrl, true)
}
}
val videoLayout = it.findViewById<ImageView>(R.id.app_video_box)
try {
initVideoPlayer(activity, videoLayout)
} catch (e: Exception) {
e.printStackTrace()
}
})
.show()
}
private fun initVideoPlayer(activity: Activity, view: View) {
val url = courseVideoUrl.replace("https", "http")
val hisTime = PlayProgressUtil.getProgress(activity, url)
videoView = PlayerView(activity, view)
.setScaleType(PlayStateParams.fitparent)
.hideAllUI()
.setNetWorkTypeTie(false)
.setAutoReConnect(true, 3)
.forbidTouch(true)
.setOnInfoListener { _, what, _ ->
if (what == PlayStateParams.STATE_COMPLETED) {
isCurrentVideoPlaying = false
PlayProgressUtil.saveProgress(activity, url, 0)
} else {
isCurrentVideoPlaying = true
}
true
}
.setPlaySource(url)
.startPlay()
.seekTo(hisTime)
view.setOnClickListener {
if (isCanClick) {
startCoursePlayActivity(activity, 1, 0, courseVideoUrl, true)
}
}
startTimer(url, activity)
}
private fun startTimer(url: String, activity: Activity) {
if (timer == null) {
timer = Timer()
}
timer?.schedule(object : TimerTask() {
override fun run() {
if (isCurrentVideoPlaying) {
var time = videoView?.currentPosition ?: 0
if (time < 3000) return
PlayProgressUtil.saveProgress(activity, url, time)
}
}
}, 1000, 1000)
}
private fun startCoursePlayActivity(
context: Context?,
from: Int,
fullScreen: Int,
coursePlayUrl: String,
isFromFloatView: Boolean
) {
ARouter.getInstance()
.build("/course/play")
.withInt("course_id", courseId.toInt())
.withInt("course_type", 1)
.withString("coursePlayUrl", coursePlayUrl)
.withInt("from", from)
.withBoolean("isFromFloatView", isFromFloatView)
.withInt("fullScreen", fullScreen)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.navigation()
}
fun dismissFloat(activity: Activity) {
CourseSendPlugin.sendMsg(false)
EasyFloat.dismissAppFloat(activity, courseTag)
if (videoView != null) {
videoView!!.stopPlay()
videoView = null
}
if (timer != null) {
timer!!.cancel()
}
timer = null
}
}
\ No newline at end of file
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
android:layout_marginTop="9dp" android:layout_marginTop="9dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/platform_dp_10"
android:padding="5dp" android:padding="5dp"
android:src="@drawable/course_confideredpacket_close" android:src="@drawable/course_confideredpacket_close"
tools:ignore="OnClick" /> tools:ignore="OnClick" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_video_layout"
android:layout_width="200dp"
android:layout_height="124dp"
android:background="@drawable/play_float_background"
android:visibility="visible">
<include
layout="@layout/course_videoplay_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/iv_video_close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:padding="8dp"
android:scaleType="centerCrop"
android:src="@drawable/ico_play_float_pause"
android:visibility="visible" />
<ImageView
android:id="@+id/iv_video_full_screen"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:padding="8dp"
android:scaleType="centerCrop"
android:src="@drawable/course_ico_play_float_full"
android:visibility="visible" />
</RelativeLayout>
\ No newline at end of file
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
android:layout_weight="1" android:layout_weight="1"
android:text="" android:text=""
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="@dimen/dp_10" /> android:textSize="@dimen/platform_dp_10" />
<TextView <TextView
android:id="@+id/tv_allTime" android:id="@+id/tv_allTime"
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
android:layout_weight="1" android:layout_weight="1"
android:text="" android:text=""
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="@dimen/dp_10" /> android:textSize="@dimen/platform_dp_10" />
<SeekBar <SeekBar
android:id="@+id/fm_progress" android:id="@+id/fm_progress"
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/platform_color_333333" android:textColor="@color/platform_color_333333"
android:textSize="@dimen/sp_16" android:textSize="@dimen/platform_sp_16"
android:textStyle="bold" android:textStyle="bold"
tools:text="你的心理足够成熟么你的心理足够成熟么" tools:text="你的心理足够成熟么你的心理足够成熟么"
/> />
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
android:layout_marginRight="146dp" android:layout_marginRight="146dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textSize="@dimen/sp_16" android:textSize="@dimen/platform_sp_16"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/platform_color_333333" android:textColor="@color/platform_color_333333"
tools:text="你的心理足够成熟么你的心理足够成熟么"/> tools:text="你的心理足够成熟么你的心理足够成熟么"/>
......
...@@ -24,7 +24,7 @@ modular { ...@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-user-api" artifactId = "m-user-api"
//开发时注释掉版本号,发布api时打开 //开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] //version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
......
...@@ -79,9 +79,6 @@ ...@@ -79,9 +79,6 @@
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<!--<meta-data-->
<!--android:name="com.yidianling.user.base.UserGlobalConfig"-->
<!--android:value="ModuleConfig"/>-->
<activity <activity
android:name=".wxapi.WXEntryActivity" android:name=".wxapi.WXEntryActivity"
android:exported="true" android:exported="true"
......
...@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse ...@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView 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 com.yidianling.user.http.request.LoginParam
import io.reactivex.Observable import io.reactivex.Observable
...@@ -19,7 +19,7 @@ interface LoginContract { ...@@ -19,7 +19,7 @@ interface LoginContract {
// 开始登录 // 开始登录
fun startLogin() fun startLogin()
// 登录成功 // 登录成功
fun loginSuccess(userInfo: UserResponse?) fun loginSuccess(userInfo: UserResponseBean?)
// 登录失败 // 登录失败
fun loginFail(msg: String) fun loginFail(msg: String)
// 登录完成 // 登录完成
...@@ -29,7 +29,7 @@ interface LoginContract { ...@@ -29,7 +29,7 @@ interface LoginContract {
} }
interface Model: IModel { interface Model: IModel {
fun login(param: LoginParam): Observable<BaseResponse<UserResponse>> fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>>
} }
interface Presenter: IPresenter<View> { interface Presenter: IPresenter<View> {
......
...@@ -6,7 +6,7 @@ import com.ydl.ydlcommon.data.http.ThrowableConsumer; ...@@ -6,7 +6,7 @@ import com.ydl.ydlcommon.data.http.ThrowableConsumer;
import com.ydl.ydlcommon.utils.BuryPointUtils; import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.ydl.ydlcommon.utils.JPushUtils; import com.ydl.ydlcommon.utils.JPushUtils;
import com.ydl.ydlcommon.utils.log.LogHelper; 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.api.event.UserLoginEvent;
import com.yidianling.user.http.UserHttp; import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl; import com.yidianling.user.http.UserHttpImpl;
...@@ -48,7 +48,7 @@ public class LoginHelper { ...@@ -48,7 +48,7 @@ public class LoginHelper {
} }
} }
public static void login(UserResponse response) { public static void login(UserResponseBean response) {
UserHelper.INSTANCE.setUserinfo(response); UserHelper.INSTANCE.setUserinfo(response);
EventBus.getDefault().post(new UserLoginEvent("login",response.getUid())); EventBus.getDefault().post(new UserLoginEvent("login",response.getUid()));
......
package com.yidianling.user package com.yidianling.user
import com.ydl.ydlcommon.data.http.BaseResponse 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.UserHttp
import com.yidianling.user.http.UserHttpImpl import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.LoginParam import com.yidianling.user.http.request.LoginParam
...@@ -14,7 +14,7 @@ import io.reactivex.Observable ...@@ -14,7 +14,7 @@ import io.reactivex.Observable
*/ */
class LoginModel: LoginContract.Model { 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() val userHttp: UserHttp = UserHttpImpl.getInstance()
return userHttp.login(param) return userHttp.login(param)
} }
......
...@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.mvp.base.BasePresenter ...@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.router.im.IMLoginInfo import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback 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.http.request.LoginParam
import com.yidianling.user.route.UserIn import com.yidianling.user.route.UserIn
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
...@@ -64,7 +64,7 @@ class LoginPresenter(view: LoginContract.View): BasePresenter<LoginContract.View ...@@ -64,7 +64,7 @@ class LoginPresenter(view: LoginContract.View): BasePresenter<LoginContract.View
}) })
} }
private fun setHXInfo(userInfo: UserResponse?) { private fun setHXInfo(userInfo: UserResponseBean?) {
try { try {
if (userInfo != null) { if (userInfo != null) {
UserIn.imSetAccount(userInfo.uid.toString()) UserIn.imSetAccount(userInfo.uid.toString())
......
...@@ -2,22 +2,17 @@ package com.yidianling.user ...@@ -2,22 +2,17 @@ package com.yidianling.user
import com.tencent.bugly.crashreport.CrashReport import com.tencent.bugly.crashreport.CrashReport
import com.ydl.ydlcommon.data.http.RxUtils 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.BuryPointUtils
import com.ydl.ydlcommon.utils.JPushUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.router.im.IMLoginInfo import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback 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.api.event.UserLoginEvent
import com.yidianling.user.http.UserHttpImpl import com.yidianling.user.http.UserHttpImpl
import com.yidianling.user.http.request.ChannelIdParam
import com.yidianling.user.http.request.Logout import com.yidianling.user.http.request.Logout
import com.yidianling.user.route.UserIn import com.yidianling.user.route.UserIn
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
/** /**
...@@ -28,12 +23,12 @@ import io.reactivex.functions.Consumer ...@@ -28,12 +23,12 @@ import io.reactivex.functions.Consumer
object LoginUtils { object LoginUtils {
@JvmStatic @JvmStatic
fun saveData(userInfo: UserResponse?) { fun saveData(userInfo: UserResponseBean?) {
UserHelper.setUserinfo(userInfo) UserHelper.setUserinfo(userInfo)
} }
@JvmStatic @JvmStatic
fun onLogin(userInfo: UserResponse?) { fun onLogin(userInfo: UserResponseBean?) {
//设置异常用户ID //设置异常用户ID
CrashReport.setUserId(userInfo?.uid) CrashReport.setUserId(userInfo?.uid)
//登录IM聊天 //登录IM聊天
...@@ -43,22 +38,22 @@ object LoginUtils { ...@@ -43,22 +38,22 @@ object LoginUtils {
val loginEvent = UserLoginEvent("login", userInfo?.uid!!) val loginEvent = UserLoginEvent("login", userInfo?.uid!!)
EventBus.getDefault().post(loginEvent) EventBus.getDefault().post(loginEvent)
BuryPointUtils.bindUid(userInfo?.uid ?: "") BuryPointUtils.bindUid(userInfo?.uid ?: "")
val channelId = JPushUtils.getRegistrationID() // val channelId = JPushUtils.getRegistrationID()
UserHttpImpl.getInstance().channelId(ChannelIdParam(channelId)) // UserHttpImpl.getInstance().channelId(ChannelIdParam(channelId))
.compose(RxUtils.resultData()) // .compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread()) // .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { // .subscribe(Consumer {
if (it["upload_log"] == "1") { // if (it["upload_log"] == "1") {
LogHelper.getInstance().uploadLog(false) // LogHelper.getInstance().uploadLog(false)
} // }
}, object : ThrowableConsumer() { // }, object : ThrowableConsumer() {
override fun accept(msg: String) { // override fun accept(msg: String) {
// ToastHelper.show(msg) // // ToastHelper.show(msg)
} // }
}) // })
} }
private fun loginIm(userInfo: UserResponse?) { private fun loginIm(userInfo: UserResponseBean?) {
val info = IMLoginInfo(userInfo?.uid ?: "", userInfo?.hxpwd ?: "") val info = IMLoginInfo(userInfo?.uid ?: "", userInfo?.hxpwd ?: "")
val callback = object : IMRequestCallback<IMLoginInfo> { val callback = object : IMRequestCallback<IMLoginInfo> {
override fun onSuccess(t: IMLoginInfo?) { override fun onSuccess(t: IMLoginInfo?) {
......
...@@ -5,8 +5,8 @@ import com.google.gson.Gson ...@@ -5,8 +5,8 @@ import com.google.gson.Gson
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.UserInfoCache import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.YdlBuryPointUtil import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.yidianling.router.user.UserResponse import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.router.user.UserSetting import com.yidianling.user.api.bean.UserSettingBean
/** /**
* 用户信息辅助类 * 用户信息辅助类
...@@ -24,13 +24,13 @@ object UserHelper { ...@@ -24,13 +24,13 @@ object UserHelper {
private val user_setting_key_sp = "ydl_user_setting_key" 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 { try {
userTemp = userInfo userTemp = userInfo
var str = gson.toJson(userTemp) var str = gson.toJson(userTemp)
...@@ -46,24 +46,33 @@ object UserHelper { ...@@ -46,24 +46,33 @@ object UserHelper {
} }
//获取用户设置信息 //获取用户设置信息
fun getUserInfo(): UserResponse? { fun getUserInfo(): UserResponseBean? {
if (userTemp != null) return userTemp!! if (userTemp != null) return userTemp!!
try { try {
var obj = SharedPreferencesEditor.getFileString(user_info_name_sp, user_info_key_sp) 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 userTemp = app
return userTemp!! return userTemp!!
} catch (e: Exception) { } catch (e: Exception) {
userTemp = UserResponse() userTemp = UserResponseBean()
} }
return userTemp 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) {
return ""
}
}
fun updateUserinfo(userInfo: UserResponseBean.UserInfo?) {
getUserInfo()?.userInfo = userInfo getUserInfo()?.userInfo = userInfo
} }
fun updateUserSetting(userseting: UserSetting?) { fun updateUserSetting(userseting: UserSettingBean?) {
setUserSetting(userseting) setUserSetting(userseting)
} }
...@@ -96,7 +105,7 @@ object UserHelper { ...@@ -96,7 +105,7 @@ object UserHelper {
/** /**
* 存储用户设置信息 * 存储用户设置信息
*/ */
fun setUserSetting(userseting: UserSetting?) { fun setUserSetting(userseting: UserSettingBean?) {
try { try {
userSetting = userseting userSetting = userseting
var str = gson.toJson(userSetting) var str = gson.toJson(userSetting)
...@@ -109,18 +118,27 @@ object UserHelper { ...@@ -109,18 +118,27 @@ object UserHelper {
/** /**
* 获取用户设置信息 * 获取用户设置信息
*/ */
fun getUsetSetting(): UserSetting? { fun getUsetSetting(): UserSettingBean? {
if (userSetting != null) return userSetting!! if (userSetting != null) return userSetting!!
try { try {
var obj = SharedPreferencesEditor.getFileString(user_setting_name_sp, user_setting_key_sp) var obj = SharedPreferencesEditor.getFileString(user_setting_name_sp, user_setting_key_sp)
if (TextUtils.isEmpty(obj)) { 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 userSetting = app
return userSetting return userSetting
} catch (e: Exception) { } catch (e: Exception) {
} }
return userSetting 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) {
return ""
}
}
} }
\ 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 ...@@ -3,7 +3,7 @@ package com.yidianling.user.http
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils 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.request.*
import com.yidianling.user.http.response.ChcekPhoneResponeBean import com.yidianling.user.http.response.ChcekPhoneResponeBean
import com.yidianling.user.http.response.PhoneAuthResponseBean import com.yidianling.user.http.response.PhoneAuthResponseBean
...@@ -48,7 +48,7 @@ class LoginApiRequestUtil { ...@@ -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) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().autoLogin(body) return getUserApi().autoLogin(body)
...@@ -57,7 +57,7 @@ class LoginApiRequestUtil { ...@@ -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) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().loginByPassword(body) return getUserApi().loginByPassword(body)
...@@ -66,7 +66,7 @@ class LoginApiRequestUtil { ...@@ -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) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().resetPwd(body) return getUserApi().resetPwd(body)
...@@ -82,7 +82,7 @@ class LoginApiRequestUtil { ...@@ -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) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().loginByMsgCode(body) return getUserApi().loginByMsgCode(body)
......
...@@ -6,7 +6,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN ...@@ -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.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse 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 com.yidianling.user.http.response.*
import io.reactivex.Observable import io.reactivex.Observable
import okhttp3.RequestBody import okhttp3.RequestBody
...@@ -22,7 +22,7 @@ interface UserApi { ...@@ -22,7 +22,7 @@ interface UserApi {
//登录 //登录
@FormUrlEncoded @FormUrlEncoded
@POST("user/user") @POST("user/user")
fun login(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponse>> fun login(@FieldMap params: Map<String, String>): Observable<BaseResponse<UserResponseBean>>
//国家列表 //国家列表
@FormUrlEncoded @FormUrlEncoded
...@@ -42,7 +42,7 @@ interface UserApi { ...@@ -42,7 +42,7 @@ interface UserApi {
//绑定手机号 //绑定手机号
@FormUrlEncoded @FormUrlEncoded
@POST("user/bind-phone") @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 @FormUrlEncoded
...@@ -62,7 +62,7 @@ interface UserApi { ...@@ -62,7 +62,7 @@ interface UserApi {
//第三方登录 //第三方登录
@POST("user/user_q_w") @POST("user/user_q_w")
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponse>> fun thirdPartyLogin(@Body body: RequestBody): Observable<BaseAPIResponse<UserResponseBean>>
//设置用户信息 //设置用户信息
@FormUrlEncoded @FormUrlEncoded
...@@ -126,17 +126,17 @@ interface UserApi { ...@@ -126,17 +126,17 @@ interface UserApi {
//一键登录 //一键登录
@POST("user/login_direct") @POST("user/login_direct")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA) @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") @POST("user/login_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA) @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") @POST("user/reset_pwd")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA) @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") @GET("user/precheck_reset_sms")
...@@ -161,12 +161,12 @@ interface UserApi { ...@@ -161,12 +161,12 @@ interface UserApi {
//验证码登录 //验证码登录
@POST("user/login_sms") @POST("user/login_sms")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA) @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") @POST("user/user_q_w")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA) @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 ...@@ -5,7 +5,7 @@ import com.google.gson.internal.LinkedTreeMap
import com.umeng.socialize.bean.SHARE_MEDIA import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse 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.bean.CheckPhonePassBean
import com.yidianling.user.http.request.* import com.yidianling.user.http.request.*
import com.yidianling.user.http.response.CheckPassword import com.yidianling.user.http.response.CheckPassword
...@@ -20,7 +20,7 @@ import io.reactivex.Observable ...@@ -20,7 +20,7 @@ import io.reactivex.Observable
*/ */
interface UserHttp { interface UserHttp {
fun login(param: LoginParam): Observable<BaseResponse<UserResponse>> fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>>
fun countryList(): Observable<BaseResponse<CountryResponse>> fun countryList(): Observable<BaseResponse<CountryResponse>>
...@@ -28,7 +28,7 @@ interface UserHttp { ...@@ -28,7 +28,7 @@ interface UserHttp {
fun code(param: CodeParam): Observable<BaseResponse<Any>> 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>> fun forget(param: ForgetParam): Observable<BaseResponse<Any>>
...@@ -36,7 +36,7 @@ interface UserHttp { ...@@ -36,7 +36,7 @@ interface UserHttp {
fun channelId(param: ChannelIdParam): Observable<BaseResponse<LinkedTreeMap<String, String>>> 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>> fun setUserInfo(param: UserInfoParam): Observable<BaseResponse<Any>>
...@@ -56,7 +56,7 @@ interface UserHttp { ...@@ -56,7 +56,7 @@ interface UserHttp {
fun privacyAgree(uid: String): Observable<BaseResponse<Any>> 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> fun umLogin(activity: Activity, media: SHARE_MEDIA): Observable<ThirdLoginParam>
......
...@@ -12,7 +12,7 @@ import com.ydl.ydlcommon.router.YdlCommonOut ...@@ -12,7 +12,7 @@ import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxAppTool import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool 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.UserHelper
import com.yidianling.user.bean.CheckPhonePassBean import com.yidianling.user.bean.CheckPhonePassBean
import com.yidianling.user.http.request.* import com.yidianling.user.http.request.*
...@@ -56,7 +56,7 @@ class UserHttpImpl private constructor() : UserHttp { ...@@ -56,7 +56,7 @@ class UserHttpImpl private constructor() : UserHttp {
// .create(UserApi::class.java) // .create(UserApi::class.java)
// } // }
override fun login(param: LoginParam): Observable<BaseResponse<UserResponse>> { override fun login(param: LoginParam): Observable<BaseResponse<UserResponseBean>> {
return RxUtils.mapObservable(param) return RxUtils.mapObservable(param)
.flatMap { getUserApi().login(it) } .flatMap { getUserApi().login(it) }
} }
...@@ -77,7 +77,7 @@ class UserHttpImpl private constructor() : UserHttp { ...@@ -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) return RxUtils.mapObservable(param)
.flatMap { getUserApi().bindPhone(it) } .flatMap { getUserApi().bindPhone(it) }
} }
...@@ -97,7 +97,7 @@ class UserHttpImpl private constructor() : UserHttp { ...@@ -97,7 +97,7 @@ class UserHttpImpl private constructor() : UserHttp {
.flatMap { getUserApi().setChannelId(it) } .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) var param: String = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), param) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), param)
...@@ -178,7 +178,7 @@ class UserHttpImpl private constructor() : UserHttp { ...@@ -178,7 +178,7 @@ class UserHttpImpl private constructor() : UserHttp {
return LoginObservable(activity, media) 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) var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().thirdPartJavaLogin(body) return getUserApi().thirdPartJavaLogin(body)
......
...@@ -7,10 +7,10 @@ import android.text.TextUtils ...@@ -7,10 +7,10 @@ import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.yidianling.common.tools.RxAppTool import com.yidianling.common.tools.RxAppTool
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.api.bean.UserSettingBean import com.yidianling.user.api.bean.UserSettingBean
import com.yidianling.user.api.service.IUserService 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.route.UserIn
import com.yidianling.user.safePrivate.FingerPrintUtil import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.PrivacyActivity import com.yidianling.user.safePrivate.PrivacyActivity
...@@ -32,64 +32,64 @@ public class UserServiceImp : IUserService { ...@@ -32,64 +32,64 @@ public class UserServiceImp : IUserService {
} }
override fun getUserSetting(): UserSettingBean? { override fun getUserSetting(): UserSettingBean? {
return UserServiceHelper.getUsetSetting() return UserHelper.getUsetSetting()
} }
override fun updateUserInfoSp(userInfo: UserResponseBean.UserInfo?) { override fun updateUserInfoSp(userInfo: UserResponseBean.UserInfo?) {
UserServiceHelper.updateUserinfo(userInfo) UserHelper.updateUserinfo(userInfo)
} }
override fun updateUserSetingSp(userSetting: UserSettingBean?) { override fun updateUserSetingSp(userSetting: UserSettingBean?) {
UserServiceHelper.updateUserSetting(userSetting) UserHelper.updateUserSetting(userSetting)
} }
override fun setChatTeamHisShowed(showed: Boolean) { override fun setChatTeamHisShowed(showed: Boolean) {
UserServiceHelper.getUsetSetting()?.chatTeamHisShowed = showed UserHelper.getUsetSetting()?.chatTeamHisShowed = showed
} }
override fun setUserResponse(userInfo: UserResponseBean?) { override fun setUserResponse(userInfo: UserResponseBean?) {
UserServiceHelper.setUserinfo(userInfo) UserHelper.setUserinfo(userInfo)
} }
override fun getUserResponse(): UserResponseBean? { override fun getUserResponse(): UserResponseBean? {
return UserServiceHelper.getUserInfo() return UserHelper.getUserInfo()
} }
override fun isLogin(): Boolean { override fun isLogin(): Boolean {
return UserServiceHelper.isLogin() return UserHelper.isLogin()
} }
override fun isFirstLogin(): Boolean { override fun isFirstLogin(): Boolean {
return UserServiceHelper.getUserInfo()?.firstLogin==1 return UserHelper.getUserInfo()?.firstLogin==1
} }
override fun setFirstLogin(first: Boolean) { override fun setFirstLogin(first: Boolean) {
var value : Int = if (first) 1 else 2 //1是2否 var value : Int = if (first) 1 else 2 //1是2否
UserServiceHelper.getUserInfo()?.firstLogin = value UserHelper.getUserInfo()?.firstLogin = value
} }
override fun isSafePrivacyClicked(): Boolean { override fun isSafePrivacyClicked(): Boolean {
return UserServiceHelper.getUsetSetting()?.meSafePrivateIsClick?:true return UserHelper.getUsetSetting()?.meSafePrivateIsClick?:true
} }
override fun putSafePrivacyClicked(clicked: Boolean) { override fun putSafePrivacyClicked(clicked: Boolean) {
UserServiceHelper.getUsetSetting()?.meSafePrivateIsClick = clicked UserHelper.getUsetSetting()?.meSafePrivateIsClick = clicked
} }
override fun getUserInfo(): UserResponseBean.UserInfo? { override fun getUserInfo(): UserResponseBean.UserInfo? {
return UserServiceHelper.getUserInfo()?.userInfo return UserHelper.getUserInfo()?.userInfo
} }
override fun isBindPhone(): Boolean { override fun isBindPhone(): Boolean {
return !TextUtils.isEmpty(UserServiceHelper.getUserInfo()?.userInfo?.phone) return !TextUtils.isEmpty(UserHelper.getUserInfo()?.userInfo?.phone)
} }
override fun putUnlockCheckSuccessTime(time: Long) { override fun putUnlockCheckSuccessTime(time: Long) {
UserServiceHelper.getUsetSetting()?.unLockCheckSuccessTime = time UserHelper.getUsetSetting()?.unLockCheckSuccessTime = time
} }
override fun getChatTeamHisShow(): Boolean { override fun getChatTeamHisShow(): Boolean {
return UserServiceHelper.getUsetSetting()?.chatTeamHisShowed?:true return UserHelper.getUsetSetting()?.chatTeamHisShowed?:true
} }
override fun privacyIntent(activity: Activity): Intent { override fun privacyIntent(activity: Activity): Intent {
...@@ -106,7 +106,7 @@ public class UserServiceImp : IUserService { ...@@ -106,7 +106,7 @@ public class UserServiceImp : IUserService {
override fun safeTipViewGone(): Boolean { override fun safeTipViewGone(): Boolean {
//如果是非登录状态 或者 app指纹开启 或者 手势密码不为空 或者 已提示过安全解锁 -> 隐藏 设置密码提示 //如果是非登录状态 或者 app指纹开启 或者 手势密码不为空 或者 已提示过安全解锁 -> 隐藏 设置密码提示
return !UserServiceHelper.isLogin() || FingerPrintUtil.instance().fingerPrintIsOpen() return !UserHelper.isLogin() || FingerPrintUtil.instance().fingerPrintIsOpen()
|| !TextUtils.isEmpty(FingerPrintUtil.instance().getHandPass()) || !TextUtils.isEmpty(FingerPrintUtil.instance().getHandPass())
|| FingerPrintUtil.instance().getTrendsSafeTip() || FingerPrintUtil.instance().getTrendsSafeTip()
} }
...@@ -120,17 +120,17 @@ public class UserServiceImp : IUserService { ...@@ -120,17 +120,17 @@ public class UserServiceImp : IUserService {
} }
override fun isFirstStart(): Boolean { 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()) val currentVersionCode : Int = RxAppTool.getAppVersionCode(BaseApp.getApp())
if (lastVersionCode < currentVersionCode) { if (lastVersionCode < currentVersionCode) {
UserServiceHelper.getUsetSetting()?.lastVersionCode = currentVersionCode UserHelper.getUsetSetting()?.lastVersionCode = currentVersionCode
return true return true
} }
return false return false
} }
override fun clearUserInfo() { override fun clearUserInfo() {
UserServiceHelper.setUserinfo(null) UserHelper.setUserinfo(null)
UserIn.clearImData() 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 ...@@ -4,13 +4,15 @@ import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.text.TextUtils import android.text.TextUtils
import com.google.gson.Gson
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.yidianling.common.tools.RxAppTool import com.yidianling.common.tools.RxAppTool
import com.yidianling.router.user.IUserRouter import com.yidianling.router.user.IUserRouter
import com.yidianling.router.user.UserResponse import com.yidianling.router.user.UserResponse
import com.yidianling.router.user.UserSetting import com.yidianling.router.user.UserSetting
import com.yidianling.user.UserHelper 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.FingerPrintUtil
import com.yidianling.user.safePrivate.PrivacyActivity import com.yidianling.user.safePrivate.PrivacyActivity
import com.yidianling.user.ui.InputPhoneActivity import com.yidianling.user.ui.InputPhoneActivity
...@@ -23,16 +25,30 @@ import com.yidianling.user.ui.login.RegisterAndLoginActivity ...@@ -23,16 +25,30 @@ import com.yidianling.user.ui.login.RegisterAndLoginActivity
* time : 2018/04/13 * time : 2018/04/13
*/ */
class UserRouterImp : IUserRouter { class UserRouterImp : IUserRouter {
val gson: Gson = Gson()
override fun getUserSetting(): UserSetting? { override fun getUserSetting(): UserSetting? {
return UserHelper.getUsetSetting() var infoStr = UserHelper.getUserSettingStr()
if (TextUtils.isEmpty(infoStr)){
return null
}
return gson.fromJson(infoStr, UserSetting::class.java)
} }
override fun updateUserInfoSp(userInfo: UserResponse.UserInfo?) { override fun updateUserInfoSp(userInfo: UserResponse.UserInfo?) {
UserHelper.updateUserinfo(userInfo) if (userInfo==null){
return
}
val info:UserResponseBean.UserInfo = gson.fromJson( gson.toJson(userInfo), UserResponseBean.UserInfo::class.java)
UserHelper.updateUserinfo(info)
} }
override fun updateUserSetingSp(userSetting: UserSetting?) { override fun updateUserSetingSp(userSetting: UserSetting?) {
UserHelper.updateUserSetting(userSetting) if (userSetting==null){
return
}
val info:UserSettingBean= gson.fromJson(gson.toJson(userSetting), UserSettingBean::class.java)
UserHelper.updateUserSetting(info)
} }
override fun setChatTeamHisShowed(showed: Boolean) { override fun setChatTeamHisShowed(showed: Boolean) {
...@@ -40,11 +56,16 @@ class UserRouterImp : IUserRouter { ...@@ -40,11 +56,16 @@ class UserRouterImp : IUserRouter {
} }
override fun setUserResponse(userInfo: UserResponse?) { 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? { override fun getUserResponse(): UserResponse? {
return UserHelper.getUserInfo() var infoStr = UserHelper.getUserInfoStr()
if (TextUtils.isEmpty(infoStr)){
return null
}
return gson.fromJson(infoStr,UserResponse::class.java)
} }
override fun isLogin(): Boolean { override fun isLogin(): Boolean {
...@@ -69,7 +90,7 @@ class UserRouterImp : IUserRouter { ...@@ -69,7 +90,7 @@ class UserRouterImp : IUserRouter {
} }
override fun getUserInfo(): UserResponse.UserInfo? { override fun getUserInfo(): UserResponse.UserInfo? {
return UserHelper.getUserInfo()?.userInfo return gson.fromJson(UserHelper.getUserInfoStr(), UserResponse::class.java)?.userInfo
} }
override fun isBindPhone(): Boolean { override fun isBindPhone(): Boolean {
......
...@@ -37,7 +37,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog; ...@@ -37,7 +37,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.ThreeLinesDialog; import com.ydl.ydlcommon.view.dialog.ThreeLinesDialog;
import com.yidianling.common.tools.RxFileTool; import com.yidianling.common.tools.RxFileTool;
import com.yidianling.common.tools.RxImageTool; 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.*;
import com.yidianling.user.http.UserHttp; import com.yidianling.user.http.UserHttp;
import com.yidianling.user.http.UserHttpImpl; import com.yidianling.user.http.UserHttpImpl;
...@@ -342,7 +342,7 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen ...@@ -342,7 +342,7 @@ public class FillInfoActivity extends BaseActivity implements View.OnClickListen
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(this::dismissProgressDialog) .doAfterTerminate(this::dismissProgressDialog)
.subscribe(o -> { .subscribe(o -> {
UserResponse userInfo = UserHelper.INSTANCE.getUserInfo(); UserResponseBean userInfo = UserHelper.INSTANCE.getUserInfo();
if (userInfo != null) { if (userInfo != null) {
userInfo.getUserInfo().setHead(head); userInfo.getUserInfo().setHead(head);
userInfo.getUserInfo().setGender(gender); userInfo.getUserInfo().setGender(gender);
......
...@@ -21,7 +21,7 @@ import com.ydl.ydlcommon.view.TitleBar; ...@@ -21,7 +21,7 @@ import com.ydl.ydlcommon.view.TitleBar;
import com.yidianling.router.RouterManager; import com.yidianling.router.RouterManager;
import com.yidianling.router.im.IMLoginInfo; import com.yidianling.router.im.IMLoginInfo;
import com.yidianling.router.im.IMRequestCallback; 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.LoginHelper;
import com.yidianling.user.R; import com.yidianling.user.R;
import com.yidianling.user.UserConstants; import com.yidianling.user.UserConstants;
...@@ -410,7 +410,7 @@ public class GetIdentifyingCodeActivity extends BaseActivity implements View.OnC ...@@ -410,7 +410,7 @@ public class GetIdentifyingCodeActivity extends BaseActivity implements View.OnC
} }
//用户信息 获取登陆信息 //用户信息 获取登陆信息
public void setHXinfo(UserResponse userInfo) { public void setHXinfo(UserResponseBean userInfo) {
try { try {
if (userInfo != null) { if (userInfo != null) {
......
...@@ -15,7 +15,7 @@ import com.ydl.ydlcommon.view.DeleteEditTextView; ...@@ -15,7 +15,7 @@ import com.ydl.ydlcommon.view.DeleteEditTextView;
import com.ydl.ydlcommon.view.JumpTextView; import com.ydl.ydlcommon.view.JumpTextView;
import com.ydl.ydlcommon.view.RoundCornerButton; import com.ydl.ydlcommon.view.RoundCornerButton;
import com.ydl.ydlcommon.view.TitleBar; 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.LoginContract;
import com.yidianling.user.LoginPresenter; import com.yidianling.user.LoginPresenter;
import com.yidianling.user.R; import com.yidianling.user.R;
...@@ -140,7 +140,7 @@ public class LoginActivity extends BaseMvpActivity<LoginContract.View,LoginContr ...@@ -140,7 +140,7 @@ public class LoginActivity extends BaseMvpActivity<LoginContract.View,LoginContr
} }
@Override @Override
public void loginSuccess(UserResponse userInfo) { public void loginSuccess(UserResponseBean userInfo) {
finishFinger(); finishFinger();
int size = ActivityManager.Companion.getActivitySize(); int size = ActivityManager.Companion.getActivitySize();
if (size == 2 || size == 1) { if (size == 2 || size == 1) {
......
...@@ -16,7 +16,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils ...@@ -16,7 +16,7 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.router.im.IMLoginInfo import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback 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.LoginUtils
import com.yidianling.user.UserConstants import com.yidianling.user.UserConstants
import com.yidianling.user.constants.UserBIConstants import com.yidianling.user.constants.UserBIConstants
...@@ -181,7 +181,7 @@ class SmsLoginActivity : BaseActivity() { ...@@ -181,7 +181,7 @@ class SmsLoginActivity : BaseActivity() {
// 登录 IM // 登录 IM
private fun loginIM(info: UserResponse) { private fun loginIM(info: UserResponseBean) {
val loginInfo = IMLoginInfo(info.uid.toString(), info.hxpwd!!) val loginInfo = IMLoginInfo(info.uid.toString(), info.hxpwd!!)
val callback = object : IMRequestCallback<IMLoginInfo> { val callback = object : IMRequestCallback<IMLoginInfo> {
override fun onSuccess(loginInfo: IMLoginInfo?) { override fun onSuccess(loginInfo: IMLoginInfo?) {
...@@ -201,7 +201,7 @@ class SmsLoginActivity : BaseActivity() { ...@@ -201,7 +201,7 @@ class SmsLoginActivity : BaseActivity() {
} }
//用户信息 获取登陆信息 //用户信息 获取登陆信息
fun setHXInfo(userInfo: UserResponse.UserInfo?) { fun setHXInfo(userInfo: UserResponseBean.UserInfo?) {
try { try {
if (userInfo != null) { if (userInfo != null) {
UserIn.imSetAccount(userInfo.uid.toString()) UserIn.imSetAccount(userInfo.uid.toString())
......
...@@ -34,7 +34,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog ...@@ -34,7 +34,7 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil 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.BuildConfig
import com.yidianling.user.R import com.yidianling.user.R
import com.yidianling.user.UserHelper import com.yidianling.user.UserHelper
...@@ -438,7 +438,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -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 var bindPhone = userInfo.bind_phone
if (bindPhone != 1) { if (bindPhone != 1) {
countryCode = userInfo.country_code countryCode = userInfo.country_code
......
...@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse ...@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView 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.PhoneLoginPwdParam
import com.yidianling.user.http.request.PhoneResetPwdParam import com.yidianling.user.http.request.PhoneResetPwdParam
import io.reactivex.Observable import io.reactivex.Observable
...@@ -60,11 +60,11 @@ interface IInputPassWordContract { ...@@ -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 ...@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView 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.BindPhoneJavaParam
import com.yidianling.user.http.request.CheckAliAuthParam import com.yidianling.user.http.request.CheckAliAuthParam
import com.yidianling.user.http.request.PhoneLoginAutoParam import com.yidianling.user.http.request.PhoneLoginAutoParam
...@@ -44,7 +44,7 @@ interface ILoginContract { ...@@ -44,7 +44,7 @@ interface ILoginContract {
/** /**
* 三方登录成功 * 三方登录成功
*/ */
fun thirdLoginSuccess(userInfo: UserResponse.UserInfo) fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo)
/** /**
* 弹窗 * 弹窗
...@@ -136,7 +136,7 @@ interface ILoginContract { ...@@ -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 ...@@ -4,7 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.IModel import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView 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.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginCodeParam import com.yidianling.user.http.request.PhoneLoginCodeParam
import io.reactivex.Observable import io.reactivex.Observable
...@@ -93,7 +93,7 @@ interface IVerificationCodeContract { ...@@ -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 package com.yidianling.user.ui.login.model
import com.ydl.ydlcommon.data.http.BaseResponse 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.LoginApiRequestUtil
import com.yidianling.user.http.request.PhoneLoginPwdParam import com.yidianling.user.http.request.PhoneLoginPwdParam
import com.yidianling.user.http.request.PhoneResetPwdParam import com.yidianling.user.http.request.PhoneResetPwdParam
...@@ -19,14 +19,14 @@ class InputPassWordModelImpl : IInputPassWordContract.Model { ...@@ -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) return LoginApiRequestUtil.resetPwd(param)
} }
/** /**
* 手机号密码登录 * 手机号密码登录
*/ */
override fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponse>> { override fun userLoginByPassword(param: PhoneLoginPwdParam): Observable<BaseResponse<UserResponseBean>> {
return LoginApiRequestUtil.userLoginByPassword(param) return LoginApiRequestUtil.userLoginByPassword(param)
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ package com.yidianling.user.ui.login.model ...@@ -3,7 +3,7 @@ package com.yidianling.user.ui.login.model
import android.app.Activity import android.app.Activity
import com.umeng.socialize.bean.SHARE_MEDIA import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.data.http.BaseResponse 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.LoginApiRequestUtil
import com.yidianling.user.http.request.BindPhoneJavaParam import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.CheckAliAuthParam import com.yidianling.user.http.request.CheckAliAuthParam
...@@ -34,7 +34,7 @@ class LoginModelImpl : ILoginContract.Model { ...@@ -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) return LoginApiRequestUtil.autoLogin(bean)
} }
......
package com.yidianling.user.ui.login.model package com.yidianling.user.ui.login.model
import com.ydl.ydlcommon.data.http.BaseResponse 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.LoginApiRequestUtil
import com.yidianling.user.http.request.BindPhoneJavaParam import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginCodeParam import com.yidianling.user.http.request.PhoneLoginCodeParam
...@@ -42,7 +42,7 @@ class VerificationCodeModelImpl : IVerificationCodeContract.Model { ...@@ -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) return LoginApiRequestUtil.loginByMsgCode(param)
} }
......
...@@ -10,7 +10,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils ...@@ -10,7 +10,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil 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.LoginUtils
import com.yidianling.user.constants.UserBIConstants import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.PhoneLoginPwdParam import com.yidianling.user.http.request.PhoneLoginPwdParam
...@@ -111,7 +111,7 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II ...@@ -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)) { if (!TextUtils.isEmpty(userResponse.userInfo!!.phone)) {
YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone) YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone)
YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code) YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code)
......
...@@ -11,7 +11,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils ...@@ -11,7 +11,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil 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.LoginUtils
import com.yidianling.user.UserHelper import com.yidianling.user.UserHelper
import com.yidianling.user.constants.UserBIConstants import com.yidianling.user.constants.UserBIConstants
...@@ -91,7 +91,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra ...@@ -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)) { if (!TextUtils.isEmpty(userResponse.userInfo!!.phone)) {
YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone) YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone)
YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code) YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code)
......
...@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils ...@@ -7,7 +7,7 @@ import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.ToastUtil 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.LoginUtils
import com.yidianling.user.constants.UserBIConstants import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.BindPhoneJavaParam import com.yidianling.user.http.request.BindPhoneJavaParam
...@@ -161,7 +161,7 @@ class VerificationCodePresenterImpl(view: IVerificationCodeContract.View) : Base ...@@ -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)) { if (!TextUtils.isEmpty(userResponse.userInfo!!.phone)) {
YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone) YDLCacheUtils.saveUserPhone(userResponse.userInfo!!.phone)
YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code) YDLCacheUtils.saveCountryPhoneCode(userResponse.userInfo!!.country_code)
......
package com.yidianling.user.api.bean package com.yidianling.user.api.bean
import com.google.gson.annotations.SerializedName import com.google.gson.annotations.SerializedName
import com.yidianling.user.api.event.UserSetEvent import com.yidianling.user.api.utils.UserApiServiceUtils
import de.greenrobot.event.EventBus
/** /**
...@@ -18,7 +17,7 @@ class UserResponseBean { ...@@ -18,7 +17,7 @@ class UserResponseBean {
var userInfo: UserResponseBean.UserInfo? = UserInfo() var userInfo: UserResponseBean.UserInfo? = UserInfo()
set(value) { set(value) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().setUserResponse(this)
} }
inner class UserInfo { inner class UserInfo {
...@@ -51,7 +50,7 @@ class UserResponseBean { ...@@ -51,7 +50,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != bind_weixin) { if (value != bind_weixin) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
@field:SerializedName("bindQq") @field:SerializedName("bindQq")
...@@ -60,7 +59,7 @@ class UserResponseBean { ...@@ -60,7 +59,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != bind_qq) { if (value != bind_qq) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
@field:SerializedName("userType") @field:SerializedName("userType")
...@@ -71,14 +70,14 @@ class UserResponseBean { ...@@ -71,14 +70,14 @@ class UserResponseBean {
set(value) { set(value) {
if (value != profession) { if (value != profession) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
var marriage: Int = 0 var marriage: Int = 0
set(value) { set(value) {
if (value != marriage) { if (value != marriage) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
@field:SerializedName("countryCode") @field:SerializedName("countryCode")
...@@ -89,7 +88,7 @@ class UserResponseBean { ...@@ -89,7 +88,7 @@ class UserResponseBean {
set(value) { set(value) {
if (!(value?.equals(home_bg) ?: false)) { if (!(value?.equals(home_bg) ?: false)) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
//是否同意过隐私权限 1同意过 0未同意 //是否同意过隐私权限 1同意过 0未同意
...@@ -97,7 +96,7 @@ class UserResponseBean { ...@@ -97,7 +96,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != privacyAgreementStatus) { if (value != privacyAgreementStatus) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
...@@ -106,7 +105,7 @@ class UserResponseBean { ...@@ -106,7 +105,7 @@ class UserResponseBean {
set(value) { set(value) {
if (!(value?.equals(description) ?: false)) { if (!(value?.equals(description) ?: false)) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
@field:SerializedName("isSilenced") @field:SerializedName("isSilenced")
...@@ -114,7 +113,7 @@ class UserResponseBean { ...@@ -114,7 +113,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != is_silenced) { if (value != is_silenced) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
var hasCoupon: Int = 0 var hasCoupon: Int = 0
...@@ -122,7 +121,7 @@ class UserResponseBean { ...@@ -122,7 +121,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != firstLogin) { if (value != firstLogin) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
...@@ -130,7 +129,7 @@ class UserResponseBean { ...@@ -130,7 +129,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != trendNum) { if (value != trendNum) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
...@@ -139,7 +138,7 @@ class UserResponseBean { ...@@ -139,7 +138,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != fansNum) { if (value != fansNum) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
var testRecordNum: Int = 0 var testRecordNum: Int = 0
...@@ -147,7 +146,7 @@ class UserResponseBean { ...@@ -147,7 +146,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != testRecordNum) { if (value != testRecordNum) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
var attentionNum: Int = 0 var attentionNum: Int = 0
...@@ -155,7 +154,7 @@ class UserResponseBean { ...@@ -155,7 +154,7 @@ class UserResponseBean {
set(value) { set(value) {
if (value != attentionNum) { if (value != attentionNum) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
var registTime: String? = null var registTime: String? = null
...@@ -163,7 +162,7 @@ class UserResponseBean { ...@@ -163,7 +162,7 @@ class UserResponseBean {
set(value) { set(value) {
if (!(value?.equals(registTime) ?: false)) { if (!(value?.equals(registTime) ?: false)) {
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserInfoSp(this)
} }
} }
......
package com.yidianling.user.api.bean package com.yidianling.user.api.bean
import com.yidianling.user.api.event.UserSetEvent import com.yidianling.user.api.utils.UserApiServiceUtils
import de.greenrobot.event.EventBus
/** /**
...@@ -15,7 +14,7 @@ class UserSettingBean { ...@@ -15,7 +14,7 @@ class UserSettingBean {
set(value) { set(value) {
if (fingerPrintStatus!=value){ if (fingerPrintStatus!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
...@@ -24,7 +23,7 @@ class UserSettingBean { ...@@ -24,7 +23,7 @@ class UserSettingBean {
set(value) { set(value) {
if (unLockCheckSuccessTime!=value){ if (unLockCheckSuccessTime!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
//指纹多次错误被禁止使用的时间戳 //指纹多次错误被禁止使用的时间戳
...@@ -32,7 +31,7 @@ class UserSettingBean { ...@@ -32,7 +31,7 @@ class UserSettingBean {
set(value) { set(value) {
if (fingerErrorTime!=value){ if (fingerErrorTime!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
//手势密码 //手势密码
...@@ -40,7 +39,7 @@ class UserSettingBean { ...@@ -40,7 +39,7 @@ class UserSettingBean {
set(value) { set(value) {
if (!value.equals(gesturePassword)){ if (!value.equals(gesturePassword)){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
//设置群聊历史记录 //设置群聊历史记录
...@@ -48,7 +47,7 @@ class UserSettingBean { ...@@ -48,7 +47,7 @@ class UserSettingBean {
set(value) { set(value) {
if (chatTeamHisShowed!=value){ if (chatTeamHisShowed!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
//获取动态页面是否提示过安全解锁 //获取动态页面是否提示过安全解锁
...@@ -56,7 +55,7 @@ class UserSettingBean { ...@@ -56,7 +55,7 @@ class UserSettingBean {
set(value) { set(value) {
if (trendsIsClick!=value){ if (trendsIsClick!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
//我的页面隐私安全是否点击过 //我的页面隐私安全是否点击过
...@@ -64,7 +63,7 @@ class UserSettingBean { ...@@ -64,7 +63,7 @@ class UserSettingBean {
set(value) { set(value) {
if (meSafePrivateIsClick!=value){ if (meSafePrivateIsClick!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
//最后一次登录的版本号 //最后一次登录的版本号
...@@ -72,7 +71,7 @@ class UserSettingBean { ...@@ -72,7 +71,7 @@ class UserSettingBean {
set(value) { set(value) {
if (lastVersionCode!=value){ if (lastVersionCode!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
/** /**
...@@ -82,7 +81,7 @@ class UserSettingBean { ...@@ -82,7 +81,7 @@ class UserSettingBean {
set(value) { set(value) {
if (hasVoice!=value){ if (hasVoice!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
/** /**
...@@ -92,7 +91,7 @@ class UserSettingBean { ...@@ -92,7 +91,7 @@ class UserSettingBean {
set(value) { set(value) {
if (hasShake!=value){ if (hasShake!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
...@@ -100,7 +99,7 @@ class UserSettingBean { ...@@ -100,7 +99,7 @@ class UserSettingBean {
set(value) { set(value) {
if (time!=value){ if (time!=value){
field = value field = value
EventBus.getDefault().post(UserSetEvent(this)) UserApiServiceUtils.provideUserApiService().updateUserSetingSp(this)
} }
} }
/** /**
...@@ -110,7 +109,7 @@ class UserSettingBean { ...@@ -110,7 +109,7 @@ class UserSettingBean {
set(value){ set(value){
if (phoneStatusPermissionIsShow!=value){ if (phoneStatusPermissionIsShow!=value){
field = 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() { ...@@ -99,6 +99,10 @@ class AudioPlayer private constructor() {
* 是否自动保存播放进度 * 是否自动保存播放进度
*/ */
var autoSaveProgress = false var autoSaveProgress = false
/**
* 是否显示通知栏
*/
var isShowNotify = false
private object SingletonHolder { private object SingletonHolder {
val instance = AudioPlayer() val instance = AudioPlayer()
...@@ -255,7 +259,7 @@ class AudioPlayer private constructor() { ...@@ -255,7 +259,7 @@ class AudioPlayer private constructor() {
for (listener in listeners) { for (listener in listeners) {
listener.onChange(music) listener.onChange(music)
} }
if (playMode != PlayModeEnum.SINGLE) { if (isShowNotify) {
NotifyManager.get().showPlay(music) NotifyManager.get().showPlay(music)
MediaSessionManager.get().updateMetaData(music) MediaSessionManager.get().updateMetaData(music)
MediaSessionManager.get().updatePlaybackState() MediaSessionManager.get().updatePlaybackState()
...@@ -313,7 +317,7 @@ class AudioPlayer private constructor() { ...@@ -313,7 +317,7 @@ class AudioPlayer private constructor() {
mediaPlayer!!.start() mediaPlayer!!.start()
state = STATE_PLAYING state = STATE_PLAYING
handler!!.post(mPublishRunnable) handler!!.post(mPublishRunnable)
if (playMode != PlayModeEnum.SINGLE) { if (isShowNotify) {
NotifyManager.get().showPlay(playMusic) NotifyManager.get().showPlay(playMusic)
MediaSessionManager.get().updatePlaybackState() MediaSessionManager.get().updatePlaybackState()
} }
...@@ -336,8 +340,10 @@ class AudioPlayer private constructor() { ...@@ -336,8 +340,10 @@ class AudioPlayer private constructor() {
mediaPlayer!!.pause() mediaPlayer!!.pause()
state = STATE_PAUSE state = STATE_PAUSE
handler!!.removeCallbacks(mPublishRunnable) handler!!.removeCallbacks(mPublishRunnable)
NotifyManager.get().showPause(playMusic) if(isShowNotify){
MediaSessionManager.get().updatePlaybackState() NotifyManager.get().showPause(playMusic)
MediaSessionManager.get().updatePlaybackState()
}
context!!.unregisterReceiver(noisyReceiver) context!!.unregisterReceiver(noisyReceiver)
if (abandonAudioFocus) { if (abandonAudioFocus) {
audioFocusManager!!.abandonAudioFocus() audioFocusManager!!.abandonAudioFocus()
......
...@@ -40,15 +40,16 @@ dependencies { ...@@ -40,15 +40,16 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api 'com.squareup.retrofit2:retrofit:2.6.0'
api 'com.squareup.retrofit2:converter-gson:2.6.0'
api 'com.squareup.retrofit2:adapter-rxjava2:2.6.0'
api "io.reactivex.rxjava2:rxjava:2.2.10"
api 'io.reactivex.rxjava2:rxandroid:2.1.1'
api 'com.squareup.retrofit2:converter-scalars:2.4.0'
api 'com.squareup.okhttp3:logging-interceptor:3.12.2'
api rootProject.ext.dependencies["gson"] api rootProject.ext.dependencies["gson"]
api rootProject.ext.dependencies["rxjava2"]
api(rootProject.ext.dependencies["rxandroid2"]) {
exclude module: 'rxjava'
}
api rootProject.ext.dependencies["retrofit"]
api rootProject.ext.dependencies["okhttp3-logging"]
api rootProject.ext.dependencies["retrofit-converter-gson"]
api rootProject.ext.dependencies["retrofit-converter-scalars"]
api rootProject.ext.dependencies["retrofit-adapter-rxjava2"]
} }
...@@ -41,22 +41,6 @@ dependencies { ...@@ -41,22 +41,6 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.4.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
//noinspection GradleCompatible
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'de.greenrobot:eventbus:2.4.0'
api 'com.umeng.sdk:share-wechat:6.9.1'
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
//开发时使用 //开发时使用
api project(':ydl-platform') api project(':ydl-platform')
......
...@@ -75,13 +75,22 @@ dependencies { ...@@ -75,13 +75,22 @@ dependencies {
api rootProject.ext.dependencies["ydl-pushagent"] api rootProject.ext.dependencies["ydl-pushagent"]
api rootProject.ext.dependencies["ydl-notracepoint"] api rootProject.ext.dependencies["ydl-notracepoint"]
api rootProject.ext.dependencies["ydl-hnet"] api rootProject.ext.dependencies["ydl-hnet"]
api rootProject.ext.dependencies["imagepicker"] api(rootProject.ext.dependencies["imagepicker"]) {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
}
api rootProject.ext.dependencies["ydl-utils"] api rootProject.ext.dependencies["ydl-utils"]
api rootProject.ext.dependencies["ydl-js"] api rootProject.ext.dependencies["ydl-js"]
api rootProject.ext.dependencies["ydl-net"] api rootProject.ext.dependencies["ydl-net"]
api rootProject.ext.dependencies["ydl-js"] api rootProject.ext.dependencies["ydl-js"]
api rootProject.ext.dependencies["ptr-lib-release"]
api(rootProject.ext.dependencies["ydl-device"]) { api(rootProject.ext.dependencies["ydl-device"]) {
transitive = true transitive = true
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
} }
api(rootProject.ext.dependencies["ydl-router"]) { api(rootProject.ext.dependencies["ydl-router"]) {
transitive = true transitive = true
...@@ -114,17 +123,12 @@ dependencies { ...@@ -114,17 +123,12 @@ dependencies {
api rootProject.ext.dependencies["glide"] api rootProject.ext.dependencies["glide"]
api rootProject.ext.dependencies["glide-transformations"] api rootProject.ext.dependencies["glide-transformations"]
api rootProject.ext.dependencies["constraint-layout"] api rootProject.ext.dependencies["constraint-layout"]
api rootProject.ext.dependencies["ptr-lib-release"]
api rootProject.ext.dependencies["cube"] api rootProject.ext.dependencies["cube"]
api rootProject.ext.dependencies["support-multidex"] api rootProject.ext.dependencies["support-multidex"]
api rootProject.ext.dependencies["tablayout"] api rootProject.ext.dependencies["tablayout"]
api rootProject.ext.dependencies["xrecyclerview"] api rootProject.ext.dependencies["xrecyclerview"]
api rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
api rootProject.ext.dependencies["flowlayout"] api rootProject.ext.dependencies["flowlayout"]
api rootProject.ext.dependencies["androidanimations"] api rootProject.ext.dependencies["androidanimations"]
api rootProject.ext.dependencies["exoplayer"]
//====================Tools==================== //====================Tools====================
api rootProject.ext.dependencies["robust"] api rootProject.ext.dependencies["robust"]
api rootProject.ext.dependencies["walle"] api rootProject.ext.dependencies["walle"]
......
package com.ydl.ydlcommon.base package com.ydl.ydlcommon.base
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View import android.view.View
import com.ydl.ydlcommon.mvp.base.IPresenter import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView import com.ydl.ydlcommon.mvp.base.IView
...@@ -27,8 +26,8 @@ abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : BaseFragment(), M ...@@ -27,8 +26,8 @@ abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : BaseFragment(), M
abstract override fun createPresenter(): P abstract override fun createPresenter(): P
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mvpDelegate?.onViewCreated(view, savedInstanceState) mvpDelegate?.onViewCreated(view, savedInstanceState)
super.onViewCreated(view, savedInstanceState)
} }
override fun onDestroyView() { override fun onDestroyView() {
...@@ -37,8 +36,8 @@ abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : BaseFragment(), M ...@@ -37,8 +36,8 @@ abstract class BaseMvpFragment<V : IView, P : IPresenter<V>> : BaseFragment(), M
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mvpDelegate?.onCreate(savedInstanceState) mvpDelegate?.onCreate(savedInstanceState)
super.onCreate(savedInstanceState)
} }
override fun onDestroy() { override fun onDestroy() {
......
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
<dimen name="platform_title_bar_height">45dp</dimen> <dimen name="platform_title_bar_height">45dp</dimen>
<dimen name="platform_action_bar_height">48dip</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_05">0.5dp</dimen>
<dimen name="platform_dp_1">1dp</dimen> <dimen name="platform_dp_1">1dp</dimen>
<dimen name="platform_dp_2">2dp</dimen> <dimen name="platform_dp_2">2dp</dimen>
...@@ -58,6 +64,7 @@ ...@@ -58,6 +64,7 @@
<dimen name="platform_dp_36">36dp</dimen> <dimen name="platform_dp_36">36dp</dimen>
<dimen name="platform_dp_37">37dp</dimen> <dimen name="platform_dp_37">37dp</dimen>
<dimen name="platform_dp_38">38dp</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_48">48dp</dimen>
<dimen name="platform_dp_60">60dp</dimen> <dimen name="platform_dp_60">60dp</dimen>
<dimen name="platform_dp_64">64dp</dimen> <dimen name="platform_dp_64">64dp</dimen>
......
...@@ -1217,7 +1217,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1217,7 +1217,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
dialog.setCallBack(type -> { dialog.setCallBack(type -> {
if (1 == type) { if (1 == type) {
if (!WebModularServiceUtils.Companion.getUserRouter().isLogin()) { if (!WebModularServiceUtils.Companion.getUserService().isLogin()) {
isToTrend = true; isToTrend = true;
ARouter.getInstance().build("/user/login").navigation(); ARouter.getInstance().build("/user/login").navigation();
} else { } else {
......
...@@ -44,15 +44,15 @@ class SafeTipView : LinearLayout { ...@@ -44,15 +44,15 @@ class SafeTipView : LinearLayout {
.duration(400) .duration(400)
.onEnd { visibility = View.GONE } .onEnd { visibility = View.GONE }
.playOn(this@SafeTipView) .playOn(this@SafeTipView)
WebModularServiceUtils.getUserRouter().setTrendsSafeTip(true) WebModularServiceUtils.getUserService().setTrendsSafeTip(true)
} }
tvTip.setOnClickListener { tvTip.setOnClickListener {
WebModularServiceUtils.getUserRouter().privacyIntent(context as Activity) WebModularServiceUtils.getUserService().privacyIntent(context as Activity)
} }
} }
fun updateVisibility() { fun updateVisibility() {
if (WebModularServiceUtils.getUserRouter().safeTipViewGone()) { if (WebModularServiceUtils.getUserService().safeTipViewGone()) {
this.visibility = View.GONE this.visibility = View.GONE
} else { } else {
this.visibility = View.VISIBLE this.visibility = View.VISIBLE
......
...@@ -3,8 +3,6 @@ package com.ydl.webview ...@@ -3,8 +3,6 @@ package com.ydl.webview
import android.app.Activity import android.app.Activity
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.yidianling.router.RouterManager
import com.yidianling.router.user.IUserRouter
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
/** /**
...@@ -14,10 +12,6 @@ import com.yidianling.user.api.service.IUserService ...@@ -14,10 +12,6 @@ import com.yidianling.user.api.service.IUserService
class WebModularServiceUtils { class WebModularServiceUtils {
companion object { companion object {
fun getUserRouter(): IUserRouter {
return RouterManager.getUserRouter()!!
}
fun getUserService(): IUserService { fun getUserService(): IUserService {
return ModularServiceManager.provide(IUserService::class.java) 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