Пример #1
0
        public override IParcelable SaveState()
        {
            Bundle state = null;

            if (_savedState.Count > 0)
            {
                state = new Bundle();
                var fss = new Fragment.SavedState[_savedState.Count];
                _savedState.CopyTo(fss, 0);
                state.PutParcelableArrayList("states", fss);
            }
            for (var i = 0; i < _fragments.Count; i++)
            {
                var f = _fragments[i];
                if (f != null && f.IsAdded)
                {
                    if (state == null)
                    {
                        state = new Bundle();
                    }
                    var key = "f" + i;
                    _fm.PutFragment(state, key, f);
                }
            }
            return(state);
        }
Пример #2
0
 protected override void OnSaveInstanceState(Bundle outState)
 {
     outState.PutParcelableArrayList("listItem", listItem);
     outState.PutString("mTVLookUpCustomPriceTotal", mTVLookUpCustomPriceTotal.Text);
     outState.PutString("formNo", tvSerial.Text);
     outState.PutInt("seq", seq);
     base.OnSaveInstanceState(outState);
 }
Пример #3
0
        public static MainFragment NewInstance(List <ResponseModel> model)
        {
            MainFragment       frag      = new MainFragment();
            Bundle             bundle    = new Bundle();
            List <IParcelable> parameter = model.Cast <IParcelable>().ToList();

            bundle.PutParcelableArrayList(MODEL_KEY, parameter);
            frag.Arguments = bundle;
            return(frag);
        }
Пример #4
0
        public static MRZFrontBackImageResultDialogFragment CreateInstance(Workflow flow, List <WorkflowStepResult> results)
        {
            var f = new MRZFrontBackImageResultDialogFragment();

            var args = new Bundle();

            args.PutParcelable(WORKFLOW_EXTRA, flow);
            args.PutParcelableArrayList(WORKFLOW_RESULT_EXTRA, results.ToArray());
            f.Arguments = args;

            return(f);
        }
        public override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);

            outState.PutString(SELECTED_DIRECTORY_KEY, currentDirectoryTextView.Text);
            var entries = new List <IParcelable> (directoryEntries.Count);

            foreach (DirectoryEntry de in directoryEntries)
            {
                entries.Add(de);
            }
            outState.PutParcelableArrayList(DIRECTORY_ENTRIES_KEY, entries);
        }
Пример #6
0
        private void AddWifi(string ssid, string psk)
        {
            var intent = new Intent("android.settings.WIFI_ADD_NETWORKS");
            var bundle = new Bundle();

            bundle.PutParcelableArrayList("android.provider.extra.WIFI_NETWORK_LIST",
                                          new List <IParcelable>
            {
                new WifiNetworkSuggestion.Builder()
                .SetSsid(ssid)
                .SetWpa2Passphrase(psk)
                .Build()
            });

            intent.PutExtras(bundle);

            StartActivityForResult(intent, AddWifiSettingsRequestCode);
        }
Пример #7
0
        public Bundle ToBundle()
        {
            var bundle = new Bundle();

            bundle.PutString(Constants.RecipeFieldTitle, TitleText);
            bundle.PutString(Constants.RecipeFieldSummary, SummaryText);
            bundle.PutString(Constants.RecipeFieldImage, RecipeImage);
            bundle.PutString(Constants.RecipeFieldIngredients, IngredientsText);
            if (RecipeSteps != null)
            {
                List <IParcelable> stepBundles = new List <IParcelable> (RecipeSteps.Count);
                foreach (RecipeStep recipeStep in RecipeSteps)
                {
                    stepBundles.Add(recipeStep.ToBundle());
                }
                bundle.PutParcelableArrayList(Constants.RecipeFieldSteps, stepBundles);
            }
            return(bundle);
        }
