Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            LoginActionBar();
            _logging = Pref.getLogging(this);
            //if (TableViewer.dBHelper == null)
            //{
            //	//prevent not null
            //	//aSQLiteManager.database = new Database(_dbPath, _cont);
            //}
            SetContentView(Resource.Layout.filter_wizard);
            Bundle extras = Intent.Extras;

            if (extras != null)
            {
                //_table = extras.GetString("TABLE");
                FieldNames        = extras.GetStringArrayList("FieldNames");
                FieldDisplayNames = extras.GetStringArrayList("FieldDisplayNames");
                _sql = toDisplaySQL(extras.GetString("FILTER"));
                if (_sql == null)
                {
                    _sql = "";
                }
                // we are editing an existing filter
            }
            setUpUI();
        }
Пример #2
0
        public static Participante BundleToParticipante(Bundle b)
        {
            var dictionary = new Dictionary <string, string>
            {
                ["codigoparticipante"] = b.GetString("codigoparticipante"),
                ["codigousuario"]      = b.GetString("codigousuario"),
                ["email"]       = b.GetString("email"),
                ["nome"]        = b.GetString("nome"),
                ["campus"]      = b.GetString("campus"),
                ["senha"]       = b.GetString("senha"),
                ["nascimento"]  = b.GetString("nascimento"),
                ["telefone"]    = b.GetString("telefone"),
                ["campus"]      = b.GetString("campus"),
                ["localizacao"] = b.GetString("localizacao")
            };

            var p = new Participante(dictionary)
            {
                Hobbies  = { Conteudo = b.GetStringArrayList("hobbie").ToList() },
                Aprender = { Conteudo = b.GetStringArrayList("aprender").ToList() },
                Ensinar  = { Conteudo = b.GetStringArrayList("ensinar").ToList() }
            };

            return(p);
        }
        Task <List <Purchase> > GetPurchasesAsync(string itemType, IInAppBillingVerifyPurchase verifyPurchase, string verifyOnlyProductId = null)
        {
            var getPurchasesTask = Task.Run(async() =>
            {
                string continuationToken = string.Empty;
                var purchases            = new List <Purchase>();

                do
                {
                    Bundle ownedItems = serviceConnection.Service.GetPurchases(3, Context.PackageName, itemType, null);
                    var response      = GetResponseCodeFromBundle(ownedItems);

                    if (response != 0)
                    {
                        break;
                    }

                    if (!ValidOwnedItems(ownedItems))
                    {
                        Console.WriteLine("Invalid purchases");
                        return(purchases);
                    }

                    var items      = ownedItems.GetStringArrayList(RESPONSE_IAP_PURCHASE_ITEM_LIST);
                    var dataList   = ownedItems.GetStringArrayList(RESPONSE_IAP_PURCHASE_DATA_LIST);
                    var signatures = ownedItems.GetStringArrayList(RESPONSE_IAP_DATA_SIGNATURE_LIST);

                    for (int i = 0; i < items.Count; i++)
                    {
                        string data = dataList[i];
                        string sign = signatures[i];

                        var purchase = JsonConvert.DeserializeObject <Purchase>(data);

                        if (verifyPurchase == null || (verifyOnlyProductId != null && !verifyOnlyProductId.Equals(purchase.ProductId)))
                        {
                            purchases.Add(purchase);
                        }
                        else if (await verifyPurchase.VerifyPurchase(data, sign, purchase.ProductId, purchase.OrderId))
                        {
                            purchases.Add(purchase);
                        }
                    }

                    continuationToken = ownedItems.GetString(RESPONSE_IAP_CONTINUATION_TOKEN);
                } while (!string.IsNullOrWhiteSpace(continuationToken));

                return(purchases);
            });

            return(getPurchasesTask);
        }
