version:1.2
fix: add:
@@ -39,8 +39,8 @@ android {
|
||||
productFlavors {
|
||||
beta {
|
||||
flavorDimensions "default"
|
||||
versionCode 2
|
||||
versionName "1.1"
|
||||
versionCode 3
|
||||
versionName "1.2"
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME: "com.uiui.appstore",
|
||||
JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey.
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@@ -56,7 +57,7 @@ public class LocalManagerActivity extends BaseActivity implements RefreshManager
|
||||
});
|
||||
mRefreshLayout.autoRefresh();
|
||||
|
||||
adapter = new LocalAppAdapter(localAppList, this);
|
||||
adapter = new LocalAppAdapter(this);
|
||||
adapter.setHasStableIds(true);
|
||||
mRvApp.setAdapter(adapter);
|
||||
mRvApp.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||
@@ -65,61 +66,17 @@ public class LocalManagerActivity extends BaseActivity implements RefreshManager
|
||||
@Override
|
||||
protected void initData() {
|
||||
initDatas();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
initDatas();
|
||||
|
||||
}
|
||||
|
||||
private void initDatas() {
|
||||
localAppList.clear();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfoList = getApplication().getPackageManager().queryIntentActivities(intent, 0);
|
||||
String qch_force_app = Settings.System.getString(getContentResolver(), "qch_force_app");
|
||||
for (int i = 0; i < resolveInfoList.size(); i++) {
|
||||
LocalApp bean = new LocalApp();
|
||||
bean.setAppName(resolveInfoList.get(i).loadLabel(getApplicationContext().getPackageManager()).toString());
|
||||
String packageName = resolveInfoList.get(i).activityInfo.packageName;
|
||||
if (packageName.equals(getApplicationContext().getPackageName()) || packageName.equals("com.android.uiuios")) {
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.canremove_systemapp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
bean.setPackageName(packageName);
|
||||
Drawable icon = resolveInfoList.get(i).loadIcon(getApplicationContext().getPackageManager());
|
||||
bean.setIcon(icon);
|
||||
if (packageName.contains(qch_force_app)){
|
||||
bean.setCanUnintall(false);
|
||||
}else {
|
||||
bean.setCanUnintall(true);
|
||||
}
|
||||
try {
|
||||
PackageInfo packageInfo = getApplicationContext().getPackageManager().getPackageInfo(packageName, 0);
|
||||
String versionCode = getApplicationContext().getPackageManager()
|
||||
.getPackageInfo(packageName, 0).versionName;
|
||||
bean.setVersion(versionCode);
|
||||
String appInstallDir = packageInfo.applicationInfo.publicSourceDir;
|
||||
int size = Integer.valueOf((int) new File(appInstallDir).length());
|
||||
bean.setSize(size);
|
||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) <= 0) {
|
||||
//第三方应用
|
||||
localAppList.add(bean);
|
||||
//判断是否需要进行更新
|
||||
|
||||
} else {
|
||||
//系统应用
|
||||
}
|
||||
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
localAppList = ApkUtils.getLocalApp(LocalManagerActivity.this);
|
||||
adapter.setLocalAppList(localAppList);
|
||||
adapter.notifyDataSetChanged();
|
||||
mRefreshLayout.finishRefresh();
|
||||
if (localAppList.size() == 0) {
|
||||
@@ -139,7 +96,6 @@ public class LocalManagerActivity extends BaseActivity implements RefreshManager
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
mRefreshLayout.autoRefresh();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,10 +33,12 @@ public class LocalAppAdapter extends RecyclerView.Adapter<LocalAppAdapter.LocalA
|
||||
|
||||
private List<LocalApp> localAppList;
|
||||
|
||||
public LocalAppAdapter(List<LocalApp> localAppList, Context context) {
|
||||
public LocalAppAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.localAppList = localAppList;
|
||||
}
|
||||
|
||||
public void setLocalAppList(List<LocalApp> appList) {
|
||||
this.localAppList = appList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.uiui.appstore.bean;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@@ -16,10 +19,6 @@ public class BaseResponse<T> implements Serializable {
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{\n" +//
|
||||
"\tcode=" + code + "\n" +//
|
||||
"\tmsg='" + msg + "\'\n" +//
|
||||
"\tdata=" + data + "\n" +//
|
||||
'}';
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,19 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.uiui.appstore.BuildConfig;
|
||||
import com.uiui.appstore.R;
|
||||
import com.uiui.appstore.activity.HintActivity;
|
||||
@@ -94,7 +100,6 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,6 +216,106 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
isNotLoadBitmap = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadData(Bundle savedInstanceState) {
|
||||
// initData();
|
||||
// initAPPData(handler);
|
||||
}
|
||||
|
||||
synchronized private void initAPPData(final Handler handler) {
|
||||
// OKGO.getAllAppInfo(handler);
|
||||
getAllAppInfo();
|
||||
// OKGO.getBannerImg(handler);
|
||||
// getBannerImg();
|
||||
getBanner();
|
||||
}
|
||||
|
||||
private void getBanner() {
|
||||
NetInterfaceManager.getInstance().getBannerObservable()
|
||||
.subscribe(new Observer<BaseResponse<Banner>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getBanner", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<Banner> bannerBaseResponse) {
|
||||
Log.e("getBanner", "onNext: " + bannerBaseResponse);
|
||||
if (bannerBaseResponse.code == 200) {
|
||||
String banner_img = bannerBaseResponse.data.getBanner_img();
|
||||
String vertical_img = bannerBaseResponse.data.getVertical_img();
|
||||
if (ScreenUtils.isPortrait()) {
|
||||
setBannerResource(banner_img);
|
||||
} else {
|
||||
setBannerResource(vertical_img);
|
||||
}
|
||||
} else {
|
||||
if (ScreenUtils.isPortrait()) {
|
||||
iv_banner.setImageDrawable(getActivity().getDrawable(R.drawable.port_banner));
|
||||
} else {
|
||||
iv_banner.setImageDrawable(getActivity().getDrawable(R.drawable.land_banner));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getBanner", "onError: " + e.getMessage());
|
||||
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getBanner", "onComplete: ");
|
||||
setImageViewSize();
|
||||
// int bannerWidth = iv_banner.getWidth();
|
||||
// int bannerHeight = iv_banner.getHeight();
|
||||
// Drawable drawable = iv_banner.getDrawable();
|
||||
// if (drawable != null) {
|
||||
// int width = drawable.getMinimumWidth();
|
||||
// int height = drawable.getMinimumHeight();
|
||||
// Log.e(TAG, "getBanner: iv_banner: width = " + bannerWidth);
|
||||
// Log.e(TAG, "getBanner: iv_banner: height = " + bannerHeight);
|
||||
// Log.e(TAG, "getBanner: Drawable: width = " + width);
|
||||
// Log.e(TAG, "getBanner: Drawable: height = " + height);
|
||||
// Log.e(TAG, "getBanner: scale = " + (float) (1.0 * bannerWidth / width));
|
||||
// Log.e(TAG, "getBanner: " + (int) ((float) (1.0 * bannerWidth / width) * height));
|
||||
// int changeHeight = (int) ((double) (bannerWidth / width) * height);
|
||||
// if (changeHeight != 0) {
|
||||
// ViewGroup.LayoutParams params = iv_banner.getLayoutParams();
|
||||
// params.height = changeHeight;
|
||||
// iv_banner.setLayoutParams(params);
|
||||
//// ViewGroup.LayoutParams clParams = cl.getLayoutParams();
|
||||
//// clParams.height = changeHeight;
|
||||
//// cl.setLayoutParams(clParams);
|
||||
// Log.e(TAG, "getBanner: iv_banner: height = " + iv_banner.getHeight());
|
||||
// Log.e(TAG, "getBanner: cl: height = " + cl.getHeight());
|
||||
// }
|
||||
// iv_banner.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setBannerResource(String url){
|
||||
Glide.with(iv_banner)
|
||||
.load(url)
|
||||
.transition(new DrawableTransitionOptions().dontTransition())
|
||||
.into(new CustomTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
|
||||
iv_banner.setImageDrawable(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setImageViewSize() {
|
||||
ViewGroup.LayoutParams ivParams = iv_banner.getLayoutParams();
|
||||
ViewGroup.LayoutParams clParams = cl.getLayoutParams();
|
||||
@@ -231,13 +336,13 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
Resources res = getActivity().getResources();
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inJustDecodeBounds = true;
|
||||
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
//竖屏
|
||||
BitmapFactory.decodeResource(res, R.drawable.port_banner, opts);
|
||||
} else {
|
||||
//横屏
|
||||
BitmapFactory.decodeResource(res, R.drawable.land_banner, opts);
|
||||
}
|
||||
// if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
// //竖屏
|
||||
// BitmapFactory.decodeResource(res, R.drawable.port_banner, opts);
|
||||
// } else {
|
||||
// //横屏
|
||||
// BitmapFactory.decodeResource(res, R.drawable.land_banner, opts);
|
||||
// }
|
||||
opts.inSampleSize = 1;
|
||||
opts.inJustDecodeBounds = false;
|
||||
int w = opts.outWidth;
|
||||
@@ -251,84 +356,8 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
iv_banner.setLayoutParams(ivParams);
|
||||
clParams.height = imageViewheight;
|
||||
cl.setLayoutParams(clParams);
|
||||
Log.e(TAG, "setImageViewSize: imageViewheight :" + imageViewheight);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void loadData(Bundle savedInstanceState) {
|
||||
// initData();
|
||||
// initAPPData(handler);
|
||||
}
|
||||
|
||||
synchronized private void initAPPData(final Handler handler) {
|
||||
// OKGO.getAllAppInfo(handler);
|
||||
getAllAppInfo();
|
||||
// OKGO.getBannerImg(handler);
|
||||
// getBannerImg();
|
||||
getBanner();
|
||||
}
|
||||
|
||||
private void getBanner() {
|
||||
if (ScreenUtils.isPortrait()) {
|
||||
iv_banner.setImageDrawable(getActivity().getDrawable(R.drawable.port_banner));
|
||||
} else {
|
||||
iv_banner.setImageDrawable(getActivity().getDrawable(R.drawable.land_banner));
|
||||
}
|
||||
NetInterfaceManager.getInstance().getBannerObservable()
|
||||
.subscribe(new Observer<BaseResponse<Banner>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getBanner", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<Banner> bannerBaseResponse) {
|
||||
if (bannerBaseResponse.code == 200) {
|
||||
String banner_img = bannerBaseResponse.data.getBanner_img();
|
||||
String vertical_img = bannerBaseResponse.data.getVertical_img();
|
||||
if (ScreenUtils.isPortrait()) {
|
||||
Glide.with(iv_banner).load(banner_img).into(iv_banner);
|
||||
} else {
|
||||
Glide.with(iv_banner).load(vertical_img).into(iv_banner);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getBanner", "onError: " + e.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getBanner", "onComplete: ");
|
||||
|
||||
}
|
||||
});
|
||||
int bannerWidth = iv_banner.getWidth();
|
||||
int bannerHeight = iv_banner.getHeight();
|
||||
Drawable drawable = iv_banner.getDrawable();
|
||||
if (drawable != null) {
|
||||
int width = drawable.getMinimumWidth();
|
||||
int height = drawable.getMinimumHeight();
|
||||
Log.e(TAG, "getBanner: iv_banner: width = " + bannerWidth);
|
||||
Log.e(TAG, "getBanner: iv_banner: height = " + bannerHeight);
|
||||
Log.e(TAG, "getBanner: Drawable: width = " + width);
|
||||
Log.e(TAG, "getBanner: Drawable: height = " + height);
|
||||
Log.e(TAG, "getBanner: " + (float) (1.0 * bannerWidth / width));
|
||||
Log.e(TAG, "getBanner: " + (int) ((float) (1.0 * bannerWidth / width) * height));
|
||||
int changeHeight = (int) ((double) (bannerWidth / width) * height);
|
||||
if (changeHeight != 0) {
|
||||
iv_banner.getLayoutParams().height = changeHeight;
|
||||
}
|
||||
iv_banner.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
Log.e(TAG, "setImageViewSize: clheight :" + cl.getHeight());
|
||||
Log.e(TAG, "setImageViewSize: imageViewheight :" + iv_banner.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -348,11 +377,12 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
Log.e("getAllAppInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<List<AppInfo>> listBaseResponse) {
|
||||
Log.e("getAllAppInfo", "onNext: " + listBaseResponse);
|
||||
int code = listBaseResponse.code;
|
||||
if (code == 200) {
|
||||
List<AppInfo> infos = listBaseResponse.data;
|
||||
@@ -382,6 +412,7 @@ public class FeaturedFragment extends LazyLoadFragment implements RefreshManager
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAllAppInfo", "onComplete: ");
|
||||
mRefreshLayout.finishRefresh();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -53,8 +53,8 @@ public class ManageFragment extends LazyLoadFragment {
|
||||
private UpdateAppAdapter adapter;
|
||||
private ConstraintLayout manage_cl_localapp, manage_cl_download;
|
||||
private Context mContext;
|
||||
private TextView tv_pripolicy;
|
||||
private TextView tv_useragreement;
|
||||
// private TextView tv_pripolicy;
|
||||
// private TextView tv_useragreement;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
@@ -66,14 +66,14 @@ public class ManageFragment extends LazyLoadFragment {
|
||||
manage_tv_updateNum = view.findViewById(R.id.manage_tv_updateNum);
|
||||
manage_tv_appNum = view.findViewById(R.id.manage_tv_appNum);
|
||||
tv_version = view.findViewById(R.id.tv_version);
|
||||
tv_pripolicy = view.findViewById(R.id.tv_pripolicy);
|
||||
tv_useragreement = view.findViewById(R.id.tv_useragreement);
|
||||
tv_pripolicy.setOnClickListener(v -> {
|
||||
startActivity(new Intent(getActivity(), PrivacyPolicyActivity.class));
|
||||
});
|
||||
tv_useragreement.setOnClickListener(v -> {
|
||||
startActivity(new Intent(getActivity(), UserAgreementActivity.class));
|
||||
});
|
||||
// tv_pripolicy = view.findViewById(R.id.tv_pripolicy);
|
||||
// tv_useragreement = view.findViewById(R.id.tv_useragreement);
|
||||
// tv_pripolicy.setOnClickListener(v -> {
|
||||
// startActivity(new Intent(getActivity(), PrivacyPolicyActivity.class));
|
||||
// });
|
||||
// tv_useragreement.setOnClickListener(v -> {
|
||||
// startActivity(new Intent(getActivity(), UserAgreementActivity.class));
|
||||
// });
|
||||
tv_version.setText("版本 " + BuildConfig.VERSION_NAME);
|
||||
manage_cl_localapp = view.findViewById(R.id.manage_cl_localapp);
|
||||
manage_cl_localapp.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -97,7 +97,6 @@ public class ManageFragment extends LazyLoadFragment {
|
||||
|
||||
mRvLocal.setAdapter(adapter);
|
||||
mRvLocal.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,63 +114,22 @@ public class ManageFragment extends LazyLoadFragment {
|
||||
super.onStart();
|
||||
mContext = getActivity();
|
||||
initAPPData(handler);
|
||||
List<LocalApp> localApps = getLocalApp();
|
||||
List<LocalApp> localApps = ApkUtils.getLocalApp(getActivity());
|
||||
if (localApps != null && localApps.size() > 0) {
|
||||
manage_tv_appNum.setText(localApps.size() + "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
synchronized private void initAPPData(final Handler handler) {
|
||||
// OKGO.getAllAppInfo(handler);
|
||||
}
|
||||
|
||||
synchronized private List<LocalApp> getLocalApp() {
|
||||
List<LocalApp> appList = new ArrayList<>();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfoList = mContext.getPackageManager().queryIntentActivities(intent, 0);
|
||||
|
||||
for (int i = 0; i < resolveInfoList.size(); i++) {
|
||||
LocalApp bean = new LocalApp();
|
||||
bean.setAppName(resolveInfoList.get(i).loadLabel(mContext.getPackageManager()).toString());
|
||||
String packageName = resolveInfoList.get(i).activityInfo.packageName;
|
||||
bean.setPackageName(packageName);
|
||||
Drawable icon = resolveInfoList.get(i).loadIcon(mContext.getPackageManager());
|
||||
bean.setIcon(icon);
|
||||
if (packageName.equals(mContext.getPackageName()) || packageName.equals("com.android.uiuios")) {
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.canremove_systemapp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(packageName, 0);
|
||||
String versionCode = mContext.getPackageManager()
|
||||
.getPackageInfo(packageName, 0).versionName;
|
||||
bean.setVersion(versionCode);
|
||||
bean.setVersionCode(packageInfo.versionCode);
|
||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) <= 0) {
|
||||
//第三方应用
|
||||
//判断是否需要进行更新
|
||||
// isNeedUpdate(bean, i);
|
||||
appList.add(bean);
|
||||
} else {
|
||||
//系统应用
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return appList;
|
||||
}
|
||||
|
||||
synchronized private void updateDta(List<AppInfo> list) {
|
||||
packageNameList.clear();
|
||||
for (AppInfo appInfo : list) {
|
||||
packageNameList.add(appInfo.getApp_package());
|
||||
}
|
||||
localAppList = getLocalApp();
|
||||
localAppList = ApkUtils.getLocalApp(getActivity());
|
||||
if (packageNameList != null && packageNameList.size() > 0) {
|
||||
if (localAppList != null && localAppList.size() > 0) {
|
||||
for (LocalApp app : localAppList) {
|
||||
@@ -232,5 +190,4 @@ public class ManageFragment extends LazyLoadFragment {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,12 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageInstaller;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
@@ -19,6 +22,7 @@ import androidx.core.content.FileProvider;
|
||||
|
||||
import com.uiui.appstore.BuildConfig;
|
||||
import com.uiui.appstore.R;
|
||||
import com.uiui.appstore.bean.LocalApp;
|
||||
import com.uiui.appstore.receiver.InstallResultReceiver;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -32,6 +36,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -108,6 +113,7 @@ public class ApkUtils {
|
||||
}
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载一个app
|
||||
*/
|
||||
@@ -626,12 +632,101 @@ public class ApkUtils {
|
||||
appVersionCode = info.versionCode;
|
||||
}
|
||||
return versionCode > appVersionCode;
|
||||
}else {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> canremove_systemapp = new ArrayList<String>() {{
|
||||
synchronized public static List<LocalApp> getLocalApp(Context context) {
|
||||
List<LocalApp> appList = new ArrayList<>();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, 0);
|
||||
String qch_force_app = Settings.System.getString(context.getContentResolver(), "qch_force_app");
|
||||
for (int i = 0; i < resolveInfoList.size(); i++) {
|
||||
LocalApp bean = new LocalApp();
|
||||
bean.setAppName(resolveInfoList.get(i).loadLabel(context.getPackageManager()).toString());
|
||||
String packageName = resolveInfoList.get(i).activityInfo.packageName;
|
||||
if (ApkUtils.ownApp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.canremove_systemapp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
bean.setPackageName(packageName);
|
||||
Drawable icon = resolveInfoList.get(i).loadIcon(context.getPackageManager());
|
||||
bean.setIcon(icon);
|
||||
if (packageName.contains(qch_force_app)) {
|
||||
bean.setCanUnintall(false);
|
||||
} else {
|
||||
bean.setCanUnintall(true);
|
||||
}
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
String versionCode = context.getPackageManager()
|
||||
.getPackageInfo(packageName, 0).versionName;
|
||||
bean.setVersion(versionCode);
|
||||
String appInstallDir = packageInfo.applicationInfo.publicSourceDir;
|
||||
int size = Integer.valueOf((int) new File(appInstallDir).length());
|
||||
bean.setSize(size);
|
||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) <= 0) {
|
||||
//第三方应用
|
||||
appList.add(bean);
|
||||
//判断是否需要进行更新
|
||||
|
||||
} else {
|
||||
//系统应用
|
||||
}
|
||||
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return appList;
|
||||
}
|
||||
|
||||
synchronized public static List<LocalApp> getLocalApp2(Context context) {
|
||||
List<LocalApp> appList = new ArrayList<>();
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfoList = context.getPackageManager().queryIntentActivities(intent, 0);
|
||||
|
||||
for (int i = 0; i < resolveInfoList.size(); i++) {
|
||||
LocalApp bean = new LocalApp();
|
||||
bean.setAppName(resolveInfoList.get(i).loadLabel(context.getPackageManager()).toString());
|
||||
String packageName = resolveInfoList.get(i).activityInfo.packageName;
|
||||
bean.setPackageName(packageName);
|
||||
Drawable icon = resolveInfoList.get(i).loadIcon(context.getPackageManager());
|
||||
bean.setIcon(icon);
|
||||
if (ApkUtils.ownApp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.canremove_systemapp.contains(packageName)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
String versionCode = context.getPackageManager()
|
||||
.getPackageInfo(packageName, 0).versionName;
|
||||
bean.setVersion(versionCode);
|
||||
bean.setVersionCode(packageInfo.versionCode);
|
||||
if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) <= 0) {
|
||||
//第三方应用
|
||||
//判断是否需要进行更新
|
||||
// isNeedUpdate(bean, i);
|
||||
appList.add(bean);
|
||||
} else {
|
||||
//系统应用
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return appList;
|
||||
}
|
||||
|
||||
|
||||
public static HashSet<String> canremove_systemapp = new HashSet<String>() {{
|
||||
//预置的可以卸载的系统应用,判断出来为第三方
|
||||
this.add("com.android.quicksearchbox");
|
||||
this.add("com.android.calendar");
|
||||
@@ -641,5 +736,13 @@ public class ApkUtils {
|
||||
this.add("com.jiaoguanyi.sysc");
|
||||
}};
|
||||
|
||||
public static HashSet<String> ownApp = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.uiui.os");
|
||||
this.add("com.uiui.browser");
|
||||
this.add("com.uiui.sn");
|
||||
|
||||
}};
|
||||
|
||||
}
|
||||
|
||||
@@ -18,17 +18,16 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_banner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/port_banner"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -43,15 +42,14 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_banner" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/banner_view"
|
||||
tools:layout_editor_absoluteX="16dp">
|
||||
app:layout_constraintTop_toBottomOf="@+id/banner_view">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/featured_rv_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -72,7 +70,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
@@ -165,28 +165,28 @@
|
||||
|
||||
<include layout="@layout/include_line_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pripolicy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:autoLink="all"
|
||||
android:text="@string/privacy_policy"
|
||||
android:textColor="@color/activation_color"
|
||||
android:textSize="16sp"
|
||||
android:visibility="visible" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_pripolicy"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="8dp"-->
|
||||
<!-- android:layout_marginTop="4dp"-->
|
||||
<!-- android:autoLink="all"-->
|
||||
<!-- android:text="@string/privacy_policy"-->
|
||||
<!-- android:textColor="@color/activation_color"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- android:visibility="visible" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_useragreement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:autoLink="all"
|
||||
android:text="@string/user_agreement"
|
||||
android:textColor="@color/activation_color"
|
||||
android:textSize="16sp"
|
||||
android:visibility="visible" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_useragreement"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="8dp"-->
|
||||
<!-- android:autoLink="all"-->
|
||||
<!-- android:text="@string/user_agreement"-->
|
||||
<!-- android:textColor="@color/activation_color"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- android:visibility="visible" />-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -18,17 +18,16 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_banner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/port_banner"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -43,13 +42,21 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_banner" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/banner_view"
|
||||
tools:layout_editor_absoluteX="16dp">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/banner_view">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="sdasdasd"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/featured_rv_result" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/featured_rv_result"
|
||||
@@ -71,8 +78,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
|
||||
|
||||
@@ -165,30 +165,30 @@
|
||||
|
||||
<include layout="@layout/include_line_horizontal" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_pripolicy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:autoLink="all"
|
||||
android:text="@string/privacy_policy"
|
||||
android:textColor="@color/activation_color"
|
||||
android:textSize="16sp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintStart_toEndOf="@+id/tv_guide"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView3" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_pripolicy"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="8dp"-->
|
||||
<!-- android:layout_marginTop="4dp"-->
|
||||
<!-- android:autoLink="all"-->
|
||||
<!-- android:text="@string/privacy_policy"-->
|
||||
<!-- android:textColor="@color/activation_color"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- android:visibility="visible"-->
|
||||
<!-- app:layout_constraintStart_toEndOf="@+id/tv_guide"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/textView3" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_useragreement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:autoLink="all"
|
||||
android:text="@string/user_agreement"
|
||||
android:textColor="@color/activation_color"
|
||||
android:textSize="16sp"
|
||||
android:visibility="visible" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_useragreement"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="8dp"-->
|
||||
<!-- android:autoLink="all"-->
|
||||
<!-- android:text="@string/user_agreement"-->
|
||||
<!-- android:textColor="@color/activation_color"-->
|
||||
<!-- android:textSize="16sp"-->
|
||||
<!-- android:visibility="visible" />-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 3.9 KiB |