private void SetVersion() { Context ctx = Context; String version; try { PackageInfo packageInfo = ctx.PackageManager.GetPackageInfo(ctx.PackageName, 0); version = packageInfo.VersionName; } catch (PackageManager.NameNotFoundException) { version = ""; } TextView tv = (TextView)FindViewById(Resource.Id.versionX); tv.Text = version; FindViewById(Resource.Id.versionB).Click += (sender, args) => ChangeLog.ShowChangeLog(ctx, () => { }); }
protected override void OnStart() { base.OnStart(); Kp2aLog.Log("KeePass.OnStart"); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); bool showChangeLog = false; try { PackageInfo packageInfo = PackageManager.GetPackageInfo(PackageName, 0); int lastInfoVersionCode = prefs.GetInt(GetString(Resource.String.LastInfoVersionCode_key), 0); if (packageInfo.VersionCode > lastInfoVersionCode) { showChangeLog = true; ISharedPreferencesEditor edit = prefs.Edit(); edit.PutInt(GetString(Resource.String.LastInfoVersionCode_key), packageInfo.VersionCode); EditorCompat.Apply(edit); } } catch (PackageManager.NameNotFoundException) { } #if DEBUG showChangeLog = false; #endif if (showChangeLog) { ChangeLog.ShowChangeLog(this, LaunchNextActivity); } else { LaunchNextActivity(); } }
protected override void OnStart() { base.OnStart(); Kp2aLog.Log("KeePass.OnStart"); ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this); /*if (GetCurrentRuntimeValue().StartsWith("ART")) * { * * if (!prefs.GetBoolean("ART_WARNING", false)) * { * * ISharedPreferencesEditor edit = prefs.Edit(); * edit.PutBoolean("ART_WARNING", true); * EditorCompat.Apply(edit); * * new AlertDialog.Builder(this) * .SetTitle("Warning") * .SetMessage( * //"It looks like you are running ART (Android Runtime). Please note: At the time of this app's release, Google says ART is experimental. And indeed, the early releases of ART (e.g. in Android 4.4, 4.4.1 and 4.4.2) contain a bug which causes crashes in Mono for Android apps including Keepass2Android. This bug was fixed after the 4.4.2 release so if you have a later Android release, you might be able to use this app. If not, please switch to Dalvik. Please do not downrate Keepass2Android for this problem, it's not our bug :-). Thanks! See our website (keepass2android.codeplex.com) for more information on this issue.") * "It looks like you are running ART (Android Runtime). Please note: At the time of this app's release, this app does not run completely stable with ART. I am waiting for more fixes regarding ART from the makers of Mono for Android. As ART is still not yet meant for every-day use, please do not down rate KP2A for this. Thanks.") * .SetPositiveButton("OK", (sender, args) => LaunchNextActivity()) * .Create() * .Show(); * * return; * } * * }*/ bool showChangeLog = false; try { PackageInfo packageInfo = PackageManager.GetPackageInfo(PackageName, 0); int lastInfoVersionCode = prefs.GetInt(GetString(Resource.String.LastInfoVersionCode_key), 0); if (packageInfo.VersionCode > lastInfoVersionCode) { showChangeLog = true; ISharedPreferencesEditor edit = prefs.Edit(); edit.PutInt(GetString(Resource.String.LastInfoVersionCode_key), packageInfo.VersionCode); EditorCompat.Apply(edit); } } catch (PackageManager.NameNotFoundException) { } #if DEBUG showChangeLog = false; #endif if (showChangeLog) { ChangeLog.ShowChangeLog(this, LaunchNextActivity); } else { #if !NoNet var pref = PreferenceManager.GetDefaultSharedPreferences(this); if ((pref.GetBoolean(App.PrefHaspendingerrorreport, false) && (App.GetErrorReportMode(this) == App.ErrorReportMode.AskAgain)) ) { ShowErrorReportQuestion(LaunchNextActivity); } else { LaunchNextActivity(); } #else LaunchNextActivity(); #endif } }