//private TunnelInstance tunnel = TunnelInstance.Instance;

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			AddPreferencesFromResource(Resource.Layout.Settings);

			portNumberPref = (EditTextPreference) FindPreference("tunnelPort");
			deviceListPref = (ListPreference) FindPreference("bluetoothDevice");
			listenForClientsPref = (CheckBoxPreference) FindPreference("listenForClients");

			enableStreaming = (CheckBoxPreference) FindPreference("streamVideo");;
			rtspPort = (EditTextPreference) FindPreference("rtspPort");;
			videoPort = (EditTextPreference) FindPreference("videoPort");;
			resolution = (ListPreference) FindPreference("videoResolution");;
			videoQuality = (ListPreference) FindPreference("videoQuality");;
			frameRate = (ListPreference) FindPreference("frameRate");;

			portNumberPref.OnPreferenceChangeListener = this;
			deviceListPref.OnPreferenceChangeListener = this;
			listenForClientsPref.OnPreferenceChangeListener = this;

			enableStreaming.OnPreferenceChangeListener = this;
			rtspPort.OnPreferenceChangeListener = this;
			videoPort.OnPreferenceChangeListener = this;
			resolution.OnPreferenceChangeListener = this;
			videoQuality.OnPreferenceChangeListener = this;
			frameRate.OnPreferenceChangeListener = this;
		}
Ejemplo n.º 2
0
        private void KeepMe()
        {
            var boolConverter   = new BooleanConverter();
            var stringConverter = new StringConverter();
            var enumConverter   = new EnumConverter(null);
            var intConverter    = new Int32Converter();

            var linearLayout = new LinearLayout(null);

            linearLayout.Visibility = ViewStates.Visible;

            var seekBar = new SeekBar(null);

            seekBar.Max      = seekBar.Max;
            seekBar.Progress = seekBar.Progress;

            var textPref = new EditTextPreference(null);

            textPref.Text    = textPref.Text;
            textPref.Enabled = textPref.Enabled;

            var switchPref = new SwitchPreference(null);

            switchPref.Checked = switchPref.Checked;
            switchPref.Enabled = switchPref.Enabled;

            var listPref = new ListPreference(null);

            listPref.Enabled = listPref.Enabled;
            listPref.Value   = listPref.Value;
        }
Ejemplo n.º 3
0
        //private TunnelInstance tunnel = TunnelInstance.Instance;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            AddPreferencesFromResource(Resource.Layout.Settings);

            portNumberPref       = (EditTextPreference)FindPreference("tunnelPort");
            deviceListPref       = (ListPreference)FindPreference("bluetoothDevice");
            listenForClientsPref = (CheckBoxPreference)FindPreference("listenForClients");

            enableStreaming = (CheckBoxPreference)FindPreference("streamVideo");;
            rtspPort        = (EditTextPreference)FindPreference("rtspPort");;
            videoPort       = (EditTextPreference)FindPreference("videoPort");;
            resolution      = (ListPreference)FindPreference("videoResolution");;
            videoQuality    = (ListPreference)FindPreference("videoQuality");;
            frameRate       = (ListPreference)FindPreference("frameRate");;

            portNumberPref.OnPreferenceChangeListener       = this;
            deviceListPref.OnPreferenceChangeListener       = this;
            listenForClientsPref.OnPreferenceChangeListener = this;

            enableStreaming.OnPreferenceChangeListener = this;
            rtspPort.OnPreferenceChangeListener        = this;
            videoPort.OnPreferenceChangeListener       = this;
            resolution.OnPreferenceChangeListener      = this;
            videoQuality.OnPreferenceChangeListener    = this;
            frameRate.OnPreferenceChangeListener       = this;
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstance)
        {
            base.OnCreate(savedInstance);
            AddPreferencesFromResource(Resource.Xml.Preferences);
            mPrefRouterUrl     = (EditTextPreference)FindPreference(Constant.PrefKeyRouterUrl);
            mPrefCameraUrl     = (EditTextPreference)FindPreference(Constant.PrefKeyCameraUrl);
            mPrefRouterUrlTest = (EditTextPreference)FindPreference(Constant.PrefKeyRouterUrlTest);
            mPrefCameraUrlTest = (EditTextPreference)FindPreference(Constant.PrefKeyCameraUrlTest);

            mPrefLenOn  = (EditTextPreference)FindPreference(Constant.PrefKeyLenOn);
            mPrefLenOff = (EditTextPreference)FindPreference(Constant.PrefKeyLenOff);

            mPrefAvanzar    = (EditTextPreference)FindPreference(Constant.PrefKeyAvanzar);
            mPrefRetroceder = (EditTextPreference)FindPreference(Constant.PrefKeyRetroceder);
            mPrefIzquierda  = (EditTextPreference)FindPreference(Constant.PrefKeyIzquierda);
            mPrefDerecha    = (EditTextPreference)FindPreference(Constant.PrefKeyDerecha);
            mPrefParar      = (EditTextPreference)FindPreference(Constant.PrefKeyParar);

            txtPotenciaMotor           = (EditTextPreference)FindPreference(Constant.PrefKeyPotencia);
            txtCorreccionMotorDerecho  = (EditTextPreference)FindPreference(Constant.PrefKeyPotenciaDerecho);
            txtCorreccionMotorIzquiedo = (EditTextPreference)FindPreference(Constant.PrefKeyPotenciaIzquierdo);
            txtPotenciaGiro            = (EditTextPreference)FindPreference(Constant.PrefKeyPotenciaGiro);

            txtCommandStart = (EditTextPreference)FindPreference(Constant.PrefKeyCommandStart);
            txtCommandCorreccionMotorDerecho  = (EditTextPreference)FindPreference(Constant.PrefKeyCommandPotenciaDerecho);
            txtCommandCorreccionMotorIzquiedo = (EditTextPreference)FindPreference(Constant.PrefKeyCommandPotenciaIzquierdo);
            txtCommandPotenciaGiro            = (EditTextPreference)FindPreference(Constant.PrefKeyCommandPotenciaGiro);
            txtCommandPotenciaMotor           = (EditTextPreference)FindPreference(Constant.PrefKeyCommandPotencia);
            txtCommandServoHorizontal         = (EditTextPreference)FindPreference(Constant.PrefKeyCommandServoHorizontal);
            txtCommandServoVertical           = (EditTextPreference)FindPreference(Constant.PrefKeyCommandServoVertical);

            listGearStep = (ListPreference)FindPreference(Constant.PrefKeyGearStep);

            InitValue();
        }
