Skip to content

Commit

Permalink
- update copyright
Browse files Browse the repository at this point in the history
- [PageRefreshLayout.addData] 添加一个参数 isEmpty 用来判断是否显示空布局
- 更新StateLayout 1.0.12 修复ViewPager代码声明不显示问题
  • Loading branch information
liangjingkanji committed Jul 14, 2020
1 parent 1b3dd2a commit 44308e8
Show file tree
Hide file tree
Showing 148 changed files with 667 additions and 248 deletions.
12 changes: 8 additions & 4 deletions brv/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:drake
* Date:7/15/20 3:20 AM
*/

apply plugin: "com.android.library"

apply plugin: "kotlin-android"
Expand Down Expand Up @@ -42,12 +49,9 @@ dependencies {
androidTestImplementation "androidx.test.ext:junit:1.1.1"
androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0"


compileOnly "androidx.recyclerview:recyclerview:$rv_version"
// api 'com.github.liangjingkanji:RefreshLayout:1.0'
api 'com.scwang.smart:refresh-layout-kernel:2.0.0'
api "com.github.liangjingkanji:StateLayout:1.0.11"
api "com.github.liangjingkanji:StateLayout:1.0.12"
api 'com.scwang.smart:refresh-footer-classics:2.0.0'
api 'com.scwang.smart:refresh-header-material:2.0.0'

}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Nathan
* Date:8/24/19 2:35 AM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

/**
* Instrumented test, which will execute on an Android device.
Expand Down
7 changes: 3 additions & 4 deletions brv/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<!--
~ Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
~ Project:BRV
~ Author:Nathan
~ Date:8/24/19 2:34 AM
~ Author:drake
~ Date:7/15/20 3:20 AM
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drake.brv" />
<manifest package="com.drake.brv" />
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/BindingAdapter.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

@file:Suppress("PropertyName")
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/DefaultDecoration.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv
Expand Down
29 changes: 14 additions & 15 deletions brv/src/main/java/com/drake/brv/PageRefreshLayout.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv
Expand Down Expand Up @@ -57,7 +57,7 @@ open class PageRefreshLayout : SmartRefreshLayout, OnRefreshLoadMoreListener {
adapter: BindingAdapter,
holder: BindingAdapter.BindingViewHolder,
position: Int
) {
) {
if (mEnableLoadMore && !mFooterNoMoreData && preloadIndex != -1 && (adapter.itemCount - preloadIndex <= position)) {
post {
if (state == RefreshState.None) {
Expand Down Expand Up @@ -114,20 +114,20 @@ open class PageRefreshLayout : SmartRefreshLayout, OnRefreshLoadMoreListener {

try {
stateEnabled =
attributes.getBoolean(R.styleable.PageRefreshLayout_stateEnabled, stateEnabled)
attributes.getBoolean(R.styleable.PageRefreshLayout_stateEnabled, stateEnabled)

mEnableLoadMoreWhenContentNotFull = false
mEnableLoadMoreWhenContentNotFull = attributes.getBoolean(
R.styleable.SmartRefreshLayout_srlEnableLoadMoreWhenContentNotFull,
mEnableLoadMoreWhenContentNotFull
)
)

emptyLayout =
attributes.getResourceId(R.styleable.PageRefreshLayout_empty_layout, View.NO_ID)
attributes.getResourceId(R.styleable.PageRefreshLayout_empty_layout, View.NO_ID)
errorLayout =
attributes.getResourceId(R.styleable.PageRefreshLayout_error_layout, View.NO_ID)
attributes.getResourceId(R.styleable.PageRefreshLayout_error_layout, View.NO_ID)
loadingLayout =
attributes.getResourceId(R.styleable.PageRefreshLayout_loading_layout, View.NO_ID)
attributes.getResourceId(R.styleable.PageRefreshLayout_loading_layout, View.NO_ID)
} finally {
attributes.recycle()
}
Expand Down Expand Up @@ -202,25 +202,24 @@ open class PageRefreshLayout : SmartRefreshLayout, OnRefreshLoadMoreListener {
* 直接接受数据, 自动判断当前属于下拉刷新还是上拉加载更多
*
* @param data 数据集
* @param hasMore 在函数参数中返回布尔类型来判断是否存在更多页
* @param hasMore 在函数参数中返回布尔类型来判断是否还存在下一页数据, 默认值true表示始终存在
* @param isEmpty 返回true表示数据为空, 将显示缺省页 -> 空布局, 默认以[data.isNullOrEmpty()]则为空
*/
fun addData(data: List<Any?>?, hasMore: BindingAdapter.() -> Boolean = { true }) {
fun addData(data: List<Any?>?,
hasMore: BindingAdapter.() -> Boolean = { true },
isEmpty: () -> Boolean = { data.isNullOrEmpty() }) {

val rv = contentView as? RecyclerView
?: throw UnsupportedOperationException("PageRefreshLayout require content RecyclerView")


val adapter = rv.adapter as? BindingAdapter
?: throw UnsupportedOperationException("RecyclerView require use BindingAdapter")

val isRefreshState = state == RefreshState.Refreshing

if (isRefreshState) {
adapter.models = data
if (data.isNullOrEmpty()) {
showEmpty()
return
}
if (isEmpty()) return
} else {
adapter.addModels(data)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.animation
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/animation/ItemAnimation.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.animation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.animation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.animation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.animation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.animation
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/annotaion/AnimationType.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.annotaion
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/annotaion/DragType.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.annotaion
Expand Down
7 changes: 7 additions & 0 deletions brv/src/main/java/com/drake/brv/annotaion/Orientation.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.annotaion

enum class Orientation {
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/annotaion/SwipeType.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.annotaion
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/binding/ObservableIml.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/item/ItemBind.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/9/20 1:07 AM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.item
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/item/ItemExpand.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.item
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/item/ItemHover.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.item
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/item/ItemPosition.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.item
Expand Down
4 changes: 2 additions & 2 deletions brv/src/main/java/com/drake/brv/item/ItemTouchable.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.item
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.layoutmanager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.layoutmanager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.layoutmanager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (C) 2018, Umbrella CompanyLimited All rights reserved.
* Project:BRV
* Author:Drake
* Date:5/5/20 9:12 PM
* Author:drake
* Date:7/15/20 3:20 AM
*/

package com.drake.brv.listener
Expand Down
Loading

0 comments on commit 44308e8

Please sign in to comment.