Skip to content

Commit 5b7f042

Browse files
committed
1、修改library 工具类FastStackUtil造成应用横竖屏切换奔溃问题
2、修改library 第三方库provided模式可项目设置对应的版本 3、删除FastMainActivity里冗余方法;调整退出程序quitApp方法 4、FastStackUtl新增获取Stack集合方法getStack
1 parent 1106587 commit 5b7f042

40 files changed

+637
-256
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ allprojects {
4444

4545
```
4646
dependencies {
47-
    //compile 'com.github.AriesHoo:FastLib:2.0.3'
47+
    //compile 'com.github.AriesHoo:FastLib:2.1.0'
4848
compile 'com.github.AriesHoo:FastLib:${LATEST_VERSION}'
4949
}
5050
```
@@ -60,11 +60,19 @@ compile project(':fastLib')
6060
```
6161
dependencies {
6262
def supportVersion = "25.3.1"
63-
compile 'com.android.support:appcompat-v7:'.concat(supportVersion)
64-
compile 'com.android.support:recyclerview-v7:'.concat(supportVersion)
63+
provided 'com.android.support:design:'.concat(supportVersion)
64+
provided 'com.android.support:appcompat-v7:'.concat(supportVersion)
65+
provided 'com.android.support:recyclerview-v7:'.concat(supportVersion)
66+
//万能适配器
67+
provided 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.28'
68+
//webView库
69+
provided 'com.just.agentweb:agentweb:2.0.1'
70+
//常用UI控件(TitleBarView、RadiusView等)
71+
provided 'com.github.AriesHoo:UIWidget:2.0.0'
72+
//下拉刷新库
73+
provided 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
6574
//图片加载
66-
compile 'com.github.bumptech.glide:glide:4.0.0'
67-
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
75+
provided 'com.github.bumptech.glide:glide:4.0.0'
6876
//日志打印
6977
compile 'com.orhanobut:logger:2.1.1'
7078
//注解
@@ -77,28 +85,20 @@ dependencies {
7785
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
7886
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
7987
compile 'com.google.code.gson:gson:2.8.1'
80-
8188
//处理rxjava内存泄漏-生命周期绑定
8289
compile 'com.trello.rxlifecycle2:rxlifecycle-components:2.1.0'
83-
//万能适配器
84-
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.28'
8590
//滑动返回Activity
86-
compile 'cn.bingoogolapple:bga-swipebacklayout:1.1.0@aar'
91+
compile 'cn.bingoogolapple:bga-swipebacklayout:1.1.1@aar'
8792
//快速Tab库
8893
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
89-
//多状态视图切换
90-
compile 'com.github.MarnonDev:EasyStatusView:v1.0.3'
91-
//常用UI控件(TitleBarView、RadiusView等)
92-
compile 'com.github.AriesHoo:UIWidget:1.9.6'
93-
//下拉刷新库
94-
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.2'
9594
//页面事件交互
9695
compile 'org.simple:androideventbus:1.0.5.1'
97-
//webView库
98-
compile 'com.just.agentweb:agentweb:2.0.0'
96+
//多状态视图切换
97+
compile 'com.github.MarnonDev:EasyStatusView:v1.0.3'
9998
}
10099
```
101100

101+
**说明:V2.1.0版本及以后将部分系统及第三方库在FastLib里使用provided编译,实际项目中需要根据项目需要compile合适的版本避免版本重复**
102102
## 实现功能
103103

104104
* 网络请求与Activity/Fragment生命周期绑定--通过RxLifeCycle2.x

apk/sample.apk

3.26 KB
Binary file not shown.

app/build.gradle

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.neenbedankt.android-apt'
33
apply plugin: 'me.tatarka.retrolambda'
44

55
def releaseTime() {
6-
return new Date().format("yyyy-mm-dd_hh-mm", TimeZone.getTimeZone("GMT+8"))
6+
return new Date().format("yyyy-MM-dd_HH-mm", TimeZone.getTimeZone("GMT+8"))
77
}
88

99
android {
@@ -14,8 +14,8 @@ android {
1414
applicationId "com.aries.library.fast.demo"
1515
minSdkVersion ext.minSdkVersion
1616
targetSdkVersion ext.targetSdkVersion
17-
versionCode 203
18-
versionName "2.0.3"
17+
versionCode 210
18+
versionName "2.1.0"
1919
multiDexEnabled true
2020
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2121
buildConfigField "String", "BASE_URL", "\"https://api.douban.com/\""
@@ -62,12 +62,31 @@ android {
6262
}
6363

6464
dependencies {
65-
compile fileTree(dir: 'libs', include: ['*.jar'])
65+
def supportVersion = "25.3.1"
66+
compile fileTree(include: ['*.jar'], dir: 'libs')
6667
compile project(':library')
68+
//compile 'com.github.AriesHoo:FastLib:+'
69+
//compile 'com.github.AriesHoo:FastLib:2.1.0'
6770
apt 'com.jakewharton:butterknife-compiler:8.8.1'
6871
compile 'cn.bingoogolapple:bga-banner:2.1.7@aar'
69-
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.2'
72+
compile 'com.scwang.smartrefresh:SmartRefreshHeader:1.0.3'
7073
//设置界面Item库
7174
compile 'com.github.lygttpod:SuperTextView:2.1.4'
7275
compile 'com.flyco.labelview:FlycoLabelView_Lib:1.0.2@aar'
76+
77+
//以下库library里使用provided只是编译使用时需根据项目选择相应版本
78+
compile 'com.android.support:design:'.concat(supportVersion)
79+
compile 'com.android.support:appcompat-v7:'.concat(supportVersion)
80+
compile 'com.android.support:recyclerview-v7:'.concat(supportVersion)
81+
//万能适配器--一般都需要吧
82+
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.28'
83+
//webView库 继承FastWebActivity需要,不需要内置WebView可以不compile
84+
compile 'com.just.agentweb:agentweb:2.0.1'
85+
//常用UI控件(TitleBarView、RadiusView、UIAlertView、UIActionSheetView、UIProgressView等),快速标题栏fast_layout_title_bar,继承FastTitleXXX类需要
86+
compile 'com.github.AriesHoo:UIWidget:2.0.0'
87+
//下拉刷新库注意刷新头SmartRefreshHeader版本要对应
88+
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
89+
//图片加载
90+
compile 'com.github.bumptech.glide:glide:4.0.0'
91+
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
7392
}

app/src/main/AndroidManifest.xml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.aries.library.fast.demo">
44

5-
<uses-feature android:name="android.hardware.screen.portrait"/>
5+
<!--<uses-feature android:name="android.hardware.screen.portrait"/>-->
66

77
<uses-permission android:name="android.permission.INTERNET"/>
88
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
@@ -26,39 +26,51 @@
2626
android:persistent="true"
2727
android:supportsRtl="true"
2828
android:theme="@style/AppTheme">
29+
<!--android:screenOrientation="portrait"-->
2930
<activity
3031
android:name=".module.SplashActivity"
31-
android:screenOrientation="portrait"
32-
android:configChanges="orientation|locale|mcc|mnc"
32+
android:configChanges="locale|layoutDirection|mcc|mnc"
3333
android:theme="@style/AppTheme.NotTranslucent">
3434
<intent-filter>
3535
<action android:name="android.intent.action.MAIN"/>
3636

3737
<category android:name="android.intent.category.LAUNCHER"/>
3838
</intent-filter>
3939
</activity>
40+
<!--android:screenOrientation="portrait"-->
4041
<activity
4142
android:name=".module.main.MainActivity"
42-
android:screenOrientation="portrait"
43-
android:configChanges="orientation|locale|mcc|mnc"
43+
android:configChanges="locale|layoutDirection|mcc|mnc"
4444
android:theme="@style/AppTheme.NotTranslucent"/>
4545
<!--应用内浏览器-->
4646
<activity
4747
android:name=".module.WebViewActivity"
48-
android:configChanges="orientation|screenSize"
48+
android:configChanges="locale|layoutDirection|mcc|mnc|orientation|screenSize"
4949
android:hardwareAccelerated="true"/>
5050
<!--滑动返回Activity-微信效果-->
51-
<activity android:name=".module.main.sample.SwipeBackActivity"/>
51+
<activity
52+
android:name=".module.main.sample.SwipeBackActivity"
53+
android:configChanges="locale|layoutDirection|mcc|mnc"/>
5254
<!--QQ默认主题TitleBar样式-->
53-
<activity android:name=".module.main.sample.QQTitleActivity"/>
55+
<activity
56+
android:name=".module.main.sample.QQTitleActivity"
57+
android:configChanges="locale|layoutDirection|mcc|mnc"/>
5458
<!--支付宝主界面效果-->
55-
<activity android:name=".module.main.sample.ali.ALiPayMainActivity"/>
59+
<activity
60+
android:name=".module.main.sample.ali.ALiPayMainActivity"
61+
android:configChanges="locale|layoutDirection|mcc|mnc"/>
5662
<!--腾讯新闻主界面效果-->
57-
<activity android:name=".module.main.sample.news.NewsMainActivity"/>
63+
<activity
64+
android:name=".module.main.sample.news.NewsMainActivity"
65+
android:configChanges="locale|layoutDirection|mcc|mnc"/>
5866
<!--设置页-->
59-
<activity android:name=".module.mine.SettingActivity"/>
67+
<activity
68+
android:name=".module.mine.SettingActivity"
69+
android:configChanges="locale|layoutDirection|mcc|mnc"/>
6070
<!--第三方库-->
61-
<activity android:name=".module.mine.ThirdLibraryActivity"/>
71+
<activity
72+
android:name=".module.mine.ThirdLibraryActivity"
73+
android:configChanges="locale|layoutDirection|mcc|mnc"/>
6274
</application>
6375

6476
</manifest>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ public void onCreate() {
5959
* @return
6060
*/
6161
public static int getImageHeight() {
62-
if (imageHeight == 0) {
63-
imageHeight = (int) (SizeUtil.getScreenWidth() * 0.55);
64-
}
62+
imageHeight = (int) (SizeUtil.getScreenWidth() * 0.55);
6563
return imageHeight;
6664
}
6765
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package com.aries.library.fast.demo.adapter;
22

3+
import android.os.Build;
4+
import android.support.v4.view.ViewCompat;
35
import android.view.View;
46

57
import com.aries.library.fast.demo.R;
68
import com.aries.library.fast.demo.entity.SubjectsEntity;
79
import com.aries.library.fast.manager.GlideManager;
10+
import com.aries.library.fast.util.SizeUtil;
11+
import com.aries.ui.view.radius.RadiusRelativeLayout;
12+
import com.aries.ui.view.radius.RadiusViewDelegate;
813
import com.chad.library.adapter.base.BaseQuickAdapter;
914
import com.chad.library.adapter.base.BaseViewHolder;
1015
import com.flyco.labelview.LabelView;
@@ -34,5 +39,11 @@ protected void convert(BaseViewHolder helper, SubjectsEntity item) {
3439
LabelView labelView = helper.getView(R.id.lv_topMovie);
3540
labelView.setText("Top" + (helper.getLayoutPosition() + 1));
3641
labelView.setVisibility(isShowTop ? View.VISIBLE : View.GONE);
42+
ViewCompat.setElevation(helper.itemView, helper.itemView.getResources().
43+
getDimensionPixelSize(R.dimen.dp_elevation));
44+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
45+
RadiusViewDelegate delegate = ((RadiusRelativeLayout) helper.itemView).getDelegate();
46+
delegate.setStrokeWidth(SizeUtil.dp2px(1));
47+
}
3748
}
3849
}

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
package com.aries.library.fast.demo.adapter;
22

3+
import android.os.Build;
4+
import android.support.v4.view.ViewCompat;
5+
import android.view.ViewGroup;
6+
37
import com.aries.library.fast.demo.R;
48
import com.aries.library.fast.demo.entity.WidgetEntity;
9+
import com.aries.library.fast.util.SizeUtil;
10+
import com.aries.ui.view.radius.RadiusRelativeLayout;
11+
import com.aries.ui.view.radius.RadiusViewDelegate;
512
import com.chad.library.adapter.base.BaseQuickAdapter;
613
import com.chad.library.adapter.base.BaseViewHolder;
714

@@ -20,7 +27,17 @@ public WidgetAdapter() {
2027

2128
@Override
2229
protected void convert(BaseViewHolder helper, WidgetEntity item) {
23-
helper.setText(R.id.tv_titleWidget, item.title);
24-
helper.setText(R.id.tv_contentWidget, item.content);
30+
helper.setText(R.id.tv_titleWidget, item.title)
31+
.setText(R.id.tv_contentWidget, item.content);
32+
ViewCompat.setElevation(helper.itemView, helper.itemView.getResources().
33+
getDimensionPixelSize(R.dimen.dp_elevation));
34+
int marginSize = helper.itemView.getResources().getDimensionPixelSize(R.dimen.dp_margin_item);
35+
ViewGroup.MarginLayoutParams margin = (ViewGroup.MarginLayoutParams) helper.itemView.getLayoutParams();
36+
margin.setMargins(marginSize, marginSize, marginSize,
37+
helper.getLayoutPosition() == getItemCount() - 1 ? marginSize : 0);
38+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
39+
RadiusViewDelegate delegate = ((RadiusRelativeLayout) helper.itemView).getDelegate();
40+
delegate.setStrokeWidth(SizeUtil.dp2px(1));
41+
}
2542
}
2643
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.aries.library.fast.demo.constant;
2+
3+
/**
4+
* Created: AriesHoo on 2017/9/29 11:30
5+
* Function: 应用全局配置-默认
6+
* Desc:
7+
*/
8+
public class GlobalConstant {
9+
10+
/**
11+
* 全局banner动画position
12+
*/
13+
public static final int GLOBAL_BANNER_TRANSITION_POSITION= 3;
14+
15+
/**
16+
* 全局adapter动画值 1-5
17+
*/
18+
public static final int GLOBAL_ADAPTER_ANIMATION_VALUE= 2;
19+
}

app/src/main/java/com/aries/library/fast/demo/helper/RefreshHeaderHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static RefreshHeaderHelper getInstance() {
3030

3131
public RefreshHeader getRefreshHeader(Context mContext) {
3232
MaterialHeader materialHeader = new MaterialHeader(mContext);
33-
materialHeader.setColorSchemeColors(R.color.colorTextBlack, R.color.colorTextBlackLight);
33+
materialHeader.setColorSchemeColors(R.color.colorTextBlack, R.color.colorTextBlack);
3434
return materialHeader;
3535
}
3636
}

app/src/main/java/com/aries/library/fast/demo/helper/TitleBarHelper.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.view.View;
66

77
import com.aries.library.fast.demo.R;
8+
import com.aries.library.fast.manager.LoggerManager;
89
import com.aries.ui.view.title.TitleBarView;
910

1011
/**
@@ -38,19 +39,18 @@ public void setTitleBarView(TitleBarView titleBar, Activity mActivity, boolean b
3839
if (titleBar == null) {
3940
return;
4041
}
41-
ViewCompat.setElevation(titleBar,
42-
mActivity.getResources().
43-
getDimensionPixelSize(R.dimen.dp_elevation));
44-
titleBar.setDividerVisible(false);
45-
titleBar.setBackgroundResource(R.color.colorWhite);
46-
titleBar.setLeftTextDrawable(backArrow ? R.drawable.fast_ic_back : 0);
47-
if (mActivity != null) {
48-
titleBar.setOnLeftTextClickListener(new View.OnClickListener() {
49-
@Override
50-
public void onClick(View v) {
51-
mActivity.onBackPressed();
52-
}
53-
});
54-
}
42+
titleBar.setLeftTextDrawable(backArrow ? R.drawable.fast_ic_back : 0)
43+
.setOnLeftTextClickListener(new View.OnClickListener() {
44+
@Override
45+
public void onClick(View v) {
46+
if (mActivity != null)
47+
mActivity.onBackPressed();
48+
}
49+
})
50+
.setBackgroundResource(R.color.colorWhite);
51+
int elevation = mActivity.getResources().
52+
getDimensionPixelSize(R.dimen.dp_elevation);
53+
ViewCompat.setElevation(titleBar, elevation);
54+
LoggerManager.d("elevation:" + elevation);
5555
}
5656
}

0 commit comments

Comments
 (0)