Ejemplo n.º 5
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Add preferences from the preferences xml file
            AddPreferencesFromResource(Resource.Xml.Preferences);

            // Add Flag choice preferences
            var preferenceScreen = this.PreferenceScreen;

            for (int i = 1; i < this.Resources.GetInteger(Resource.Integer.VpnItemCount) + 1; i++)
            {
                var namePreferenceTitle = string.Format(this.Resources.GetString(Resource.String.VpnNamePreferenceTitleFormat), i);
                var namePreference      = new EditTextPreference(preferenceScreen.Context);
                namePreference.Title      = namePreferenceTitle;
                namePreference.Key        = String.Format(VeeKeePreferences.VpnNamePreferenceKeyFormat, i);
                namePreference.Persistent = true;
                preferenceScreen.AddPreference(namePreference);

                var flagPreferenceTitle = string.Format(this.Resources.GetString(Resource.String.VpnFlagKeyPreferenceTitleFormat), i);
                var flagPreference      = new ListPreference(preferenceScreen.Context);
                flagPreference.SetEntries(Resource.Array.flag_titles);
                flagPreference.SetEntryValues(Resource.Array.flag_image_names);
                flagPreference.Title      = flagPreferenceTitle;
                flagPreference.Key        = String.Format(VeeKeePreferences.VpnFlagPreferenceKeyFormat, i);;
                flagPreference.Persistent = true;
                preferenceScreen.AddPreference(flagPreference);
            }
        }
Ejemplo n.º 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Log.Debug("SettingsActivity", "Settings created");
            this.AddPreferencesFromResource(Resource.Layout.preferences);

            postIntervalEditText = (EditTextPreference)FindPreference("post_interval");
            postIntervalEditText.PreferenceChange += onPostIntervalEditTextChanged;
        }
Ejemplo n.º 7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            Settings.Instance.Load ();

            // Create your application here
            AddPreferencesFromResource (Resource.Layout.Settings);

            prefBlacklist = FindPreference ("pref_blacklist");
            prefReorder = FindPreference ("pref_reorder");

            prefDisableHomeDetect = (CheckBoxPreference)FindPreference ("pref_disablecheck");
            prefWallpaperUrl = (EditTextPreference)FindPreference ("pref_WallpaperUrl");

            prefBlacklist.PreferenceClick += delegate {
                StartActivity (typeof (SettingsAppShowHideActivity));
            };
            prefReorder.PreferenceClick += delegate {
                StartActivity (typeof (ReorderActivity));
            };

            // Start the intent service, it will decide to stop itself or not
            prefDisableHomeDetect.PreferenceChange += (sender, e) =>
                StartService (new Intent (this, typeof(ExcuseMeService)));

            prefWallpaperUrl.PreferenceChange += (sender, e) => {
                AndHUD.Shared.Show(this, "Downloading Wallpaper...");

                var url = prefWallpaperUrl.EditText.Text;

                Task.Factory.StartNew (() => {

                    try {
                        var http = new System.Net.WebClient ();
                        var bytes = http.DownloadData (url);
                        var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
                        var filename = System.IO.Path.Combine(path, "wallpaper.png");
                        System.IO.File.WriteAllBytes (filename, bytes);

                        AndHUD.Shared.Dismiss (this);
                    } catch (Exception ex) {

                        AndHUD.Shared.Dismiss (this);

                        Settings.Instance.WallpaperUrl = string.Empty;

                        Toast.MakeText (this, "Failed to Download Wallpaper", ToastLength.Long).Show ();
                        Log.Error ("Downloading Wallpaper Failed", ex);
                    }
                });
            };
        }
Ejemplo n.º 8
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.preferences, false);
     AddPreferencesFromResource(Resource.Xml.preferences);
     _pricePerKmPreference = (EditTextPreference) FindPreference("CustomPricePerKilometerKey");
     _consumptionPer100KmPreference = (EditTextPreference) FindPreference("ConsumptionPer100kmKey");
     _fuelTypeListPreference = (ListPreference) FindPreference("SelectedFuelTypeKey");
     _fuelPriceEditTextPreference = (EditTextPreference) FindPreference("CustomFuelPriceKey");
     _consumptionModesListPreference = (ListPreference) FindPreference("ConsumptionModeSettingKey");
     _consumptionModesListPreference.PreferenceChange += OnConsumptionModePreferenceChanged;
 }
Ejemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Settings.Instance.Load();

            // Create your application here
            AddPreferencesFromResource(Resource.Layout.Settings);

            prefBlacklist = FindPreference("pref_blacklist");
            prefReorder   = FindPreference("pref_reorder");

            prefDisableHomeDetect = (CheckBoxPreference)FindPreference("pref_disablecheck");
            prefWallpaperUrl      = (EditTextPreference)FindPreference("pref_WallpaperUrl");

            prefBlacklist.PreferenceClick += delegate {
                StartActivity(typeof(SettingsAppShowHideActivity));
            };
            prefReorder.PreferenceClick += delegate {
                StartActivity(typeof(ReorderActivity));
            };

            // Start the intent service, it will decide to stop itself or not
            prefDisableHomeDetect.PreferenceChange += (sender, e) =>
                                                      StartService(new Intent(this, typeof(ExcuseMeService)));

            prefWallpaperUrl.PreferenceChange += (sender, e) => {
                AndHUD.Shared.Show(this, "Downloading Wallpaper...");

                var url = prefWallpaperUrl.EditText.Text;

                if (url.IndexOf("http://") == -1)
                {
                    url = string.Concat("http://", url);
                }

                Task.Run(() => {
                    try {
                        var http     = new System.Net.WebClient();
                        var bytes    = http.DownloadData(url);
                        var filename = Settings.GetWallpaperPath();
                        System.IO.File.WriteAllBytes(filename, bytes);
                    } catch (Exception ex) {
                        Settings.Instance.WallpaperUrl = string.Empty;
                        //Toast.MakeText (this, "Failed to Download Wallpaper", ToastLength.Long).Show ();
                        Log.Error("Downloading Wallpaper Failed", ex);
                    }

                    AndHUD.Shared.Dismiss(this);
                });
            };
        }
Ejemplo n.º 10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            AddPreferencesFromResource(Resource.Layout.Settings);

            prefBlacklist          = FindPreference("pref_blacklist");
            prefReorder            = FindPreference("pref_reorder");
            prefHideLabels         = (CheckBoxPreference)FindPreference("pref_hidelabels");
            prefAppNameFontSize    = (EditTextPreference)FindPreference("pref_applabelfontsize");
            prefHideLogo           = (CheckBoxPreference)FindPreference("pref_hidelogo");
            prefHideDividerLine    = (CheckBoxPreference)FindPreference("pref_hidedivider");
            prefHideDate           = (CheckBoxPreference)FindPreference("pref_hidedate");
            prefHideTime           = (CheckBoxPreference)FindPreference("pref_hidetime");
            prefTwentyFourHourTime = (CheckBoxPreference)FindPreference("pref_twentyfourhourtime");
            prefDisableHomeDetect  = (CheckBoxPreference)FindPreference("pref_disablecheck");

            prefAppNameFontSize.EditText.InputType = Android.Text.InputTypes.ClassNumber;

            prefBlacklist.PreferenceClick += delegate {
                StartActivity(typeof(SettingsAppShowHideActivity));
            };
            prefReorder.PreferenceClick += delegate {
                StartActivity(typeof(ReorderActivity));
//
//				AlertDialog dlg = null;
//				var bld = new AlertDialog.Builder(this);
//
//				bld.SetTitle ("Re-Order Apps");
//				bld.SetMessage ("To re-order apps on the home screen, select the app you want to re-order, then long click the item.  This will put the app into re-order mode.  You can now move the app around until you are happy with its position, and select the item again once to exit re-order mode");
//				bld.SetNegativeButton("OK", delegate {
//					dlg.Dismiss();
//				});
//
//				dlg = bld.Create();
//				dlg.Show();
            };

            prefAppNameFontSize.PreferenceChange    += SaveHandler;
            prefHideLabels.PreferenceChange         += SaveHandler;
            prefHideLogo.PreferenceChange           += SaveHandler;
            prefHideDividerLine.PreferenceChange    += SaveHandler;
            prefHideDate.PreferenceChange           += SaveHandler;
            prefHideTime.PreferenceChange           += SaveHandler;
            prefTwentyFourHourTime.PreferenceChange += SaveHandler;
            prefDisableHomeDetect.PreferenceChange  += SaveHandler;
        }
