mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
show when update/install app
This commit is contained in:
parent
a9b8e15812
commit
c3c0749a7a
@ -11,6 +11,8 @@ import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@ -287,8 +289,33 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
||||
}
|
||||
|
||||
// Changelog popup
|
||||
int versionCode = 0;
|
||||
try {
|
||||
PackageInfo packageInfo = getApplicationContext().getPackageManager()
|
||||
.getPackageInfo(getApplicationContext().getPackageName(), 0);
|
||||
versionCode = packageInfo.versionCode;
|
||||
}
|
||||
catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e("changelogDialog", Objects.requireNonNull(e.getMessage()));
|
||||
}
|
||||
|
||||
if (!tinyDb.getBoolean("versionFlag")) {
|
||||
if (versionCode > tinyDb.getInt("versionCode")) {
|
||||
tinyDb.putInt("versionCode", versionCode);
|
||||
tinyDb.putBoolean("versionFlag", true);
|
||||
}
|
||||
else {
|
||||
tinyDb.putBoolean("versionFlag", false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
tinyDb.putBoolean("versionFlag", false);
|
||||
}
|
||||
|
||||
if(tinyDb.getBoolean("versionFlag")) {
|
||||
ChangeLog changelogDialog = new ChangeLog(this);
|
||||
changelogDialog.showDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,8 @@ public class ChangeLog {
|
||||
androidx.appcompat.app.AlertDialog.Builder builder = new AlertDialog.Builder(changelogActivity);
|
||||
builder.setTitle(R.string.changelogTitle);
|
||||
builder.setMessage(Html.fromHtml("<small>" + changelogMessage + "</small>"));
|
||||
builder.setNegativeButton(R.string.okButton, (dialog, which) -> dialog.cancel());
|
||||
builder.setNegativeButton(R.string.close, (dialog, which) -> dialog.cancel());
|
||||
builder.setCancelable(false);
|
||||
builder.create();
|
||||
builder.show();
|
||||
|
||||
|
@ -1,6 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog>
|
||||
|
||||
<release version="2.4.1" versioncode="91">
|
||||
<change>Improvement: Show issues only in Issues Tabs</change>
|
||||
<change>Bugfix: Files breadcrumb navigation links</change>
|
||||
<change>Bugfix: Login with special characters</change>
|
||||
</release>
|
||||
|
||||
<release version="2.4.0" versioncode="90">
|
||||
<change>New: Light theme (choose from settings)</change>
|
||||
<change>New: Icons</change>
|
||||
|
Loading…
Reference in New Issue
Block a user