Пример #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ws_man);
            _logging = Pref.getLogging(this);
            SetActionBarTitle(GetString(Resource.String.RefreshData));
            btnCreate = (Button)FindViewById(Resource.Id.btnCreate);
            listView  = FindViewById <ListView>(Resource.Id.listView);
            btnChkAll = (Button)FindViewById(Resource.Id.btnChkAll);
            btnRef    = (Button)FindViewById(Resource.Id.btnRef);

            Bundle extras = Intent.Extras;

            if (extras != null)
            {
                FieldNames        = extras.GetStringArrayList("FieldNames");
                FieldDisplayNames = extras.GetStringArrayList("FieldDisplayNames");
                _tableDisplayName = extras.GetString("TableDisplayName");
                sourceType        = extras.GetInt("type");
                _table            = extras.GetString("Table");
                _tvQ = extras.GetString("sql");

                if (bundle != null)
                {
                    listRec = (JavaList <IParcelable>)bundle.GetParcelableArrayList("listRec");
                }
                listView.ItemsCanFocus     = false;
                listView.ChoiceMode        = ChoiceMode.Multiple;
                listView.TextFilterEnabled = true;
                notATable = string.IsNullOrEmpty(_table);
                if ((notATable && string.IsNullOrEmpty(_tvQ)) || string.IsNullOrEmpty(_tableDisplayName) || FieldNames == null || FieldDisplayNames == null)
                {
                    InvalidateUI(btnChkAll, btnRef);
                }
                else
                {
                    adapter                    = new ArrayAdapter <IParcelable>(this, Android.Resource.Layout.SimpleListItemMultipleChoice, listRec);
                    listView.Adapter           = adapter;
                    listView.ItemsCanFocus     = false;
                    listView.ChoiceMode        = ChoiceMode.Multiple;
                    listView.TextFilterEnabled = true;
                }
            }
            else
            {
                InvalidateUI(btnChkAll, btnRef);
            }
        }
        public void OnPartialResults(Bundle partialResults)
        {
            var textView = FindViewById <TextView> (Resource.Id.SpeechTextView);
            var matches  = partialResults.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            textView.Text = matches [0];
        }
        public async void OnResults(Bundle results)
        {
            Console.WriteLine("OnResults");
            if (!_dialogWasManuallyAnswered)
            {
                var res = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
                Log.LogMessage($"Speech recognition results = {string.Join(", ", res)}");
                var answer = mappingService.DetectAnswer(res);

                if (answer != AnswerType.Unknown)
                {
                    _voiceRecognitionTCS.TrySetResult(answer == AnswerType.Positive);
                    await textToSpeechService.SpeakAsync($"Your answer is {answer.ToString()}", false);

                    if (_isMusicRunning)
                    {
                        platformService.PlayMusic();
                    }
                }
                else
                {
                    _voiceRecognitionTCS.TrySetCanceled();
                }
            }
        }
        public void OnResults(Bundle results)
        {
            Console.WriteLine("OnResults");
            if (!_dialogWasManuallyAnswered)
            {
                TimerManager(Question);
                var res = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
                Log.LogMessage($"Speech recognition results = {string.Join(", ", res)}");
                var answer = MappingService.DetectAnswer(res);

                //_handler.Post(() =>
                //{
                //    if (answer != AnswerType.Unknown)
                //        CancelDialog();

                //    StopRecognizer();
                //});

                //_firstInit = true;

                if (answer != AnswerType.Unknown)
                {
                    TextToSpeechService.Speak($"Your answer is {answer.ToString()}", false).Wait();
                    if (_isMusicRunning)
                    {
                        PlatformService.PlayMusic();
                    }
                    _recognitionTask.TrySetResult(answer == AnswerType.Positive);
                }
                else
                {
                    TimerManager(Question);
                }
            }
        }
