Commit 77266238 by 徐健
parents bef23df6 a22ecff5
......@@ -165,7 +165,7 @@ dependencies {
kapt rootProject.ext.dependencies["butterknife-compiler"]
if (rootProject.ext.dev_mode) {
if (true) {
//开发模式
api project(':m-user')
api project(':m-fm')
......@@ -174,7 +174,7 @@ dependencies {
api (project(':ydl-platform')){
transitive = true
}
// implementation project(':ydl-webview')
implementation project(':ydl-webview')
implementation project(':ydl-media')
} else {
//发布模式
......
......@@ -33,9 +33,18 @@ import kotlinx.android.synthetic.main.activity_main.*
*/
class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(),
DemoContract.View {
private var serviceConnection: ServiceConnection? = null
protected var playService: PlayService? = null
override fun getContentViewId(): Int {
return R.id.lce_content_view
}
override fun getStateViewId(): Int {
return R.id.lce_state_view
}
override fun setData(data: String) {
tv_content.text = data
}
......@@ -50,10 +59,10 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun initDataAndEvent() {
bindService()
loadData()
reLoadData()
requestPermission()
tv_user.setOnClickListener {
loadData()
reLoadData()
}
tv_home.setOnClickListener {
......@@ -111,7 +120,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
override fun loadData() {
override fun reLoadData() {
mPresenter?.loadUsers()
}
......
......@@ -6,6 +6,14 @@ import com.ydl.component.mvp.DemoPresenter
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
class MusicPlayActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(), DemoContract.View {
override fun getContentViewId(): Int {
return R.id.lce_content_view
}
override fun getStateViewId(): Int {
return R.id.lce_state_view
}
private var mPlayFragment: PlayFragment? = null
override fun createPresenter(): DemoContract.Presenter {
......@@ -17,10 +25,10 @@ class MusicPlayActivity : BaseLceActivity<DemoContract.View, DemoContract.Prese
}
override fun initDataAndEvent() {
loadData()
reLoadData()
}
override fun loadData() {
override fun reLoadData() {
mPresenter.loadFmMusic()
}
......
......@@ -18,7 +18,8 @@ import io.reactivex.Observable
class DemoModel : BaseModel(), DemoContract.Model {
override fun getFmMusic(): Observable<HomeFMBean> {
return YDLHttpUtils.obtainApi(DemoService::class.java)
.getFMData().compose(RxUtils.resultJavaData())
.getFMData()
.compose(RxUtils.resultJavaData())
}
......
......@@ -24,18 +24,15 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
}
override fun onSuccess(homeFMBean: HomeFMBean) {
// var jsonStirng = Gson().toJson(homeFMBean.list)
// val list = Gson().fromJson<ArrayList<Music>>(jsonStirng, object : TypeToken<ArrayList<Music>>() {}.type)
homeFMBean.list?.let {
AudioPlayer.get().addPlayList(stringToMusicPlayerList(it))
mView.setData("")
}
}
})
}
override fun loadHome() = mModel!!.getHome()
override fun loadHome() = mModel.getHome()
.compose(RxUtils.applySchedulers(mView))
.subscribe(object : CommonObserver<JsonObject>() {
override fun onError(errorMsg: String) {
......@@ -43,11 +40,11 @@ class DemoPresenter : BasePresenter<DemoContract.View,DemoContract.Model>(),
override fun onSuccess(users: JsonObject) {
var cateTitle = users.getAsJsonObject("data").getAsJsonArray("askCategoryData").get(0).asJsonObject.get("cateTitle").asString;
mView?.setData(cateTitle)
mView.setData(cateTitle)
}
})
override fun loadUsers() = mModel!!.getUser()
override fun loadUsers() = mModel.getUser()
.compose(RxUtils.applySchedulers(mView))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.subscribe(object : CommonObserver<JsonArray>() {
override fun onError(errorMsg: String) {
......
......@@ -172,7 +172,7 @@ ext {
//Modular Api
"ydl-user-router" : 'com.ydl:router:1.0.0-SNAPSHOT@aar',
"ydl-platform" : 'com.ydl:ydl-platform:0.0.10@aar',
"ydl-platform" : 'com.ydl:ydl-platform:0.0.12@aar',
"ydl-m-user-api" : 'com.ydl:m-user-api:0.0.5',
"ydl-webview" : 'com.ydl:ydl-webview:0.0.14@aar',
"ydl-m-muse-api" : 'com.ydl:m-muse-api:0.0.1@aar',
......
......@@ -8,14 +8,14 @@ modular {
groupId = "com.ydl"
artifactId = "m-consultant-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = "0.0.11"
version = "0.0.13"
}
ydl{
groupId = "com.ydl"
artifactId = "m-consultant-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = "0.0.11"
version = "0.0.13"
}
}
......
......@@ -14,7 +14,7 @@ import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.DisplayUtils
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import com.yidianling.common.tools.LogUtil
......
......@@ -20,7 +20,7 @@ import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.view.listener.EndlessRecyclerViewScrollListener
import com.yidianling.common.tools.ToastUtil
import com.yidianling.router.RouterManager
......
......@@ -8,14 +8,14 @@ modular {
groupId = "com.ydl"
artifactId = "m-user-module-xlzx"
// 上报的 心理咨询 业务模块 aar 包的版本号
version = "0.0.19"
version = "0.0.21"
}
ydl{
groupId = "com.ydl"
artifactId = "m-user-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = "0.0.19"
version = "0.0.21"
}
}
......
......@@ -8,7 +8,7 @@ import android.view.View;
import com.ydl.ydlcommon.base.BaseMvpActivity;
import com.ydl.ydlcommon.data.http.EncryptUtils;
import com.ydl.ydlcommon.utils.ActivityManager;
import com.ydl.ydlcommon.utils.UMEventUtils;
import com.ydl.ydlcommon.utils.log.LogHelper;
import com.ydl.ydlcommon.utils.remind.ToastHelper;
import com.ydl.ydlcommon.view.DeleteEditTextView;
......
......@@ -11,7 +11,7 @@ import android.view.animation.AnimationUtils
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxKeyboardTool
......
......@@ -28,7 +28,7 @@ import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.actionutil.BIConstants
......
......@@ -10,7 +10,7 @@ import android.view.View
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.actionutil.BIConstants
......
......@@ -5,7 +5,7 @@ import android.text.TextUtils
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
......
......@@ -6,7 +6,7 @@ import android.text.TextUtils
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
......
......@@ -2,7 +2,7 @@ package com.yidianling.user.ui.login.presenter
import android.text.TextUtils
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
......
......@@ -16,7 +16,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import com.yidianling.user.R;
import com.ydl.ydlcommon.utils.UMEventUtils;
import java.util.ArrayList;
import java.util.List;
......
IS_PUBLISH=true
VERSION_NAME=0.0.10
\ No newline at end of file
VERSION_NAME=0.0.12
\ No newline at end of file
......@@ -86,6 +86,7 @@ object RxUtils {
/**
* RxJava 线程协调 / RxLifecycle绑定方法
* 自动调用 showLoading/hideLoading 方法
* @param view LceView 强转使用
*/
fun <T> applySchedulers(view: ILceView): ObservableTransformer<T, T> {
......
......@@ -2,7 +2,6 @@ package com.ydl.ydlcommon.mvp.lce
import android.support.annotation.CallSuper
import android.view.View
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
......@@ -13,34 +12,28 @@ import com.ydl.ydlcommon.mvp.lce.view.ILceViewState
* Des: LCE 架构 BaseActivity,统一处理页面加载状态
* LCE:L:Loading加载,C:Content加载内容,E:Error加载失败
*
* 【注意:StateView需设置id为:R.id.lce_state_view】
* 【注意:ContentView需设置id为:R.id.lce_content_view】
* 【注意:StateView需继承 ILceViewState 接口】
*/
abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V, P>(), ILceView{
abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V, P>(), ILceView {
protected lateinit var lceStateView: ILceViewState
protected var lceContentView: View? = null
private var lceStateView: ILceViewState? = null
private var lceContentView: View? = null
@CallSuper
override fun onContentChanged() {
super.onContentChanged()
lceStateView = createStateView()
lceContentView = createContentView()
if (lceContentView == null) {
throw NullPointerException(
"请检查布局文件中ContentView是否设置,id需为R.id.lce_content_view"
)
}
}
protected fun createStateView(): ILceViewState {
val stateView = findViewById<View>(R.id.lce_state_view)
if (stateView is ILceViewState) {
private fun createStateView(): ILceViewState {
val stateView:View? = findViewById<View>(getStateViewId())
if (stateView != null && stateView is ILceViewState) {
val viewState = stateView as ILceViewState
viewState.setListener(object : ILceViewState.LogoLoadingListener {
override fun onDataResetClick() {
loadData()
reLoadData()
}
override fun onBackClick() {
......@@ -51,33 +44,48 @@ abstract class BaseLceActivity<V : IView, P : IPresenter<V>> : BaseMvpActivity<V
}
throw NullPointerException(
"请检查布局文件中StateView是否设置,id需为R.id.lce_state_view"
"请检查布局文件中 StateView 是否设置,StateView 需继承 ILceViewState 接口 , className:${this.javaClass.simpleName}"
)
}
protected fun createContentView(): View {
return findViewById(R.id.lce_content_view)
private fun createContentView(): View {
val contentView: View? = findViewById<View>(getContentViewId())
?: throw NullPointerException(
"请检查布局文件中 ContentView 是否设置 , className:${this.javaClass.simpleName}"
)
return contentView!!
}
/**
* 获取 ContentView 控件ID
*/
abstract fun getContentViewId(): Int
/**
* 获取 StateVie 控件 ID
*/
abstract fun getStateViewId(): Int
override fun showLoading() {
lceStateView.showLoading()
lceStateView?.showLoading()
lceContentView?.visibility = View.INVISIBLE
}
override fun hideLoading() {
lceStateView.hideLoading()
}
override fun showContent() {
lceContentView?.visibility = View.VISIBLE
lceStateView.hideLoading()
lceStateView?.hideLoading()
}
override fun showEmpty(msg: String) {
lceStateView.showEmpty(msg)
lceContentView?.visibility = View.INVISIBLE
lceStateView?.showEmpty(msg)
}
override fun showError(msg: String) {
lceStateView.showError(msg)
lceContentView?.visibility = View.INVISIBLE
lceStateView?.showError(msg)
}
}
......
......@@ -4,7 +4,6 @@ import android.os.Bundle
import android.support.annotation.CallSuper
import android.support.v4.app.FragmentActivity
import android.view.View
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseMvpDialogFragment
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
......@@ -21,30 +20,23 @@ import java.util.*
*/
abstract class BaseLceDialogFragment<V : IView, P : IPresenter<V>> : BaseMvpDialogFragment<V, P>(), ILceView {
protected var lceStateView: ILceViewState? = null
protected var lceContentView: View? = null
private var lceStateView: ILceViewState? = null
private var lceContentView: View? = null
@CallSuper
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
lceStateView = createStateView(view)
lceContentView = createContentView(view)
if (lceContentView == null) {
throw NullPointerException(
"请检查布局文件中ContentView是否设置,id需为R.id.lce_content_view"
)
}
}
protected fun createStateView(view: View): ILceViewState {
val stateView = view.findViewById<View>(R.id.lce_state_view)
if (stateView is ILceViewState) {
private fun createStateView(view: View): ILceViewState {
val stateView:View? = view.findViewById<View>(getStateViewId())
if (stateView != null && stateView is ILceViewState) {
val viewState = stateView as ILceViewState
viewState.setListener(object : ILceViewState.LogoLoadingListener {
override fun onDataResetClick() {
loadData()
reLoadData()
}
override fun onBackClick() {
......@@ -55,34 +47,48 @@ abstract class BaseLceDialogFragment<V : IView, P : IPresenter<V>> : BaseMvpDial
}
throw NullPointerException(
"请检查布局文件中StateView是否设置,id需为R.id.lce_state_view"
"请检查布局文件中 StateView 是否设置,StateView 需继承 ILceViewState 接口 , className:${this.javaClass.simpleName}"
)
}
private fun createContentView(view: View): View {
val contentView: View? = view.findViewById<View>(getContentViewId())
?: throw NullPointerException(
"请检查布局文件中 ContentView 是否设置 , className:${this.javaClass.simpleName}"
)
protected fun createContentView(view: View): View {
return view.findViewById(R.id.lce_content_view)
return contentView!!
}
/**
* 获取 ContentView 控件ID
*/
abstract fun getContentViewId(): Int
/**
* 获取 StateVie 控件 ID
*/
abstract fun getStateViewId(): Int
override fun showLoading() {
lceStateView!!.showLoading()
lceStateView?.showLoading()
lceContentView?.visibility = View.INVISIBLE
}
override fun hideLoading() {
lceStateView!!.hideLoading()
}
override fun showContent() {
lceContentView?.visibility = View.VISIBLE
lceStateView!!.hideLoading()
lceStateView?.hideLoading()
}
override fun showEmpty(msg: String) {
lceStateView!!.showEmpty(msg)
lceContentView?.visibility = View.INVISIBLE
lceStateView?.showEmpty(msg)
}
override fun showError(msg: String) {
lceStateView!!.showError(msg)
lceContentView?.visibility = View.INVISIBLE
lceStateView?.showError(msg)
}
override fun onDestroyView() {
......
......@@ -4,7 +4,6 @@ import android.os.Bundle
import android.support.annotation.CallSuper
import android.support.v4.app.FragmentActivity
import android.view.View
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
......@@ -20,8 +19,8 @@ import java.util.*
*/
abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<V, P>(), ILceView {
protected var lceStateView: ILceViewState? = null
protected var lceContentView: View? = null
private var lceStateView: ILceViewState? = null
private var lceContentView: View? = null
@CallSuper
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
......@@ -37,13 +36,13 @@ abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<
}
protected fun createStateView(view: View): ILceViewState {
val stateView = view.findViewById<View>(R.id.lce_state_view)
if (stateView is ILceViewState) {
private fun createStateView(view: View): ILceViewState {
val stateView:View? = view.findViewById<View>(getStateViewId())
if (stateView != null && stateView is ILceViewState) {
val viewState = stateView as ILceViewState
viewState.setListener(object : ILceViewState.LogoLoadingListener {
override fun onDataResetClick() {
loadData()
reLoadData()
}
override fun onBackClick() {
......@@ -54,34 +53,48 @@ abstract class BaseLceFragment< V : IView, P : IPresenter<V>> : BaseMvpFragment<
}
throw NullPointerException(
"请检查布局文件中StateView是否设置,id需为R.id.lce_state_view"
"请检查布局文件中 StateView 是否设置,StateView 需继承 ILceViewState 接口 , className:${this.javaClass.simpleName}"
)
}
private fun createContentView(view: View): View {
val contentView: View? = view.findViewById<View>(getContentViewId())
?: throw NullPointerException(
"请检查布局文件中 ContentView 是否设置 , className:${this.javaClass.simpleName}"
)
protected fun createContentView(view: View): View {
return view.findViewById(R.id.lce_content_view)
return contentView!!
}
/**
* 获取 ContentView 控件ID
*/
abstract fun getContentViewId(): Int
/**
* 获取 StateVie 控件 ID
*/
abstract fun getStateViewId(): Int
override fun showLoading() {
lceStateView!!.showLoading()
lceStateView?.showLoading()
lceContentView?.visibility = View.INVISIBLE
}
override fun hideLoading() {
lceStateView!!.hideLoading()
}
override fun showContent() {
lceContentView?.visibility = View.VISIBLE
lceStateView!!.hideLoading()
lceStateView?.hideLoading()
}
override fun showEmpty(msg: String) {
lceStateView!!.showEmpty(msg)
lceContentView?.visibility = View.INVISIBLE
lceStateView?.showEmpty(msg)
}
override fun showError(msg: String) {
lceStateView!!.showError(msg)
lceContentView?.visibility = View.INVISIBLE
lceStateView?.showError(msg)
}
override fun onDestroyView() {
......
......@@ -16,15 +16,12 @@ interface ILceView : IView{
fun hideLoading()
@UiThread
fun showContent()
@UiThread
fun showError(msg: String)
@UiThread
fun showEmpty(msg: String)
@UiThread
fun loadData()
fun reLoadData()
}
package com.ydl.ydlcommon.utils;
import android.content.Context;
import com.ydl.ydl_router.provider.YDLRouterBurryPointProvider;
/**
* Created by Wi1ls on 2016/11/11;
*/
//@Route(path = "/burry/point")
public class UMEventUtils implements YDLRouterBurryPointProvider{
@Override
public void init(Context context) {
}
@Override
public void burryPoint(String s, String s1) {
}
}
......@@ -10,7 +10,7 @@ import android.view.View
import android.widget.LinearLayout
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.ydl.ydlcommon.utils.UMEventUtils
import kotlinx.android.synthetic.main.web_ui_private_safe_hint.view.*
......
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