新增APP内部更新功能

This commit is contained in:
tongchao 2025-08-14 16:36:52 +08:00
parent 4d87fa752b
commit 6ac2e96fd4
7 changed files with 39 additions and 67 deletions

View File

@ -12,8 +12,8 @@ android {
applicationId "com.tairui.gov_affairs_cloud"
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
versionCode 3
versionName "1.1"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {

View File

@ -9,6 +9,9 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<!-- 安装应用权限 -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<!-- 用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 用于访问GPS定位 -->
@ -355,6 +358,18 @@
android:name="com.amap.api.location.APSService"
android:foregroundServiceType="location" />
<!-- 声明FileProvider -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>

View File

@ -5,7 +5,7 @@ import com.tairui.gov_affairs_cloud.BuildConfig;
public class Api {
public static String BASE_HOST = BuildConfig.DOMAIN;
public static String OSS_HOST = "http://gov-cloud.oss-cn-chengdu.aliyuncs.com/";
public static String OSS_HOST = "http://app.yingyijt.com/";
/**
* 请求成功

View File

@ -139,7 +139,7 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
@Override
protected void onApplyData() {
// getAppVersionInfo();
getAppVersionInfo();
}
/**

View File

@ -9,16 +9,13 @@ import com.tairui.gov_affairs_cloud.databinding.ActivitySplashBinding;
import com.tairui.gov_affairs_cloud.ui.login.LoginActivity;
import com.tairui.gov_affairs_cloud.util.IntentUtil;
import com.tairui.gov_affairs_cloud.util.MyCountDownTimer;
import com.tairui.gov_affairs_cloud.util.SingleClickListener;
import android.text.TextUtils;
import android.view.View;
public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
private CountTimer countTimer;
private static final int INTERVAL = 1000;
private boolean isSkipAble = true;// 跳过按钮可以点击
@Override
protected Class<ActivitySplashBinding> getBindingClass() {
@ -31,51 +28,16 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
.statusBarDarkFont(true).init();
}
@Override
protected void onBindListener() {
binding.txtTimerSplash.setOnClickListener(new SingleClickListener() {
@Override
protected void onSingleClick(View v) {
skipTimeCountDown();
}
});
}
@Override
protected void onApplyData() {
goMain();
}
private void goMain() {
if (null != binding.txtTimerSplash) {
setGone(binding.txtTimerSplash, true);
countTimer = new CountTimer(1 * 1000, INTERVAL);
WeakReference<CountTimer> weakTimerCountDowner = new WeakReference<>(countTimer);
if (null != weakTimerCountDowner.get()) {
weakTimerCountDowner.get().start();
}
}
}
/**
* 跳过倒计时
*/
private void skipTimeCountDown() {
if (isSkipAble) {
isSkipAble = false;
if (null != binding.txtTimerSplash) {
binding.txtTimerSplash.setClickable(false);
}
if (null != countTimer) {
countTimer.cancel();
countTimer = null;
}
if (TextUtils.isEmpty(AppConfig.getInstance().getToken())) {
IntentUtil.startActivity(mContext, LoginActivity.class, null);
finish();
} else {
gotoMain();
}
countTimer = new CountTimer(1 * 1000, INTERVAL);
WeakReference<CountTimer> weakTimerCountDowner = new WeakReference<>(countTimer);
if (null != weakTimerCountDowner.get()) {
weakTimerCountDowner.get().start();
}
}
@ -111,11 +73,6 @@ public class SplashActivity extends BaseActivity<ActivitySplashBinding> {
@Override
public void onTick(long millisUntilFinished) {
int time = (int) (millisUntilFinished / INTERVAL) + 1;
if (null != binding.txtTimerSplash) {
String TIME_PASS = "跳过 ";
binding.txtTimerSplash.setText(TIME_PASS + time);
}
}
@Override

View File

@ -12,21 +12,5 @@
android:layout_centerInParent="true"
android:src="@mipmap/ic_logo" />
<TextView
android:id="@+id/txt_timer_splash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/margin_big"
android:layout_marginRight="15dp"
android:background="@drawable/container_timer_selector"
android:paddingLeft="15dp"
android:paddingTop="4dp"
android:paddingRight="15dp"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:textSize="@dimen/font_size_small"
android:visibility="visible" />
</RelativeLayout>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<!--所有路径-->
<external-path
name="external_storage_root"
path="." />
<external-files-path
name="opensdk_external"
path="Images/tmp" />
<root-path
name="opensdk_root"
path="" />
</paths>