Пример #8
0
            public void OnResults(Bundle results)
            {
                var    commands   = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
                string topcommand = commands.FirstOrDefault();

                onGot.Invoke(topcommand);
            }
        Task<IEnumerable<Product>> GetProductInfoAsync(string[] productIds, string itemType)
        {
            var getSkuDetailsTask = Task.Factory.StartNew<IEnumerable<Product>>(() =>
            {

                var querySku = new Bundle();
                querySku.PutStringArrayList(SKU_ITEM_ID_LIST, productIds);


                Bundle skuDetails = serviceConnection.Service.GetSkuDetails(3, Context.PackageName, itemType, querySku);

                if (!skuDetails.ContainsKey(SKU_DETAILS_LIST))
                {
                    return null;
                }

                var products = skuDetails.GetStringArrayList(SKU_DETAILS_LIST);

                if (products == null || !products.Any())
                    return null;

                var items = new List<Product>(products.Count);
                foreach (var item in products)
                {
                    items.Add(JsonConvert.DeserializeObject<Product>(item));
                }
                return items;
            });

            return getSkuDetailsTask;
        }
Пример #10
0
            public override void OnReceive(Context context, Intent intent)
            {
                Log.Info(TAG, "Receiving broadcast " + intent);

                Bundle extra = GetResultExtras(false);

                if (ResultCode != Result.Ok)
                {
                    self.mHandler.Post(() => {
                        Toast.MakeText(self, "Error code:" + ResultCode, ToastLength.Short).Show();
                    });
                }

                if (extra == null)
                {
                    self.mHandler.Post(() => {
                        Toast.MakeText(self, "No extra", ToastLength.Short).Show();
                    });
                }

                else if (extra.ContainsKey(RecognizerIntent.ExtraSupportedLanguages))
                {
                    self.mHandler.Post(() => {
                        self.UpdateSupportedLanguages(extra.GetStringArrayList(RecognizerIntent.ExtraSupportedLanguages));
                    });
                }

                else if (extra.ContainsKey(RecognizerIntent.ExtraLanguagePreference))
                {
                    self.mHandler.Post(() => {
                        self.UpdateLanguagePreference(extra.GetString(RecognizerIntent.ExtraLanguagePreference));
                    });
                }
            }
Пример #11
0
        protected void CreatePresenter(Bundle savedInstanceState)
        {
            if (GetRetainedPresenter() != null)
            {
                Presenter          = GetRetainedPresenter();
                Presenter.BaseView = BaseView;
            }
            else
            {
                Presenter = GetPresenter();

                if (Presenter == null)
                {
                    throw new NotImplementedException();
                }

                if (savedInstanceState != null)
                {
                    Presenter.RestoreState(savedInstanceState.GetStringArrayList(PresenterStateKey));
                }
                else
                {
                    Presenter.Init();
                }
            }
        }
Пример #12
0
        Task <Product> GetProductInfoAsync(string productSku, string itemType)
        {
            var getSkuDetailsTask = Task.Factory.StartNew <Product>(() =>
            {
                var querySku = new Bundle();
                querySku.PutStringArrayList(SKU_ITEM_ID_LIST, new string[] { productSku });


                Bundle skuDetails = serviceConnection.Service.GetSkuDetails(3, Context.PackageName, itemType, querySku);

                if (!skuDetails.ContainsKey(SKU_DETAILS_LIST))
                {
                    return(null);
                }

                var products = skuDetails.GetStringArrayList(SKU_DETAILS_LIST);

                if (products == null || !products.Any())
                {
                    return(null);
                }

                return(JsonConvert.DeserializeObject <Product>(products.FirstOrDefault()));
            });

            return(getSkuDetailsTask);
        }
        void SendResults(Bundle bundle, Action <string>?action)
        {
            var matches = bundle.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            if (matches == null || matches.Count == 0)
            {
                Debug.WriteLine("Matches value is null in bundle");
                return;
            }

            if (Build.VERSION.SdkInt >= BuildVersionCodes.IceCreamSandwich && matches.Count > 1)
            {
                var scores = bundle.GetFloatArray(SpeechRecognizer.ConfidenceScores);
                var best   = 0;
                for (var i = 0; i < scores.Length; i++)
                {
                    if (scores[best] < scores[i])
                    {
                        best = i;
                    }
                }
                var winner = matches[best];
                action?.Invoke(winner);
            }
            else
            {
                action?.Invoke(matches.First());
            }
        }