Ejemplo n.º 11
0
 private void UpdatePrefSummary(Preference p)
 {
     if (p is ListPreference)
     {
         ListPreference listPref = (ListPreference)p;
         p.Summary = listPref.Entry;
     }
     if (p is EditTextPreference)
     {
         EditTextPreference editTextPref = (EditTextPreference)p;
         p.Summary = editTextPref.Text;
     }
     if (p is SeekBarPreference)
     {
         SeekBarPreference seekBarPref = (SeekBarPreference)p;
         p.Summary = Convert.ToString(seekBarPref.Progress) + "%";
     }
 }
Ejemplo n.º 12
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your fragment here
            AddPreferencesFromResource(Resource.Xml.system_settings);
            try
            {
                ISharedPreferences d = PreferenceManager.GetDefaultSharedPreferences(MainActivity.context);                         // getting access from Preference manager
                PreferenceManager.GetDefaultSharedPreferences(MainActivity.context).RegisterOnSharedPreferenceChangeListener(this); // registerer the preference listner

                EditTextPreference checkbox = (EditTextPreference)FindPreference("WMSUrl");

                checkbox.Text = d.GetString("WMSUrl", "");
            }
            catch (Exception ex)
            {
                //ErrorLoging.WriteErrorLog(Constants.StudentObject.Idx, ex.Message, "Student_Settings_Fragment");
            }
        }
        public object SelectTemplate(object itemObj, object container)
        {
            var item = (PreferenceModel)itemObj;

            if (item == null)
            {
                return(null);
            }
            var        preference = (Preference)container;
            Preference result;

            using (var set = new BindingSet <PreferenceModel>())
            {
                if (item.IsCheckbox)
                {
                    var checkBoxPref = new CheckBoxPreference(preference.Context)
                    {
                        Key = item.Key
                    };
                    result = checkBoxPref;
                    set.Bind(checkBoxPref, () => p => p.Checked)
                    .To(() => (m, ctx) => m.Value)
                    .TwoWay();
                }
                else
                {
                    var editTextPref = new EditTextPreference(preference.Context)
                    {
                        Key = item.Key
                    };
                    result = editTextPref;
                    set.Bind(editTextPref, () => p => p.Text)
                    .To(() => (m, ctx) => m.Value)
                    .TwoWay();
                    set.Bind(editTextPref, () => p => p.Summary)
                    .ToSelf(() => (m, ctx) => m.Text);
                }
                set.Bind(result, () => p => p.Title).To(() => (m, ctx) => m.Title);
            }
            return(result);
        }
