示例#1
1
        public void CriarChamada(Activity activity)
        {
            isRecording = !isRecording;
            if (isRecording)
            {
                // Cria o INTENT
                var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);

                // Abre um modal com uma mensagem de voz
                voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, "Diga o nome da pessoa");

                // Se passar de 5.5s considera que não há mensagem falada
                voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 5500);
                voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
                voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
                voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);

                // Para chamadas em outras líguas
                // voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.German);
                // if you wish it to recognise the default Locale language and German
                // if you do use another locale, regional dialects may not be recognised very well

                voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                activity.StartActivityForResult(voiceIntent, Constants.VOICE);
            }
        }
示例#2
1
        public static void Launch(Activity act, PwEntry pw, AppTask appTask)
        {
            Intent i = new Intent(act, typeof(EntryEditActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());

            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
示例#3
1
文件: Util.cs 项目: pythe/wristpass
        private static void ShowInternalLocalFileChooser(Activity act, int requestCodeBrowse, bool forSaving, string defaultPath)
        {
            #if !EXCLUDE_FILECHOOSER
            string fileProviderAuthority = act.PackageName+".android-filechooser.localfile";

            Intent i = Keepass2android.Kp2afilechooser.Kp2aFileChooserBridge.GetLaunchFileChooserIntent(act,
                                                                                                        fileProviderAuthority,
                                                                                                        defaultPath);
            if (forSaving)
                i.PutExtra("group.pals.android.lib.ui.filechooser.FileChooserActivity.save_dialog", true);

            act.StartActivityForResult(i, requestCodeBrowse);
            #else
            Toast.MakeText(act, "File Chooser excluded!",ToastLength.Long).Show();
            #endif
        }
示例#4
0
 /// <summary>
 /// 跳转到设置界面
 /// </summary>
 private void StartSetting()
 {
     if (MiuiOs.MIUI)
     {
         Intent intent = MiuiOs.GetSettingIntent(mActivity);
         if (MiuiOs.IsIntentAvailable(mActivity, intent))
         {
             mActivity.StartActivityForResult(intent, REQUEST_CODE_SETTING);
             return;
         }
     }
     try
     {
         Intent intent = (new Intent(Settings.ActionApplicationDetailsSettings)).SetData(Uri.Parse("package:" + mActivity.PackageName));
         mActivity.StartActivityForResult(intent, REQUEST_CODE_SETTING);
     }
     catch (ActivityNotFoundException e)
     {
         Console.WriteLine(e.ToString());
         Console.Write(e.StackTrace);
         try
         {
             Intent intent = new Intent(Settings.ActionManageApplicationsSettings);
             mActivity.StartActivityForResult(intent, REQUEST_CODE_SETTING);
         }
         catch (Exception e1)
         {
             Console.WriteLine(e1.ToString());
             Console.Write(e1.StackTrace);
         }
     }
 }
        public static void LaunchWithoutLockCheck(Activity act)
        {
            Intent i = new Intent(act, typeof(GeneratePasswordActivity));

            i.PutExtra(NoLockCheck, true);

            act.StartActivityForResult(i, 0);
        }
示例#6
0
        public static void Launch(Activity act, PwGroup parentGroup)
        {
            Intent i = new Intent(act, typeof(GroupEditActivity));

            PwGroup parent = parentGroup;
            i.PutExtra(KeyParent, parent.Uuid.ToHexString());

            act.StartActivityForResult(i, 0);
        }
示例#7
0
        /// <summary>
        /// To be added.
        /// </summary>
        /// <param name="activity"></param>
        /// <param name="requestCode"></param>
        /// <param name="allowMultiple"></param>
        public static void PerformJpgFileSearch(this Activity activity, int requestCode, bool allowMultiple = false)
        {
            var intent = new Intent(Intent.ActionOpenDocument);

            intent.AddCategory(Intent.CategoryOpenable);
            intent.SetType("image/jpeg");
            intent.PutExtra(Intent.ExtraAllowMultiple, allowMultiple);
            activity.StartActivityForResult(intent, requestCode);
        }
示例#8
0
        //--------------------------------------------------------------
        // METHODS
        //--------------------------------------------------------------
        /* Activate the bluetooth to allow connection with an other device*/
        public ResultEnabling TryEnablingBluetooth(Activity activity)
        {
            #if DEBUG
            Log.Debug(Tag, "TryEnablingBluetooth()");
            #endif

            // Get local Bluetooth adapter
            BluetoothAdapter bluetoothAdapter = BluetoothAdapter.DefaultAdapter;

            // If the adapter is null, then Bluetooth is not supported
            if(bluetoothAdapter == null)
            {
                #if DEBUG
                Log.Debug(Tag, "display of the alert");
                #endif

                UtilsDialog.PopUpEndEvent += activity.Finish;
                Intent intent = UtilsDialog.CreateBluetoothDialogNoCancel(activity, Resource.String.BTNotAvailable);
                activity.StartActivity(intent);
                return ResultEnabling.NoMedium;
            }

            // If the bluetooth is not enable, we try to activate it
            if(!bluetoothAdapter.IsEnabled)
            {
                #if DEBUG
                Log.Debug(Tag, "intent to activate bluetooth");
                #endif

                Intent enableIntent = new Intent(BluetoothAdapter.ActionRequestEnable);
                activity.StartActivityForResult(enableIntent,(int) Utils.RequestCode.RequestEnableBluetooth);
                return ResultEnabling.Activation;
            }

            #if DEBUG
            Log.Debug(Tag, "creation of BluetoothManager");
            #endif

            EnableBluetooth();
            _communicationWay.Start();
            return ResultEnabling.Enabled;
        }
示例#9
0
文件: Util.cs 项目: pythe/wristpass
        /// <summary>
        /// Opens a browse dialog for selecting a file.
        /// </summary>
        /// <param name="activity">context activity</param>
        /// <param name="requestCodeBrowse">requestCode for onActivityResult</param>
        /// <param name="forSaving">if true, the file location is meant for saving</param>
        /// <param name="tryGetPermanentAccess">if true, the caller prefers a location that can be used permanently
        /// This means that ActionOpenDocument should be used instead of ActionGetContent (for not saving), as ActionGetContent
        /// is more for one-time access, but therefore allows possibly more available sources.</param>
        public static void ShowBrowseDialog(Activity activity, int requestCodeBrowse, bool forSaving, bool tryGetPermanentAccess)
        {
            var loadAction = (tryGetPermanentAccess && IsKitKatOrLater) ?
                            Intent.ActionOpenDocument : Intent.ActionGetContent;
            if ((!forSaving) && (IsIntentAvailable(activity, loadAction, "*/*", new List<string> { Intent.CategoryOpenable})))
            {
                Intent i = new Intent(loadAction);
                i.SetType("*/*");
                i.AddCategory(Intent.CategoryOpenable);

                activity.StartActivityForResult(i, requestCodeBrowse);
            }
            else
            {
                if ((forSaving) && (IsKitKatOrLater))
                {
                    Intent i = new Intent(Intent.ActionCreateDocument);
                    i.SetType("*/*");
                    i.AddCategory(Intent.CategoryOpenable);

                    activity.StartActivityForResult(i, requestCodeBrowse);
                }
                else
                {
                    string defaultPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;

                    ShowInternalLocalFileChooser(activity, requestCodeBrowse, forSaving, defaultPath);
                }

            }
        }
 public void LaunchProductDetailsActivity(Activity activity, Product product, ProductDetailsTheme theme)
 {
     var builder = new ProductDetailsBuilder(this, BuyClient);
     var intent = builder.SetShopDomain(BuyClient.ShopDomain)
             .SetProduct(product)
             .SetTheme(theme)
             .SetShop(Shop)
             .SetWebReturnToUrl(GetString(Resource.String.web_return_to_url))
             .SetWebReturnToLabel(GetString(Resource.String.web_return_to_label))
             .Build();
     activity.StartActivityForResult(intent, 1);
 }
示例#11
0
        public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags? flags = null)
        {
            Intent i = new Intent(act, typeof(EntryActivity));

            i.PutExtra(KeyEntry, pw.Uuid.ToHexString());
            i.PutExtra(KeyRefreshPos, pos);

            if (flags != null)
                i.SetFlags((ActivityFlags) flags);

            appTask.ToIntent(i);
            if (flags != null && (((ActivityFlags) flags) | ActivityFlags.ForwardResult) == ActivityFlags.ForwardResult)
                act.StartActivity(i);
            else
                act.StartActivityForResult(i, 0);
        }
示例#12
0
 public static void Launch(Activity act)
 {
     Intent i = new Intent(act, typeof(IconPickerActivity));
     act.StartActivityForResult(i, 0);
 }
示例#13
0
        public static void Launch(Activity act, PwGroup g, AppTask appTask)
        {
            // Need to use PwDatabase since group may be null
            PwDatabase db = App.Kp2a.GetDb().KpDatabase;

            if (db == null) {
                // Reached if db is null
                Log.Debug (Tag, "Tried to launch with null db");
                return;
            }

            Intent i = new Intent(act, typeof(GroupActivity));

            if ( g != null ) {
                i.PutExtra(KeyEntry, g.Uuid.ToHexString());
            }
            appTask.ToIntent(i);

            act.StartActivityForResult(i,0);
        }
 public static void StartForResult(Activity activity, Session session, int requestCode)
 {
     var intent = CreateIntent(activity, session);
     activity.StartActivityForResult(intent, requestCode);
 }
示例#15
0
        public static void Launch(Activity act, PwGroup pw, AppTask appTask)
        {
            Intent i = new Intent(act, typeof(EntryEditActivity));

            PwGroup parent = pw;
            i.PutExtra(KeyParent, parent.Uuid.ToHexString());

            appTask.ToIntent(i);

            act.StartActivityForResult(i, 0);
        }
示例#16
0
 public static void startTwoPlayerGame(Activity activity, string opponentName)
 {
     Intent intent = new Intent(activity, typeof(GameMultiActivity));
     intent.PutExtra(Utils.OpponentNameExtra, opponentName);
     activity.StartActivityForResult(intent, (int) Utils.RequestCode.RequestGameTwoPlayer);
 }
示例#17
0
 //--------------------------------------------------------------
 // PUBLIC METHODS
 //--------------------------------------------------------------
 public static void startOnePlayerGame(Activity activity)
 {
     Intent intent = new Intent(activity, typeof(GameSingleActivity));
     activity.StartActivityForResult(intent, (int) Utils.RequestCode.RequestGameOnePlayer);
 }
示例#18
0
        public static void Launch(Activity act)
        {
            Intent i = new Intent(act, typeof(GeneratePasswordActivity));

            act.StartActivityForResult(i, 0);
        }