Пример #8
0
        private void LoginOnClick(object s, EventArgs e)
        {
            EditText userNameText = FindViewById <EditText>(Resource.Id.userNameText);
            EditText passwordText = FindViewById <EditText>(Resource.Id.passwordText);

            if (userNameText.Text.Trim().Length != 0 && passwordText.Text.Trim().Length != 0)
            {
                User user = DBHandler.Instance.GetUser(userNameText.Text, passwordText.Text);

                if (user != null)
                {
                    var intent = new Intent(this, typeof(MainUserActivity));
                    var bundle = new Bundle();

                    bundle.PutParcelable(MainUserActivity.ARG_USER, user);

                    // set user collection list parcelable
                    List <Collection>  userCollection = DBHandler.Instance.GetUserCollection(user.ID);
                    List <IParcelable> parcelList     = new List <IParcelable>();
                    foreach (Collection item in userCollection)
                    {
                        parcelList.Add(item.ToBundle());
                    }
                    bundle.PutParcelableArrayList(MainUserActivity.ARG_COLLECTION, parcelList);

                    intent.PutExtras(bundle);

                    StartActivity(intent);
                }
                else
                {
                    Toast.MakeText(this, "Username or password incorrect!", ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(this, "Missing fields!", ToastLength.Long).Show();
            }
        }
Пример #9
0
        private void OnListClicked(object sender, int position)
        {
            var intent = new Android.Content.Intent(Activity, typeof(ViewMovieActivity));

            CollectionItemList selected = (CollectionItemList)((ListView)sender).Adapter.GetItem(position);

            Bundle bundle = new Bundle();

            bundle.PutParcelable(ViewMovieActivity.ARG_USER, ((MainUserActivity)Activity).LoggedIn);
            bundle.PutInt(ViewMovieActivity.ARG_MOVIE, selected.MovieID);

            // set user collection list parcelable
            List <IParcelable> parcelList = new List <IParcelable>();

            foreach (Collection item in ((MainUserActivity)Activity).UserCollection)
            {
                parcelList.Add(item.ToBundle());
            }
            bundle.PutParcelableArrayList(ViewMovieActivity.ARG_COLLECTION, parcelList);

            intent.PutExtras(bundle);

            StartActivity(intent);
        }
Пример #10
0
 protected override void OnSaveInstanceState(Bundle outState)
 {
     outState.PutParcelableArrayList("listRec", listRec);
     base.OnSaveInstanceState(outState);
 }
Пример #11
0
		public Bundle ToBundle()
		{
			var bundle = new Bundle ();
			bundle.PutString (Constants.RecipeFieldTitle, TitleText);
			bundle.PutString (Constants.RecipeFieldSummary, SummaryText);
			bundle.PutString (Constants.RecipeFieldImage, RecipeImage);
			bundle.PutString (Constants.RecipeFieldIngredients, IngredientsText);
			if (RecipeSteps != null) {
				List<IParcelable> stepBundles = new List<IParcelable> (RecipeSteps.Count);
				foreach (RecipeStep recipeStep in RecipeSteps) {
					stepBundles.Add (recipeStep.ToBundle ());
				}
				bundle.PutParcelableArrayList (Constants.RecipeFieldSteps, stepBundles);
			}
			return bundle;
		}
        private void CreateRestrictions(Context context, PendingResult result, Bundle existingRestrictions)
        {
            // The incoming restrictions bundle contains key/value pairs representing existing app
            // restrictions for this package. In order to retain existing app restrictions, you need to
            // construct new restriction entries and then copy in any existing values for the new keys.
            List <IParcelable> newEntries = InitRestrictions(context);

            // If app restrictions were not previously configured for the package, create the default
            // restrictions entries and return them.
            if (existingRestrictions == null)
            {
                var extras = new Bundle();
                extras.PutParcelableArrayList(Intent.ExtraRestrictionsList, newEntries);
                result.SetResult(Result.Ok, null, extras);
                result.Finish();
                return;
            }

            // Retains current restriction settings by transferring existing restriction entries to
            // new ones.
            foreach (RestrictionEntry entry in newEntries)
            {
                String key = entry.Key;

                if (KEY_BOOLEAN.Equals(key))
                {
                    entry.SelectedState = existingRestrictions.GetBoolean(KEY_BOOLEAN);
                }
                else if (KEY_CHOICE.Equals(key))
                {
                    if (existingRestrictions.ContainsKey(KEY_CHOICE))
                    {
                        entry.SelectedString = existingRestrictions.GetString(KEY_CHOICE);
                    }
                }
                else if (KEY_MULTI_SELECT.Equals(key))
                {
                    if (existingRestrictions.ContainsKey(KEY_MULTI_SELECT))
                    {
                        entry.SetAllSelectedStrings(existingRestrictions.GetStringArray(key));
                    }
                }
            }

            var extra = new Bundle();

            // This path demonstrates the use of a custom app restriction activity instead of standard
            // types.  When a custom activity is set, the standard types will not be available under
            // app restriction settings.
            //
            // If your app has an existing activity for app restriction configuration, you can set it
            // up with the intent here.
            if (PreferenceManager.GetDefaultSharedPreferences(context)
                .GetBoolean(MainActivity.CUSTOM_CONFIG_KEY, false))
            {
                var customIntent = new Intent();
                customIntent.SetClass(context, typeof(CustomRestrictionsActivity));
                extra.PutParcelable(Intent.ExtraRestrictionsIntent, customIntent);
            }

            extra.PutParcelableArrayList(Intent.ExtraRestrictionsList, newEntries);
            result.SetResult(Result.Ok, null, extra);
            result.Finish();
        }
Пример #13
0
        public void OnSaveInstanceState(Bundle outState)
        {
            var list = this as IEnumerable <IParcelable>;

            outState.PutParcelableArrayList(STATE_SELECTION, new List <IParcelable>(list));
        }
		private void CreateRestrictions (Context context, PendingResult result, Bundle existingRestrictions) 
		{
			// The incoming restrictions bundle contains key/value pairs representing existing app
			// restrictions for this package. In order to retain existing app restrictions, you need to
			// construct new restriction entries and then copy in any existing values for the new keys.
			List <IParcelable> newEntries = InitRestrictions (context);

			// If app restrictions were not previously configured for the package, create the default
			// restrictions entries and return them.
			if (existingRestrictions == null) {
				var extras = new Bundle ();
				extras.PutParcelableArrayList (Intent.ExtraRestrictionsList, newEntries);
				result.SetResult (Result.Ok, null, extras);
				result.Finish ();
				return;
			}

			// Retains current restriction settings by transferring existing restriction entries to
			// new ones.
			foreach (RestrictionEntry entry in newEntries) {
				String key = entry.Key;

				if (KEY_BOOLEAN.Equals (key)) {
					entry.SelectedState = existingRestrictions.GetBoolean (KEY_BOOLEAN);

				} else if (KEY_CHOICE.Equals (key)) {
					if (existingRestrictions.ContainsKey (KEY_CHOICE)) {
						entry.SelectedString = existingRestrictions.GetString (KEY_CHOICE);
					}
			
				} else if (KEY_MULTI_SELECT.Equals (key)) {
					if (existingRestrictions.ContainsKey (KEY_MULTI_SELECT)) {
						entry.SetAllSelectedStrings(existingRestrictions.GetStringArray (key));
					}
				}
			}

			var extra = new Bundle();

			// This path demonstrates the use of a custom app restriction activity instead of standard
			// types.  When a custom activity is set, the standard types will not be available under
			// app restriction settings.
			//
			// If your app has an existing activity for app restriction configuration, you can set it
			// up with the intent here.
			if (PreferenceManager.GetDefaultSharedPreferences (context)
			    .GetBoolean (MainActivity.CUSTOM_CONFIG_KEY, false)) {
				var customIntent = new Intent();
				customIntent.SetClass (context, typeof (CustomRestrictionsActivity));
				extra.PutParcelable (Intent.ExtraRestrictionsIntent, customIntent);
			}

			extra.PutParcelableArrayList (Intent.ExtraRestrictionsList, newEntries);
			result.SetResult (Result.Ok, null, extra);
			result.Finish ();
		}
Пример #15
0
        private void SetProfileConfig(DWProfileSetConfigSettings settings)
        {
            // (Re)Configuration du profil via l'intent SET_PROFILE
            // NB : on peut envoyer cet intent sans soucis même si le profil est déjà configuré
            Bundle profileConfig = new Bundle();

            profileConfig.PutString("PROFILE_NAME", settings.ProfileName);
            profileConfig.PutString("PROFILE_ENABLED", "true");
            profileConfig.PutString("CONFIG_MODE", "UPDATE");

            // Configuration des applications du profil
            Bundle appConfig = new Bundle();

            appConfig.PutString("PACKAGE_NAME", mContext.PackageName);
            appConfig.PutStringArray("ACTIVITY_LIST", new String[] { "*" });
            profileConfig.PutParcelableArray("APP_LIST", new Bundle[] { appConfig });

            // Configuration des différents plugins
            List <IParcelable> pluginConfigs = new List <IParcelable>();

            // Configuration du plugin BARCODE
            Bundle barcodePluginConfig = new Bundle();

            barcodePluginConfig.PutString("PLUGIN_NAME", "BARCODE");
            barcodePluginConfig.PutString("RESET_CONFIG", "true");

            Bundle barcodeProps = new Bundle();

            barcodeProps.PutString("aim_mode", "on");
            barcodeProps.PutString("lcd_mode", "3");

            // Use this for Datawedge < 6.7
            //barcodeProps.putString("scanner_selection", "auto");

            // Use this for Datawedge >= 6.7
            barcodeProps.PutString("scanner_selection_by_identifier", "INTERNAL_IMAGER");

            if (settings.AggressiveMode)
            {
                // Super aggressive continuous mode without beam timer and no timeouts
                barcodeProps.PutString("aim_type", "5");
                barcodeProps.PutInt("beam_timer", 0);
                barcodeProps.PutString("different_barcode_timeout", "0");
                barcodeProps.PutString("same_barcode_timeout", "0");
            }
            else
            {
                // Standard mode with beam timer and same/different timeout
                barcodeProps.PutString("aim_type", "3");
                barcodeProps.PutInt("beam_timer", 5000);
                barcodeProps.PutString("different_barcode_timeout", "500");
                barcodeProps.PutString("same_barcode_timeout", "500");
            }
            barcodePluginConfig.PutBundle("PARAM_LIST", barcodeProps);
            pluginConfigs.Add(barcodePluginConfig);


            // Configuration du plugin KEYSTROKE
            Bundle keystrokePluginConfig = new Bundle();

            keystrokePluginConfig.PutString("PLUGIN_NAME", "KEYSTROKE");
            keystrokePluginConfig.PutString("RESET_CONFIG", "true");
            Bundle keystrokeProps = new Bundle();

            keystrokeProps.PutString("keystroke_output_enabled", "false");
            keystrokePluginConfig.PutBundle("PARAM_LIST", keystrokeProps);
            pluginConfigs.Add(keystrokePluginConfig);

            // Configuration du plugin INTENT
            Bundle intentPluginConfig = new Bundle();

            intentPluginConfig.PutString("PLUGIN_NAME", "INTENT");
            intentPluginConfig.PutString("RESET_CONFIG", "true");
            Bundle intentProps = new Bundle();

            intentProps.PutString("intent_output_enabled", "true");
            intentProps.PutString("intent_action", settings.IntentAction);
            intentProps.PutString("intent_category", settings.IntentCategory);
            intentProps.PutString("intent_delivery", "2");
            intentPluginConfig.PutBundle("PARAM_LIST", intentProps);
            pluginConfigs.Add(intentPluginConfig);

            // Envoi d'intent de configuration du profil
            profileConfig.PutParcelableArrayList("PLUGIN_CONFIG", pluginConfigs);

            SendDataWedgeIntentWithExtraRequestResult(DataWedgeConstants.ACTION_DATAWEDGE_FROM_6_2,
                                                      DataWedgeConstants.EXTRA_SET_CONFIG,
                                                      profileConfig);
        }
		public override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);

			outState.PutString (SELECTED_DIRECTORY_KEY, currentDirectoryTextView.Text);
			var entries = new List<IParcelable> (directoryEntries.Count);
			foreach (DirectoryEntry de in directoryEntries)
				entries.Add (de);
			outState.PutParcelableArrayList (DIRECTORY_ENTRIES_KEY, entries);
	 	}