protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            //string micId = savedInstanceState.GetString("mic_id");
            //string micId = base.GetString("mic_id");
            micId = Intent.GetStringExtra("mic_id");
            sound = JsonConvert.DeserializeObject <MicSound>(Intent.GetStringExtra("sound"));

            //string micName = MicsManager.GetMicsFromPreferences().FirstOrDefault(e => e.WavioId == micId).Name;


            SetContentView(Resource.Layout.page_settings);

            var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            toolbar.Title = sound.sound_name;

            SoundSettingsFragment fragment = new SoundSettingsFragment(micId, sound, this);

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, fragment)
            .Commit();
        }
Ejemplo n.º 2
0
 public PickIconFragment(MicSound Sound, string MicId)
 {
     micId          = MicId;
     sound          = Sound;
     RetainInstance = true;
 }
Ejemplo n.º 3
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            sounds = new List <MicSound>();
            var tempSound1 = new MicSound();

            tempSound1.sound_name     = "...";
            tempSound1.sound_settings = SoundsManager.NewSoundSettings();
            //tempSound1.settings.Add("Push", true.ToString());
            //tempSound1.settings.Add("ShowMessage", false.ToString());
            //tempSound1.settings.Add("Vibrate", true.ToString());
            //sounds.Add(tempSound1);

            SetContentView(Resource.Layout.page_sounds);
            var toolbar = FindViewById <V7Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            mRegistrationBroadcastReceiver          = new Shared.BroadcastReceiver();
            mRegistrationBroadcastReceiver.Receive += (sender, e) =>
            {
                //progressDialog.Dismiss();5
                var result = e.Intent.GetStringExtra("reply_error");
                if (result == Shared.ServerResponsecode.STARTED_RECORDING.ToString())
                {
                    if (progressDialog != null)
                    {
                        progressDialog.Dismiss();
                    }
                    //if (awaitingResponse == ExpectedResponse.NowRecording)
                    {
                        //progressDialog = Android.App.ProgressDialog.Show(this, "RECORDING...", "Play your sound...", true);
                        Acr.UserDialogs.UserDialogs.Instance.Loading("RECORDING, Play your sound!");
                        awaitingResponse = ExpectedResponse.DoneRecording;
                    }
                }
                else if (result == Shared.ServerResponsecode.DONE_RECORDING.ToString())
                {
                    if (progressDialog != null)
                    {
                        progressDialog.Dismiss();
                    }
                    //if (awaitingResponse == ExpectedResponse.DoneRecording)
                    {
                        var progress = Acr.UserDialogs.UserDialogs.Instance.Progress("");
                        progress.Hide();
                        Acr.UserDialogs.UserDialogs.Instance.HideLoading();
                        Acr.UserDialogs.UserDialogs.Instance.ShowSuccess("Recording complete.");

                        GetSoundList();
                    }
                }
            };

            listView            = FindViewById <ListView>(Resource.Id.soundsListView);
            listView.ItemClick += OnListItemClick;

            adapter          = new SoundAdapter(this, sounds);
            listView.Adapter = adapter;

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

            //wavioId = savedInstanceState.GetString("id", "");

            var prefs = PreferenceManager.GetDefaultSharedPreferences(Application.Context);

            wavioId = prefs.GetString("edit_mic_id", "");

            GetSoundList();
        }
 public SoundSettingsFragment(string MicId, MicSound Sound, SoundSettingsActivity Parent)
 {
     micId  = MicId;
     sound  = Sound;
     parent = Parent;
 }
Ejemplo n.º 5
0
        private void AddNewSoundRequest(string soundName)
        {
            Acr.UserDialogs.UserDialogs.Instance.Loading("Sending request...");

            string hwid                     = Android.OS.Build.Serial;
            var    SharedSettings           = new Dictionary <String, String>();
            var    prefs                    = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
            ISharedPreferencesEditor editor = prefs.Edit();
            String gcmID                    = prefs.GetString("GCMID", "");

            var newSound = new MicSound();

            newSound.sound_name     = soundName;
            newSound.sound_image    = "http://jmprog.com/hzinnovations/icons/pulse2.png";
            newSound.sound_settings = SoundsManager.NewSoundSettings();

            try
            {
                if (string.IsNullOrEmpty(wavioId))
                {
                    if (progressDialog != null)
                    {
                        progressDialog.Dismiss();
                    }
                    Acr.UserDialogs.UserDialogs.Instance.ErrorToast("Error: Missing ID");
                    return;
                }


                var client     = new RestClient(Shared.SERVERURL);
                var request    = new RestRequest("resource/{id}", Method.POST);
                var parameters = new Dictionary <string, string>();

                parameters.Add(Shared.ParamType.REQUEST_CODE, Shared.RequestCode.RECORD_NEW_SOUND.ToString());
                parameters.Add(Shared.ParamType.SOUND_INFO, JsonConvert.SerializeObject(newSound));

                parameters.Add(Shared.ParamType.WAVIO_ID, wavioId);
                parameters.Add(Shared.ParamType.GCM_ID, gcmID);
                parameters.Add(Shared.ParamType.HWID, hwid);
                string requestJson = JsonConvert.SerializeObject(parameters);
                request.AddParameter(Shared.ParamType.REQUEST, requestJson);

                Console.WriteLine("Waiting for response");


                client.ExecuteAsync(request, response => {
                    ServerResponse serverResponse = JsonConvert.DeserializeObject <ServerResponse>(response.Content);

                    if (serverResponse == null)
                    {
                        //Acr.UserDialogs.UserDialogs.Instance.ShowError("Unknown error!");
                        return;
                    }


                    if (serverResponse.error == Shared.ServerResponsecode.OK)
                    {
                        Acr.UserDialogs.UserDialogs.Instance.Loading("Initializing mic...", RecordCanceled);

                        awaitingResponse = ExpectedResponse.NowRecording;
                    }
                    else if (serverResponse.error == Shared.ServerResponsecode.DATABASE_ERROR)
                    {
                        Acr.UserDialogs.UserDialogs.Instance.ShowError("Server error!");
                    }
                    else
                    {
                        if (serverResponse.request != Shared.RequestCode.RECORD_NEW_SOUND)
                        {
                            Acr.UserDialogs.UserDialogs.Instance.ShowError("Request type mismatch!");
                            return;
                        }
                        Acr.UserDialogs.UserDialogs.Instance.ShowError("Unknown error!");
                    }
                    return;
                });
            }
            catch (WebException ex)
            {
                string _exception = ex.ToString();
                if (progressDialog != null)
                {
                    progressDialog.Dismiss();
                }
                Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!");
                Console.WriteLine("--->" + _exception);
            }
        }