Skip to content

Commit 26e3905

Browse files
AriesHooAriesHoo
AriesHoo
authored and
AriesHoo
committed
1、完善FastMultiStatusView设置多状态布局方法
2、修改FastConfig设置全局加载更多脚布局及多状态布局方法
1 parent 88e040e commit 26e3905

17 files changed

+375
-110
lines changed

apk/sample.apk

16.2 KB
Binary file not shown.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
applicationId "com.aries.library.fast.demo"
1515
minSdkVersion ext.minSdkVersion
1616
targetSdkVersion ext.targetSdkVersion
17-
versionCode 215
18-
versionName "2.1.5"
17+
versionCode 216
18+
versionName "2.1.6-alpha"
1919
multiDexEnabled true
2020
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2121
buildConfigField "String", "BASE_URL", "\"https://api.douban.com/\""

app/src/main/java/com/aries/library/fast/demo/App.java

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,27 @@
22

33
import android.app.Application;
44
import android.content.Context;
5+
import android.content.pm.ActivityInfo;
56
import android.graphics.Color;
67
import android.os.Build;
78
import android.support.annotation.NonNull;
9+
import android.support.annotation.Nullable;
810

911
import com.aries.library.fast.FastConfig;
1012
import com.aries.library.fast.demo.helper.RefreshHeaderHelper;
1113
import com.aries.library.fast.entity.FastQuitConfigEntity;
1214
import com.aries.library.fast.entity.FastTitleConfigEntity;
15+
import com.aries.library.fast.i.IMultiStatusView;
1316
import com.aries.library.fast.i.LoadMoreFoot;
17+
import com.aries.library.fast.i.MultiStatusView;
1418
import com.aries.library.fast.manager.LoggerManager;
1519
import com.aries.library.fast.retrofit.FastRetrofit;
1620
import com.aries.library.fast.util.SizeUtil;
1721
import com.aries.library.fast.util.ToastUtil;
1822
import com.aries.library.fast.widget.FastLoadMoreView;
23+
import com.aries.library.fast.widget.FastMultiStatusView;
1924
import com.chad.library.adapter.base.BaseQuickAdapter;
2025
import com.chad.library.adapter.base.loadmore.LoadMoreView;
21-
import com.scwang.smartrefresh.header.DeliveryHeader;
2226
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreater;
2327
import com.scwang.smartrefresh.layout.api.RefreshHeader;
2428
import com.scwang.smartrefresh.layout.api.RefreshLayout;
@@ -61,14 +65,17 @@ public void onCreate() {
6165
//增加一个Header配置注意FastMultiUrl.BASE_URL_NAME_HEADER是必须后面"test"作为标记
6266
// FastMultiUrl里增加的拦截器才找得到对应的BaseUrl
6367

64-
//主页返回键是否退回桌面--程序后台
68+
//主页返回键是否退回桌面(程序后台)
6569
boolean isBackTask = false;
6670
//全局配置参数
67-
//推荐先获取library里默认标题栏TitleBarView配置再按需修改的模式 FastTitleConfigEntity
71+
//全局标题栏TitleBarView设置--推荐先获取library里默认标题栏TitleBarView配置再按需修改的模式 FastTitleConfigEntity
6872
FastTitleConfigEntity titleConfig = FastConfig.getInstance(mContext).getTitleConfig();
69-
//推荐先获取library里默认主页面点击返回键配置FastQuitConfigEntity配置再按需修改的模式 FastQuitConfigEntity
73+
//全局主页面返回键操作设置--推荐先获取library里默认主页面点击返回键配置FastQuitConfigEntity配置再按需修改的模式 FastQuitConfigEntity
7074
FastQuitConfigEntity quitConfig = FastConfig.getInstance(mContext).getQuitConfig();
71-
//推荐先获取library里默认主页面Tab参数配置FastTabConfigEntity配置再按需修改的模式 FastTabConfigEntity
75+
//全局列表Adapter加载更多View相关设置--推荐先获取library里默认参数配置FastLoadMoreView.Builder按需set属性后最终build
76+
FastLoadMoreView.Builder loadMoreViewBuilder = FastConfig.getInstance(mContext).getLoadMoreViewBuilder();
77+
//全局列表多状态布局设置--推荐先获取library里默认多布局参数配置FastMultiStatusView.Builder再按需set属性后最终build
78+
FastMultiStatusView.Builder multiStatusViewBuilder = FastConfig.getInstance(mContext).getMultiStatusViewBuilder();
7279
FastConfig.getInstance(mContext)
7380
// 设置全局TitleBarView-其它属性请查看getInstance默认设置
7481
.setTitleConfig(titleConfig
@@ -88,7 +95,7 @@ public void onCreate() {
8895
//设置退回桌面是否有一次提示setBackToTaskEnable(true)才有意义
8996
.setBackToTaskDelayEnable(isBackTask)
9097
.setQuitDelay(2000)
91-
.setQuitMessage(isBackTask ? mContext.getString(R.string.fast_back_home) : mContext.getString(R.string.fast_quit_app))
98+
.setQuitMessage(isBackTask ? mContext.getText(R.string.fast_back_home) : mContext.getText(R.string.fast_quit_app))
9299
.setSnackBarBackgroundColor(Color.argb(220, 0, 0, 0))
93100
.setSnackBarEnable(false)
94101
.setSnackBarMessageColor(Color.WHITE))
@@ -99,25 +106,21 @@ public void onCreate() {
99106
//设置Activity是否支持滑动返回-添加透明主题参考Demo样式;
100107
.setSwipeBackEnable(true, this)
101108
//设置Activity横竖屏模式
102-
// .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
109+
.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
103110
.setContentViewBackgroundResource(R.color.colorBackground)//设置Activity或Fragment根布局背景资源
104111
//设置Adapter加载更多视图--默认设置了FastLoadMoreView
105-
.setDefaultLoadMoreView(new LoadMoreFoot() {
112+
.setLoadMoreFoot(new LoadMoreFoot() {
113+
@Nullable
106114
@Override
107115
public LoadMoreView createDefaultLoadMoreView(BaseQuickAdapter adapter) {
108116
if (adapter != null) {
109117
//设置动画是否一直开启
110118
adapter.isFirstOnly(false);
119+
//设置动画
111120
adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
112121
}
113-
//方式一:设置FastLoadMoreView--以下为FastConfig里默认配置
114-
return new FastLoadMoreView.Builder()
115-
.setLoadTextColor(mContext.getResources().getColor(R.color.colorLoadMoreText))
116-
.setLoadTextSize(mContext.getResources().getDimensionPixelSize(R.dimen.dp_load_more_text_size))
117-
.setLoadingProgressColor(mContext.getResources().getColor(R.color.colorLoadMoreProgress))
118-
.setLoadingText(mContext.getText(R.string.fast_load_more_loading))
119-
.setLoadFailText(mContext.getText(R.string.fast_load_more_load_failed))
120-
.setLoadEndText(mContext.getText(R.string.fast_load_more_load_end))
122+
//方式一:设置FastLoadMoreView--可参考FastLoadMoreView.Builder相应set方法
123+
return loadMoreViewBuilder
121124
// //设置Loading 颜色-5.0以上有效
122125
// .setLoadingProgressColor(Color.MAGENTA)
123126
// //设置Loading drawable--会是Loading颜色失效
@@ -142,12 +145,20 @@ public LoadMoreView createDefaultLoadMoreView(BaseQuickAdapter adapter) {
142145
// return MyLoadMoreView();
143146
}
144147
})
148+
.setMultiStatusView(new MultiStatusView() {
149+
@NonNull
150+
@Override
151+
public IMultiStatusView createMultiStatusView() {
152+
//根据具体情况可设置更多属性具体请参考FastMultiStatusView.Builder里set方法
153+
return multiStatusViewBuilder
154+
.build();
155+
}
156+
})
145157
.setDefaultRefreshHeader(new DefaultRefreshHeaderCreater() {//设置SmartRefreshLayout刷新头-自定加载使用BaseRecyclerViewAdapterHelper
146158
@NonNull
147159
@Override
148160
public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
149161
layout.setEnableHeaderTranslationContent(false);
150-
layout.setRefreshHeader(new DeliveryHeader(mContext));
151162
return RefreshHeaderHelper.getInstance().getRefreshHeader(mContext);
152163
}
153164
});

app/src/main/java/com/aries/library/fast/demo/module/mine/ThirdLibraryActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void setTitleBar(TitleBarView titleBar) {
4545

4646
@Override
4747
public int getContentLayout() {
48-
return R.layout.fast_layout_title_multi_status_refresh_recycler;
48+
return R.layout.fast_layout_title_refresh_recycler;
4949
}
5050

5151
@Override

app/src/main/res/values/dimens.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<dimen name="dp_banner_point">8dp</dimen>
55

66
<dimen name="dp_margin_item">10dp</dimen>
7-
<dimen name="dp_elevation">2dp</dimen>
7+
<dimen name="dp_elevation">4dp</dimen>
88
<dimen name="dp_radius">3dp</dimen>
99

1010
<!--以下属性为lib设置默认属性,在app设置同名属性可覆盖lib效果-->
@@ -28,7 +28,7 @@
2828
<!--多状态布局icon与文字间距-->
2929
<dimen name="dp_multi_margin">12dp</dimen>
3030
<!--多状态布局icon宽高-->
31-
<dimen name="dp_multi_img_height">72dp</dimen>
31+
<dimen name="dp_multi_image_size">72dp</dimen>
3232

3333
<!--glide加载圆角图片占位图圆角弧度-->
3434
<dimen name="dp_placeholder_radius">2dp</dimen>

library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
defaultConfig {
99
minSdkVersion 15
1010
targetSdkVersion 25
11-
versionCode 215
12-
versionName "2.1.5"
11+
versionCode 216
12+
versionName "2.1.6-alpha"
1313
}
1414
buildTypes {
1515
release {

0 commit comments

Comments
 (0)