Skip to content

Commit

Permalink
1、升级BaseRecyclerViewAdapterHelper到3.x--升级变动较大主要是BaseRecyclerViewAdapt…
Browse files Browse the repository at this point in the history
…erHelper包名及部分api调整参考demo

2、升级SmartRefreshLayout到2.x-升级变动较大主要是包名及api变动及拆分了不同的刷新头和脚
3、日常升级其它三方库版本不涉及包名及api变更
4、修改网络例子模型
  • Loading branch information
AriesHoo committed Apr 6, 2021
1 parent fe87845 commit 2cb4839
Show file tree
Hide file tree
Showing 34 changed files with 190 additions and 301 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

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

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

## 主要功能

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

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

## 重大更新日志 其它版本参看[Release](https://github.com/AriesHoo/FastLib/releases)


## 关于模板项目template

伴随新版本 2.3.6 发布,项目增加一个模板项目 template 以完成基础配置,开发者可直接在此项目上进行开发方便。

## 重大更新日志 其它版本参看[Release](https://github.com/AriesHoo/FastLib/releases)

* 2.4.0

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

* 2.3.2

Expand Down
Binary file modified apk/sample.apk
Binary file not shown.
24 changes: 14 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ android {
force 'com.squareup.okhttp3:logging-interceptor:3.12.2'
force 'io.reactivex.rxjava2:rxjava:2.2.19'
force 'androidx.appcompat:appcompat:'.concat(supportVersion)
force 'com.google.android.material:material:'.concat(supportVersion)
force 'androidx.appcompat:appcompat:'.concat(supportVersion)
force 'androidx.recyclerview:recyclerview:'.concat(supportVersion)
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':library')
// implementation 'com.github.AriesHoo:FastLib:2.3.5'
//implementation 'com.github.AriesHoo:FastLib:2.4.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
Expand All @@ -90,28 +93,29 @@ dependencies {
implementation 'androidx.appcompat:appcompat:'.concat(supportVersion)
implementation 'androidx.recyclerview:recyclerview:'.concat(supportVersion)
//快速Tab库-继承FastMainActivity使用
implementation "com.github.AriesHoo.UIWidget:tab-layout:$rootProject.widgetVersion"
implementation "com.github.AriesHoo.UIWidget:tab-layout:".concat(widgetVersion)
//滑动返回Activity-鉴于现在全面屏比较多不推荐使用该库
implementation 'cn.bingoogolapple:bga-swipebacklayout:2.0.1@aar'
//页面事件交互-androideventbus-停止维护-按需导入
// implementation 'org.simple:androideventbus:1.0.5.1'
//页面事件交互-eventbus-按需导入
// implementation 'org.greenrobot:eventbus:3.1.1'
//万能适配器--一般都需要吧
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:'.concat(BRVAHVersion)
//webView库 继承FastWebActivity需要,不需要内置WebView可以不implementation
implementation 'com.just.agentweb:agentweb:4.1.2'
implementation 'com.just.agentweb:agentweb:'.concat(agentwebVersion)
//webView提供下载功能
implementation 'com.download.library:Downloader:4.1.2'
implementation 'com.download.library:Downloader:'.concat(agentwebVersion)
//下拉刷新库注意刷新头SmartRefreshHeader版本最好对应尤其头版本不要低于SmartRefreshLayout版本
implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-14'
implementation 'com.scwang.smart:refresh-layout-kernel:'.concat(smartRefreshLayoutVersion)
implementation 'com.scwang.smart:refresh-header-material:'.concat(smartRefreshLayoutVersion)
implementation 'com.scwang.smart:refresh-header-classics:'.concat(smartRefreshLayoutVersion)
//Glide图片加载
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
implementation 'com.github.bumptech.glide:glide:'.concat(glideVersion)
annotationProcessor 'com.github.bumptech.glide:compiler:'.concat(glideVersion)
annotationProcessor 'com.jakewharton:butterknife-compiler:'.concat(butterknifeVersion)
//以上库FastLib里使用compileOnly只是编译,使用时需根据项目选择相应版本
implementation 'cn.bingoogolapple:bga-banner:2.1.7@aar'
implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-14'
implementation 'com.github.lygttpod:SuperTextView:2.1.8'
implementation 'com.flyco.labelview:FlycoLabelView_Lib:1.0.2@aar'
//文件选择器
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import com.flyco.labelview.LabelView;

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

@Override
protected void convert(BaseItemTouchViewHolder helper, ReadArticleItemEntity item) {
LoggerManager.i("isShowTop", "isShowTop:" + isShowTop);
helper.setText(R.id.tv_titleArticle, item.title)
.setText(R.id.tv_summaryArticle, item.summary)
.setText(R.id.tv_timeArticle, item.getTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.animation.ScaleInAnimation;
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.header.MaterialHeader;
import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;
import com.scwang.smart.refresh.layout.api.RefreshHeader;
import com.scwang.smart.refresh.layout.api.RefreshLayout;

import io.reactivex.Observable;
import me.bakumon.statuslayoutmanager.library.StatusLayoutManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import com.google.gson.JsonIOException;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.constant.RefreshState;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.constant.RefreshState;

import java.net.ConnectException;
import java.net.SocketException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import com.aries.library.fast.demo.R;
import com.aries.ui.util.StatusBarUtil;
import com.aries.ui.view.title.TitleBarView;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.header.MaterialHeader;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;

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

public static void start(Context mActivity, String url, int color) {
mColor = color;
start(mActivity, WebAppActivity.class, url);
start(mActivity, WebAppActivity.class, url,true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@
import com.just.agentweb.MiddlewareWebChromeBase;
import com.just.agentweb.VideoImpl;
import com.just.agentweb.WebListenerManager;
import com.scwang.smartrefresh.header.StoreHouseHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;

import java.io.File;

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

public static void start(Context mActivity, String url, boolean isShowTitle) {
mIsShowTitle = isShowTitle;
start(mActivity, WebViewActivity.class, url);
start(mActivity, WebViewActivity.class, url,true);
}

@Override
Expand Down Expand Up @@ -240,15 +239,15 @@ public View getContentView() {
return null;
}

@Override
public void setRefreshLayout(SmartRefreshLayout refreshLayout) {
this.mRefreshLayout = refreshLayout;
refreshLayout.setRefreshHeader(new StoreHouseHeader(mContext)
.initWithString("FastLib Refresh")
.setTextColor(ContextCompat.getColor(mContext, R.color.colorTextBlack)))
.setPrimaryColorsId(R.color.transparent)
.setEnableHeaderTranslationContent(true);
}
// @Override
// public void setRefreshLayout(SmartRefreshLayout refreshLayout) {
// this.mRefreshLayout = refreshLayout;
// refreshLayout.setRefreshHeader(new StoreHouseHeader(mContext)
// .initWithString("FastLib Refresh")
// .setTextColor(ContextCompat.getColor(mContext, R.color.colorTextBlack)))
// .setPrimaryColorsId(R.color.transparent)
// .setEnableHeaderTranslationContent(true);
// }

@Override
public boolean setNavigationBar(Dialog dialog, NavigationViewHelper helper, View bottomView) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@
*/
public class ActivityFragment extends FastTitleFragment {

@BindView(R.id.vp_contentFastLib) ViewPager vpContent;
@BindView(R.id.vp_contentFastLib)
ViewPager mVpContent;
private List<Fragment> listFragment = new ArrayList<>();
private SegmentTabLayout mSegmentTab;
private SlidingTabLayout mSlidingTab;
private View viewSliding;
private View viewSegment;

private boolean isSliding = true;
private View mViewSliding;

public static ActivityFragment newInstance() {
Bundle args = new Bundle();
Expand All @@ -54,38 +51,16 @@ public static ActivityFragment newInstance() {
@Override
public void beforeSetContentView() {
super.beforeSetContentView();
LoggerManager.d(TAG, "refreshActivityTab:" + isSliding);
}

@Override
public void setTitleBar(TitleBarView titleBar) {
isSliding = (boolean) SPUtil.get(mContext, SPConstant.SP_KEY_ACTIVITY_TAB_SLIDING, true);
if (isSliding && viewSliding == null) {
viewSliding = View.inflate(mContext, R.layout.layout_activity_sliding, null);
mSlidingTab = viewSliding.findViewById(R.id.tabLayout_slidingActivity);
} else if (!isSliding && viewSegment == null) {
viewSegment = View.inflate(mContext, R.layout.layout_activity_segment, null);
mSegmentTab = viewSegment.findViewById(R.id.tabLayout_segment);
}
mViewSliding = View.inflate(mContext, R.layout.layout_activity_sliding, null);
mSlidingTab = mViewSliding.findViewById(R.id.tabLayout_slidingActivity);
LinearLayout center = titleBar.getLinearLayout(Gravity.CENTER);
if (isSliding) {
if (center.indexOfChild(viewSliding) == -1) {
titleBar.addCenterAction(titleBar.new ViewAction(viewSliding),
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
viewSliding.setVisibility(View.VISIBLE);
if (viewSegment != null) {
viewSegment.setVisibility(View.GONE);
}
} else {
if (center.indexOfChild(viewSegment) == -1) {
titleBar.addCenterAction(titleBar.new ViewAction(viewSegment),
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
viewSegment.setVisibility(View.VISIBLE);
if (viewSliding != null) {
viewSliding.setVisibility(View.GONE);
}
if (center.indexOfChild(mViewSliding) == -1) {
titleBar.addCenterAction(titleBar.new ViewAction(mViewSliding),
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
}
setTab();
}
Expand All @@ -100,43 +75,17 @@ public int getContentLayout() {
*/
@Override
public void initView(Bundle savedInstanceState) {
// setTab();
}

@Override
public void loadData() {
super.loadData();
// setTab();
}

// @Override
// public void onConfigurationChanged(Configuration newConfig) {
// super.onConfigurationChanged(newConfig);
// if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
// LoggerManager.d(TAG, "竖屏");
// } else {
// LoggerManager.d(TAG, "横屏");
// }
// setTab();
// }

private void setTab() {
isSliding = (boolean) SPUtil.get(mContext, SPConstant.SP_KEY_ACTIVITY_TAB_SLIDING, isSliding);
vpContent.removeAllViews();
mVpContent.removeAllViews();
listFragment.clear();

listFragment.add(MovieBaseFragment.newInstance(ApiConstant.API_MOVIE_IN_THEATERS));
listFragment.add(MovieBaseFragment.newInstance(ApiConstant.API_MOVIE_COMING_SOON));
listFragment.add(MovieBaseFragment.newInstance(ApiConstant.API_MOVIE_TOP));
if (isSliding) {
TabLayoutManager.getInstance().setSlidingTabData(this, mSlidingTab, vpContent,
getTitles(R.array.arrays_tab_activity), listFragment);
} else {
TabLayoutManager.getInstance().setSegmentTabData(this, mSegmentTab, vpContent,
getResources().getStringArray(R.array.arrays_tab_activity), listFragment);
}
//SlidingTabLayout--需这样切换一下不然选中变粗没有效果不知是SlidingTabLayout BUG还是设置问题
// mSlidingTab.setCurrentTab(1);
TabLayoutManager.getInstance().setSlidingTabData(this, mSlidingTab, mVpContent,
getTitles(R.array.arrays_tab_activity), listFragment);
mSlidingTab.setCurrentTab(0);
}

Expand All @@ -151,12 +100,4 @@ protected void onVisibleChanged(boolean isVisibleToUser) {
StatusBarUtil.setStatusBarLightMode(mContext);
}
}

// @Subscriber(mode = ThreadMode.MAIN, tag = EventConstant.EVENT_KEY_REFRESH_ACTIVITY_TAB)
// public void refreshActivityTab(boolean isSliding) {
// mIsFirstShow = true;
// setTitleBar(mTitleBar);
// setTab();
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import me.bakumon.statuslayoutmanager.library.StatusLayoutManager;

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

0 comments on commit 2cb4839

Please sign in to comment.