Ejemplo n.º 14
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your fragment here
            AddPreferencesFromResource(Resource.Xml.System_Settings);
            try
            {
                ISharedPreferences d = PreferenceManager.GetDefaultSharedPreferences(MainActivity.context);                         // getting access from Preference manager
                PreferenceManager.GetDefaultSharedPreferences(MainActivity.context).RegisterOnSharedPreferenceChangeListener(this); // registerer the preference listner

                EditTextPreference edittextrange = (EditTextPreference)FindPreference("Default Range");

                edittextrange.Text    = d.GetString("Default Range", ApplicationSettings.Defualt_Distance_Range.ToString());
                edittextrange.Summary = "The Defualt Range for all product searches";

                //CheckBoxPreference checkboxvibrate = (CheckBoxPreference)FindPreference("Vibrate");

                //checkboxvibrate.Checked = d.GetBoolean("Vibrate", NotificationSettings.Vibrate);


                //CheckBoxPreference checkboxSound = (CheckBoxPreference)FindPreference("Sound");

                //checkboxSound.Checked = d.GetBoolean("Sound", NotificationSettings.Sound);



                //RingtonePreference rigntone = (RingtonePreference)FindPreference("NotificationRigntone");

                //Android.Net.Uri uri = Android.Net.Uri.Parse(d.GetString("NotificationRigntone", RingtoneManager.GetDefaultUri(RingtoneType.Alarm).ToString()));

                //Ringtone ringtone = RingtoneManager.GetRingtone(MainActivity.context, uri);
                //String name = ringtone.GetTitle(MainActivity.context);
                //rigntone.Summary = name;
            }
            catch (Exception ex)
            {
                ErrorLoging.WriteErrorLog(Constants.StudentObject.Idx, ex.Message, "Student_Settings_Fragment");
            }
        }
        //About
        private void About_Me_Pref_PreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
        {
            try
            {
                EditTextPreference etp = (EditTextPreference)sender;
                var value = etp.EditText.Text;
                etp.Summary = value;

                var datauser = Classes.MyProfileList.FirstOrDefault(a => a.user_id == UserDetails.User_id);
                if (datauser != null)
                {
                    datauser.about = etp.EditText.Text;
                    S_About        = etp.EditText.Text;
                }

                if (IMethods.CheckConnectivity())
                {
                    var dataPrivacy = new Dictionary <string, string>
                    {
                        { "about", value },
                    };

                    var data = Global.Update_User_Data(dataPrivacy)
                               .ConfigureAwait(false);
                }
                else
                {
                    Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_Error_check_internet_connection),
                                   ToastLength.Long).Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
        {
            try
            {
                var datauser = Classes.MyProfileList.FirstOrDefault(a => a.user_id == UserDetails.User_id);
                if (key.Equals("about_me_key"))
                {
                    // Set summary to be the user-description for the selected value
                    EditTextPreference etp = (EditTextPreference)FindPreference("about_me_key");

                    if (datauser != null)
                    {
                        Wo_Main_Settings.Shared_Data.Edit().PutString("about_me_key", datauser.about).Commit();

                        S_About = datauser.about;

                        if (S_About != "Empty")
                        {
                            etp.EditText.Text = S_About;
                            etp.Text          = S_About;
                        }
                        else
                        {
                            etp.EditText.Text = this.GetText(Resource.String.Lbl_DefaultAbout) + " " + AppSettings.Application_Name;
                            etp.Text          = this.GetText(Resource.String.Lbl_DefaultAbout) + " " + AppSettings.Application_Name;
                        }
                    }

                    string Getvalue = Wo_Main_Settings.Shared_Data.GetString("about_me_key", S_About);
                    etp.EditText.Text = Getvalue;
                    etp.Summary       = Getvalue;
                }
                else if (key.Equals("whocanfollow_key"))
                {
                    var valueAsText = Privacy_Follow_Pref.Entry;
                    if (string.IsNullOrEmpty(valueAsText))
                    {
                        if (datauser != null)
                        {
                            Wo_Main_Settings.Shared_Data.Edit().PutString("whocanfollow_key", datauser.follow_privacy)
                            .Commit();
                            Privacy_Follow_Pref.SetValueIndex(int.Parse(datauser.follow_privacy));

                            S_WhoCanFollowMe = datauser.follow_privacy;
                            if (S_WhoCanFollowMe == "0")
                            {
                                Privacy_Follow_Pref.Summary = this.GetText(Resource.String.Lbl_Everyone);
                            }
                            else if (S_WhoCanFollowMe == "1")
                            {
                                Privacy_Follow_Pref.Summary = this.GetText(Resource.String.Lbl_People_i_Follow);
                            }
                            else
                            {
                                Privacy_Follow_Pref.Summary = this.GetText(Resource.String.Lbl_No_body);
                            }
                        }
                    }
                    else
                    {
                        Privacy_Follow_Pref.Summary = valueAsText;
                        S_WhoCanFollowMe            = Privacy_Follow_Pref.Value;
                        //Privacy_Follow_Pref.SetValueIndex(0);
                    }
                }
                else if (key.Equals("whocanMessage_key"))
                {
                    var valueAsText = Privacy_Message_Pref.Entry;
                    if (string.IsNullOrEmpty(valueAsText))
                    {
                        if (datauser != null)
                        {
                            Privacy_Message_Pref.SetValueIndex(int.Parse(datauser.message_privacy));
                            Wo_Main_Settings.Shared_Data.Edit().PutString("whocanMessage_key", datauser.message_privacy)
                            .Commit();
                            S_WhoCanMessageMe = datauser.message_privacy;
                            if (S_WhoCanMessageMe == "0")
                            {
                                Privacy_Message_Pref.Summary = this.GetText(Resource.String.Lbl_Everyone);
                            }
                            else if (S_WhoCanMessageMe == "1")
                            {
                                Privacy_Message_Pref.Summary = this.GetText(Resource.String.Lbl_People_i_Follow);
                            }
                            else
                            {
                                Privacy_Message_Pref.Summary = this.GetText(Resource.String.Lbl_No_body);
                            }
                        }
                    }
                    else
                    {
                        Privacy_Message_Pref.Summary = valueAsText;
                        S_WhoCanMessageMe            = Privacy_Message_Pref.Value;
                    }
                }
                else if (key.Equals("whocanseemybirthday_key"))
                {
                    var valueAsText = Privacy_Birthday_Pref.Entry;
                    if (string.IsNullOrEmpty(valueAsText))
                    {
                        if (datauser != null)
                        {
                            Privacy_Birthday_Pref.SetValueIndex(int.Parse(datauser.birth_privacy));
                            Wo_Main_Settings.Shared_Data.Edit()
                            .PutString("whocanseemybirthday_key", datauser.birth_privacy).Commit();

                            S_WhoCanSeeMyBirthday = datauser.birth_privacy;
                            if (S_WhoCanSeeMyBirthday == "0")
                            {
                                Privacy_Birthday_Pref.Summary = this.GetText(Resource.String.Lbl_Everyone);
                            }
                            else if (S_WhoCanSeeMyBirthday == "1")
                            {
                                Privacy_Birthday_Pref.Summary = this.GetText(Resource.String.Lbl_People_i_Follow);
                            }
                            else
                            {
                                Privacy_Birthday_Pref.Summary = this.GetText(Resource.String.Lbl_No_body);
                            }
                        }
                    }
                    else
                    {
                        Privacy_Birthday_Pref.Summary = valueAsText;
                        S_WhoCanSeeMyBirthday         = Privacy_Birthday_Pref.Value;
                    }
                }
                else if (key.Equals("notifications_key"))
                {
                    bool Getvalue = Wo_Main_Settings.Shared_Data.GetBoolean("notifications_key", true);
                    Notifcation_Popup_Pref.Checked = Getvalue;
                }
                else if (key.Equals("checkBox_PlaySound_key"))
                {
                    bool Getvalue = Wo_Main_Settings.Shared_Data.GetBoolean("checkBox_PlaySound_key", true);
                    Notifcation_PlaySound_Pref.Checked = Getvalue;

                    if (Getvalue)
                    {
                        S_SoundControl = true;
                    }
                    else
                    {
                        S_SoundControl = false;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 17
0
            public override void OnCreatePreferences(Bundle savedInstanceState, string rootKey)
            {
                SetPreferencesFromResource(Resource.Xml.pref_general, null);
                HasOptionsMenu = false;

                notCategory = (PreferenceCategory)FindPreference(CATEGORY_NOTIFICATION);
                apiCategory = (PreferenceCategory)FindPreference(CATEGORY_API);

                FindPreference(KEY_ABOUTAPP).PreferenceClick += (object sender, Preference.PreferenceClickEventArgs e) =>
                {
                    // Display the fragment as the main content.
                    FragmentManager.BeginTransaction()
                    .Replace(Android.Resource.Id.Content, new AboutAppFragment())
                    .AddToBackStack(null)
                    .Commit();
                };

                followGps = (SwitchPreferenceCompat)FindPreference(KEY_FOLLOWGPS);
                followGps.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
                {
                    var pref = e.Preference as SwitchPreferenceCompat;
                    if ((bool)e.NewValue)
                    {
                        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.AccessFineLocation) != Permission.Granted &&
                            ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.AccessCoarseLocation) != Permission.Granted)
                        {
                            ActivityCompat.RequestPermissions(this.Activity, new String[] { Manifest.Permission.AccessCoarseLocation, Manifest.Permission.AccessFineLocation },
                                                              PERMISSION_LOCATION_REQUEST_CODE);
                            return;
                        }
                        else
                        {
                            // Reset home location data
                            //Settings.SaveLastGPSLocData(new WeatherData.LocationData());
                        }
                    }
                };

                keyEntry        = (EditTextPreference)FindPreference(KEY_APIKEY);
                personalKeyPref = (SwitchPreferenceCompat)FindPreference(KEY_USEPERSONALKEY);
                personalKeyPref.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
                {
                    var pref = e.Preference as SwitchPreferenceCompat;
                    if ((bool)e.NewValue)
                    {
                        if (apiCategory.FindPreference(KEY_APIKEY) == null)
                        {
                            apiCategory.AddPreference(keyEntry);
                        }
                        if (apiCategory.FindPreference(KEY_APIREGISTER) == null)
                        {
                            apiCategory.AddPreference(registerPref);
                        }
                        keyEntry.Enabled = true;
                    }
                    else
                    {
                        var selectedWProv = WeatherData.WeatherManager.GetProvider(providerPref.Value);

                        if (!String.IsNullOrWhiteSpace(selectedWProv.GetAPIKey()))
                        {
                            // We're using our own (verified) keys
                            Settings.KeyVerified = true;
                            Settings.API         = providerPref.Value;
                        }

                        keyEntry.Enabled = false;
                        apiCategory.RemovePreference(keyEntry);
                        apiCategory.RemovePreference(registerPref);
                    }
                };

                var providers = WeatherData.WeatherAPI.APIs;

                providerPref = (DropDownPreference)FindPreference(KEY_API);
                providerPref.SetEntries(providers.Select(provider => provider.Display).ToArray());
                providerPref.SetEntryValues(providers.Select(provider => provider.Value).ToArray());
                providerPref.Persistent        = false;
                providerPref.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
                {
                    var pref          = e.Preference as ListPreference;
                    var selectedWProv = WeatherData.WeatherManager.GetProvider(e.NewValue.ToString());

                    if (selectedWProv.KeyRequired)
                    {
                        if (String.IsNullOrWhiteSpace(selectedWProv.GetAPIKey()))
                        {
                            personalKeyPref.Checked = Settings.UsePersonalKey = true;
                            personalKeyPref.Enabled = false;
                            keyEntry.Enabled        = false;
                            apiCategory.RemovePreference(keyEntry);
                            apiCategory.RemovePreference(registerPref);
                        }
                        else
                        {
                            personalKeyPref.Enabled = true;
                        }

                        if (!Settings.UsePersonalKey)
                        {
                            // We're using our own (verified) keys
                            Settings.KeyVerified = true;
                            keyEntry.Enabled     = false;
                            apiCategory.RemovePreference(keyEntry);
                            apiCategory.RemovePreference(registerPref);
                        }
                        else
                        {
                            keyEntry.Enabled = true;

                            if (apiCategory.FindPreference(KEY_APIKEY) == null)
                            {
                                apiCategory.AddPreference(keyEntry);
                            }
                            if (apiCategory.FindPreference(KEY_APIREGISTER) == null)
                            {
                                apiCategory.AddPreference(registerPref);
                            }
                        }

                        if (apiCategory.FindPreference(KEY_USEPERSONALKEY) == null)
                        {
                            apiCategory.AddPreference(personalKeyPref);
                        }

                        // Reset to old value if not verified
                        if (!Settings.KeyVerified)
                        {
                            Settings.API = pref.Value;
                        }
                        else
                        {
                            Settings.API = e.NewValue.ToString();
                        }

                        var providerEntry = providers.Find(provider => provider.Value == e.NewValue.ToString());
                        UpdateKeySummary(providerEntry.Display);
                        UpdateRegisterLink(providerEntry.Value);
                    }
                    else
                    {
                        Settings.KeyVerified    = false;
                        keyEntry.Enabled        = false;
                        personalKeyPref.Enabled = false;

                        Settings.API = e.NewValue.ToString();
                        // Clear API KEY entry to avoid issues
                        Settings.API_KEY = String.Empty;

                        apiCategory.RemovePreference(personalKeyPref);
                        apiCategory.RemovePreference(keyEntry);
                        apiCategory.RemovePreference(registerPref);
                        UpdateKeySummary();
                        UpdateRegisterLink();
                    }

                    UpdateAlertPreference(WeatherData.WeatherManager.GetInstance().SupportsAlerts);
                };

                registerPref = FindPreference(KEY_APIREGISTER);

                // Set key as verified if API Key is req for API and its set
                if (WeatherData.WeatherManager.GetInstance().KeyRequired)
                {
                    keyEntry.Enabled = true;

                    if (!String.IsNullOrWhiteSpace(Settings.API_KEY) && !Settings.KeyVerified)
                    {
                        Settings.KeyVerified = true;
                    }

                    if (String.IsNullOrWhiteSpace(WeatherData.WeatherManager.GetInstance().GetAPIKey()))
                    {
                        personalKeyPref.Checked = Settings.UsePersonalKey = true;
                        personalKeyPref.Enabled = false;
                        keyEntry.Enabled        = false;
                        apiCategory.RemovePreference(keyEntry);
                        apiCategory.RemovePreference(registerPref);
                    }
                    else
                    {
                        personalKeyPref.Enabled = true;
                    }

                    if (!Settings.UsePersonalKey)
                    {
                        // We're using our own (verified) keys
                        Settings.KeyVerified = true;
                        keyEntry.Enabled     = false;
                        apiCategory.RemovePreference(keyEntry);
                        apiCategory.RemovePreference(registerPref);
                    }
                    else
                    {
                        keyEntry.Enabled = true;

                        if (apiCategory.FindPreference(KEY_APIKEY) == null)
                        {
                            apiCategory.AddPreference(keyEntry);
                        }
                        if (apiCategory.FindPreference(KEY_APIREGISTER) == null)
                        {
                            apiCategory.AddPreference(registerPref);
                        }
                    }
                }
                else
                {
                    keyEntry.Enabled        = false;
                    personalKeyPref.Enabled = false;
                    apiCategory.RemovePreference(personalKeyPref);
                    apiCategory.RemovePreference(keyEntry);
                    apiCategory.RemovePreference(registerPref);
                    Settings.KeyVerified = false;
                }

                UpdateKeySummary();
                UpdateRegisterLink();

                onGoingNotification = (SwitchPreferenceCompat)FindPreference(KEY_ONGOINGNOTIFICATION);
                onGoingNotification.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
                {
                    var pref    = e.Preference as SwitchPreferenceCompat;
                    var context = App.Context;

                    // On-going notification
                    if ((bool)e.NewValue)
                    {
                        WeatherWidgetService.EnqueueWork(context, new Intent(context, typeof(WeatherWidgetService))
                                                         .SetAction(WeatherWidgetService.ACTION_REFRESHNOTIFICATION));

                        if (notCategory.FindPreference(KEY_NOTIFICATIONICON) == null)
                        {
                            notCategory.AddPreference(notificationIcon);
                        }
                    }
                    else
                    {
                        WeatherWidgetService.EnqueueWork(context, new Intent(context, typeof(WeatherWidgetService))
                                                         .SetAction(WeatherWidgetService.ACTION_REMOVENOTIFICATION));

                        notCategory.RemovePreference(notificationIcon);
                    }
                };

                notificationIcon = (DropDownPreference)FindPreference(KEY_NOTIFICATIONICON);
                notificationIcon.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
                {
                    var context = App.Context;
                    WeatherWidgetService.EnqueueWork(context, new Intent(context, typeof(WeatherWidgetService))
                                                     .SetAction(WeatherWidgetService.ACTION_REFRESHNOTIFICATION));
                };

                // Remove preferences
                if (!onGoingNotification.Checked)
                {
                    notCategory.RemovePreference(notificationIcon);
                }

                alertNotification = (SwitchPreferenceCompat)FindPreference(KEY_USEALERTS);
                alertNotification.PreferenceChange += (object sender, Preference.PreferenceChangeEventArgs e) =>
                {
                    var pref    = e.Preference as SwitchPreferenceCompat;
                    var context = App.Context;

                    // Alert notification
                    if ((bool)e.NewValue)
                    {
                        WeatherWidgetService.EnqueueWork(context, new Intent(context, typeof(WeatherWidgetService))
                                                         .SetAction(WeatherWidgetService.ACTION_STARTALARM));
                    }
                    else
                    {
                        WeatherWidgetService.EnqueueWork(context, new Intent(context, typeof(WeatherWidgetService))
                                                         .SetAction(WeatherWidgetService.ACTION_CANCELALARM));
                    }
                };
                UpdateAlertPreference(WeatherData.WeatherManager.GetInstance().SupportsAlerts);
            }
Ejemplo n.º 18
0
 public static void MakeNumeric(this EditTextPreference Preference)
 {
     Preference.SetOnBindEditTextListener(new NumericOnBindEditTextListener());
 }
Ejemplo n.º 19
0
 public void AddSummary(EditTextPreference editTextPreference)
 {
     editTextPreference.Summary = editTextPreference.EditText.InputType != (InputTypes.ClassText | InputTypes.TextVariationPassword) ? editTextPreference.Text : editTextPreference.Text.Aggregate("", (all, next) => all + "*");
 }
    public override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        //getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        // Load the preferences from an XML resource
        AddPreferencesFromResource(Resource.Xml.preferences);

        // Get the Preference Category which we want to add the ListPreference
        ListPreference customListPref = (ListPreference)FindPreference("pref_template");

        MainActivity parentActivity = (MainActivity)Activity;

        // Retrieve SimulScan default templates from the system
        RetrieveTemplates();

        if (customListPref != null)
        {
            List <string> entries     = new List <string>();
            List <string> entryValues = new List <string>();

            string path = Environment.ExternalStorageDirectory.ToString() + "/simulscan/templates";
            Log.Debug(TAG, "Path: " + path);
            File f = new File(path);

            File [] file = f.ListFiles();
            if (file != null)
            {
                for (int i = 0; i < file.Length; i++)
                {
                    Log.Debug(TAG, "FileName:" + file[i].Name);
                    //Log.d("Files", "value:" + file[i].getAbsolutePath());
                    entries.Add(file[i].Name);
                    entryValues.Add(i.ToString());
                }
            }
            else
            {
                Log.Debug(TAG, "Cant find folder");
            }

            if (entries.Count == 0)
            {
                entries.Add(NO_TEMPLATE_FOUND);
                entryValues.Add("");
            }
            customListPref.SetEntries(entries.ToArray());
            customListPref.SetEntryValues(entryValues.ToArray());

            //customListPref.setPersistent(true);

            ISharedPreferences prefs = PreferenceScreen.SharedPreferences;
            int lastTemplatePos      = prefs.GetInt(SETTINGS_LAST_TEMPLATE_POS, 0);
            if (lastTemplatePos >= entries.Count)
            {
                lastTemplatePos = 0;
            }
            customListPref.SetValueIndex(lastTemplatePos);
            customListPref.Summary = entries[lastTemplatePos];


            if (entryValues[lastTemplatePos].CompareTo("") != 0)
            {
                parentActivity.localSettings.fileList          = new List <File>(file);
                parentActivity.localSettings.selectedFileIndex = lastTemplatePos;
            }
        }

        EditTextPreference pref1 = (EditTextPreference)FindPreference("timeout_identification");

        parentActivity.localSettings.identificationTimeout = int.Parse(pref1.Text);
        EditTextPreference pref2 = (EditTextPreference)FindPreference("timeout_processing");

        parentActivity.localSettings.processingTimeout = int.Parse(pref2.Text);
        CheckBoxPreference pref3 = (CheckBoxPreference)FindPreference("ui_result_confirmation");

        parentActivity.localSettings.enableResultConfirmation = pref3.Checked;
        CheckBoxPreference pref4 = (CheckBoxPreference)FindPreference("auto_capture");

        parentActivity.localSettings.enableAutoCapture = pref4.Checked;
        CheckBoxPreference pref5 = (CheckBoxPreference)FindPreference("debug");

        parentActivity.localSettings.enableDebugMode = pref5.Checked;
        CheckBoxPreference pref6 = (CheckBoxPreference)FindPreference("feedback_audio");

        parentActivity.localSettings.enableFeedbackAudio = pref6.Checked;
        CheckBoxPreference pref7 = (CheckBoxPreference)FindPreference("feedback_haptic");

        parentActivity.localSettings.enableHaptic = pref7.Checked;
        CheckBoxPreference pref8 = (CheckBoxPreference)FindPreference("feedback_led");

        parentActivity.localSettings.enableLED = pref8.Checked;
    }
Ejemplo n.º 21
0
        public void saveMapServerURL()
        {
            EditTextPreference post = (EditTextPreference)PreferenceManager.FindPreference("mapserver_url");

            AppConfig.MapServerURL = post.Text;
        }
Ejemplo n.º 22
0
        public void savePostInterval()
        {
            EditTextPreference interval = (EditTextPreference)PreferenceManager.FindPreference("post_interval");

            AppConfig.PostInterval = Int32.Parse(interval.Text);
        }
    public void OnSharedPreferenceChanged(ISharedPreferences prefs, string key)
    {
        MainActivity parentActivity = (MainActivity)Activity;

        if (key.CompareTo(Resources.GetString(Resource.String.pref_key)) == 0)
        {
            ListPreference connectionPref = (ListPreference)FindPreference(key);
            Log.Debug(TAG, "Template PreferenceChanged: " + connectionPref.Value);
            parentActivity.localSettings.selectedFileIndex = int.Parse(connectionPref.Value);
            connectionPref.Summary = connectionPref.Entry;
            //save last template used

            /*ISharedPreferences iprefs = null;
             * iprefs.Edit();
             * iprefs = (ISharedPreferences)prefs.PutInt(SETTINGS_LAST_TEMPLATE_POS, parentActivity.localSettings.selectedFileIndex);
             * prefs.Apply();*/

            ISharedPreferencesEditor editor = (ISharedPreferencesEditor)prefs.Edit();
            editor.PutInt(SETTINGS_LAST_TEMPLATE_POS, parentActivity.localSettings.selectedFileIndex);
            editor.Apply();
        }
        else if (key.CompareTo("timeout_identification") == 0)
        {
            EditTextPreference connectionPref = (EditTextPreference)FindPreference(key);
            Log.Debug(TAG, "Identification PreferenceChanged: " + connectionPref.Text);

            int idto = parentActivity.localSettings.identificationTimeout;

            try {
                idto = int.Parse(connectionPref.Text);
                if (idto < 5000)
                {
                    idto = 5000;
                }
            }
            catch (IllegalFormatException ex)
            {
                Log.Error(TAG, "Invalid identification timeout exception: " + ex.Message);
                Toast.MakeText(parentActivity.ApplicationContext, "Invalid identification timeout value", ToastLength.Long).Show();
            }
            catch (System.OverflowException ex)
            {
                Log.Error(TAG, "Invalid identification timeout exception: " + ex.Message);
                Toast.MakeText(parentActivity.ApplicationContext, "Invalid identification timeout value", ToastLength.Long).Show();
            }

            connectionPref.Text = idto.ToString();
            parentActivity.localSettings.identificationTimeout = idto;
        }
        else if (key.CompareTo("timeout_processing") == 0)
        {
            EditTextPreference connectionPref = (EditTextPreference)FindPreference(key);
            Log.Debug(TAG, "Processing PreferenceChanged: " + connectionPref.Text);

            int processingTimeout = parentActivity.localSettings.processingTimeout;;

            try
            {
                processingTimeout = int.Parse(connectionPref.Text);
            }
            catch (IllegalFormatException ex)
            {
                Log.Error(TAG, "Invalid processing timeout exception: " + ex.Message);
                Toast.MakeText(parentActivity.ApplicationContext, "Invalid processing timeout value", ToastLength.Long).Show();
            }
            catch (System.OverflowException ex)
            {
                Log.Error(TAG, "Invalid processing timeout exception: " + ex.Message);
                Toast.MakeText(parentActivity.ApplicationContext, "Invalid processing timeout value", ToastLength.Long).Show();
            }
            connectionPref.Text = processingTimeout.ToString();
            parentActivity.localSettings.processingTimeout = processingTimeout;
        }
        else if (key.CompareTo("ui_result_confirmation") == 0)
        {
            CheckBoxPreference connectionPref = (CheckBoxPreference)FindPreference(key);
            Log.Debug(TAG, "result confrmation PreferenceChanged: " + connectionPref.Checked);
            parentActivity.localSettings.enableResultConfirmation = connectionPref.Checked;
        }
        else if (key.CompareTo("auto_capture") == 0)
        {
            CheckBoxPreference connectionPref = (CheckBoxPreference)FindPreference(key);
            Log.Debug(TAG, "Auto capture PreferenceChanged: " + connectionPref.Checked);
            parentActivity.localSettings.enableAutoCapture = connectionPref.Checked;
        }
        else if (key.CompareTo("debug") == 0)
        {
            CheckBoxPreference connectionPref = (CheckBoxPreference)FindPreference(key);
            Log.Debug(TAG, "Debug PreferenceChanged: " + connectionPref.Checked);
            parentActivity.localSettings.enableDebugMode = connectionPref.Checked;
        }
        else if (key.CompareTo("feedback_audio") == 0)
        {
            CheckBoxPreference connectionPref = (CheckBoxPreference)FindPreference(key);
            Log.Debug(TAG, "Audio PreferenceChanged: " + connectionPref.Checked);
            parentActivity.localSettings.enableFeedbackAudio = connectionPref.Checked;
        }
        else if (key.CompareTo("feedback_haptic") == 0)
        {
            CheckBoxPreference connectionPref = (CheckBoxPreference)FindPreference(key);
            Log.Debug(TAG, "Haptic PreferenceChanged: " + connectionPref.Checked);
            parentActivity.localSettings.enableHaptic = connectionPref.Checked;
        }
        else if (key.CompareTo("feedback_led") == 0)
        {
            CheckBoxPreference connectionPref = (CheckBoxPreference)FindPreference(key);
            Log.Debug(TAG, "LED PreferenceChanged: " + connectionPref.Checked);
            parentActivity.localSettings.enableLED = connectionPref.Checked;
        }
    }
        public override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                AddPreferencesFromResource(Resource.Xml.SettingsPrefs);

                Wo_Main_Settings.Shared_Data = PreferenceManager.SharedPreferences;

                PreferenceCategory mCategory = (PreferenceCategory)FindPreference("category_General");

                EditProfile         = FindPreference("editprofile_key");
                BlockedUsers        = FindPreference("blocked_key");
                Account_Pref        = FindPreference("editAccount_key");
                Password_Pref       = FindPreference("editpassword_key");
                General_Invite_Pref = FindPreference("invite_key");
                General_Call_Pref   = FindPreference("Call_key");

                if (!AppSettings.Enable_Audio_Video_Call)
                {
                    mCategory.RemovePreference(General_Call_Pref);
                }


                if (!AppSettings.Invitation_System)
                {
                    mCategory.RemovePreference(General_Invite_Pref);
                }


                Support_Report_Pref        = FindPreference("Report_key");
                Support_Help_Pref          = FindPreference("help_key");
                Support_Logout_Pref        = FindPreference("logout_key");
                Support_deleteaccount_Pref = FindPreference("deleteaccount_key");

                Lang_Pref     = (ListPreference)FindPreference("Lang_key");
                About_Me_Pref = (EditTextPreference)FindPreference("about_me_key");

                //Privacy
                Privacy_Follow_Pref   = (ListPreference)FindPreference("whocanfollow_key");
                Privacy_Message_Pref  = (ListPreference)FindPreference("whocanMessage_key");
                Privacy_Birthday_Pref = (ListPreference)FindPreference("whocanseemybirthday_key");

                Notifcation_Popup_Pref     = (SwitchPreference)FindPreference("notifications_key");
                Notifcation_PlaySound_Pref = (CheckBoxPreference)FindPreference("checkBox_PlaySound_key");

                //Add Click event to Preferences
                EditProfile.Intent         = new Intent(Application.Context, typeof(MyProfile_Activity));
                BlockedUsers.Intent        = new Intent(Application.Context, typeof(BlockedUsers_Activity));
                Account_Pref.Intent        = new Intent(Application.Context, typeof(My_Account_Activity));
                Password_Pref.Intent       = new Intent(Application.Context, typeof(Password_Activity));
                General_Invite_Pref.Intent = new Intent(Application.Context, typeof(Invite_Friends_Activity));

                //Update Preferences data on Load
                OnSharedPreferenceChanged(Wo_Main_Settings.Shared_Data, "about_me_key");
                OnSharedPreferenceChanged(Wo_Main_Settings.Shared_Data, "whocanfollow_key");
                OnSharedPreferenceChanged(Wo_Main_Settings.Shared_Data, "whocanMessage_key");
                OnSharedPreferenceChanged(Wo_Main_Settings.Shared_Data, "whocanseemybirthday_key");
                OnSharedPreferenceChanged(Wo_Main_Settings.Shared_Data, "notifications_key");
                OnSharedPreferenceChanged(Wo_Main_Settings.Shared_Data, "checkBox_PlaySound_key");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public static string BindText(this EditTextPreference editTextPreference)
 => MvxAndroidPropertyBinding.EditTextPreference_Text;
Ejemplo n.º 26
0
        public void saveSenderID()
        {
            EditTextPreference sid = (EditTextPreference)PreferenceManager.FindPreference("send_id");

            AppConfig.Agency = sid.Text;
        }
Ejemplo n.º 27
0
        //@SuppressWarnings("deprecation")
        protected override void onCreate(Bundle savedInstanceState)
        {
            if (Build.VERSION.SdkInt < 11)
                requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); // added for actionbarcompat

            base.OnCreate(savedInstanceState);

            this.activity = this;
            SyncManager.setActivity(this);
            SyncManager.setHandler(this.preferencesMessageHandler);

            addPreferencesFromResource(Resource.xml.preferences);

            // Fill the Preferences fields
            baseSize = FindPreference<EditTextPreference>(Preferences.Key.BASE_TEXT_SIZE.getName());
            defaultSort = FindPreference<ListPreference>(Preferences.Key.SORT_ORDER.getName());
            syncServer = FindPreference<EditTextPreference>(Preferences.Key.SYNC_SERVER.getName());
            syncService = FindPreference<ListPreference>(Preferences.Key.SYNC_SERVICE.getName());
            sdLocation = FindPreference<EditTextPreference>(Preferences.Key.SD_LOCATION.getName());
            clearSearchHistory = FindPreference<Preference>(Preferences.Key.CLEAR_SEARCH_HISTORY.getName());
            delNotes = FindPreference<Preference>(Preferences.Key.DEL_ALL_NOTES.getName());
            delRemoteNotes = FindPreference<Preference>(Preferences.Key.DEL_REMOTE_NOTES.getName());
            backupNotes = FindPreference<Preference>(Preferences.Key.BACKUP_NOTES.getName());
            autoBackup = FindPreference<Preference>(Preferences.Key.AUTO_BACKUP_NOTES.getName());

            // Set the default values if nothing Exists
            setDefaults();

            // Fill the services combo list
            fillServices();

            // Fill the services combo list
            fillSortOrders();

            // Enable or disable the server field depending on the selected sync service
            setServer(syncService.getValue());

            //			syncService.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            //
            //				public bool onPreferenceChange(Preference preference, Object newValue) {
            //					string selectedSyncServiceKey = (string)newValue;
            //
            //					// did the selection change?
            //					if (!syncService.getValue().contentEquals(selectedSyncServiceKey)) {
            //						TLog.d(TAG, "preference change triggered");
            //
            //						syncServiceChanged(selectedSyncServiceKey);
            //					}
            //					return true;
            //				}
            //			});

            // force reauthentication if the sync server changes
            //			syncServer.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            //
            //				public bool onPreferenceChange(Preference preference,
            //						Object serverUri) {
            //
            //					if (serverUri == null) {
            //						Toast.MakeText(PreferencesActivity.this,
            //								GetString(Resource.String.prefServerEmpty),
            //								ToastLength.Short).Show();
            //						return false;
            //					}
            //
            //					if (!URLUtil.isValidUrl(serverUri.ToString())){
            //						noValidEntry(serverUri.ToString());
            //						return false;
            //					}
            //					syncServer.setSummary((string)serverUri);
            //
            //					// TODO is this necessary? hasn't it changed already?
            //					Preferences.putstring(Preferences.Key.SYNC_SERVER, (string)serverUri);
            //
            //					reauthenticate();
            //					return true;
            //				}
            //
            //			});

            // Change the Folder Location
            //			sdLocation.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            //
            //				public bool onPreferenceChange(Preference preference, Object locationUri) {
            //
            //					if (locationUri.equals(Preferences.GetString(Preferences.Key.SD_LOCATION))) {
            //						return false;
            //					}
            //					if ((locationUri.ToString().contains("\t")) || (locationUri.ToString().contains("\n"))) {
            //						noValidEntry(locationUri.ToString());
            //						return false;
            //					}
            //
            //					File path = new File(Environment.getExternalStorageDirectory()
            //							+ "/" + locationUri + "/");
            //
            //					if(!path.Exists()) {
            //						TLog.w(TAG, "Folder {0} does not exist.", path);
            //						folderNotExisting(path.ToString());
            //						return false;
            //					}
            //
            //					Preferences.putstring(Preferences.Key.SD_LOCATION, locationUri.ToString());
            //					TLog.d(TAG, "Changed Folder to: " + path.ToString());
            //
            //					Tomdroid.NOTES_PATH = path.ToString();
            //					sdLocation.setSummary(Tomdroid.NOTES_PATH);
            //
            //					resetLocalDatabase();
            //					return true;
            //				}
            //			});

            //delete Search History
            //			clearSearchHistory.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            //		        public bool onPreferenceClick(Preference preference) {
            //		            SearchRecentSuggestions suggestions = new SearchRecentSuggestions(PreferencesActivity.this,
            //		                    SearchSuggestionProvider.AUTHORITY, SearchSuggestionProvider.MODE);
            //		            suggestions.clearHistory();
            //
            //		        	Toast.MakeText(getBaseContext(),
            //	                        GetString(Resource.String.deletedSearchHistory),
            //	                        Toast.LENGTH_LONG).Show();
            //		        	TLog.d(TAG, "Deleted search history.");
            //
            //		        	return true;
            //		        }
            //		    });

            //			baseSize.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

            //				public bool onPreferenceChange(Preference preference, Object newValue) {
            //					try {
            //						Float.parseFloat((string)newValue);
            //						Preferences.putstring(Preferences.Key.BASE_TEXT_SIZE, (string)newValue);
            //					}
            //					catch(Exception e) {
            //			        	Toast.MakeText(getBaseContext(),
            //		                        GetString(Resource.String.illegalTextSize),
            //		                        Toast.LENGTH_LONG).Show();
            //			        	TLog.e(TAG, "Illegal text size in preferences");
            //			        	return false;
            //					}
            //					baseSize.setSummary((string)newValue);
            //					return true;
            //				}
            //			});
            //			defaultSort.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            //
            //				public bool onPreferenceChange(Preference preference, Object newValue) {
            //					string value = (string) newValue;
            //					if(value.equals("sort_title"))
            //						defaultSort.setSummary(GetString(Resource.String.sortByTitle));
            //					else
            //						defaultSort.setSummary(GetString(Resource.String.sortByDate));
            //					return true;
            //				}
            //			});
            //			delNotes.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            //
            //		        public bool onPreferenceClick(Preference preference) {
            //		        	ShowDialog(DIALOG_DELETE);
            //					return true;
            //				}
            //			});

            //			delRemoteNotes.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            //
            //		        public bool onPreferenceClick(Preference preference) {
            //		        	ShowDialog(DIALOG_DEL_REMOTE);
            //					return true;
            //				}
            //			});
            //
            //
            //			backupNotes.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            //
            //		        public bool onPreferenceClick(Preference preference) {
            //		        	ShowDialog(DIALOG_BACKUP);
            //
            //					return true;
            //				}
            //			});
        }
 public MvxEditTextPreferenceTextTargetBinding(EditTextPreference preference)
     : base(preference)
 {
 }
Ejemplo n.º 29
0
        public void saveDistributionID()
        {
            EditTextPreference did = (EditTextPreference)PreferenceManager.FindPreference("distribution_id");

            AppConfig.UserID = did.Text;
        }
 public MvxEditTextPreferenceTextTargetBinding(EditTextPreference preference)
     : base(preference)
 {
 }
Ejemplo n.º 31
0
        public void savePostURL()
        {
            EditTextPreference post = (EditTextPreference)PreferenceManager.FindPreference("post_url");

            AppConfig.PostUrl = post.Text;
        }