Пример #14
0
        public void OnResults(Bundle results)
        {
            IList <string> matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            alarmEditText.Text = matches[0];
            HandleVoiceRecognitionResult();
        }
Пример #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            InitialiseStuff();
            FindViews();
            AddEventHandler();

            if (bundle != null && bundle.ContainsKey("PlayerNames"))
            {
                var savedNameList = bundle.GetStringArrayList("PlayerNames");
                if (savedNameList.Count == 5)
                {
                    for (int i = 0; i < savedNameList.Count; i++)
                    {
                        _playerNameEditTexts[i].Text = savedNameList[i];
                    }
                }
            }
            if (_playMenuItem != null)
            {
                _playMenuItem.SetVisible(true);
            }
        }
Пример #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //set view
            SetContentView(Resource.Layout.SelectView);
            TextView Lab_RowTitle = FindViewById <TextView>(Resource.Id.Lab_RowTitle);

            Lab_RowTitle.Text = "時間";
            //get Data
            //    得到跳转到该Activity的Intent对象
            Bundle        bundle   = Intent.GetBundleExtra("bundle");
            List <string> timelist = bundle.GetStringArrayList("timelist").ToList();


            //Create your application here
            TableLayout MainTable = FindViewById <TableLayout>(Resource.Id.table_city);
            Button      b;
            TableRow    tr;

            for (int i = 0; i < timelist.Count; i++)
            {
                tr = new TableRow(this);

                b = new Button(this);
                string time = timelist[i].Substring(1, timelist[i].Length - 2);
                b.Text   = time;
                b.Click += delegate { CreatNewSelect("4"); };
                tr.AddView(b);

                MainTable.AddView(tr);
            }
        }
Пример #17
0
        Task <List <Purchase> > GetPurchasesAsync(string itemType)
        {
            var getPurchasesTask = Task.Run(() =>
            {
                string continuationToken = string.Empty;
                var purchases            = new List <Purchase>();

                do
                {
                    Bundle ownedItems = serviceConnection.Service.GetPurchases(3, Context.PackageName, itemType, null);
                    var response      = GetResponseCodeFromBundle(ownedItems);

                    if (response != 0)
                    {
                        break;
                    }

                    if (!ValidOwnedItems(ownedItems))
                    {
                        Console.WriteLine("Invalid purchases");
                        return(purchases);
                    }

                    var items      = ownedItems.GetStringArrayList(RESPONSE_IAP_PURCHASE_ITEM_LIST);
                    var dataList   = ownedItems.GetStringArrayList(RESPONSE_IAP_PURCHASE_DATA_LIST);
                    var signatures = ownedItems.GetStringArrayList(RESPONSE_IAP_DATA_SIGNATURE_LIST);

                    for (int i = 0; i < items.Count; i++)
                    {
                        string data = dataList[i];
                        string sign = signatures[i];

                        if (!string.IsNullOrEmpty(ValidationPublicKey) && Security.VerifyPurchase(ValidationPublicKey, data, sign))
                        {
                            var purchase = JsonConvert.DeserializeObject <Purchase>(data);
                            purchases.Add(purchase);
                        }
                    }

                    continuationToken = ownedItems.GetString(RESPONSE_IAP_CONTINUATION_TOKEN);
                } while (!string.IsNullOrWhiteSpace(continuationToken));

                return(purchases);
            });

            return(getPurchasesTask);
        }
