Skip to content

Commit 9468ca4

Browse files
AriesHoo@126.comAriesHoo@126.com
AriesHoo@126.com
authored and
AriesHoo@126.com
committed
1、升级部分三方库
2、修改已知bug
1 parent bc44cbd commit 9468ca4

File tree

15 files changed

+97
-125
lines changed

15 files changed

+97
-125
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ allprojects {
158158

159159
```
160160
dependencies {
161-
implementation 'com.github.AriesHoo:FastLib:2.2.13'
161+
implementation 'com.github.AriesHoo:FastLib:2.3.0'
162162
}
163163
```
164164

@@ -177,7 +177,7 @@ dependencies {
177177
<dependency>
178178
<groupId>com.github.AriesHoo</groupId>
179179
<artifactId>FastLib</artifactId>
180-
<version>2.2.13</version>
180+
<version>2.3.0</version>
181181
</dependency>
182182
```
183183

apk/sample.apk

-14.6 KB
Binary file not shown.

apk/update

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"versionCode": 243,
3-
"versionName": "2.2.13_beta13",
2+
"versionCode": 244,
3+
"versionName": "2.3.0",
44
"url": "https://raw.githubusercontent.com/AriesHoo/FastLib/dev/apk/sample.apk",
5-
"force": true,
6-
"size": "3.75M",
7-
"message": "1、升级部分三方库增强稳定性"
5+
"force": false,
6+
"size": "3.74M",
7+
"message": "1、升级部分三方库增强稳定性\n2、修改部分BUG"
88
}

app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ android {
7777
dependencies {
7878
implementation fileTree(include: ['*.jar'], dir: 'libs')
7979
implementation project(':library')
80-
// implementation 'com.github.AriesHoo:FastLib:2.2.13_beta12'
80+
// implementation 'com.github.AriesHoo:FastLib:2.3.0'
8181
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
8282
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
8383
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
@@ -117,4 +117,7 @@ dependencies {
117117
implementation 'androidx.multidex:multidex:2.0.0'
118118
//蒲公英
119119
implementation 'com.pgyersdk:sdk:3.0.5'
120+
//
121+
// //保活组件
122+
// implementation 'com.fanjun:keeplive:1.1.18'
120123
}

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
android:icon="@drawable/ic_launcher"
2424
android:label="@string/app_name"
2525
android:supportsRtl="true"
26+
2627
android:theme="@style/AppTheme">
2728
<!-- 配置APP渠道号 -->
2829
<meta-data

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

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,16 @@
1010
import com.aries.library.fast.demo.R;
1111
import com.aries.library.fast.demo.entity.UpdateEntity;
1212
import com.aries.library.fast.demo.retrofit.repository.ApiRepository;
13-
import com.aries.library.fast.demo.widget.ProgressDialog;
1413
import com.aries.library.fast.manager.LoggerManager;
1514
import com.aries.library.fast.retrofit.FastDownloadObserver;
1615
import com.aries.library.fast.retrofit.FastLoadingObserver;
1716
import com.aries.library.fast.retrofit.FastObserver;
18-
import com.aries.library.fast.retrofit.FastRetrofit;
19-
import com.aries.library.fast.util.FastFileUtil;
20-
import com.aries.library.fast.util.FastFormatUtil;
2117
import com.aries.library.fast.util.FastStackUtil;
2218
import com.aries.library.fast.util.ToastUtil;
19+
import com.download.library.DownloadImpl;
2320
import com.trello.rxlifecycle3.android.ActivityEvent;
24-
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
2521

26-
import java.io.File;
2722
import java.lang.ref.SoftReference;
28-
import java.util.HashMap;
29-
import java.util.Map;
3023

3124
import io.reactivex.annotations.NonNull;
3225

@@ -161,74 +154,15 @@ public void downloadApk(UpdateEntity entity, String fileName, boolean isRangeEna
161154
if (activity == null || activity.isFinishing()) {
162155
return;
163156
}
164-
165-
ProgressDialog mProgressDialog = new ProgressDialog(activity);
166-
mProgressDialog.setTitle(entity.getTitle());
167-
mProgressDialog.setIndeterminate(false);
168-
mProgressDialog.setMessage(entity.getMessage());
169-
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
170-
mProgressDialog.setCancelable(!entity.force);
171-
mProgressDialog.setProgressNumberFormat("");
172-
mProgressDialog.setCanceledOnTouchOutside(!entity.force);
173-
174-
//暂停下载-慎用;建议使用 Disposable.dispose();
175-
// mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "暂停", new DialogInterface.OnClickListener() {
176-
// @Override
177-
// public void onClick(DialogInterface dialog, int which) {
178-
// if (mDownloadObserver != null) {
179-
// mDownloadObserver.pause();
180-
// }
181-
// }
182-
// });
183-
184-
File mLocal = new File(FastFileUtil.getCacheDir(), fileName);
185-
Map<String, Object> header = null;
186-
long length = mLocal.length();
187-
if (isRangeEnable) {
188-
header = new HashMap<>(1);
189-
header.put("range", "bytes=" + length + "-");
190-
LoggerManager.i("downloadApk", "length:" + length);
191-
}
192-
//不同url不能使用相同的本地绝对路径不然很可能将B的后半部分下载追加到A的后面--最终也是错误的
193-
ProgressDialog finalMProgressDialog = mProgressDialog;
194-
mDownloadObserver = new FastDownloadObserver(fileName, finalMProgressDialog, isRangeEnable) {
195-
@Override
196-
public void onSuccess(File file) {
197-
FastFileUtil.installApk(file);
198-
}
199-
200-
@Override
201-
public void onFail(Throwable e) {
202-
LoggerManager.e("downloadApk", e.getMessage());
203-
//HTTP 416 Range Not Satisfiable 出现该错误--很大可能性是文件已下载完成传递的
204-
boolean satisfiable = e != null && e.getMessage().contains("416") && e.getMessage().toLowerCase().contains("range");
205-
if (satisfiable) {
206-
onSuccess(mLocal);
207-
return;
208-
}
209-
boolean isPause = e != null && e.getMessage().equals(FastDownloadObserver.DOWNLOAD_PAUSE);
210-
if (isPause) {
211-
ToastUtil.show("暂停下载");
212-
return;
213-
}
214-
ToastUtil.show("下载失败:" + e.getMessage());
215-
}
216-
217-
@Override
218-
public void onProgress(float progress, long current, long total) {
219-
LoggerManager.i("downloadApk", "current:" + current + ";total:" + total);
220-
if (!finalMProgressDialog.isShowing()) {
221-
return;
222-
}
223-
finalMProgressDialog.setProgressNumberFormat(FastFormatUtil.formatDataSize(current) + "/" + FastFormatUtil.formatDataSize(total));
224-
finalMProgressDialog.setMax((int) total);
225-
finalMProgressDialog.setProgress((int) current);
226-
}
227-
};
228-
FastRetrofit.getInstance().downloadFile(entity.url, header)
229-
.compose(((RxAppCompatActivity) activity).bindUntilEvent(ActivityEvent.DESTROY))
230-
//可自定义保存路径默认//storage/emulated/0/Android/data/<package-name>/cache/xxx/
231-
.subscribe(mDownloadObserver);
157+
DownloadImpl.getInstance()
158+
.with(mContext)
159+
.url(entity.url)
160+
.quickProgress()
161+
.setEnableIndicator(true)
162+
.autoOpenIgnoreMD5()
163+
.setRetry(5)
164+
.setBlockMaxTime(100000L)
165+
.enqueue();
232166
}
233167

234168
}

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import android.content.Intent;
55
import android.os.Bundle;
66
import android.text.TextUtils;
7+
import android.view.View;
8+
import android.widget.ImageView;
79

810
import androidx.appcompat.app.AlertDialog;
911

@@ -17,6 +19,7 @@
1719
import com.aries.library.fast.manager.RxJavaManager;
1820
import com.aries.library.fast.module.activity.FastMainActivity;
1921
import com.aries.library.fast.retrofit.FastObserver;
22+
import com.aries.library.fast.util.SizeUtil;
2023
import com.aries.ui.view.tab.CommonTabLayout;
2124
import com.didichuxing.doraemonkit.util.PermissionUtil;
2225
import com.trello.rxlifecycle3.android.ActivityEvent;
@@ -35,6 +38,7 @@
3538
public class MainActivity extends FastMainActivity {
3639

3740
@BindView(R.id.tabLayout_commonFastLib) CommonTabLayout mTabLayout;
41+
private ArrayList<FastTabEntity> mTabEntities;
3842

3943
@Override
4044
protected void onCreate(Bundle savedInstanceState) {
@@ -48,12 +52,12 @@ public boolean isSwipeEnable() {
4852

4953
@Override
5054
public List<FastTabEntity> getTabList() {
51-
ArrayList<FastTabEntity> tabEntities = new ArrayList<>();
52-
tabEntities.add(new FastTabEntity(R.string.home, R.drawable.ic_home_normal, R.drawable.ic_home_selected, HomeFragment.newInstance()));
53-
tabEntities.add(new FastTabEntity(R.string.web_app, R.drawable.ic_app_normal, R.drawable.ic_app_selected, WebAppFragment.newInstance()));
54-
tabEntities.add(new FastTabEntity(R.string.activity, R.drawable.ic_activity_normal, R.drawable.ic_activity_selected, ActivityFragment.newInstance()));
55-
tabEntities.add(new FastTabEntity(R.string.mine, R.drawable.ic_mine_normal, R.drawable.ic_mine_selected, MineFragment.newInstance()));
56-
return tabEntities;
55+
mTabEntities = new ArrayList<>();
56+
mTabEntities.add(new FastTabEntity(R.string.home, R.drawable.ic_home_normal, R.drawable.ic_home_selected, HomeFragment.newInstance()));
57+
mTabEntities.add(new FastTabEntity(R.string.web_app, R.drawable.ic_app_normal, R.drawable.ic_app_selected, WebAppFragment.newInstance()));
58+
mTabEntities.add(new FastTabEntity(R.string.activity, R.drawable.ic_activity_normal, R.drawable.ic_activity_selected, ActivityFragment.newInstance()));
59+
mTabEntities.add(new FastTabEntity(R.string.mine, R.drawable.ic_mine_normal, R.drawable.ic_mine_selected, MineFragment.newInstance()));
60+
return mTabEntities;
5761
}
5862

5963
@Override
@@ -76,6 +80,14 @@ protected void onNewIntent(Intent intent) {
7680

7781
@Override
7882
public void setTabLayout(CommonTabLayout tabLayout) {
83+
ImageView imageView = new ImageView(mContext);
84+
imageView.setImageResource(R.drawable.ic_github);
85+
tabLayout.setCenterView(imageView, SizeUtil.dp2px(42), SizeUtil.dp2px(42), new View.OnClickListener() {
86+
@Override
87+
public void onClick(View v) {
88+
WebViewActivity.start(mContext, "https://github.com/AriesHoo/FastLib/blob/master/README.md");
89+
}
90+
});
7991
}
8092

8193
@Override

app/src/main/res/layout/fragment_mine.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
app:sDividerLineType="both"
102102
app:sLeftIconHeight="22dp"
103103
app:sLeftIconMarginLeft="13dp"
104+
android:visibility="gone"
104105
app:sLeftIconRes="@drawable/ic_update"
105106
app:sLeftIconWidth="22dp"
106107
app:sLeftTextString="@string/upload_file"/>

app/src/main/res/values-zh/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22
<string name="app_name">FastLib</string>
33
<string name="home">主页</string>
4-
<string name="web_app">WebApp</string>
4+
<string name="web_app">网页</string>
55
<string name="activity">活动</string>
66
<string name="mine">我的</string>
77
<string name="home_list_content">点击查看示例</string>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22
<string name="app_name">FastLib</string>
33
<string name="home">主页</string>
4-
<string name="web_app">WebApp</string>
4+
<string name="web_app">网页</string>
55
<string name="activity">活动</string>
66
<string name="mine">我的</string>
77
<string name="home_list_content">点击查看示例</string>

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.4.2'
9+
classpath 'com.android.tools.build:gradle:3.5.0'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1111
}
1212
}
@@ -31,6 +31,6 @@ ext{
3131
minLibSdkVersion = 15
3232
targetSdkVersion = 28
3333
supportVersion = "1.0.0"
34-
versionCode = 243
35-
versionName = "2.2.13_beta13"
34+
versionCode = 244
35+
versionName = "2.3.0"
3636
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon May 06 09:11:06 CST 2019
1+
#Wed Aug 28 08:42:21 CST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

library/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ dependencies {
5858
//图片加载
5959
compileOnly 'com.github.bumptech.glide:glide:4.8.0'
6060
//常用UI控件(TitleBarView、RadiusView等)
61-
api 'com.github.AriesHoo.UIWidget:widget-core:3.2.21'
61+
api 'com.github.AriesHoo.UIWidget:widget-core:3.2.23'
6262
//快速Tab库
63-
api 'com.github.AriesHoo.UIWidget:tab-layout:3.2.21'
63+
api 'com.github.AriesHoo.UIWidget:tab-layout:3.2.23'
6464
//日志打印
6565
api 'com.orhanobut:logger:2.2.0'
6666
//注解

library/src/main/java/com/aries/library/fast/basis/BasisViewHelper.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.graphics.Bitmap;
66
import android.graphics.drawable.BitmapDrawable;
77
import android.graphics.drawable.Drawable;
8+
import android.util.TypedValue;
89
import android.view.View;
910
import android.widget.Checkable;
1011
import android.widget.CompoundButton;
@@ -41,7 +42,8 @@ public BasisViewHelper(Activity context) {
4142
*
4243
* @return
4344
*/
44-
public abstract @LayoutRes int getContentLayout();
45+
public abstract @LayoutRes
46+
int getContentLayout();
4547

4648
public View getContentView() {
4749
if (mContentView == null) {
@@ -92,6 +94,22 @@ public T setEnabled(int id, boolean enabled) {
9294
return back();
9395
}
9496

97+
public T setFakeBoldText(int id, boolean fakeBoldText) {
98+
TextView textView = getContentView().findViewById(id);
99+
textView.getPaint().setFakeBoldText(fakeBoldText);
100+
return back();
101+
}
102+
103+
public T setTextSize(int id, float dp) {
104+
return setTextSize(id, TypedValue.COMPLEX_UNIT_DIP, dp);
105+
}
106+
107+
public T setTextSize(int id, int unit, float dp) {
108+
TextView textView = getContentView().findViewById(id);
109+
textView.setTextSize(unit, dp);
110+
return back();
111+
}
112+
95113
public T setText(int id, int resId) {
96114
return setText(id, mContext.getText(resId));
97115
}

0 commit comments

Comments
 (0)