Remove 'whats new dialog'

This commit is contained in:
Paul Schaub 2019-01-01 22:53:54 +01:00
parent 6259280078
commit 2961cd4c1f
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 0 additions and 74 deletions

View file

@ -1,6 +1,5 @@
package de.vanitasvitae.enigmandroid; package de.vanitasvitae.enigmandroid;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -15,7 +14,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.InputType; import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -79,9 +77,6 @@ public class MainActivity extends Activity
SettingsActivity.SettingsSingleton.getInstance(prefs, getResources()); SettingsActivity.SettingsSingleton.getInstance(prefs, getResources());
layoutContainer = LayoutContainer.createLayoutContainer(); layoutContainer = LayoutContainer.createLayoutContainer();
//Handle whats-new dialog
handleVersionUpdate();
//Handle shared text //Handle shared text
Intent intent = getIntent(); Intent intent = getIntent();
String action = intent.getAction(); String action = intent.getAction();
@ -238,58 +233,6 @@ public class MainActivity extends Activity
new PassphraseDialogBuilder().showDialog(); new PassphraseDialogBuilder().showDialog();
} }
/**
* Check, whether the app has been updated
*/
private void handleVersionUpdate()
{
int currentVersionNumber = 0;
int savedVersionNumber = SettingsActivity.SettingsSingleton.getInstance().getVersionNumber();
try
{
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0);
currentVersionNumber = p.versionCode;
}
catch (Exception ignored) {}
if(currentVersionNumber > savedVersionNumber)
{
showWhatsNewDialog();
SettingsActivity.SettingsSingleton.getInstance().setVersionNumber(currentVersionNumber);
}
}
/**
* Show a dialog that informs the user about the latest important changes in the app
* The dialog appears whenever the app starts after an update or after data has been
* deleted
*/
private void showWhatsNewDialog()
{
PackageInfo pInfo = null;
try{ pInfo = getPackageManager().getPackageInfo(this.getPackageName(), 0);}
catch (PackageManager.NameNotFoundException e){ e.printStackTrace();}
assert pInfo != null;
String version = pInfo.versionName;
LayoutInflater li = LayoutInflater.from(this);
@SuppressLint("InflateParams")
View dialog = li.inflate(R.layout.dialog_whats_new, null);
((TextView) dialog.findViewById(R.id.dialog_whats_new_header)).setText(
String.format(getResources().getText(R.string.dialog_whats_new_header).toString(),version));
((TextView) dialog.findViewById(R.id.dialog_whats_new_details)).setText(
R.string.dialog_whats_new_content);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(dialog).setTitle(R.string.dialog_whats_new_title)
.setPositiveButton(R.string.dialog_positive, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
}
});
builder.create().show();
}
/** /**
* Show a Dialog containing information about the app, license, usage, author and a link * Show a Dialog containing information about the app, license, usage, author and a link
* to the changelog * to the changelog

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dialog_whats_new_title">Was ist neu?</string>
</resources>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dialog_whats_new_title">What\'s new?</string>
<string translatable="false" name="dialog_whats_new_header">%1$s:</string> <!--Version-->
<string translatable="false" name="dialog_whats_new_content">
- This splash screen!
\n- Protocol-versioning to ensure compatibility to upcoming releases/new functions.\n
Unfortunately we had to break backwards compatibility to older versions :/
\n- Enigma KD!
\n- New Icon!
</string>
</resources>