Skip to content

Commit 2cb4839

Browse files
AriesHooAriesHoo
AriesHoo
authored and
AriesHoo
committed
1、升级BaseRecyclerViewAdapterHelper到3.x--升级变动较大主要是BaseRecyclerViewAdapterHelper包名及部分api调整参考demo
2、升级SmartRefreshLayout到2.x-升级变动较大主要是包名及api变动及拆分了不同的刷新头和脚 3、日常升级其它三方库版本不涉及包名及api变更 4、修改网络例子模型
1 parent fe87845 commit 2cb4839

34 files changed

+190
-301
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
[wiki](https://github.com/AriesHoo/FastLib/wiki) 基于**FastLib 2.2.12****Android Studio 3.3.1****Gradle 4.10.1**版本编写,后期重大变更会同步更新。
2424

25-
Demo中使用到的网络请求api来源于[豆瓣API V2](https://developers.douban.com/wiki/?title=api_v2) **版权及最终解释权归d豆瓣所有,如有侵权请联系删除!**
25+
Demo中使用到的网络请求api来源于[readhub](https://readhub.cn/) **版权及最终解释权归readhub所有,如有侵权请联系删除!**
2626

2727
## 主要功能
2828

@@ -50,13 +50,17 @@ Demo中使用到的网络请求api来源于[豆瓣API V2](https://developers.dou
5050

5151
2、**2.2.13_beta12以下版本**可参考[proguard-rules.pro](/library/proguard-rules.pro)
5252

53-
## 重大更新日志 其它版本参看[Release](https://github.com/AriesHoo/FastLib/releases)
54-
55-
5653
## 关于模板项目template
5754

5855
伴随新版本 2.3.6 发布,项目增加一个模板项目 template 以完成基础配置,开发者可直接在此项目上进行开发方便。
56+
57+
## 重大更新日志 其它版本参看[Release](https://github.com/AriesHoo/FastLib/releases)
58+
59+
* 2.4.0
5960

61+
* 升级: 升级BaseRecyclerViewAdapterHelper到3.x--升级变动较大主要是BaseRecyclerViewAdapterHelper包名及部分api调整参考demo
62+
* 升级: 升级SmartRefreshLayout到2.x-升级变动较大主要是包名及api变动及拆分了不同的刷新头和脚
63+
* 升级: 日常升级其它三方库版本不涉及包名及api变更
6064

6165
* 2.3.2
6266

apk/sample.apk

1.53 MB
Binary file not shown.

app/build.gradle

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,17 @@ android {
7373
force 'com.squareup.okhttp3:logging-interceptor:3.12.2'
7474
force 'io.reactivex.rxjava2:rxjava:2.2.19'
7575
force 'androidx.appcompat:appcompat:'.concat(supportVersion)
76+
force 'com.google.android.material:material:'.concat(supportVersion)
77+
force 'androidx.appcompat:appcompat:'.concat(supportVersion)
78+
force 'androidx.recyclerview:recyclerview:'.concat(supportVersion)
7679
}
7780
}
7881
}
7982

8083
dependencies {
8184
implementation fileTree(include: ['*.jar'], dir: 'libs')
8285
implementation project(':library')
83-
// implementation 'com.github.AriesHoo:FastLib:2.3.5'
86+
//implementation 'com.github.AriesHoo:FastLib:2.4.0'
8487
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
8588
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
8689
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
@@ -90,28 +93,29 @@ dependencies {
9093
implementation 'androidx.appcompat:appcompat:'.concat(supportVersion)
9194
implementation 'androidx.recyclerview:recyclerview:'.concat(supportVersion)
9295
//快速Tab库-继承FastMainActivity使用
93-
implementation "com.github.AriesHoo.UIWidget:tab-layout:$rootProject.widgetVersion"
96+
implementation "com.github.AriesHoo.UIWidget:tab-layout:".concat(widgetVersion)
9497
//滑动返回Activity-鉴于现在全面屏比较多不推荐使用该库
9598
implementation 'cn.bingoogolapple:bga-swipebacklayout:2.0.1@aar'
9699
//页面事件交互-androideventbus-停止维护-按需导入
97100
// implementation 'org.simple:androideventbus:1.0.5.1'
98101
//页面事件交互-eventbus-按需导入
99102
// implementation 'org.greenrobot:eventbus:3.1.1'
100103
//万能适配器--一般都需要吧
101-
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
104+
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:'.concat(BRVAHVersion)
102105
//webView库 继承FastWebActivity需要,不需要内置WebView可以不implementation
103-
implementation 'com.just.agentweb:agentweb:4.1.2'
106+
implementation 'com.just.agentweb:agentweb:'.concat(agentwebVersion)
104107
//webView提供下载功能
105-
implementation 'com.download.library:Downloader:4.1.2'
108+
implementation 'com.download.library:Downloader:'.concat(agentwebVersion)
106109
//下拉刷新库注意刷新头SmartRefreshHeader版本最好对应尤其头版本不要低于SmartRefreshLayout版本
107-
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-14'
110+
implementation 'com.scwang.smart:refresh-layout-kernel:'.concat(smartRefreshLayoutVersion)
111+
implementation 'com.scwang.smart:refresh-header-material:'.concat(smartRefreshLayoutVersion)
112+
implementation 'com.scwang.smart:refresh-header-classics:'.concat(smartRefreshLayoutVersion)
108113
//Glide图片加载
109-
implementation 'com.github.bumptech.glide:glide:4.10.0'
110-
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
111-
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
114+
implementation 'com.github.bumptech.glide:glide:'.concat(glideVersion)
115+
annotationProcessor 'com.github.bumptech.glide:compiler:'.concat(glideVersion)
116+
annotationProcessor 'com.jakewharton:butterknife-compiler:'.concat(butterknifeVersion)
112117
//以上库FastLib里使用compileOnly只是编译,使用时需根据项目选择相应版本
113118
implementation 'cn.bingoogolapple:bga-banner:2.1.7@aar'
114-
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-14'
115119
implementation 'com.github.lygttpod:SuperTextView:2.1.8'
116120
implementation 'com.flyco.labelview:FlycoLabelView_Lib:1.0.2@aar'
117121
//文件选择器

app/src/main/java/com/aries/library/fast/demo/adapter/ReadArticleAdapter.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
import com.flyco.labelview.LabelView;
1616

1717
/**
18-
* @Author: AriesHoo on 2018/8/10 9:53
18+
* @Author: AriesHoo on 2021/4/6 9:53
1919
* @E-Mail: AriesHoo@126.com
20-
* Function:
20+
* Function: 新闻资讯适配器
2121
* Description:
2222
*/
2323
public class ReadArticleAdapter extends BaseItemTouchQuickAdapter<ReadArticleItemEntity, BaseItemTouchViewHolder> implements LoadMoreModule {
@@ -31,7 +31,6 @@ public ReadArticleAdapter(boolean isShowTop) {
3131

3232
@Override
3333
protected void convert(BaseItemTouchViewHolder helper, ReadArticleItemEntity item) {
34-
LoggerManager.i("isShowTop", "isShowTop:" + isShowTop);
3534
helper.setText(R.id.tv_titleArticle, item.title)
3635
.setText(R.id.tv_summaryArticle, item.summary)
3736
.setText(R.id.tv_timeArticle, item.getTime());

app/src/main/java/com/aries/library/fast/demo/impl/AppImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
import com.chad.library.adapter.base.BaseQuickAdapter;
4242
import com.chad.library.adapter.base.animation.ScaleInAnimation;
4343
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView;
44-
import com.scwang.smartrefresh.header.MaterialHeader;
45-
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
46-
import com.scwang.smartrefresh.layout.api.RefreshHeader;
47-
import com.scwang.smartrefresh.layout.api.RefreshLayout;
44+
import com.scwang.smart.refresh.header.MaterialHeader;
45+
import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;
46+
import com.scwang.smart.refresh.layout.api.RefreshHeader;
47+
import com.scwang.smart.refresh.layout.api.RefreshLayout;
4848

4949
import io.reactivex.Observable;
5050
import me.bakumon.statuslayoutmanager.library.StatusLayoutManager;

app/src/main/java/com/aries/library/fast/demo/impl/HttpRequestControlImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import com.google.gson.JsonIOException;
1717
import com.google.gson.JsonParseException;
1818
import com.google.gson.JsonSyntaxException;
19-
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
20-
import com.scwang.smartrefresh.layout.constant.RefreshState;
19+
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
20+
import com.scwang.smart.refresh.layout.constant.RefreshState;
2121

2222
import java.net.ConnectException;
2323
import java.net.SocketException;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import com.aries.library.fast.demo.R;
88
import com.aries.ui.util.StatusBarUtil;
99
import com.aries.ui.view.title.TitleBarView;
10-
import com.scwang.smartrefresh.header.MaterialHeader;
11-
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
10+
import com.scwang.smart.refresh.header.MaterialHeader;
11+
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
1212

1313
/**
1414
* @Author: AriesHoo on 2019/4/24 13:41
@@ -26,7 +26,7 @@ public static void start(Context mActivity, String url) {
2626

2727
public static void start(Context mActivity, String url, int color) {
2828
mColor = color;
29-
start(mActivity, WebAppActivity.class, url);
29+
start(mActivity, WebAppActivity.class, url,true);
3030
}
3131

3232
@Override

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@
5353
import com.just.agentweb.MiddlewareWebChromeBase;
5454
import com.just.agentweb.VideoImpl;
5555
import com.just.agentweb.WebListenerManager;
56-
import com.scwang.smartrefresh.header.StoreHouseHeader;
57-
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
58-
import com.scwang.smartrefresh.layout.api.RefreshLayout;
56+
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
57+
import com.scwang.smart.refresh.layout.api.RefreshLayout;
5958

6059
import java.io.File;
6160

@@ -80,7 +79,7 @@ public static void start(Context mActivity, String url) {
8079

8180
public static void start(Context mActivity, String url, boolean isShowTitle) {
8281
mIsShowTitle = isShowTitle;
83-
start(mActivity, WebViewActivity.class, url);
82+
start(mActivity, WebViewActivity.class, url,true);
8483
}
8584

8685
@Override
@@ -240,15 +239,15 @@ public View getContentView() {
240239
return null;
241240
}
242241

243-
@Override
244-
public void setRefreshLayout(SmartRefreshLayout refreshLayout) {
245-
this.mRefreshLayout = refreshLayout;
246-
refreshLayout.setRefreshHeader(new StoreHouseHeader(mContext)
247-
.initWithString("FastLib Refresh")
248-
.setTextColor(ContextCompat.getColor(mContext, R.color.colorTextBlack)))
249-
.setPrimaryColorsId(R.color.transparent)
250-
.setEnableHeaderTranslationContent(true);
251-
}
242+
// @Override
243+
// public void setRefreshLayout(SmartRefreshLayout refreshLayout) {
244+
// this.mRefreshLayout = refreshLayout;
245+
// refreshLayout.setRefreshHeader(new StoreHouseHeader(mContext)
246+
// .initWithString("FastLib Refresh")
247+
// .setTextColor(ContextCompat.getColor(mContext, R.color.colorTextBlack)))
248+
// .setPrimaryColorsId(R.color.transparent)
249+
// .setEnableHeaderTranslationContent(true);
250+
// }
252251

253252
@Override
254253
public boolean setNavigationBar(Dialog dialog, NavigationViewHelper helper, View bottomView) {

app/src/main/java/com/aries/library/fast/demo/module/activity/ActivityFragment.java

Lines changed: 11 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@
3535
*/
3636
public class ActivityFragment extends FastTitleFragment {
3737

38-
@BindView(R.id.vp_contentFastLib) ViewPager vpContent;
38+
@BindView(R.id.vp_contentFastLib)
39+
ViewPager mVpContent;
3940
private List<Fragment> listFragment = new ArrayList<>();
40-
private SegmentTabLayout mSegmentTab;
4141
private SlidingTabLayout mSlidingTab;
42-
private View viewSliding;
43-
private View viewSegment;
44-
45-
private boolean isSliding = true;
42+
private View mViewSliding;
4643

4744
public static ActivityFragment newInstance() {
4845
Bundle args = new Bundle();
@@ -54,38 +51,16 @@ public static ActivityFragment newInstance() {
5451
@Override
5552
public void beforeSetContentView() {
5653
super.beforeSetContentView();
57-
LoggerManager.d(TAG, "refreshActivityTab:" + isSliding);
5854
}
5955

6056
@Override
6157
public void setTitleBar(TitleBarView titleBar) {
62-
isSliding = (boolean) SPUtil.get(mContext, SPConstant.SP_KEY_ACTIVITY_TAB_SLIDING, true);
63-
if (isSliding && viewSliding == null) {
64-
viewSliding = View.inflate(mContext, R.layout.layout_activity_sliding, null);
65-
mSlidingTab = viewSliding.findViewById(R.id.tabLayout_slidingActivity);
66-
} else if (!isSliding && viewSegment == null) {
67-
viewSegment = View.inflate(mContext, R.layout.layout_activity_segment, null);
68-
mSegmentTab = viewSegment.findViewById(R.id.tabLayout_segment);
69-
}
58+
mViewSliding = View.inflate(mContext, R.layout.layout_activity_sliding, null);
59+
mSlidingTab = mViewSliding.findViewById(R.id.tabLayout_slidingActivity);
7060
LinearLayout center = titleBar.getLinearLayout(Gravity.CENTER);
71-
if (isSliding) {
72-
if (center.indexOfChild(viewSliding) == -1) {
73-
titleBar.addCenterAction(titleBar.new ViewAction(viewSliding),
74-
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
75-
}
76-
viewSliding.setVisibility(View.VISIBLE);
77-
if (viewSegment != null) {
78-
viewSegment.setVisibility(View.GONE);
79-
}
80-
} else {
81-
if (center.indexOfChild(viewSegment) == -1) {
82-
titleBar.addCenterAction(titleBar.new ViewAction(viewSegment),
83-
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
84-
}
85-
viewSegment.setVisibility(View.VISIBLE);
86-
if (viewSliding != null) {
87-
viewSliding.setVisibility(View.GONE);
88-
}
61+
if (center.indexOfChild(mViewSliding) == -1) {
62+
titleBar.addCenterAction(titleBar.new ViewAction(mViewSliding),
63+
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
8964
}
9065
setTab();
9166
}
@@ -100,43 +75,17 @@ public int getContentLayout() {
10075
*/
10176
@Override
10277
public void initView(Bundle savedInstanceState) {
103-
// setTab();
104-
}
105-
106-
@Override
107-
public void loadData() {
108-
super.loadData();
109-
// setTab();
11078
}
11179

112-
// @Override
113-
// public void onConfigurationChanged(Configuration newConfig) {
114-
// super.onConfigurationChanged(newConfig);
115-
// if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
116-
// LoggerManager.d(TAG, "竖屏");
117-
// } else {
118-
// LoggerManager.d(TAG, "横屏");
119-
// }
120-
// setTab();
121-
// }
122-
12380
private void setTab() {
124-
isSliding = (boolean) SPUtil.get(mContext, SPConstant.SP_KEY_ACTIVITY_TAB_SLIDING, isSliding);
125-
vpContent.removeAllViews();
81+
mVpContent.removeAllViews();
12682
listFragment.clear();
12783

12884
listFragment.add(MovieBaseFragment.newInstance(ApiConstant.API_MOVIE_IN_THEATERS));
12985
listFragment.add(MovieBaseFragment.newInstance(ApiConstant.API_MOVIE_COMING_SOON));
13086
listFragment.add(MovieBaseFragment.newInstance(ApiConstant.API_MOVIE_TOP));
131-
if (isSliding) {
132-
TabLayoutManager.getInstance().setSlidingTabData(this, mSlidingTab, vpContent,
133-
getTitles(R.array.arrays_tab_activity), listFragment);
134-
} else {
135-
TabLayoutManager.getInstance().setSegmentTabData(this, mSegmentTab, vpContent,
136-
getResources().getStringArray(R.array.arrays_tab_activity), listFragment);
137-
}
138-
//SlidingTabLayout--需这样切换一下不然选中变粗没有效果不知是SlidingTabLayout BUG还是设置问题
139-
// mSlidingTab.setCurrentTab(1);
87+
TabLayoutManager.getInstance().setSlidingTabData(this, mSlidingTab, mVpContent,
88+
getTitles(R.array.arrays_tab_activity), listFragment);
14089
mSlidingTab.setCurrentTab(0);
14190
}
14291

@@ -151,12 +100,4 @@ protected void onVisibleChanged(boolean isVisibleToUser) {
151100
StatusBarUtil.setStatusBarLightMode(mContext);
152101
}
153102
}
154-
155-
// @Subscriber(mode = ThreadMode.MAIN, tag = EventConstant.EVENT_KEY_REFRESH_ACTIVITY_TAB)
156-
// public void refreshActivityTab(boolean isSliding) {
157-
// mIsFirstShow = true;
158-
// setTitleBar(mTitleBar);
159-
// setTab();
160-
// }
161-
162103
}

app/src/main/java/com/aries/library/fast/demo/module/article/ActicleBaseFragment.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
import me.bakumon.statuslayoutmanager.library.StatusLayoutManager;
3737

3838
/**
39-
* @Author: AriesHoo on 2018/8/10 10:14
39+
* @Author: AriesHoo on 2021/4/5 10:14
4040
* @E-Mail: AriesHoo@126.com
41-
* Function: 新闻列表示例
41+
* Function: 新闻资讯列表示例
4242
* Description:
4343
*/
4444
public class ActicleBaseFragment extends FastRefreshLoadFragment<ReadArticleItemEntity> {
@@ -143,7 +143,6 @@ public void loadData(int page) {
143143
public void _onNext(BaseReadArticleEntity entity) {
144144
mLastCursor = entity.getLastCursor();
145145
LoggerManager.i("url:" + mUrl + ";lastCursor:" + mLastCursor);
146-
mStatusManager.showSuccessLayout();
147146
FastManager.getInstance().getHttpRequestControl().httpRequestSuccess(getIHttpRequestControl(), entity == null || entity.data == null ? new ArrayList<>() : entity.data, null);
148147
}
149148
});

0 commit comments

Comments
 (0)