version:1.1.2 Huaruian
fix: update:增加检查更新
This commit is contained in:
@@ -109,8 +109,8 @@ android {
|
|||||||
|
|
||||||
Huaruian {
|
Huaruian {
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
versionCode 12
|
versionCode 13
|
||||||
versionName "1.1.1"
|
versionName "1.1.2"
|
||||||
buildConfigField "String", "platform", '"ZR6016"'
|
buildConfigField "String", "platform", '"ZR6016"'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,11 @@
|
|||||||
android:screenOrientation="userPortrait" />
|
android:screenOrientation="userPortrait" />
|
||||||
<activity android:name=".activity.TopActivity" />
|
<activity android:name=".activity.TopActivity" />
|
||||||
<activity android:name=".activity.MainActivity1" />
|
<activity android:name=".activity.MainActivity1" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.update.UpdateActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="userPortrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.requestlog.RequestLogActivity"
|
android:name=".activity.requestlog.RequestLogActivity"
|
||||||
android:launchMode="singleTask" />
|
android:launchMode="singleTask" />
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ public class MainAPresenter implements MainAContact.Presenter {
|
|||||||
mView.checkTestUpdateFinish();
|
mView.checkTestUpdateFinish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "checkTestUpdate: tag is Empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,12 +162,12 @@ public class MainAPresenter implements MainAContact.Presenter {
|
|||||||
public void getDefaultDesktop() {
|
public void getDefaultDesktop() {
|
||||||
Log.e(TAG, "getDefaultDesktop: ");
|
Log.e(TAG, "getDefaultDesktop: ");
|
||||||
if (JGYUtils.isOfficialVersion() || !JGYUtils.getInstance().getDeviceIsLocked()) {
|
if (JGYUtils.isOfficialVersion() || !JGYUtils.getInstance().getDeviceIsLocked()) {
|
||||||
Log.e(TAG, "getDefaultDesktop: "+"Device unLocked");
|
Log.e(TAG, "getDefaultDesktop: " + "Device unLocked");
|
||||||
mView.getDefaultDesktopFinish();
|
mView.getDefaultDesktopFinish();
|
||||||
} else {
|
} else {
|
||||||
int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
|
int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
|
||||||
if (JGYUtils.getInstance().isAihuaFramwwork() && aihuaUnlock == 1) {
|
if (JGYUtils.getInstance().isAihuaFramwwork() && aihuaUnlock == 1) {
|
||||||
Log.e(TAG, "getDefaultDesktop: "+"Device aihua");
|
Log.e(TAG, "getDefaultDesktop: " + "Device aihua");
|
||||||
mView.getDefaultDesktopFinish();
|
mView.getDefaultDesktopFinish();
|
||||||
} else {
|
} else {
|
||||||
NetInterfaceManager.getInstance()
|
NetInterfaceManager.getInstance()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.view.Gravity;
|
|||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
|||||||
import com.aoleyun.sn.BuildConfig;
|
import com.aoleyun.sn.BuildConfig;
|
||||||
import com.aoleyun.sn.R;
|
import com.aoleyun.sn.R;
|
||||||
import com.aoleyun.sn.activity.requestlog.RequestLogActivity;
|
import com.aoleyun.sn.activity.requestlog.RequestLogActivity;
|
||||||
|
import com.aoleyun.sn.activity.update.UpdateActivity;
|
||||||
import com.aoleyun.sn.base.BaseActivity;
|
import com.aoleyun.sn.base.BaseActivity;
|
||||||
import com.aoleyun.sn.bean.StudentsInfo;
|
import com.aoleyun.sn.bean.StudentsInfo;
|
||||||
import com.aoleyun.sn.comm.CommonConfig;
|
import com.aoleyun.sn.comm.CommonConfig;
|
||||||
@@ -72,6 +74,8 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
|||||||
ImageView back;
|
ImageView back;
|
||||||
@BindView(R.id.tv_version)
|
@BindView(R.id.tv_version)
|
||||||
TextView tv_version;
|
TextView tv_version;
|
||||||
|
@BindView(R.id.bt_update)
|
||||||
|
Button bt_update;
|
||||||
@BindView(R.id.iv_head)
|
@BindView(R.id.iv_head)
|
||||||
ImageView iv_head;
|
ImageView iv_head;
|
||||||
@BindView(R.id.tv_name)
|
@BindView(R.id.tv_name)
|
||||||
@@ -206,6 +210,12 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
|||||||
cl_class.setVisibility(View.VISIBLE);
|
cl_class.setVisibility(View.VISIBLE);
|
||||||
cl_number_name.setVisibility(View.GONE);
|
cl_number_name.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
bt_update.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
startActivity(new Intent(MainActivity.this, UpdateActivity.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
// setStoreUpdateListener(bt_checkupdate);
|
// setStoreUpdateListener(bt_checkupdate);
|
||||||
registerReceiver();
|
registerReceiver();
|
||||||
}
|
}
|
||||||
@@ -483,6 +493,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkAoleyunUpdateFinish() {
|
public void checkAoleyunUpdateFinish() {
|
||||||
|
Log.e(TAG, "checkAoleyunUpdateFinish: ");
|
||||||
mMainAPresenter.checkTestUpdate();
|
mMainAPresenter.checkTestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
package com.aoleyun.sn.activity.update;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.aoleyun.sn.R;
|
||||||
|
import com.aoleyun.sn.adapter.AppUpdateAdapter;
|
||||||
|
import com.aoleyun.sn.base.BaseActivity;
|
||||||
|
import com.aoleyun.sn.bean.AppUpdateInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
public class UpdateActivity extends BaseActivity implements UpdateContact.UpdateView {
|
||||||
|
|
||||||
|
private static final String TAG = UpdateActivity.class.getSimpleName();
|
||||||
|
@BindView(R.id.root)
|
||||||
|
ConstraintLayout root;
|
||||||
|
@BindView(R.id.main)
|
||||||
|
ConstraintLayout main;
|
||||||
|
@BindView(R.id.iv_back)
|
||||||
|
ImageView iv_back;
|
||||||
|
@BindView(R.id.cl_nodata)
|
||||||
|
ConstraintLayout cl_nodata;
|
||||||
|
@BindView(R.id.recyclerView)
|
||||||
|
RecyclerView recyclerView;
|
||||||
|
|
||||||
|
private UpdatePresenter mPresenter;
|
||||||
|
private AppUpdateAdapter mAppUpdateAdapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.activity_update;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
mPresenter = new UpdatePresenter(this);
|
||||||
|
mPresenter.attachView(this);
|
||||||
|
mPresenter.setLifecycle(lifecycleSubject);
|
||||||
|
|
||||||
|
mAppUpdateAdapter = new AppUpdateAdapter();
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(UpdateActivity.this));
|
||||||
|
recyclerView.setAdapter(mAppUpdateAdapter);
|
||||||
|
root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
main.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
iv_back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
registmNewAppReceiver();
|
||||||
|
mPresenter.checkAllAppUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
mPresenter.detachView();
|
||||||
|
if (mNewAppReceiver != null) {
|
||||||
|
unregisterReceiver(mNewAppReceiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppUpdate(List<AppUpdateInfo> updateApp) {
|
||||||
|
if (updateApp == null || updateApp.size() == 0) {
|
||||||
|
cl_nodata.setVisibility(View.VISIBLE);
|
||||||
|
recyclerView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
cl_nodata.setVisibility(View.GONE);
|
||||||
|
recyclerView.setVisibility(View.VISIBLE);
|
||||||
|
mAppUpdateAdapter.setAppInfoList(updateApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registmNewAppReceiver() {
|
||||||
|
mNewAppReceiver = new NewAppReceiver();
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
|
filter.addDataScheme("package");
|
||||||
|
registerReceiver(mNewAppReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private NewAppReceiver mNewAppReceiver;
|
||||||
|
|
||||||
|
class NewAppReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
Log.e(TAG, "onReceive: " + action);
|
||||||
|
if (Intent.ACTION_PACKAGE_ADDED.equals(action)
|
||||||
|
|| Intent.ACTION_PACKAGE_REMOVED.equals(action)
|
||||||
|
|| Intent.ACTION_PACKAGE_REPLACED.equals(action)
|
||||||
|
|| Intent.ACTION_PACKAGE_CHANGED.equals(action)
|
||||||
|
) {
|
||||||
|
mAppUpdateAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.aoleyun.sn.activity.update;
|
||||||
|
|
||||||
|
import com.aoleyun.sn.base.BasePresenter;
|
||||||
|
import com.aoleyun.sn.base.BaseView;
|
||||||
|
import com.aoleyun.sn.bean.AppUpdateInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class UpdateContact {
|
||||||
|
interface Presenter extends BasePresenter<UpdateView> {
|
||||||
|
/*获取所有更新*/
|
||||||
|
void checkAllAppUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface UpdateView extends BaseView {
|
||||||
|
void onAppUpdate(List<AppUpdateInfo> updateApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.aoleyun.sn.activity.update;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.aoleyun.sn.bean.AppUpdateInfo;
|
||||||
|
import com.aoleyun.sn.network.NetInterfaceManager;
|
||||||
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
|
|
||||||
|
public class UpdatePresenter implements UpdateContact.Presenter {
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
UpdatePresenter(Context context) {
|
||||||
|
this.mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UpdateContact.UpdateView mView;
|
||||||
|
|
||||||
|
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||||
|
|
||||||
|
public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||||
|
this.lifecycle = lifecycle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BehaviorSubject<ActivityEvent> getLifecycle() {
|
||||||
|
return lifecycle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void attachView(UpdateContact.UpdateView view) {
|
||||||
|
this.mView = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detachView() {
|
||||||
|
this.mView = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkAllAppUpdate() {
|
||||||
|
NetInterfaceManager.getInstance().checkAoleyunUpdate( getLifecycle(), new NetInterfaceManager.UpdateCallback() {
|
||||||
|
@Override
|
||||||
|
public void onUpdate(List<AppUpdateInfo> appUpdateInfos) {
|
||||||
|
mView.onAppUpdate(appUpdateInfos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
180
app/src/main/java/com/aoleyun/sn/adapter/AppUpdateAdapter.java
Normal file
180
app/src/main/java/com/aoleyun/sn/adapter/AppUpdateAdapter.java
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
package com.aoleyun.sn.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.aoleyun.sn.BuildConfig;
|
||||||
|
import com.aoleyun.sn.R;
|
||||||
|
import com.aoleyun.sn.bean.AppUpdateInfo;
|
||||||
|
import com.aoleyun.sn.comm.PackageNames;
|
||||||
|
import com.aoleyun.sn.gson.GsonUtils;
|
||||||
|
import com.aoleyun.sn.utils.ApkUtils;
|
||||||
|
import com.aoleyun.sn.utils.JGYUtils;
|
||||||
|
import com.aoleyun.sn.utils.ToastUtil;
|
||||||
|
import com.aoleyun.sn.utils.Utils;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AppUpdateAdapter extends RecyclerView.Adapter<AppUpdateAdapter.Holder> {
|
||||||
|
private static final String TAG = AppUpdateAdapter.class.getSimpleName();
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private List<AppUpdateInfo> mAppInfoList;
|
||||||
|
private PackageManager mPackageManager;
|
||||||
|
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Holder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
mContext = parent.getContext();
|
||||||
|
mPackageManager = mContext.getPackageManager();
|
||||||
|
return new Holder(LayoutInflater.from(mContext).inflate(R.layout.item_app_update, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||||
|
AppUpdateInfo appInfo = mAppInfoList.get(position);
|
||||||
|
String pkg = appInfo.getPackages();
|
||||||
|
Drawable drawable;
|
||||||
|
switch (pkg) {
|
||||||
|
case BuildConfig.APPLICATION_ID:
|
||||||
|
drawable = mContext.getDrawable(R.mipmap.ic_launcher);
|
||||||
|
break;
|
||||||
|
case PackageNames.APPSTORE:
|
||||||
|
drawable = mContext.getDrawable(R.drawable.com_aoleyun_appstore);
|
||||||
|
break;
|
||||||
|
case PackageNames.DESKTOP:
|
||||||
|
drawable = mContext.getDrawable(R.drawable.com_aoleyun_os);
|
||||||
|
break;
|
||||||
|
case PackageNames.NOTIFICATIONS:
|
||||||
|
drawable = mContext.getDrawable(R.drawable.com_aoleyun_info);
|
||||||
|
break;
|
||||||
|
case PackageNames.BROWSER:
|
||||||
|
drawable = mContext.getDrawable(R.drawable.com_aoleyun_browser);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
drawable = mContext.getDrawable(R.drawable.exit_icon);
|
||||||
|
}
|
||||||
|
Glide.with(mContext).load(drawable).into(holder.imageView);
|
||||||
|
if (!TextUtils.isEmpty(appInfo.getApp_name())) {
|
||||||
|
holder.tv_app_name.setText(appInfo.getApp_name());
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(appInfo.getVersion_name())) {
|
||||||
|
holder.tv_app_version.setText("更新版本:" + appInfo.getVersion_name());
|
||||||
|
}
|
||||||
|
holder.tv_local_version.setText("安装版本:" + installedVersion(pkg));
|
||||||
|
if (ApkUtils.isAvailable(mContext, appInfo.getPackages())) {
|
||||||
|
if (isUpdate(appInfo)) {
|
||||||
|
holder.bt_update.setEnabled(true);
|
||||||
|
holder.bt_update.setText("更新");
|
||||||
|
holder.bt_update.setBackground(mContext.getDrawable(R.drawable.bt_activation_selector));
|
||||||
|
} else {
|
||||||
|
holder.bt_update.setEnabled(false);
|
||||||
|
holder.bt_update.setText("暂无");
|
||||||
|
holder.bt_update.setBackground(mContext.getDrawable(R.drawable.bt_disable));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
holder.bt_update.setEnabled(true);
|
||||||
|
holder.bt_update.setText("下载");
|
||||||
|
holder.bt_update.setBackground(mContext.getDrawable(R.drawable.bt_activation_selector));
|
||||||
|
}
|
||||||
|
holder.bt_update.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
notifyDataSetChanged();
|
||||||
|
if (isUpdate(appInfo)) {
|
||||||
|
ToastUtil.show("开始下载:" + appInfo.getApp_name());
|
||||||
|
JsonObject jsonObject = GsonUtils.getJsonObject(new Gson().toJson(appInfo));
|
||||||
|
Utils.ariaDownload(mContext, appInfo.getUrl(), jsonObject);
|
||||||
|
} else {
|
||||||
|
ToastUtil.show(appInfo.getApp_name() + " 已是最新版本");
|
||||||
|
Log.e(TAG, "onClick: 没有找到更新");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isUpdate(AppUpdateInfo appInfo) {
|
||||||
|
String pkg = appInfo.getPackages();
|
||||||
|
PackageInfo packageInfo = null;
|
||||||
|
try {
|
||||||
|
packageInfo = mPackageManager.getPackageInfo(pkg, 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (packageInfo == null) {
|
||||||
|
//未安装
|
||||||
|
Log.e(TAG, "getAllAppUpdateInfos: " + pkg);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
long appVersionCode;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
|
appVersionCode = packageInfo.getLongVersionCode();
|
||||||
|
} else {
|
||||||
|
appVersionCode = packageInfo.versionCode;
|
||||||
|
}
|
||||||
|
long versionCode = appInfo.getVersion_code();
|
||||||
|
//版本升级
|
||||||
|
return appVersionCode < versionCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String installedVersion(String pkg) {
|
||||||
|
PackageInfo packageInfo = null;
|
||||||
|
try {
|
||||||
|
packageInfo = mPackageManager.getPackageInfo(pkg, 0);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (packageInfo == null) {
|
||||||
|
return "未安装";
|
||||||
|
} else {
|
||||||
|
return packageInfo.versionName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppInfoList(List<AppUpdateInfo> appInfoList) {
|
||||||
|
this.mAppInfoList = appInfoList;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mAppInfoList == null ? 0 : mAppInfoList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
class Holder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
ImageView imageView;
|
||||||
|
TextView tv_app_name;
|
||||||
|
TextView tv_app_version;
|
||||||
|
TextView tv_local_version;
|
||||||
|
Button bt_update;
|
||||||
|
|
||||||
|
public Holder(@NonNull View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
imageView = itemView.findViewById(R.id.imageView);
|
||||||
|
tv_app_name = itemView.findViewById(R.id.tv_app_name);
|
||||||
|
tv_app_version = itemView.findViewById(R.id.tv_app_version);
|
||||||
|
tv_local_version = itemView.findViewById(R.id.tv_local_version);
|
||||||
|
bt_update = itemView.findViewById(R.id.bt_update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ public class BaseApplication extends MultiDexApplication {
|
|||||||
Log.e(TAG, "mmkv root: " + rootDir);
|
Log.e(TAG, "mmkv root: " + rootDir);
|
||||||
|
|
||||||
CrashReport.initCrashReport(getApplicationContext(), "b16b3c7f1a", false);
|
CrashReport.initCrashReport(getApplicationContext(), "b16b3c7f1a", false);
|
||||||
CrashReport.setDeviceModel(this, Utils.getSerial(this));
|
CrashReport.setDeviceId(this, Utils.getSerial(this));
|
||||||
|
|
||||||
PushManager.init(this);
|
PushManager.init(this);
|
||||||
initRegisterObservable();
|
initRegisterObservable();
|
||||||
|
|||||||
29
app/src/main/java/com/aoleyun/sn/bean/DownloadTaskInfo.java
Normal file
29
app/src/main/java/com/aoleyun/sn/bean/DownloadTaskInfo.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.aoleyun.sn.bean;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class DownloadTaskInfo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -5406588064200275496L;
|
||||||
|
|
||||||
|
String app_name;
|
||||||
|
@SerializedName(value = "app_package", alternate = {"package", "packages"})
|
||||||
|
String app_package;
|
||||||
|
|
||||||
|
public String getApp_name() {
|
||||||
|
return app_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_name(String app_name) {
|
||||||
|
this.app_name = app_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApp_package() {
|
||||||
|
return app_package;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApp_package(String app_package) {
|
||||||
|
this.app_package = app_package;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ public class CommonConfig {
|
|||||||
|
|
||||||
public static final String AES_KEY = "0123456789ABCDEF";
|
public static final String AES_KEY = "0123456789ABCDEF";
|
||||||
|
|
||||||
|
public static final String DEFAULT_DESKTOP_PACKAGE = "default_desktop_package_key";
|
||||||
|
|
||||||
/*爱华解锁标识*/
|
/*爱华解锁标识*/
|
||||||
public final static String AIHUA_UNLOCK = "Aihua_unlock_state";
|
public final static String AIHUA_UNLOCK = "Aihua_unlock_state";
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ import io.reactivex.rxjava3.core.Observer;
|
|||||||
import io.reactivex.rxjava3.disposables.Disposable;
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
import io.reactivex.rxjava3.functions.BiFunction;
|
import io.reactivex.rxjava3.functions.BiFunction;
|
||||||
import io.reactivex.rxjava3.functions.Function5;
|
import io.reactivex.rxjava3.functions.Function5;
|
||||||
|
import io.reactivex.rxjava3.functions.Function6;
|
||||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||||
import okhttp3.Cache;
|
import okhttp3.Cache;
|
||||||
@@ -827,6 +828,91 @@ public class NetInterfaceManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface UpdateCallback {
|
||||||
|
void onUpdate(List<AppUpdateInfo> appUpdateInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized public void checkAoleyunUpdate(BehaviorSubject<ActivityEvent> lifecycle, UpdateCallback callback) {
|
||||||
|
Observable<BaseResponse<AppUpdateInfo>> infoUpdateObservable = NetInterfaceManager.getInstance()
|
||||||
|
.getUpdateApi().getUpdate(BuildConfig.APPLICATION_ID, JGYUtils.getInstance().checkAppPlatform());
|
||||||
|
Observable<BaseResponse<AppUpdateInfo>> storeUpdateObservable = NetInterfaceManager.getInstance()
|
||||||
|
.getUpdateApi().getUpdate(PackageNames.APPSTORE, JGYUtils.getInstance().checkAppPlatform());
|
||||||
|
Observable<BaseResponse<AppUpdateInfo>> desktopUpdateObservable = NetInterfaceManager.getInstance()
|
||||||
|
.getUpdateApi().getUpdate(PackageNames.DESKTOP, JGYUtils.getInstance().checkAppPlatform());
|
||||||
|
Observable<BaseResponse<AppUpdateInfo>> notifyUpdateObservable = NetInterfaceManager.getInstance()
|
||||||
|
.getUpdateApi().getUpdate(PackageNames.NOTIFICATIONS, JGYUtils.getInstance().checkAppPlatform());
|
||||||
|
Observable<BaseResponse<AppUpdateInfo>> browserUpdateObservable = NetInterfaceManager.getInstance()
|
||||||
|
.getUpdateApi().getUpdate(PackageNames.BROWSER, JGYUtils.getInstance().checkAppPlatform());
|
||||||
|
String desktop = mMMKV.decodeString(CommonConfig.DEFAULT_DESKTOP_PACKAGE);
|
||||||
|
Observable<BaseResponse<AppUpdateInfo>> learningDesktopObservable = NetInterfaceManager.getInstance()
|
||||||
|
.getUpdateApi().getUpdate(desktop, JGYUtils.getInstance().checkAppPlatform());
|
||||||
|
Observable.zip(infoUpdateObservable, storeUpdateObservable, desktopUpdateObservable,
|
||||||
|
notifyUpdateObservable, browserUpdateObservable, learningDesktopObservable,
|
||||||
|
new Function6<BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, List<AppUpdateInfo>>() {
|
||||||
|
@Override
|
||||||
|
public List<AppUpdateInfo> apply
|
||||||
|
(BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse, BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse2, BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse3,
|
||||||
|
BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse4, BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse5, BaseResponse<AppUpdateInfo> appUpdateInfoBaseResponse6) throws Throwable {
|
||||||
|
List<AppUpdateInfo> appUpdateInfos = new ArrayList<>();
|
||||||
|
if (appUpdateInfoBaseResponse.code == OK) {
|
||||||
|
appUpdateInfos.add(appUpdateInfoBaseResponse.data);
|
||||||
|
}
|
||||||
|
if (appUpdateInfoBaseResponse2.code == OK) {
|
||||||
|
appUpdateInfos.add(appUpdateInfoBaseResponse2.data);
|
||||||
|
}
|
||||||
|
if (appUpdateInfoBaseResponse3.code == OK) {
|
||||||
|
appUpdateInfos.add(appUpdateInfoBaseResponse3.data);
|
||||||
|
}
|
||||||
|
if (appUpdateInfoBaseResponse4.code == OK) {
|
||||||
|
appUpdateInfos.add(appUpdateInfoBaseResponse4.data);
|
||||||
|
}
|
||||||
|
if (appUpdateInfoBaseResponse5.code == OK) {
|
||||||
|
appUpdateInfos.add(appUpdateInfoBaseResponse5.data);
|
||||||
|
}
|
||||||
|
if (appUpdateInfoBaseResponse6.code == OK) {
|
||||||
|
appUpdateInfos.add(appUpdateInfoBaseResponse6.data);
|
||||||
|
}
|
||||||
|
return appUpdateInfos;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||||
|
.subscribe(new Observer<List<AppUpdateInfo>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("checkAoleyunUpdate", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull List<AppUpdateInfo> appUpdateInfos) {
|
||||||
|
String jsonString = GsonUtils.toJSONString(appUpdateInfos);
|
||||||
|
Log.e("checkAoleyunUpdate", "onNext: " + jsonString);
|
||||||
|
if (appUpdateInfos != null && appUpdateInfos.size() != 0) {
|
||||||
|
cacheHelper.put(UrlAddress.CHECK_UPDATE, jsonString);
|
||||||
|
for (AppUpdateInfo info : appUpdateInfos) {
|
||||||
|
JsonObject jsonObject = parseString(new Gson().toJson(info)).getAsJsonObject();
|
||||||
|
JGYUtils.getInstance().installAPK(jsonObject);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cacheHelper.put(UrlAddress.CHECK_UPDATE, "");
|
||||||
|
}
|
||||||
|
callback.onUpdate(appUpdateInfos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("checkAoleyunUpdate", "onError: " + e.getMessage());
|
||||||
|
onComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("checkAoleyunUpdate", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public void checkUpdate() {
|
public void checkUpdate() {
|
||||||
String jsonString = cacheHelper.getAsString(UrlAddress.CHECK_UPDATE);
|
String jsonString = cacheHelper.getAsString(UrlAddress.CHECK_UPDATE);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import com.aoleyun.sn.BuildConfig;
|
|||||||
import com.aoleyun.sn.KeepAliveConnection;
|
import com.aoleyun.sn.KeepAliveConnection;
|
||||||
import com.aoleyun.sn.R;
|
import com.aoleyun.sn.R;
|
||||||
import com.aoleyun.sn.bean.BaseResponse;
|
import com.aoleyun.sn.bean.BaseResponse;
|
||||||
|
import com.aoleyun.sn.bean.DownloadTaskInfo;
|
||||||
|
import com.aoleyun.sn.bean.ForceDownloadData;
|
||||||
import com.aoleyun.sn.comm.CommonConfig;
|
import com.aoleyun.sn.comm.CommonConfig;
|
||||||
import com.aoleyun.sn.comm.PackageNames;
|
import com.aoleyun.sn.comm.PackageNames;
|
||||||
import com.aoleyun.sn.gson.GsonUtils;
|
import com.aoleyun.sn.gson.GsonUtils;
|
||||||
@@ -46,7 +48,9 @@ import com.arialyy.annotations.Download;
|
|||||||
import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.Aria;
|
||||||
import com.arialyy.aria.core.task.DownloadTask;
|
import com.arialyy.aria.core.task.DownloadTask;
|
||||||
import com.baidu.location.LocationClient;
|
import com.baidu.location.LocationClient;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -54,6 +58,8 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||||
@@ -845,9 +851,13 @@ public class GuardService extends Service {
|
|||||||
//在这里处理任务执行中的状态,如进度进度条的刷新
|
//在这里处理任务执行中的状态,如进度进度条的刷新
|
||||||
@Download.onTaskRunning
|
@Download.onTaskRunning
|
||||||
protected void running(DownloadTask task) {
|
protected void running(DownloadTask task) {
|
||||||
JsonObject jsonObject = GsonUtils.getJsonObject(task.getExtendField());
|
String jsonString = task.getExtendField();
|
||||||
String app_name = jsonObject.get("app_name").getAsString();
|
Gson gson = new Gson();
|
||||||
String app_package = jsonObject.get("app_package").getAsString();
|
Type listType = new TypeToken<DownloadTaskInfo>() {
|
||||||
|
}.getType();
|
||||||
|
DownloadTaskInfo downloadTaskInfo = gson.fromJson(jsonString, listType);
|
||||||
|
String app_name = downloadTaskInfo.getApp_name();
|
||||||
|
String app_package = downloadTaskInfo.getApp_package();
|
||||||
Log.e("aria", "正在下载:" + task.getPercent() + ":" + task.getExtendField());
|
Log.e("aria", "正在下载:" + task.getPercent() + ":" + task.getExtendField());
|
||||||
ToastUtil.show("正在下载:" + app_name + "-" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
|
ToastUtil.show("正在下载:" + app_name + "-" + task.getPercent() + "%" + "\t" + Formatter.formatFileSize(GuardService.this, task.getSpeed()) + "/s");
|
||||||
}
|
}
|
||||||
@@ -861,9 +871,13 @@ public class GuardService extends Service {
|
|||||||
Log.e("taskComplete", "extendField::" + extendField);
|
Log.e("taskComplete", "extendField::" + extendField);
|
||||||
|
|
||||||
if (filepath.endsWith("apk")) {
|
if (filepath.endsWith("apk")) {
|
||||||
JsonObject jsonObject = GsonUtils.getJsonObject(extendField);
|
String jsonString = task.getExtendField();
|
||||||
String app_name = jsonObject.get("app_name").getAsString();
|
Gson gson = new Gson();
|
||||||
String app_package = jsonObject.get("app_package").getAsString();
|
Type listType = new TypeToken<DownloadTaskInfo>() {
|
||||||
|
}.getType();
|
||||||
|
DownloadTaskInfo downloadTaskInfo = gson.fromJson(jsonString, listType);
|
||||||
|
String app_name = downloadTaskInfo.getApp_name();
|
||||||
|
String app_package = downloadTaskInfo.getApp_package();
|
||||||
ToastUtil.show(app_name + "\t:下载完成");
|
ToastUtil.show(app_name + "\t:下载完成");
|
||||||
if (filepath.endsWith(".xapk")) {
|
if (filepath.endsWith(".xapk")) {
|
||||||
XAPKUtils.getInstance().installXAPK(filepath);
|
XAPKUtils.getInstance().installXAPK(filepath);
|
||||||
|
|||||||
@@ -1323,6 +1323,7 @@ public class JGYUtils {
|
|||||||
String app_url = jsonObject.get("app_url").getAsString();
|
String app_url = jsonObject.get("app_url").getAsString();
|
||||||
String app_package = jsonObject.get("app_package").getAsString();
|
String app_package = jsonObject.get("app_package").getAsString();
|
||||||
int app_version_code = jsonObject.get("app_version_code").getAsInt();
|
int app_version_code = jsonObject.get("app_version_code").getAsInt();
|
||||||
|
mMMKV.encode(CommonConfig.DEFAULT_DESKTOP_PACKAGE, app_package);
|
||||||
Set<String> desktop = new HashSet<>(ApkUtils.desktopAPP);
|
Set<String> desktop = new HashSet<>(ApkUtils.desktopAPP);
|
||||||
desktop.remove(app_package);
|
desktop.remove(app_package);
|
||||||
for (String s : desktop) {
|
for (String s : desktop) {
|
||||||
|
|||||||
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_appstore.png
Normal file
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_appstore.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_browser.png
Normal file
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_browser.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_info.png
Normal file
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_info.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_os.png
Normal file
BIN
app/src/main/res/drawable-hdpi/com_aoleyun_os.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable-hdpi/exit_icon.png
Normal file
BIN
app/src/main/res/drawable-hdpi/exit_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_nodata.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_nodata.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
@@ -10,6 +10,6 @@
|
|||||||
android:topRightRadius="@dimen/dp_20" />
|
android:topRightRadius="@dimen/dp_20" />
|
||||||
|
|
||||||
<padding
|
<padding
|
||||||
android:left="@dimen/dp_10"
|
android:left="@dimen/dp_4"
|
||||||
android:right="@dimen/dp_10" />
|
android:right="@dimen/dp_4" />
|
||||||
</shape>
|
</shape>
|
||||||
@@ -10,6 +10,6 @@
|
|||||||
android:topRightRadius="@dimen/dp_20" />
|
android:topRightRadius="@dimen/dp_20" />
|
||||||
|
|
||||||
<padding
|
<padding
|
||||||
android:left="@dimen/dp_10"
|
android:left="@dimen/dp_4"
|
||||||
android:right="@dimen/dp_10" />
|
android:right="@dimen/dp_4" />
|
||||||
</shape>
|
</shape>
|
||||||
18
app/src/main/res/drawable/bt_disable.xml
Normal file
18
app/src/main/res/drawable/bt_disable.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 内部颜色 -->
|
||||||
|
<solid
|
||||||
|
android:color="@color/check_activation_color" />
|
||||||
|
<!-- 圆角的幅度 -->
|
||||||
|
<corners
|
||||||
|
android:topLeftRadius="24dp"
|
||||||
|
android:topRightRadius="24dp"
|
||||||
|
android:bottomLeftRadius="24dp"
|
||||||
|
android:bottomRightRadius="24dp" />
|
||||||
|
<padding
|
||||||
|
android:bottom="5dp"
|
||||||
|
android:left="10dp"
|
||||||
|
android:right="10dp"
|
||||||
|
android:top="5dp" />
|
||||||
|
</shape>
|
||||||
@@ -42,15 +42,31 @@
|
|||||||
app:layout_constraintStart_toEndOf="@+id/iv_back"
|
app:layout_constraintStart_toEndOf="@+id/iv_back"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_version"
|
android:id="@+id/tv_version"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/dp_8"
|
android:layout_marginEnd="@dimen/dp_4"
|
||||||
android:text="@string/unknown"
|
android:text="@string/unknown"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="@dimen/sp_12"
|
android:textSize="@dimen/sp_12"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bt_update"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_update"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/dp_8"
|
||||||
|
android:background="@drawable/bt_activation_selector"
|
||||||
|
android:stateListAnimator="@null"
|
||||||
|
android:text="检查更新"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_8"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -46,11 +46,26 @@
|
|||||||
android:id="@+id/tv_version"
|
android:id="@+id/tv_version"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/dp_8"
|
android:layout_marginEnd="@dimen/dp_4"
|
||||||
android:text="@string/unknown"
|
android:text="@string/unknown"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/text_gray"
|
||||||
android:textSize="@dimen/sp_12"
|
android:textSize="@dimen/sp_12"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bt_update"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_update"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/dp_8"
|
||||||
|
android:background="@drawable/bt_activation_selector"
|
||||||
|
android:stateListAnimator="@null"
|
||||||
|
android:text="检查更新"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_8"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
96
app/src/main/res/layout/activity_update.xml
Normal file
96
app/src/main/res/layout/activity_update.xml
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.update.UpdateActivity">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_40"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="@dimen/dp_24"
|
||||||
|
android:layout_height="@dimen/dp_24"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/bt_return"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="应用更新检测"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/sp_14"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/main">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_nodata"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="没有找到更新信息"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.498"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.621" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/dp_64"
|
||||||
|
android:layout_height="@dimen/dp_64"
|
||||||
|
android:layout_marginBottom="@dimen/dp_32"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/icon_nodata"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/textView7"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/textView7"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/textView7" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
86
app/src/main/res/layout/item_app_update.xml
Normal file
86
app/src/main/res/layout/item_app_update.xml
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_64"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_width="@dimen/dp_40"
|
||||||
|
android:layout_height="@dimen/dp_40"
|
||||||
|
android:layout_marginStart="@dimen/dp_32"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/imageView"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/bt_update"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/imageView"
|
||||||
|
app:layout_constraintVertical_bias="0.5">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_app_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_9"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="应用名" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_app_version"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_4"
|
||||||
|
android:textSize="@dimen/sp_8"
|
||||||
|
android:textColor="@color/activation_color"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_app_name"
|
||||||
|
tools:text="在线版本" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_local_version"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/sp_8"
|
||||||
|
android:layout_marginTop="@dimen/dp_4"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_app_version"
|
||||||
|
tools:text="本地版本" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bt_update"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginEnd="@dimen/dp_32"
|
||||||
|
android:background="@drawable/bt_activation_selector"
|
||||||
|
android:stateListAnimator="@null"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="@dimen/sp_8"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:text="更新" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
<color name="appstore_selecte_color">#8f82bc</color>
|
<color name="appstore_selecte_color">#8f82bc</color>
|
||||||
<color name="check_update_color">#4880ff</color>
|
<color name="check_update_color">#4880ff</color>
|
||||||
<color name="check_update_color_pressed">#3e76f6</color>
|
<color name="check_update_color_pressed">#3e76f6</color>
|
||||||
|
<color name="check_activation_color">#D3D3D3</color>
|
||||||
<color name="title_textcolor">#494949</color>
|
<color name="title_textcolor">#494949</color>
|
||||||
|
|
||||||
<color name="toast_color">#CD000000</color>
|
<color name="toast_color">#CD000000</color>
|
||||||
|
|||||||
Reference in New Issue
Block a user