Пример #18
0
        public void OnResults(Bundle bundle)
        {
            IList <string> result = bundle.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            Log.Info(TAG, "onResults ");
            _answer = result[0];
            _tcs.SetResult(0);
        }
        public IList <Purchase> GetPurchases(string itemType)
        {
            string continuationToken = string.Empty;
            var    purchases         = new List <Purchase> ();

            do
            {
                Logger.Debug("ContinuationTocken {0}", continuationToken);

                Bundle ownedItems = _billingService.GetPurchases(Billing.APIVersion, _activity.PackageName, itemType, null);
                var    response   = ownedItems.GetResponseCodeFromBundle();

                if (response != BillingResult.OK)
                {
                    break;
                }

                if (!ValidOwnedItems(ownedItems))
                {
                    Logger.Debug("Invalid purchases");
                    return(purchases);
                }

                var items      = ownedItems.GetStringArrayList(Response.InAppPurchaseItemList);
                var dataList   = ownedItems.GetStringArrayList(Response.InAppPurchaseDataList);
                var signatures = ownedItems.GetStringArrayList(Response.InAppDataSignatureList);

                for (int i = 0; i < items.Count; i++)
                {
                    string data = dataList [i];
                    string sign = signatures [i];

                    if (Security.VerifyPurchase(_publicKey, data, sign))
                    {
                        var purchase = JsonConvert.DeserializeObject <Purchase> (data);
                        purchases.Add(purchase);
                    }
                }

                continuationToken = ownedItems.GetString(Response.InAppContinuationToken);

                Console.WriteLine(items);
            } while(!string.IsNullOrWhiteSpace(continuationToken));

            return(purchases);
        }
Пример #20
0
        public override void Setup(Bundle b)
        {
            ShowUserNotifications = (ShowUserNotificationsMode)GetIntFromBundle(b, ShowUserNotificationsKey, (int)ShowUserNotificationsMode.Always);

            Url                 = b.GetString(UrlKey);
            AllFields           = b.GetString(AllFieldsKey);
            ProtectedFieldsList = b.GetStringArrayList(ProtectedFieldsListKey);
        }
Пример #21
0
        public void GetPurchases(string itemType)
        {
            Bundle ownedItems = billingService.GetPurchases(Billing.APIVersion, activity.PackageName, itemType, null);
            var    response   = GetResponseCodeFromBundle(ownedItems);

            if (response != BillingResult.OK)
            {
                return;
            }

            var list = ownedItems.GetStringArrayList(Response.InAppPurchaseItemList);
            var data = ownedItems.GetStringArrayList(Response.InAppPurchaseDataList);

            Console.WriteLine(list);

            //TODO: Get more products if continuation token is not null
        }
Пример #22
0
        public void OnResults(Bundle results)
        {
            var matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            if (matches != null && matches.Count > 0)
            {
                Recognized?.Invoke(this, matches[0]);
            }
        }
Пример #23
0
        public void OnResults(Bundle results)
        {
            var matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            if (matches != null && matches.Count > 0)
            {
                Message = matches[0];
            }
        }
