コード例 #1
0
        public virtual void SetCurrentUserId(string id)
        {
            SharedPreferences sp = PreferenceManager.GetDefaultSharedPreferences(GetApplicationContext
                                                                                     ());

            if (id != null)
            {
                sp.Edit().PutString(PrefCurrentUserId, id).Apply();
            }
            else
            {
                sp.Edit().Remove(PrefCurrentUserId).Apply();
            }
        }
コード例 #2
0
        public MvxAndroidSettings()
        {
            SharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
            SharedPreferencesEditor = SharedPreferences.Edit();

            SecuredPreferences = Application.Context.GetSharedPreferences(Application.Context.PackageName + ".SecureStorage",
                                                                          FileCreationMode.Private);
            SecuredPreferencesEditor = SecuredPreferences.Edit();
        }
コード例 #3
0
        // ===========================================================
        // Methods
        // ===========================================================

        public bool IsFirstTime(/* final */ String pKey)
        {
            /* final */
            SharedPreferences prefs = this.GetPreferences(FileCreationMode.Private);

            if (prefs.GetBoolean(pKey, true))
            {
                prefs.Edit().PutBoolean(pKey, false).Commit();
                return(true);
            }
            return(false);
        }
コード例 #4
0
        public bool IsAppUpdated()
        {
            int ver = GetVersionCode();

            if (ver > SharedPreferences.GetInt("version", 0))
            {
                SharedPreferences.Edit().PutInt("version", ver).Commit();
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        public MainApp(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
        {
            Instance          = this;
            SharedPreferences = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
            GraphSaverLoader  = new Graph.SaverLoader(new AssetsProvider(ApplicationContext));
            if (IsAppUpdated())
            {
                var groupName = SharedPreferences.GetString("groupnumber", "-1");

                var dictionary = Instance.GroupsDictionary.Task.Result;

                if (dictionary.TryGetValue(groupName, out int id))
                {
                    SharedPreferences.Edit().PutInt("groupid", id).Apply();
                }
            }
        }
コード例 #6
0
        // ===========================================================
        // Constructors
        // ===========================================================

        public void OnCreate(/* final */ Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.SetContentView(R.Layout.list_examples);

            this.mExpandableExampleLauncherListAdapter = new ExpandableExampleLauncherListAdapter(this);

            this.SetListAdapter(this.mExpandableExampleLauncherListAdapter);

            /* TODO: Consider re-adding this if we
             * this.findViewById(R.id.btn_get_involved).setOnClickListener(new OnClickListener() {
             *  @Override
             *  public void onClick(final View pView) {
             *      ExampleLauncher.this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.andengine.org")));
             *  }
             * });
             */

            /* final */
            SharedPreferences prefs = this.GetPreferences(FileCreationMode.Private);

            this.mVersionCodeCurrent    = this.GetVersionCode();
            this.mVersionCodeLastLaunch = prefs.GetInt(PREF_LAST_APP_LAUNCH_VERSIONCODE_ID, -1);

            if (this.IsFirstTime("first.app.launch"))
            {
                this.ShowDialog(DIALOG_FIRST_APP_LAUNCH);
            }
            else if (this.mVersionCodeLastLaunch != -1 && this.mVersionCodeLastLaunch < this.mVersionCodeCurrent)
            {
                this.ShowDialog(DIALOG_NEW_IN_THIS_VERSION);
            }
            else if (IsFirstTime("please.submit.benchmarks"))
            {
                this.ShowDialog(DIALOG_BENCHMARKS_SUBMIT_PLEASE);
            }

            prefs.Edit().PutInt(PREF_LAST_APP_LAUNCH_VERSIONCODE_ID, this.mVersionCodeCurrent).Commit();
        }
コード例 #7
0
ファイル: Settings.cs プロジェクト: Sumit2668/My-StepCounter
 public SettingsHelper()
 {
     SharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
     SharedPreferencesEditor = SharedPreferences.Edit();
 }
コード例 #8
0
 public AndroidUserPreferences()
 {
     SharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
     SharedPreferencesEditor = SharedPreferences.Edit();
 }
コード例 #9
0
 public static void SetInt(string key, int value)
 {
     SharedPreferences.Edit().PutInt(key, value).Commit();
 }