1:修改小时榜

This commit is contained in:
2025-10-09 09:26:16 +08:00
parent c68ffe6016
commit 329d698550
21 changed files with 315 additions and 62 deletions

View File

@@ -101,7 +101,7 @@ android {
}
buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
@@ -123,7 +123,7 @@ android {
debug {
debuggable true
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug

View File

@@ -85,10 +85,43 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
}
}
}
// 新增版本检查逻辑
checkAppVersion();
super.onCreate(savedInstanceState);
// EventBus.getDefault().register(this);
// AppLogUtil.reportAppLog(AppLogEvent.A0101);
}
private void checkAppVersion() {
// 获取当前版本号
int currentVersionCode = 0;
try {
currentVersionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
} catch (Exception e) {
e.printStackTrace();
}
// 从SharedPreferences中获取上次运行的版本号
int lastVersionCode = PreferencesUtils.getInt(CommonAppContext.getInstance(), "last_version_code", 0);
// 如果版本号不同,说明应用已更新
if (currentVersionCode != lastVersionCode) {
// 保存当前版本号
PreferencesUtils.putInt(CommonAppContext.getInstance(), "last_version_code", currentVersionCode);
// 如果不是首次安装,则需要清理任务栈
if (lastVersionCode != 0) {
clearTaskAndRestart();
}
}
}
private void clearTaskAndRestart() {
// 清理所有Activity并重启应用
Intent intent = new Intent(this, PasswordLoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}
@Override
protected void onDestroy() {