Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            foreach (Reminder r in GetReminders())
            {
                if ((DateTime.Now >= r.From) &&
                    (DateTime.Now < r.To))
                {
                    SetContentView(r.ResourceToShow);
                }
            }

            FindViewById(Resource.Id.ok_donate).Click += (sender, args) => { Util.GotoDonateUrl(this); Finish(); };
            FindViewById(Resource.Id.no_donate).Click += (sender, args) =>
            {
                ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);

                ISharedPreferencesEditor edit = prefs.Edit();
                edit.PutBoolean("DismissedDonateReminder", true);
                EditorCompat.Apply(edit);

                Finish();
            };
        }
Ejemplo n.º 2
0
        public static void ShowDonateReminderIfAppropriate(Activity context)
        {
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(context);

            if (prefs.GetBoolean(context.GetString(Resource.String.NoDonationReminder_key), false))
            {
                return;
            }

            long usageCount = prefs.GetLong(context.GetString(Resource.String.UsageCount_key), 0);

            if (usageCount <= 5)
            {
                return;
            }

            foreach (Reminder r in GetReminders())
            {
                if ((DateTime.Now >= r.From) &&
                    (DateTime.Now < r.To))
                {
                    if (prefs.GetBoolean(r.Key, false) == false)
                    {
                        ISharedPreferencesEditor edit = prefs.Edit();
                        edit.PutBoolean(r.Key, true);
                        EditorCompat.Apply(edit);

                        context.StartActivity(new Intent(context, typeof(DonateReminder)));
                        break;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void SetNewSortOrder(int selectedAfter)
        {
            String sortKey = _context.GetString(Resource.String.sort_key);
            ISharedPreferencesEditor editor = _prefs.Edit();

            editor.PutInt(sortKey, selectedAfter);
            //editor.PutBoolean(_context.GetString(Resource.String.sortgroups_key), false);
            EditorCompat.Apply(editor);
        }
Ejemplo n.º 4
0
        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();
            }
        }
Ejemplo n.º 5
0
        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
            }
        }