private void InitializePreferences()
        {
            AddPreferencesFromResource(Resource.Layout.fragment_settings);

            var version = PreferenceManager.FindPreference("version");

            version.Summary = Activity.PackageManager.GetPackageInfo(Activity.PackageName, 0).VersionName;
        }
 /// <summary>
 /// Finds a <seealso cref="Preference"/> based on its key.
 /// </summary>
 /// <param name="key"> The key of the preference to retrieve. </param>
 /// <returns> The <seealso cref="Preference"/> with the key, or null. </returns>
 /// <seealso cref= PreferenceGroup#findPreference(CharSequence) </seealso>
 public virtual Preference FindPreference(string key)
 {
     if (mPreferenceManager == null)
     {
         return(null);
     }
     return(mPreferenceManager.FindPreference(key));
 }
 /**
  * Finds a {@link Preference} based on its key.
  *
  * @param key The key of the preference to retrieve.
  * @return The {@link Preference} with the key, or null.
  * @see PreferenceGroup#findPreference(CharSequence)
  */
 public Preference FindPreference(ICharSequence key)
 {
     if (mPreferenceManager == null)
     {
         return(null);
     }
     return(mPreferenceManager.FindPreference(key));
 }
 public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
 {
     if (_preferenceManager == null)
     {
         sharedPreferences.UnregisterOnSharedPreferenceChangeListener(this);
         return;
     }
     _preferenceManager.FindPreference(key)?.TryRaiseAttachedEvent(AttachedMembers.Preference.ValueChangedEvent);
 }
Exemple #5
0
        public void saveIconScale()
        {
            ListPreference rt = (ListPreference)PreferenceManager.FindPreference("icon_scale");

            string[] vals  = rt.GetEntryValues();
            int      index = rt.FindIndexOfValue(rt.Value);

            AppConfig.setIconScale(vals[index]);
            Log.Debug("SettingsActivity", "Icon Scale is now " + rt.Entry + "  - " + vals[index]);
        }
Exemple #6
0
        public void saveResourceType()
        {
            ListPreference rt = (ListPreference)PreferenceManager.FindPreference("resource_type");

            string[] vals  = rt.GetEntryValues();
            int      index = rt.FindIndexOfValue(rt.Value);

            AppConfig.SelectedResource = vals[index];
            AppConfig.ResourceIndex    = index;
            Log.Debug("SettingsActivity", "Resource type is now " + rt.Entry + "  - " + vals[index]);
        }
Exemple #7
0
        private void InitializePreferences()
        {
            AddPreferencesFromResource(Resource.Layout.fragment_settings);

            var exampleValue = PreferenceManager.FindPreference("example_value") as EditNumberPreference;

            exampleValue.InvalidInput += (s, args) => DisplayInputError(args.Message);

            var resetDefaults = PreferenceManager.FindPreference("reset_defaults");

            resetDefaults.PreferenceClick += ResetDefaults_PreferenceClick;

            var version = PreferenceManager.FindPreference("version");

            version.Summary = Activity.PackageManager.GetPackageInfo(Activity.PackageName, 0).VersionName;
        }
        protected override View OnCreateView(ViewGroup parent)
        {
            parent.SetPadding(0, 0, 0, 0);

            LayoutInflater inflater = (LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService);
            View           layout   = inflater.Inflate(Resource.Layout.toolbar, parent, false);

            Toolbar toolbar = (Toolbar)layout.FindViewById <Toolbar>(Resource.Id.mytoolbar);

            toolbar.SetNavigationIcon(Resource.Drawable.ic_arrow_back_white_24dp);
            toolbar.Title            = Title;
            toolbar.NavigationClick += (sender, args) =>
            {
                PreferenceScreen prefScreen = (PreferenceScreen)PreferenceManager.FindPreference(Key);
                if (prefScreen == null)
                {
                    throw new Exception("didn't find preference " + Key);
                }
                prefScreen.Dialog.Dismiss();
            };

            return(layout);
        }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            ToolbarHelper.ShowToolbar(Activity, "Settings");
            ToolbarHelper.ShowToolbarBackButton(Activity);

            SetUpRecyclerView();

            var stayActive = PreferenceManager.FindPreference("stay_active");

            if (stayActive != null)
            {
                stayActive.PreferenceChange += StayActive_PreferenceChange;
            }

            var viewDebugLog = PreferenceManager.FindPreference("view_debug_log");

            if (viewDebugLog != null)
            {
                viewDebugLog.PreferenceClick += ViewDebugLog_PreferenceClick;
            }

            var resetDefaults = PreferenceManager.FindPreference("reset_defaults");

            if (resetDefaults != null)
            {
                resetDefaults.PreferenceClick += ResetDefaults_PreferenceClick;
            }

            var version = PreferenceManager.FindPreference("version");

            if (version != null)
            {
                version.Summary = Activity.PackageManager.GetPackageInfo(Activity.PackageName, 0).VersionName;
            }
        }
Exemple #10
0
        public void saveMapServerURL()
        {
            EditTextPreference post = (EditTextPreference)PreferenceManager.FindPreference("mapserver_url");

            AppConfig.MapServerURL = post.Text;
        }
Exemple #11
0
        public void savePostInterval()
        {
            EditTextPreference interval = (EditTextPreference)PreferenceManager.FindPreference("post_interval");

            AppConfig.PostInterval = Int32.Parse(interval.Text);
        }
Exemple #12
0
        public void savePostURL()
        {
            EditTextPreference post = (EditTextPreference)PreferenceManager.FindPreference("post_url");

            AppConfig.PostUrl = post.Text;
        }
Exemple #13
0
        public void saveDistributionID()
        {
            EditTextPreference did = (EditTextPreference)PreferenceManager.FindPreference("distribution_id");

            AppConfig.UserID = did.Text;
        }
Exemple #14
0
        public void saveSenderID()
        {
            EditTextPreference sid = (EditTextPreference)PreferenceManager.FindPreference("send_id");

            AppConfig.Agency = sid.Text;
        }