Commit 68f5d8a7 authored by yinjiacheng's avatar yinjiacheng

update SmartRefreshLayout初始化迁移到BGeneralBusiness组件

parent 57d39dc6
package com.yidian.shenghuoquan.bgeneralbusiness.app package com.yidian.shenghuoquan.bgeneralbusiness.app
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.layout.SmartRefreshLayout
import com.scwang.smart.refresh.layout.constant.SpinnerStyle
import com.yidian.bcommon.services.ZapServiceNameConstants import com.yidian.bcommon.services.ZapServiceNameConstants
import com.yidian.shenghuoquan.bgeneralbusiness.service.EncryptService import com.yidian.shenghuoquan.bgeneralbusiness.service.EncryptService
import com.yidian.shenghuoquan.bgeneralbusiness.service.GeneralAbilityService import com.yidian.shenghuoquan.bgeneralbusiness.service.GeneralAbilityService
...@@ -18,6 +22,7 @@ object BGeneralBusiness { ...@@ -18,6 +22,7 @@ object BGeneralBusiness {
*/ */
fun init() { fun init() {
initService() initService()
initSmartRefreshLayout()
} }
private fun initService() { private fun initService() {
...@@ -25,4 +30,25 @@ object BGeneralBusiness { ...@@ -25,4 +30,25 @@ object BGeneralBusiness {
Zap.addService(ZapServiceNameConstants.GeneralAbilityService, GeneralAbilityService()) Zap.addService(ZapServiceNameConstants.GeneralAbilityService, GeneralAbilityService())
Zap.addService(ZapServiceNameConstants.EncryptService, EncryptService()) Zap.addService(ZapServiceNameConstants.EncryptService, EncryptService())
} }
/**
* 设置刷新 默认的header和footer
*/
private fun initSmartRefreshLayout() {
//设置全局的Header构建器
SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
layout.setPrimaryColorsId(android.R.color.transparent)//全局设置主题颜色
ClassicsHeader(context) //指定为经典Header,默认是 贝塞尔雷达Header
}
//设置全局的Footer构建器
SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
layout.setEnableLoadMoreWhenContentNotFull(true) //内容不满一页时候启用加载更多
val footer = ClassicsFooter(context)
footer.setBackgroundResource(android.R.color.transparent)
footer.setDrawableSize(20f)
footer.spinnerStyle = SpinnerStyle.FixedBehind //设置为固定在背后模式
footer //指定为经典Footer,默认是 BallPulseFooter
}
}
} }
package com.yidian.shenghuoquan.bgeneralbusiness.app package com.yidian.shenghuoquan.bgeneralbusiness.app
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.layout.SmartRefreshLayout
import com.scwang.smart.refresh.layout.constant.SpinnerStyle
import com.yidian.bcommon.app.YdBaseApplication import com.yidian.bcommon.app.YdBaseApplication
import com.yidian.bcommon.services.ZapServiceNameConstants import com.yidian.bcommon.services.ZapServiceNameConstants
import com.yidian.news.util.ProcessUtil import com.yidian.news.util.ProcessUtil
...@@ -16,6 +20,7 @@ class BGeneralBusinessApplication : YdBaseApplication() { ...@@ -16,6 +20,7 @@ class BGeneralBusinessApplication : YdBaseApplication() {
super.onCreate() super.onCreate()
if (ProcessUtil.isMainProcess(this)) { if (ProcessUtil.isMainProcess(this)) {
initService() initService()
initSmartRefreshLayout()
} }
} }
...@@ -25,4 +30,24 @@ class BGeneralBusinessApplication : YdBaseApplication() { ...@@ -25,4 +30,24 @@ class BGeneralBusinessApplication : YdBaseApplication() {
Zap.addService(ZapServiceNameConstants.EncryptService, EncryptService()) Zap.addService(ZapServiceNameConstants.EncryptService, EncryptService())
} }
/**
* 设置刷新 默认的header和footer
*/
private fun initSmartRefreshLayout() {
//设置全局的Header构建器
SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
layout.setPrimaryColorsId(android.R.color.transparent)//全局设置主题颜色
ClassicsHeader(context) //指定为经典Header,默认是 贝塞尔雷达Header
}
//设置全局的Footer构建器
SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
layout.setEnableLoadMoreWhenContentNotFull(true) //内容不满一页时候启用加载更多
val footer = ClassicsFooter(context)
footer.setBackgroundResource(android.R.color.transparent)
footer.setDrawableSize(20f)
footer.spinnerStyle = SpinnerStyle.FixedBehind //设置为固定在背后模式
footer //指定为经典Footer,默认是 BallPulseFooter
}
}
} }
package com.yidian.shenghuoquan.broot package com.yidian.shenghuoquan.broot
import android.content.Context import android.content.Context
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.header.ClassicsHeader
import com.scwang.smart.refresh.layout.SmartRefreshLayout
import com.scwang.smart.refresh.layout.constant.SpinnerStyle
import com.yidian.bcommon.BuildConfig import com.yidian.bcommon.BuildConfig
import com.yidian.bcommon.constant.AppConfig import com.yidian.bcommon.constant.AppConfig
import com.yidian.bcommon.constant.GlobalConstants import com.yidian.bcommon.constant.GlobalConstants
...@@ -45,8 +41,6 @@ object BaseInitConfig { ...@@ -45,8 +41,6 @@ object BaseInitConfig {
initXBridManager(context) initXBridManager(context)
// 初始化App升级 // 初始化App升级
initAppUpgrade(context) initAppUpgrade(context)
// SmartRefresh
initSmartRefreshLayout()
// 调用延迟初始化 // 调用延迟初始化
ZapTicket(ZapServiceNameConstants.GeneralAbilityService).withAction(ZapServiceActionConstants.ActionLazyInit).ship() ZapTicket(ZapServiceNameConstants.GeneralAbilityService).withAction(ZapServiceActionConstants.ActionLazyInit).ship()
} }
...@@ -136,24 +130,4 @@ object BaseInitConfig { ...@@ -136,24 +130,4 @@ object BaseInitConfig {
}) })
} }
/**
* 设置刷新 默认的header和footer
*/
private fun initSmartRefreshLayout() {
//设置全局的Header构建器
SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
layout.setPrimaryColorsId(android.R.color.transparent)//全局设置主题颜色
ClassicsHeader(context) //指定为经典Header,默认是 贝塞尔雷达Header
}
//设置全局的Footer构建器
SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
layout.setEnableLoadMoreWhenContentNotFull(true) //内容不满一页时候启用加载更多
val footer = ClassicsFooter(context)
footer.setBackgroundResource(android.R.color.transparent)
footer.setDrawableSize(20f)
footer.spinnerStyle = SpinnerStyle.FixedBehind //设置为固定在背后模式
footer //指定为经典Footer,默认是 BallPulseFooter
}
}
} }
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