Skip to content

Commit

Permalink
更新app-debug.apk;优化设置界面、关于界面和关于作者界面;优化下载按钮状态切换,已安装应用显示打开,未安装应用显示安装;更新R…
Browse files Browse the repository at this point in the history
…EADME.md;下载界面和应用更新界面细节优化
  • Loading branch information
Z-P-J committed Apr 20, 2021
1 parent ca95e7e commit 07f21c7
Show file tree
Hide file tree
Showing 53 changed files with 3,920 additions and 3,454 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,17 @@
## 感谢以下开源库

- [Fragment框架Fragmentation](https://github.com/Z-P-J/Fragmentation)
- [强大的弹窗框架XPopup](https://github.com/li-xiaojun/XPopup)
- [HTML解析器Jsoup](https://github.com/jhy/jsoup)
- [图片加载框架Glide](https://github.com/bumptech/glide)
- [响应式编程框架RxJava](https://github.com/ReactiveX/RxJava)
- [RxJava for Android:RxAndroid](https://github.com/ReactiveX/RxAndroid)
- [HTML解析器Jsoup](https://github.com/jhy/jsoup)
- [数据库框架DBFlow](https://github.com/agrosner/DBFlow)
- [ViewPager指示器框架MagicIndicator](https://github.com/hackware1993/MagicIndicator)
- [知乎图片选择框架Matisse](https://github.com/zhihu/Matisse)
- [毛玻璃效果Blurred](https://github.com/goweii/Blurred)
- [轮播图Banner](https://github.com/AlpsDog/Banner)
- [权限申请XPermission](https://github.com/li-xiaojun/XPermission)
- [自定义SeekBar库IndicatorSeekBar](https://github.com/warkiz/IndicatorSeekBar)
- [Emoji表情库LQREmojiLibrary](https://github.com/GitLqr/LQREmojiLibrary)
- [等级评分控件CBRatingBar](https://github.com/CB-ysx/CBRatingBar)
- [图片压缩CompressHelper](https://github.com/nanchen2251/CompressHelper)
- [九宫格图片NineGridView](https://github.com/Vanish136/NineGridView)
Expand All @@ -81,17 +80,17 @@
- [BadgeView](https://github.com/qstumn/BadgeView)


## 其他
## 开发者的开源库

- [基于Fragmentation的Fragment框架ZFragmentation](https://github.com/Z-P-J/Fragmentation)
- [基于XPopup和ZFragmentation弹窗框架Fragmentation-Dialog](https://github.com/Z-P-J/Fragmentation-Dialog)
- [网络请求库ZHttp,内置Jsoup](https://github.com/Z-P-J/ZHttp)
- [基于Fragmentation修改的Fragment框架ZFragmentation](https://github.com/Z-P-J/Fragmentation)
- [基于ZFragmentation的弹窗框架Fragmentation-Dialog](https://github.com/Z-P-J/Fragmentation-Dialog)
- [网络请求库ZHttp](https://github.com/Z-P-J/ZHttp)
- [文件下载框架ZDownloader](https://github.com/Z-P-J/ZDownloader)
- [RecyclerView框架ZRecyclerView](https://github.com/Z-P-J/ZRecyclerView)
- [RxBus](https://github.com/Z-P-J/RxBus)
- [RxLife](https://github.com/Z-P-J/RxLife)
- [ZToolBar](https://github.com/Z-P-J/ZToolBar)
- [ZSwitcher](https://github.com/Z-P-J/ZSwitcher)
- [SmoothCheckBox](https://github.com/Z-P-J/SmoothCheckBox)
- [StateManager](https://github.com/Z-P-J/StateManager)
- [ZToast](https://github.com/Z-P-J/ZToast)
- [事件订阅和分发库RxBus](https://github.com/Z-P-J/RxBus)
- [Rxjava生命周期管理RxLife](https://github.com/Z-P-J/RxLife)
- [自定义ToolBar:ZToolBar](https://github.com/Z-P-J/ZToolBar)
- [自定义Switch:ZSwitcher](https://github.com/Z-P-J/ZSwitcher)
- [自定义CheckBox:SmoothCheckBox](https://github.com/Z-P-J/SmoothCheckBox)
- [状态切换StateManager](https://github.com/Z-P-J/StateManager)
- [吐司ZToast](https://github.com/Z-P-J/ZToast)
Binary file modified app-debug.apk
Binary file not shown.
9 changes: 4 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ android {

debug {
debuggable true
// minifyEnabled true
minifyEnabled false
minifyEnabled true
// minifyEnabled false
zipAlignEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -104,8 +104,7 @@ dependencies {

// RecyclerView
implementation 'com.android.support:recyclerview-v7:28.0.0'
// implementation 'com.zpj.widget:ZRecyclerView:1.2.1'
implementation 'com.github.Z-P-J:ZRecyclerView:1.2.2'
implementation 'com.github.Z-P-J:ZRecyclerView:1.2.3'
implementation 'com.yanyusong.y_divideritemdecoration:y_divideritemdecoration:2.0'

// up/down arrow
Expand Down Expand Up @@ -158,7 +157,7 @@ dependencies {
implementation 'com.github.promeg:tinypinyin:2.0.3'
implementation 'com.nex3z:flow-layout:1.2.4'

implementation 'com.github.Z-P-J:Fragmentation-Dialog:1.1.9'
implementation 'com.github.Z-P-J:Fragmentation-Dialog:1.2.0'
implementation 'com.github.Z-P-J:Fragmentation:1.1.3'
implementation 'com.zpj.widget:SmoothCheckBox:1.0.0'
implementation 'com.zpj.widget:ZSwitcher:1.0.5'
Expand Down
5,934 changes: 2,992 additions & 2,942 deletions app/proguardMapping.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
android:name="com.zpj.shouji.market.BaseApplication"
Expand Down
25 changes: 19 additions & 6 deletions app/src/main/java/com/zpj/shouji/market/api/SearchApi.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package com.zpj.shouji.market.api;

import com.zpj.http.core.HttpObserver;
import com.zpj.http.parser.html.nodes.Document;
import com.zpj.http.parser.html.nodes.Element;
import com.zpj.shouji.market.R;
import com.zpj.shouji.market.model.GuessAppInfo;
import com.zpj.shouji.market.model.QuickAppInfo;
import com.zpj.shouji.market.utils.BeanUtils;
import com.zpj.utils.Callback;
import com.zpj.utils.ContextUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import io.reactivex.ObservableEmitter;

public class SearchApi {

private static final List<String> HOT_KEYWORD_LIST = new ArrayList<>();
Expand Down Expand Up @@ -38,26 +43,34 @@ public static void getHotKeywordApi(Callback<List<String>> callback) {

public static void getGuessApi(Callback<List<GuessAppInfo>> callback) {
HttpApi.getXml("/appv3/user_app_search_rm_xml.jsp?searchKey=")
.onSuccess(data -> {
.flatMap((HttpObserver.OnFlatMapListener<Document, List<GuessAppInfo>>) (data, emitter) -> {
List<GuessAppInfo> list = new ArrayList<>();
for (Element item : data.select("item").get(1).select("subitem")) {
list.add(GuessAppInfo.parse(item));
GuessAppInfo info = BeanUtils.createBean(item, GuessAppInfo.class);
info.init();
list.add(info);
}
callback.onCallback(list);
emitter.onNext(list);
emitter.onComplete();
})
.onSuccess(callback::onCallback)
.onError(throwable -> callback.onCallback(new ArrayList<>()))
.subscribe();
}

public static void getQuickApi(String keyword, Callback<List<QuickAppInfo>> callback) {
HttpApi.getHtml("/androidv4/app_search_quick_xml.jsp?s=" + keyword)
.onSuccess(data -> {
.flatMap((HttpObserver.OnFlatMapListener<Document, List<QuickAppInfo>>) (data, emitter) -> {
List<QuickAppInfo> list = new ArrayList<>();
for (Element item : data.select("item")) {
list.add(QuickAppInfo.parse(item));
QuickAppInfo info = BeanUtils.createBean(item, QuickAppInfo.class);
info.init();
list.add(info);
}
callback.onCallback(list);
emitter.onNext(list);
emitter.onComplete();
})
.onSuccess(callback::onCallback)
.onError(throwable -> callback.onCallback(new ArrayList<>()))
.subscribe();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.support.annotation.Keep;
import android.text.TextUtils;
import android.util.Log;

Expand Down Expand Up @@ -41,6 +42,7 @@
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;

@Keep
public class AppDownloadMission extends BaseMission<AppDownloadMission> {

public interface AppMissionListener extends DownloadMission.MissionListener {
Expand All @@ -49,6 +51,8 @@ public interface AppMissionListener extends DownloadMission.MissionListener {

void onUninstalled();

void onUpgrade();

}

private static final String TAG = AppDownloadMission.class.getSimpleName();
Expand All @@ -58,6 +62,7 @@ public interface AppMissionListener extends DownloadMission.MissionListener {
private String appId;
private String appType;
private String appName;
private String versionName;
private boolean isShareApp;

private transient boolean isInstalled;
Expand Down Expand Up @@ -125,6 +130,7 @@ protected void onFinish() {
if (errCode > 0) {
return;
}
versionName = AppUtils.getApkVersionName(getContext(), getFilePath());
checkUpgrade();
if (FileUtils.getFileType(name) == FileUtils.FileType.ARCHIVE) {
// TODO 解压
Expand Down Expand Up @@ -196,9 +202,9 @@ public boolean isUpgrade() {

private boolean checkUpgrade() {
if (isFinished() && isInstalled) {
apkVersion = AppUtils.getApkVersionName(getContext(), getFilePath());
// apkVersion = AppUtils.getApkVersionName(getContext(), getFilePath());
appVersion = AppUtils.getAppVersionName(getContext(), getPackageName());
return AppUtil.isNewVersion(appVersion, apkVersion);
return AppUtil.isNewVersion(appVersion, versionName);
}
return false;
}
Expand All @@ -215,8 +221,8 @@ public boolean isInstalled() {
// }
// return isInstalled;
if (isFinished() && isInstalled) {
Log.d(TAG, "apkVersion=" + apkVersion + " appVersion=" + appVersion);
return TextUtils.equals(apkVersion, appVersion);
Log.d(TAG, "apkVersion=" + versionName + " appVersion=" + appVersion);
return TextUtils.equals(versionName, appVersion);
}
return false;
// return AppUtils.isApkInstalled(getContext(), packageName);
Expand Down Expand Up @@ -284,7 +290,7 @@ public void onStart() {
@Override
public void onComplete() {
String currentVersion = AppUtils.getAppVersionName(activity, getPackageName());
String apkVersion = AppUtils.getApkVersionName(activity, getFilePath());
String apkVersion = versionName;
if (TextUtils.equals(apkVersion, currentVersion)) {
File file = getFile();
if (AppConfig.isAutoDeleteAfterInstalled() && file != null) {
Expand Down
Loading

0 comments on commit 07f21c7

Please sign in to comment.