Commit 7de0d978 authored by shiyl's avatar shiyl

添加上拉加载下拉刷新库的经典样式

parent 81157f18
......@@ -2,11 +2,40 @@ package com.yidian.common
import android.app.Activity
import android.app.Application
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
open class YdBaseApplication: Application(){
companion object{
lateinit var context: Application
var activityList = ArrayList<Activity>()
open class YdBaseApplication : Application() {
companion object {
lateinit var context: Application
var activityList = ArrayList<Activity>()
}
override fun onCreate() {
super.onCreate()
initSmartRefreshLayout()
}
/**
* 设置刷新 默认的header和footer
*/
private fun initSmartRefreshLayout() {
//设置全局的Header构建器
SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
layout.setPrimaryColorsId(R.color.white)//全局设置主题颜色
ClassicsHeader(context) //指定为经典Header,默认是 贝塞尔雷达Header
}
//设置全局的Footer构建器
SmartRefreshLayout.setDefaultRefreshFooterCreator { context, layout ->
layout.setEnableLoadMoreWhenContentNotFull(true) //内容不满一页时候启用加载更多
val footer = ClassicsFooter(context)
footer.setBackgroundResource(R.color.white)
footer.setDrawableSize(20f)
footer.spinnerStyle = SpinnerStyle.FixedBehind //设置为固定在背后模式
footer //指定为经典Footer,默认是 BallPulseFooter
}
}
}
\ No newline at end of file
}
......@@ -27,9 +27,11 @@ ext.dependencies = [
'androidx.constraintlayout:constraintlayout:2.0.4',
'jp.co.cyberagent.android:gpuimage:2.1.0',
'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9',
// 刷新
'com.scwang.smart:refresh-layout-kernel:2.0.1',
'com.scwang.smart:refresh-header-classics:2.0.1',
'com.scwang.smart:refresh-footer-classics:2.0.1',
"androidx.recyclerview:recyclerview:1.1.0",
'de.hdodenhof:circleimageview:3.1.0',
'com.github.chrisbanes:PhotoView:2.3.0',
......
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