show when update/install app

This commit is contained in:
M M Arif 2020-03-21 23:52:52 +05:00
parent a9b8e15812
commit c3c0749a7a
3 changed files with 39 additions and 5 deletions

View File

@ -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();
}
}

View File

@ -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();

View File

@ -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>