Beispiel #1
0
        public override void OnCreatePreferences(Bundle savedInstanceState, string rootKey)
        {
            AddPreferencesFromResource(Resource.Xml.mic_preferences);


            //Preference

            var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
            ISharedPreferencesEditor editor = prefs.Edit();

            editor.PutBoolean("settings_changed", true);
            editor.PutString("edit_mic_id", micId);
            editor.Apply();

            //clearPreferencesButton = FindPreference("preference_mic_button_sounds") as Android.Support.V7.Preferences.PreferenceScreen;
            //clearPreferencesButton.PreferenceClick += micSounds;

            //changeSensitivityButton = FindPreference("preference_mic_button_sensitivity") as Android.Support.V7.Preferences.PreferenceScreen;
            //changeSensitivityButton.PreferenceClick += setSensitivity;


            restoreNotificationsButton = FindPreference("preference_mic_button_restore") as Android.Support.V7.Preferences.PreferenceScreen;
            restoreNotificationsButton.PreferenceClick += restoreNotifications;
            deleteMicButton = FindPreference("preference_mic_button_delete") as Android.Support.V7.Preferences.PreferenceScreen;
            deleteMicButton.PreferenceClick += deleteMic;
            //preference_mic_button_sensitivity

            mRegistrationBroadcastReceiver          = new Shared.BroadcastReceiver();
            mRegistrationBroadcastReceiver.Receive += (sender, e) =>
            {
                var reply_error = e.Intent.GetStringExtra("reply_error");
                var reply_data  = e.Intent.GetStringExtra("reply_data");

                if (reply_data == Shared.QueuedDeviceRequestType.CHANGE_SENSITIVITY)
                {
                    if (reply_error == Shared.ServerResponsecode.OK.ToString())
                    {
                        if (loadingDialog != null)
                        {
                            loadingDialog.Hide();
                        }
                        Acr.UserDialogs.UserDialogs.Instance.SuccessToast("Success!");
                    }
                    else
                    {
                        if (loadingDialog != null)
                        {
                            loadingDialog.Hide();
                        }
                        Acr.UserDialogs.UserDialogs.Instance.ShowError("Error Changing Sensitivity");
                    }
                }
            };

            LocalBroadcastManager.GetInstance(base.Activity).RegisterReceiver(mRegistrationBroadcastReceiver,
                                                                              new IntentFilter("reply_error"));
        }
Beispiel #2
0
        public override void OnCreatePreferences(Bundle savedInstanceState, string rootKey)
        {
            AddPreferencesFromResource(Resource.Xml.preferences2);


            var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
            ISharedPreferencesEditor editor = prefs.Edit();

            editor.PutBoolean("settings_changed", true);
            editor.Apply();

            clearPreferencesButton = FindPreference("button_clear") as Android.Support.V7.Preferences.PreferenceScreen;
            clearPreferencesButton.PreferenceClick += clearPreferences;

            instanceButton = FindPreference("button_instance") as Android.Support.V7.Preferences.PreferenceScreen;
            instanceButton.PreferenceClick += makeInstance;

            testNotifButton = FindPreference("button_test_notif") as Android.Support.V7.Preferences.PreferenceScreen;
            testNotifButton.PreferenceClick += RequestTestNotif;

            //testButton1 = FindPreference("button_test1") as Android.Support.V7.Preferences.PreferenceScreen;
            //testButton1.PreferenceClick += runTestButton1;
        }
        public override void OnCreatePreferences(Bundle savedInstanceState, string rootKey)
        {
            AddPreferencesFromResource(Resource.Xml.sound_preferences);


            mRegistrationBroadcastReceiver          = new Shared.BroadcastReceiver();
            mRegistrationBroadcastReceiver.Receive += (sender, e) =>
            {
                var reply_error = e.Intent.GetStringExtra("reply_error");
                var reply_data  = e.Intent.GetStringExtra("reply_data");

                if (reply_data == Shared.QueuedDeviceRequestType.NEW_SOUND)
                {
                    if (reply_error == Shared.ServerResponsecode.OK.ToString())
                    {
                        if (loading != null)
                        {
                            loading.Hide();
                        }
                        var intent = new Intent(parent, typeof(MicSoundsActivity));
                        parent.NavigateUpTo(intent);
                    }
                    else
                    {
                        if (loading != null)
                        {
                            loading.Hide();
                        }
                        var intent = new Intent(parent, typeof(MicSoundsActivity));
                        parent.NavigateUpTo(intent);
                    }
                }
                if (reply_data == Shared.QueuedDeviceRequestType.DELETE_SOUND)
                {
                    if (reply_error == Shared.ServerResponsecode.OK.ToString())
                    {
                        if (loading != null)
                        {
                            loading.Hide();
                        }
                        var intent = new Intent(parent, typeof(MicSoundsActivity));
                        parent.NavigateUpTo(intent);
                    }
                    else
                    {
                        if (loading != null)
                        {
                            loading.Hide();
                        }
                        var intent = new Intent(parent, typeof(MicSoundsActivity));
                        parent.NavigateUpTo(intent);
                    }
                }
            };

            LocalBroadcastManager.GetInstance(base.Activity).RegisterReceiver(mRegistrationBroadcastReceiver,
                                                                              new IntentFilter("reply_error"));



            if (sound.sound_settings == null)
            {
                sound.sound_settings = new Dictionary <string, string>();
            }
            //Preference

            var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
            ISharedPreferencesEditor editor = prefs.Edit();

            soundPushCheck = FindPreference("sound_push") as Android.Support.V7.Preferences.CheckBoxPreference;
            soundPushCheck.PreferenceClick += settingsClicked;
            if (sound.sound_settings.ContainsKey("Push"))
            {
                soundPushCheck.Checked = Boolean.Parse(sound.sound_settings["Push"]);
            }
            else
            {
                sound.sound_settings.Add("Push", true.ToString());
                soundPushCheck.Checked = true;
            }

            soundVibrateCheck = FindPreference("sound_vibrate") as Android.Support.V7.Preferences.CheckBoxPreference;
            soundVibrateCheck.PreferenceClick += settingsClicked;
            if (sound.sound_settings.ContainsKey("Vibrate"))
            {
                soundVibrateCheck.Checked = Boolean.Parse(sound.sound_settings["Vibrate"]);
            }
            else
            {
                sound.sound_settings.Add("Vibrate", true.ToString());
                soundVibrateCheck.Checked = true;
            }

            soundshowMessageCheck = FindPreference("sound_open") as Android.Support.V7.Preferences.CheckBoxPreference;
            soundshowMessageCheck.PreferenceClick += settingsClicked;
            if (sound.sound_settings.ContainsKey("ShowMessage"))
            {
                soundshowMessageCheck.Checked = Boolean.Parse(sound.sound_settings["ShowMessage"]);
            }
            else
            {
                sound.sound_settings.Add("ShowMessage", false.ToString());
                soundshowMessageCheck.Checked = false;
            }

            deleteSoundButton = FindPreference("sound_delete") as Android.Support.V7.Preferences.PreferenceScreen;
            deleteSoundButton.PreferenceClick += deleteSound;

            changeIconButton = FindPreference("sound_icon") as Android.Support.V7.Preferences.PreferenceScreen;
            changeIconButton.PreferenceClick += changeIcon;
        }