Пример #24
0
        public void OnResults(Bundle results)
        {
            var textView = FindViewById <TextView>(Resource.Id.SpeechTextView);
            var btnSayIt = FindViewById <Button>(Resource.Id.btnSpeak);
            var lang     = Java.Util.Locale.Default;

            var matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);

            if (matches.Count != 0)
            {
                textView.Text = matches[0];
                var intentResult = nlp.GetMatchingIntent(textView.Text);
                if (intentResult != null)
                {
                    textView.Text += "\r\n" + "Awesome, I will get it done.";
                    textView.Text += "\r\n" + "Action: " + intentResult.Action;
                    speakText      = "Action Name is " + intentResult.Action;
                    if (intentResult.Parameters != null)
                    {
                        var speakTextBuilder = new System.Text.StringBuilder();
                        speakTextBuilder.Append(speakText);
                        var textViewBuilder = new System.Text.StringBuilder();
                        textViewBuilder.Append(textView.Text);
                        foreach (var paramter in intentResult.Parameters)
                        {
                            textViewBuilder.Append("\r\n" + "Parameter Name: " + paramter.Key);
                            textViewBuilder.Append("\r\n" + "Parameter Values: " + string.Join(", ", paramter.Value));
                            speakTextBuilder.Append(" with parameter as " + paramter.Key);
                            foreach (var item in paramter.Value)
                            {
                                speakTextBuilder.Append(" " + item);
                            }
                        }
                        textView.Text = textViewBuilder.ToString();
                        speakText     = speakTextBuilder.ToString();
                    }
                    else
                    {
                        textView.Text += "\r\n" + "No specific parameters mentioned.";
                    }

                    btnSayIt.CallOnClick();
                }
                else
                {
                    textView.Text = "Sorry, I do not understand that... Can You Repeat";
                    speakText     = "Sorry, I do not understand that";
                    btnSayIt.CallOnClick();
                }
            }
            else
            {
                textView.Text = "No speech was recognised";
                speakText     = "No speech was recognised";
                btnSayIt.CallOnClick();
            }
        }
 public void OnPartialResults(Bundle bundle)
 {
     Log.Info(LOG_TAG, "onPartialResults");
     var matches = bundle.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
     //string text = " ";
     //text = matches[0];
     ////txt_view.Append(text.ToCharArray(),0,text.Length);
     //txt_view.Text = "";
     //txt_view.Append(text);
 }
        public void OnPartialResults(Bundle partialResults)
        {
            IList <string> matches = partialResults.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
            string         text    = "";

            foreach (string result in matches)
            {
                text = text + result;
            }
            mTextView.Text = text;
        }
Пример #27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            Bundle Extras = Intent.Extras;

            byte[] BackgroundByteArray = Extras.GetByteArray("BackgroundByteArray");
            TripInfo = Extras.GetStringArrayList("TripData").ToArray();
            Me       = new TripClient(Utilizator_Main.INPUT, Utilizator_Main.OUTPUT, new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Login.Username), this);
            TripId   = new SaveUsingSharedPreferences(this).LoadString(SaveUsingSharedPreferences.Tags.Trip.TipId);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Utilizator_Trip);

            InitiateView();
            CheckIfNewInTrip();

            test = this;

            LocalActivityManager LAM = new LocalActivityManager(this, false);

            LAM.DispatchCreate(savedInstanceState);
            LAM.DispatchResume();
            LAM.DispatchPause(IsFinishing);
            tabHost.Setup(LAM);

            int[] Layouturi = new int[] {
                Resource.Layout.Utilizator_Trip_ChatView,
                Resource.Layout.Utilizator_Trip_MaskB,
                Resource.Layout.Utilizator_Trip_MaskC,
            };

            Background.Background = DrawableConverter.ByteArrayToDrawable(BackgroundByteArray, this);

            SetTypeface.Normal.SetTypeFace(this, UserNume);
            LeftDrawerListView.Adapter = new Utilizator_Trip_LeftDrawerAdapter(this, Background.Background, new string[] { "Galerie", "Modificare Cont", "As vrea sa cumpar", "Informatii excursie", "Setari", "Iesire Excursie", "Logut" });

            //	OrganizatorProfilePic.SetImageDrawable(RoundedUserProfile);
            //	OrganizatorNume.Text = "Nume Prenume";
            //	SetTypeface.Normal.SetTypeFace (this,OrganizatorNume);

            Pager.Adapter = new Utilizator_Trip_ViewPagerAdapter(SupportFragmentManager, this);

            for (int i = 0; i < 3; i++)
            {
                CreateTab(typeof(Utilizator_Trip_MaskA), Tags[i], string.Empty, TabsIcon[i], tabHost);
            }

            tabHost.TabChanged += TabHost_TabChanged;
            Pager.PageSelected += Pager_PageSelected;
            ClientGetMessage   += Utilizator_Trip_ClientGetMessage;
        }
Пример #28
0
    public void OnResults(Bundle results)
    {
        var           data    = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
        StringBuilder builder = new StringBuilder();

        for (int i = 0; i < data.Count; i++)
        {
            builder.Append(data[i]);
        }
        tv.Text = builder.ToString();
    }
        public void OnResults(Bundle results)
        {
            var contents = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
            var sb       = new StringBuilder();

            foreach (var s in contents)
            {
                sb.Append(s).Append(" ");
            }
            OnSpeechRecognized(new SpeechRecognizedEvent(sb.ToString()));
        }
Пример #30
0
 public void OnResults(Bundle results)
 {
     var matches = results.GetStringArrayList(SpeechRecognizer.ResultsRecognition);
     if (matches == null)
         Words = "Null";
     else
         if (matches.Count != 0)
         Words = matches[0];
     else
         Words = "";
     //do anything you want for the result
     }
Пример #31
0
        private void RestoreState(Bundle savedInstanceState)
        {
            if (savedInstanceState != null)
            {
                _showPassword = savedInstanceState.GetBoolean(ShowpasswordKey, false);
                MakePasswordMaskedOrVisible();

                _keyFileOrProvider = savedInstanceState.GetString(KeyFileOrProviderKey);
                _password = FindViewById<EditText>(Resource.Id.password).Text = savedInstanceState.GetString(PasswordKey);

                _pendingOtps = new List<string>(savedInstanceState.GetStringArrayList(PendingOtpsKey));

                string otpInfoString = savedInstanceState.GetString(OtpInfoKey);
                if (otpInfoString != null)
                {

                    XmlSerializer xs = new XmlSerializer(typeof(OtpInfo));
                    _otpInfo = (OtpInfo)xs.Deserialize(new StringReader(otpInfoString));

                    var enteredOtps = savedInstanceState.GetStringArrayList(EnteredOtpsKey);

                    ShowOtpEntry(enteredOtps);
                }

                UpdateKeyProviderUiState();

            }
        }
Пример #32
0
        public override void Setup(Bundle b)
        {
            bool showUserNotification;
            if (!Boolean.TryParse(b.GetString(ShowUserNotificationsKey), out showUserNotification))
            {
                showUserNotification = true; //default to true
            }
            ShowUserNotifications = showUserNotification;

            Url = b.GetString(UrlKey);
            AllFields = b.GetString(AllFieldsKey);
            ProtectedFieldsList = b.GetStringArrayList(ProtectedFieldsListKey);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var root = inflater.Inflate(Resource.Layout.shows_add_show_fragment, container, false);

            SetUpSwipeView(root);

            GridView = root.FindViewById<GridView>(Resource.Id.addShowFragmentGridView);

            SetUpAdapter();

            //SetUpEmptyView(root);

            if (savedInstanceState == null)
            {
                ShowsList = new List<TVShow>();
                _pageNumber = 1;
                //var downloadTask = 
                PopulateShowsAsync();
            }
            else
            {
                var myJsonString = savedInstanceState.GetString(Bundle_SHOWLIST);
                ShowsList = JsonConvert.DeserializeObject<TVShowList>(myJsonString).tvShowList;
                TrakkedShowsTMDBIDs = savedInstanceState.GetStringArrayList(Bundle_TRAKKEDLIST)?.ToEnumerable().ToList();
                _pageNumber = savedInstanceState.GetInt(Bundle_PAGENUMBER, 1);
                UpdateAdapter();
            }

            GridView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                var intent = new Intent(Activity, typeof (ShowOverviewActivity));
                //Change to show
                intent.PutExtra("TMDBID", "" + ShowsList[e.Position].TMDBID);
                StartActivity(intent);
            };

            GridView.Scroll += (sender, args) =>
            {
                if (args.FirstVisibleItem + args.VisibleItemCount >= args.TotalItemCount
                    && Adapter.Count > 15 && !_reachedBottomOfGridView)
                {
                    _reachedBottomOfGridView = true;
                    GetNextPage();
                    Console.WriteLine("I reached bottom of grid view");
                }
            };

            return root;
        }