Пример #1
0
        public static RegisterUserFragment NewInstance(GoFragments go)
        {
            var fragment = new RegisterUserFragment ();
            var args = new Bundle ();
            switch (go) {

            case GoFragments.InitFragment:

                args.PutInt ("Go", 0);

                break;

            case GoFragments.SubastaFragment:

                args.PutInt ("Go", 1);

                break;
            default:
                args.PutInt ("Go", 0);
                break;
            }

            fragment.Arguments = args;
            return fragment;
        }
 public static Bundle CreateArguments(int errorCode, int requestCode)
 {
    Bundle args = new Bundle();
    args.PutInt(GooglePlayServicesErrorDialogFragment.ARG_ERROR_CODE, errorCode);
    args.PutInt(GooglePlayServicesErrorDialogFragment.ARG_REQUEST_CODE, requestCode);
    return args;
 }
        public override void OnSaveInstanceState (Bundle outState)
        {
            base.OnSaveInstanceState (outState);

            outState.PutInt (DigitsEnteredKey, digitsEntered);
            outState.PutInt (NewDurationHoursKey, newDuration.Hours);
            outState.PutInt (NewDurationMinutesKey, newDuration.Minutes);
        }
 public static DialogFragment Create(int errorCode, int requestCode)
 {
    DialogFragment fragment = new GooglePlusErrorDialogFragment();
    Bundle args = new Bundle();
    args.PutInt(GooglePlusErrorDialogFragment.ARG_ERROR_CODE, errorCode);
    args.PutInt(GooglePlusErrorDialogFragment.ARG_REQUEST_CODE, requestCode);
    fragment.SetArguments(args);
    return fragment;
 }
Пример #5
0
 public static MessageDialog NewInstance(int message, int title)
 {
     var dialog = new MessageDialog();
     var args = new Bundle();
     args.PutInt(MESSAGE, message);
     args.PutInt(TITLE, title);
     dialog.Arguments = args;
     return dialog;
 }
		public static TrickSelectorPreMenuDialogFragment newInstance(int position, int rank)
		{
			var frag = new TrickSelectorPreMenuDialogFragment();
			args = new Bundle();
			args.PutInt("Rank", rank);
			args.PutInt("Pos", position);
			frag.Arguments = args;

			return frag;
		}
        public static ValueChooserDialogFragment NewInstance(int id, int titleId, int itemsArrayId)
        {
            ValueChooserDialogFragment fragment = new ValueChooserDialogFragment();
            Bundle args = new Bundle();
            args.PutInt(ARG_ID, id);
            args.PutInt(ARG_TITLE, titleId);
            args.PutInt(ARG_ITEMS_ARRAY, itemsArrayId);
            fragment.Arguments = args;

            return fragment;
        }
Пример #8
0
        public static TimePickerFragment NewInstance(DateTime date)
        {
            TimePickerFragment fragment = new TimePickerFragment();
            fragment.mDate = date;

            Bundle args = new Bundle();
            args.PutInt(EXTRA_HOUR, date.Hour);
            args.PutInt(EXTRA_MINUTE, date.Minute);
            fragment.Arguments = args;

            return fragment;
        }
Пример #9
0
        public static DatePickerFragment NewInstance(Action<int, int, int> OnDateSet, int year, int monthOfYear, int dayOfMonth)
        {
            var fragment = new DatePickerFragment();
            fragment._onDateSet = OnDateSet;

            var args = new Bundle();
            args.PutInt("year", year);
            args.PutInt("monthOfYear", monthOfYear - 1);
            args.PutInt("dayOfMonth", dayOfMonth);
            fragment.Arguments = args;

            return fragment;
        }
Пример #10
0
		/**
	     * Create a new instance of DetailFragment.
	     * @param resourceId The resource ID of the Drawable image to show
	     * @param title The title of the image
	     * @param x The horizontal position of the grid item in pixel
	     * @param y The vertical position of the grid item in pixel
	     * @param width The width of the grid item in pixel
	     * @param height The height of the grid item in pixel
	     * @return a new instance of DetailFragment
	     */
		public static DetailFragment NewInstance (int resourceId, string title, int x, int y, int width, int height)
		{
			var fragment = new DetailFragment ();
			var args = new Bundle ();
			args.PutInt (ARG_RESOURCE_ID, resourceId);
			args.PutString (ARG_TITLE, title);
			args.PutInt (ARG_X, x);
			args.PutInt (ARG_Y, y);
			args.PutInt (ARG_WIDTH, width);
			args.PutInt (ARG_HEIGHT, height);
			fragment.Arguments = args;
			return fragment;
		}
Пример #11
0
        public static DatePickerFragment NewInstance(DateTime date)
        {
            DatePickerFragment fragment = new DatePickerFragment();
            fragment.mDate = date;

            Bundle args = new Bundle();
            args.PutInt(EXTRA_YEAR, date.Year);
            args.PutInt(EXTRA_MONTH, date.Month);
            args.PutInt(EXTRA_DAY, date.Day);
            fragment.Arguments = args;

            return fragment;
        }
		/**
     * Return an instance of TimeFragment with its bundle filled with the
     * constructor arguments. The values in the bundle are retrieved in
     * {@link #onCreateView()} below to properly initialize the TimePicker.
     *
     * @param theme
     * @param hour
     * @param minute
     * @param isClientSpecified24HourTime
     * @param is24HourTime
     * @return
     */
		public static TimeFragment NewInstance(int Theme, int Hour, int Minute,bool IsClientSpecified24HourTime, bool Is24HourTime)
		{
			TimeFragment timeFragment = new TimeFragment();

			Bundle bundle = new Bundle();
			bundle.PutInt("theme", Theme);
			bundle.PutInt("hour", Hour);
			bundle.PutInt("minute", Minute);
			bundle.PutBoolean("isClientSpecified24HourTime", IsClientSpecified24HourTime);
			bundle.PutBoolean("is24HourTime", Is24HourTime);
			timeFragment.Arguments=bundle;

			return timeFragment;
		}
        public static TimeFragment NewInstance(int theme,int hour,int minute,
			bool isClientSpecified24HourTime,bool is24HourTime)
        {
            TimeFragment t = new TimeFragment ();
            Bundle b = new Bundle ();
            b.PutInt ("theme", theme);
            b.PutInt ("hour", hour);
            b.PutInt ("minute", minute);
            b.PutBoolean ("isClientSpecified24HourTime", isClientSpecified24HourTime);
            b.PutBoolean ("is24HourTime", is24HourTime);
            t.Arguments = b;

            return t;
        }
		/**
     * Return an instance of DateFragment with its bundle filled with the
     * constructor arguments. The values in the bundle are retrieved in
     * {@link #onCreateView()} below to properly initialize the DatePicker.
     *
     * @param theme
     * @param year
     * @param month
     * @param day
     * @param minDate
     * @param maxDate
     * @return an instance of DateFragment
     */
		public static DateFragment newInstance(int Theme, int Year, int Month,int Day, Date MinDate, Date MaxDate)
		{
			DateFragment dateFragment = new DateFragment();

			Bundle b = new Bundle();
			b.PutInt("theme", Theme);
			b.PutInt("year", Year);
			b.PutInt("month", Month);
			b.PutInt("day", Day);
			b.PutSerializable("minDate", MinDate);
			b.PutSerializable("maxDate", MaxDate);
			dateFragment.Arguments=b;

			return dateFragment;
		}
        protected void SaveGameAndPlayer()
        {
            // Create an array to store player into
            List<GamePlayer> attendees = new List<GamePlayer>();
            int listItemCount = _playersListView.ChildCount;
            for (int i = 0; i < listItemCount; i++)
            {
                CheckBox cbox = (_playersListView.GetChildAt(i)).FindViewById<CheckBox>(Resource.Id.playerCheckbox);
                if (cbox.Checked)
                {
                    attendees.Add(new GamePlayer()
                    {
                        PlayerId = (int)GameData.PlayerService.Players[i].Id,
                        PlayerAlias = GameData.PlayerService.Players[i].Name,
                        Score = 0
                    });
                }
            }
            Game game = new Game()
            {
                Name = Arguments.GetString("game_name"),
                Players = attendees
            };
            GameData.Service.SaveGame(game);
            //StartActivity(typeof(GamesActivity));

            var fragment = new GameFragment();
            Bundle bundle = new Bundle();
            bundle.PutInt("game_id", (int)game.Id);
            fragment.Arguments = bundle;

            var trans = Activity.SupportFragmentManager.BeginTransaction();
            trans.Add(Resource.Id.fragmentContainer, fragment, "GameFragment");
            trans.Commit();
        }
        public static DateFragment NewInstance(int theme, int year, int month,
            int day, DateTime minDate, DateTime maxDate)
        {
            DateFragment t = new DateFragment();

            Bundle b = new Bundle();
            b.PutInt("theme", theme);
            b.PutInt("year", year);
            b.PutInt("month", month);
            b.PutInt("day", day);
            b.PutLong("minDate", minDate.Ticks);
            b.PutLong("maxDate", maxDate.Ticks);
            t.Arguments = b;

            return t;
        }
 public static SubCategoriesFragment NewInstance(int position)
 {
     Bundle bundle = new Bundle();
     bundle.PutInt("position",position);
     var frag = new SubCategoriesFragment { Arguments = bundle };
     return frag;
 }
Пример #18
0
        public override void Present(GlassService service)
        {
            base.Present(service);

            if (service.GetType() == typeof (StopwatchService))
            {
                if (_card == null)
                {
                    _card = new LiveCard(service, service.GetType().FullName);
                    _renderer = new ChronometerRenderer(service);
                    _card.SetDirectRenderingEnabled(true).SurfaceHolder.AddCallback(_renderer);

                    var mi = new Intent(service, typeof(MenuActivity));
                    var b = new Bundle();
                    b.PutInt("ResourceID", Resource.Menu.stopwatch);
                    mi.PutExtras(b);
                    mi.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);

                    _card.SetAction(PendingIntent.GetActivity(service, 0, mi, 0));
                    _card.Attach(service);

                    _card.Publish(LiveCard.PublishMode.Reveal);
                }
                else
                {
                    _card.Navigate();
                }
            }
        }
Пример #19
0
		private void ButtonOnClick (object sender, EventArgs eventArgs)
		{
			// These are the values that we want to pass to the next activity
			Bundle valuesForActivity = new Bundle ();
			valuesForActivity.PutInt ("count", _count);

			// Create the PendingIntent with the back stack             
			// When the user clicks the notification, SecondActivity will start up.
			Intent resultIntent = new Intent (this, typeof(SecondActivity));
			resultIntent.PutExtras (valuesForActivity); // Pass some values to SecondActivity.

			TaskStackBuilder stackBuilder = TaskStackBuilder.Create (this);
			stackBuilder.AddParentStack (Class.FromType (typeof(SecondActivity)));
			stackBuilder.AddNextIntent (resultIntent);

			PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent (0, (int)PendingIntentFlags.UpdateCurrent);

			// Build the notification
			NotificationCompat.Builder builder = new NotificationCompat.Builder (this)
                .SetAutoCancel (true) // dismiss the notification from the notification area when the user clicks on it
                .SetContentIntent (resultPendingIntent) // start up this activity when the user clicks the intent.
                .SetContentTitle ("Button Clicked") // Set the title
                .SetNumber (_count) // Display the count in the Content Info
                .SetSmallIcon (Resource.Drawable.ic_stat_button_click) // This is the icon to display
                .SetContentText (String.Format ("The button has been clicked {0} times.", _count)); // the message to display.

			// Finally publish the notification
			NotificationManager notificationManager = (NotificationManager)GetSystemService (NotificationService);
			notificationManager.Notify (ButtonClickNotificationId, builder.Build ());

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


            if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape)
            {
                Finish();
                return;
            }

            if (savedInstanceState == null)
            {
                //Insert Details Fragment to frame
                DetailsFragment details = new DetailsFragment();
                Bundle b = new Bundle();
                b.PutInt("index", Intent.GetIntExtra("index", 0));
                details.Arguments = b;
                SupportFragmentManager.BeginTransaction().Add(Android.Resource.Id.Content, details).Commit();

            }




        }
Пример #21
0
 public static MyAlertDialogFragment NewInstance(int title) {
     MyAlertDialogFragment frag = new MyAlertDialogFragment();
     Bundle args = new Bundle();
     args.PutInt("title", title);
     frag.SetArguments(args);
     return frag;
 }
Пример #22
0
 public override void OnSaveInstanceState (Bundle outState)
 {
     base.OnSaveInstanceState (outState);
     if (viewPager != null) {
         outState.PutInt (ExtraPage, viewPager.CurrentItem);
     }
 }
 public static BrowserItemFragment NewInstance(int position)
 {
     BrowserItemFragment ret = new BrowserItemFragment();
     Bundle args = new Bundle(1);
     args.PutInt(POSITION_ARG, position);
     ret.Arguments = args;
     return ret;
 }
 public override Fragment GetItem(int p)
 {
     var fragment = new DummySectionFragment();
     var args = new Bundle();
     args.PutInt(DummySectionFragment.ArgSectionNumber, p + 1);
     fragment.Arguments = args;
     return fragment;
 }
Пример #25
0
 public static SuperAwesomeCardFragment NewInstance(int position)
 {
     var f = new SuperAwesomeCardFragment ();
     var b = new Bundle ();
     b.PutInt("position", position);
     f.Arguments = b;
     return f;
 }
Пример #26
0
        protected override void OnSaveInstanceState (Bundle outState)
        {
            outState.PutInt ("click_count", _counter);
            Log.Debug(GetType().FullName, "Activity A - Saving instance state");

            // always call the base implementation!
            base.OnSaveInstanceState (outState);    
        }
		public override void OnSaveInstanceState (Bundle outState)
		{
			base.OnSaveInstanceState (outState);
			if (resultData != null) {
				outState.PutInt (STATE_RESULT_CODE, resultCode);
				outState.PutParcelable (STATE_RESULT_DATA, resultData);
			}
		}
Пример #28
0
 public static PageFragment NewInstance(int position)
 {
     var f = new PageFragment ();
     var b = new Bundle ();
     b.PutInt ("position", position);
     f.Arguments = b;
     return f;
 }
Пример #29
0
 public static LoginFragment NewInstance (int loginAction)
 {
     var fragment = new LoginFragment ();
     var bundle = new Bundle ();
     bundle.PutInt (LoginActivity.EXTRA_ACTION, loginAction);
     fragment.Arguments = bundle;
     return fragment;
 }
Пример #30
0
		public static ImageFragment Create (int resId)
		{
			var fragment = new ImageFragment ();
			var args = new Bundle ();
			args.PutInt (ARG_PATTERN, resId);
			fragment.Arguments = args;
			return fragment;
		}
Пример #31
0
 protected override void OnSaveInstanceState(Bundle outState)
 {
     try {
         if (string.IsNullOrEmpty(localPath))
         {
             Console.WriteLine("No image file to save");
         }
         else
         {
             outState.PutString("pathToImage", localPath);
         }
         outState.PutInt("counter", counter);
         outState.PutString("name", nameText.Text);
         outState.PutString("surname", surnameText.Text);
         outState.PutString("imageURL", urlTextBox.Text);
         base.OnSaveInstanceState(outState);
         Console.WriteLine("State saved");
     } catch (Exception e) {
         Console.WriteLine("Something went wrong");
     }
 }
Пример #32
0
            protected override Bundle PrepareArguments()
            {
                Bundle args = new Bundle();

                args.PutString(ARG_TITLE, title);
                args.PutString(ARG_POSITIVE_BUTTON, confirmButtonText);
                args.PutString(ARG_NEGATIVE_BUTTON, cancelButtonText);

                args.PutStringArray(ARG_ITEMS, items);

                SparseBooleanArrayParcelable sparseArray = new SparseBooleanArrayParcelable();

                for (int index = 0; checkedItems != null && index < checkedItems.Length; index++)
                {
                    sparseArray.Put(checkedItems[index], true);
                }
                args.PutParcelable(ARG_CHECKED_ITEMS, sparseArray);
                args.PutInt(ARG_MODE, (int)mode);

                return(args);
            }
Пример #33
0
 /// <summary>
 /// OnSaved
 /// </summary>
 /// <param name="outState"></param>
 protected override void OnSaveInstanceState(Bundle outState)
 {
     outState.PutInt(ExtraId, this.id);
     if (NELatitude != null)
     {
         outState.PutDouble(ExtraNELatitude, this.NELatitude.Value);
     }
     if (NELongitude != null)
     {
         outState.PutDouble(ExtraNELongitude, this.NELongitude.Value);
     }
     if (SWLatitude != null)
     {
         outState.PutDouble(ExtraSWLatitude, this.SWLatitude.Value);
     }
     if (SWLongitude != null)
     {
         outState.PutDouble(ExtraSWLongitude, this.SWLongitude.Value);
     }
     base.OnSaveInstanceState(outState);
 }
Пример #34
0
 private static string CheckRequiredParams(Context context, Bundle bundle, string type)
 {
     if (GetActivityClass(context) == null)
     {
         return("Activity is required!");
     }
     else if (bundle.GetString(NotificationConstants.Message) == null)
     {
         return("Notification Message is required!");
     }
     else if (!bundle.ContainsKey(NotificationConstants.Id))
     {
         bundle.PutInt(NotificationConstants.Id, CoreUtils.GetRandomInt());
         return(Success);
     }
     else if (type == CoreConstants.NotificationType.Scheduled && bundle.GetDouble(NotificationConstants.FireDate) == 0)
     {
         return("Fire Date is required for schedule!");
     }
     return(Success);
 }
Пример #35
0
        public override void OnReceive(Context context, Intent intent)
        {
            var message = intent.GetStringExtra("message");
            var title   = intent.GetStringExtra("title");

            // Pass the current button press count value to the next activity:
            var valuesForActivity = new Bundle();

            valuesForActivity.PutInt(MainActivity.COUNT_KEY, MainActivity.count);

            // When the user clicks the notification, SecondActivity will start up.
            var resultIntent = new Intent(context, typeof(SecondActivity));

            // Pass some values to SecondActivity:
            resultIntent.PutExtras(valuesForActivity);

            // Construct a back stack for cross-task navigation:
            //var stackBuilder = TaskStackBuilder.Create(this);
            var stackBuilder = TaskScheduler.Create(context);

            stackBuilder.AddParentStack(Class.FromType(typeof(SecondActivity)));
            stackBuilder.AddNextIntent(resultIntent);

            // Create the PendingIntent with the back stack:
            var resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent);

            // Build the notification:
            var notificationBuilder = new NotificationCompat.Builder(context, MainActivity.CHANNEL_ID)
                                      .SetAutoCancel(true)                                  // Dismiss the notification from the notification area when the user clicks on it
                                      .SetContentIntent(resultPendingIntent)                // Start up this activity when the user clicks the intent.
                                      .SetContentTitle(title)                               // Set the title
                                      .SetNumber(MainActivity.count)                        // Display the count in the Content Info
                                      .SetSmallIcon(Resource.Drawable.ic_stat_button_click) // This is the icon to display
                                      .SetContentText(message);                             // the message to display.

            // Finally, publish the notification:
            var notificationManager = NotificationManagerCompat.From(context);

            notificationManager.Notify(MainActivity.NOTIFICATION_ID, notificationBuilder.Build());
        }
Пример #36
0
        private bool RestoreUser()
        {
            if (!AppController.IsUserRestorable)
            {
                return(false);
            }

            if (_isLogginUser)
            {
                return(true);
            }

            _isLogginUser = true;

            // Create a new cancellation token for this request
            _cts = new CancellationTokenSource();
            AppController.RestoreUser(_cts, AppController.Settings.AuthAccessToken,
                                      // Service call success
                                      (data) =>
            {
                Bundle b = new Bundle();
                b.PutBoolean("UserRestored", true);
                b.PutInt("UserId", data.UserId);
                MakeRoot(typeof(MainActivity), b);
            },
                                      // Service call error
                                      (error) =>
            {
                Toast.MakeText(this.Application, error, ToastLength.Long).Show();

                MakeRoot(typeof(MainActivity));
            },
                                      // Service call finished
                                      () =>
            {
                _isLogginUser = false;
            });

            return(true);
        }
        private void ButtonOnClick(object sender, System.EventArgs e)
        {
            // Pass the current button press count value to the next activity:
            var valuesForActivity = new Bundle();

            valuesForActivity.PutInt(COUNT_KEY, count);

            // When the user clicks the notification, SecondActivity will start up.
            var resultIntent = new Intent(this, typeof(SecondActivity));

            // Pass some values to SecondActivity:
            resultIntent.PutExtras(valuesForActivity);

            // Construct a back stack for cross-task navigation:
            //var stackBuilder = TaskStackBuilder.Create(this);
            var stackBuilder = TaskScheduler.Create(this);

            stackBuilder.AddParentStack(Class.FromType(typeof(SecondActivity)));
            stackBuilder.AddNextIntent(resultIntent);

            // Create the PendingIntent with the back stack:
            var resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent);

            // Build the notification:
            var builder = new NotificationCompat.Builder(this, CHANNEL_ID)
                          .SetAutoCancel(true)                                            // Dismiss the notification from the notification area when the user clicks on it
                          .SetContentIntent(resultPendingIntent)                          // Start up this activity when the user clicks the intent.
                          .SetContentTitle("Button Clicked")                              // Set the title
                          .SetNumber(count)                                               // Display the count in the Content Info
                          .SetSmallIcon(Resource.Drawable.ic_stat_button_click)           // This is the icon to display
                          .SetContentText($"The button has been clicked {count} times."); // the message to display.

            // Finally, publish the notification:
            var notificationManager = NotificationManagerCompat.From(this);

            notificationManager.Notify(NOTIFICATION_ID, builder.Build());

            // Increment the button press count:
            count++;
        }
        private void Btntaketest_Click(object sender, EventArgs e)
        {
            Bundle args = new Bundle();

            args.PutInt("EvalID", msg_dto.evaluation_dto.Id);
            Vm.EvalId = msg_dto.evaluation_dto.Id;
            //Vm.OpenTakeEvaluationCommand.Execute(null);
            var newmsg = new msg_TakeEvaluation(msg_dto.evaluation_dto);

            try
            {
                if (this.Activity == null || this.Activity.IsFinishing)
                {
                    return;
                }
                if (this.ChildFragmentManager == null)
                {
                    return;
                }

                TakeEvaluationFragment frg = new TakeEvaluationFragment(newmsg);

                var ft2      = ChildFragmentManager.BeginTransaction();
                var fragment = this.ChildFragmentManager.FindFragmentById(Resource.Id.dry_evalframelayout);
                if (fragment != null)
                {
                    ft2.Remove(fragment);
                }
                ft2.Replace(Resource.Id.dry_evalframelayout, frg);
                ft2.Commit();
                //if (this.Activity == null || this.Activity.IsFinishing) return;
                //var viewfragment = new TakeEvaluationFragment();
                //var ft = ChildFragmentManager.BeginTransaction();
                //ft.Replace(Resource.Id.dry_evalframelayout, viewfragment);
                //ft.Commit();
            }
            catch (Exception ex)
            {
            }
        }
Пример #39
0
        void CreateLocalNotification()
        {
            int count = 1;

            // Pass the current button press count value to the next activity:
            var valuesForActivity = new Bundle();

            valuesForActivity.PutInt(COUNT_KEY, count);

            // When the user clicks the notification, MainActivity will start up.
            var resultIntent = new Intent(this, typeof(MainActivity));

            // Pass some values to MainActivity:
            //resultIntent.PutExtras(valuesForActivity);

            // Construct a back stack for cross-task navigation:
            var stackBuilder = Android.Support.V4.App.TaskStackBuilder.Create(this);

            stackBuilder.AddParentStack(Java.Lang.Class.FromType(typeof(MainActivity)));
            stackBuilder.AddNextIntent(resultIntent);

            //// Create the PendingIntent with the back stack:
            var resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent);

            // Build the notification:
            var builder = new NotificationCompat.Builder(this, CHANNEL_ID)
                          .SetAutoCancel(true)                             // Dismiss the notification from the notification area when the user clicks on it
                          .SetContentIntent(resultPendingIntent)           // Start up this activity when the user clicks the intent.
                          .SetContentTitle("JustDrive")                    // Set the title
                          .SetNumber(count)                                // Display the count in the Content Info
                          .SetSmallIcon(Resource.Drawable.notification_bg) // This is the icon to display
                          .SetContentText($"Battery is low, charge it");   // the message to display.

            // Finally, publish the notification:
            var notificationManager = NotificationManagerCompat.From(this);

            notificationManager.Notify(NOTIFICATION_ID, builder.Build());

            count++;
        }
 /// <summary>
 /// Callback method from <seealso cref="ItemListFragment.Callbacks"/> indicating that
 /// the item with the given ID was selected.
 /// </summary>
 public void OnItemSelected(int id)
 {
     if (mTwoPane)
     {
         // In two-pane mode, show the detail view in this activity by
         // adding or replacing the detail fragment using a
         // fragment transaction.
         Bundle arguments = new Bundle();
         arguments.PutInt(ItemDetailFragment.ARG_ITEM_ID, id);
         ItemDetailFragment fragment = new ItemDetailFragment();
         fragment.Arguments = arguments;
         SupportFragmentManager.BeginTransaction().Replace(Resource.Id.item_detail_container, fragment).Commit();
     }
     else
     {
         // In single-pane mode, simply start the detail activity
         // for the selected item ID.
         Intent detailIntent = new Intent(this, typeof(ItemDetailActivity));
         detailIntent.PutExtra(ItemDetailFragment.ARG_ITEM_ID, id);
         StartActivity(detailIntent);
     }
 }
        protected override void OnSaveInstanceState(Bundle outState)
        {
            if (!string.IsNullOrEmpty(imageurl))
            {
                outState.PutString("pathImagen1", imageurl);
            }

            if (!string.IsNullOrEmpty(imageurlId))
            {
                outState.PutString("pathImagen1Id", imageurlId);
            }

            if (!string.IsNullOrEmpty(lblInfoFoto.Text))
            {
                outState.PutString("lblDetalle", lblInfoFoto.Text);
            }

            outState.PutInt("contador", Contador);


            base.OnSaveInstanceState(outState);
        }
Пример #42
0
        private void Listacategoria_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            int id = list[e.Position].Id;

            Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder((Activity)rootView.Context)
                                                    .SetTitle("Opciones")
                                                    .SetIcon(Android.Resource.Drawable.IcDialogInfo)
                                                    .SetMessage("¿Desea ver los libros de esta categoría?")
                                                    .SetNegativeButton("No", (IDialogInterfaceOnClickListener)null)
                                                    .SetPositiveButton("Si", delegate
            {
                //Llamar al fragment de los libros por categoria y le paso el parametro de la categoria
                Bundle bundle = new Bundle();
                bundle.PutInt("IdCategory", id);

                Fragment fragment  = new FragmentBooksByCategory();
                fragment.Arguments = bundle;
                FragmentManager.BeginTransaction().
                Replace(Resource.Id.content_frame, fragment).Commit();
            });
            alert.Create().Show();
        }
Пример #43
0
        public LinearLayout getRecordsLayout(IGrouping <String, AnxityRecords> anx)
        {
            LinearLayout s1Layout = new LinearLayout(Context);

            s1Layout.Orientation = Orientation.Vertical;
            LinearLayout.LayoutParams s1LayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            s1Layout.LayoutParameters = s1LayoutParams;
            foreach (var x in anx)
            {
                RelativeLayout layout_4 = new RelativeLayout(Context);
                RelativeLayout.LayoutParams layout_4_params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                layout_4.Click += delegate {
                    var    fragment = new Single_RecordAnx();
                    Bundle args     = new Bundle();
                    args.PutInt("recordId", x._id);
                    fragment.Arguments = args;
                    var trans = Activity.SupportFragmentManager.BeginTransaction();
                    trans.Replace(Resource.Id.fragmentContent, fragment, "MenuFragment");
                    trans.Commit();;

                    //Android.App.AlertDialog cat = new Android.App.AlertDialog.Builder(Activity).Create();
                    ////cat.SetMessage("Location : " + formLocation + " || Date :" + formDate + " || Note : " + formNote);
                    //cat.SetMessage("Location");

                    //cat.SetTitle("Did it boy,her's the record's _id : " + x._id);
                    //cat.SetButton("OK", delegate { });
                    //cat.Show();
                };
                layout_4.SetPadding(30, 30, 30, 30);
                layout_4.LayoutParameters = layout_4_params;
                Log.Info("Xamarin", "Count" + anx.Count());
                TextView s1Text = new TextView(Activity);
                s1Text.Text     = "Location: " + x._id;
                s1Text.TextSize = 10;
                layout_4.AddView(s1Text);
                s1Layout.AddView(layout_4);
            }
            return(s1Layout);
        }
Пример #44
0
        // Handler for button click events.
        private void ButtonOnClick(object sender, EventArgs eventArgs)
        {
            // Pass the current button press count value to the next activity:
            Bundle valuesForActivity = new Bundle();

            valuesForActivity.PutInt("count", count);

            // When the user clicks the notification, SecondActivity will start up.
            Intent resultIntent = new Intent(this, typeof(SecondActivity));

            // Pass some values to SecondActivity:
            resultIntent.PutExtras(valuesForActivity);

            // Construct a back stack for cross-task navigation:
            TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this);

            stackBuilder.AddParentStack(Class.FromType(typeof(SecondActivity)));
            stackBuilder.AddNextIntent(resultIntent);

            // Create the PendingIntent with the back stack:
            PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent);

            // Build the notification:
            NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
                                                 .SetAutoCancel(true)                                                             // Dismiss the notification from the notification area when the user clicks on it
                                                 .SetContentIntent(resultPendingIntent)                                           // Start up this activity when the user clicks the intent.
                                                 .SetContentTitle("Button Clicked")                                               // Set the title
                                                 .SetNumber(count)                                                                // Display the count in the Content Info
                                                 .SetSmallIcon(Resource.Drawable.ic_stat_button_click)                            // This is the icon to display
                                                 .SetContentText(String.Format("The button has been clicked {0} times.", count)); // the message to display.

            // Finally, publish the notification:
            NotificationManager notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);

            notificationManager.Notify(ButtonClickNotificationId, builder.Build());

            // Increment the button press count:
            count++;
        }
Пример #45
0
        public BaseDialogFragment Create()
        {
            Bundle args = PrepareArguments();

            BaseDialogFragment fragment = (BaseDialogFragment)Fragment.Instantiate(mContext, mClass.Name, args);

            args.PutBoolean(ARG_CANCELABLE_ON_TOUCH_OUTSIDE, mCancelableOnTouchOutside);

            args.PutBoolean(ARG_USE_DARK_THEME, mUseDarkTheme);

            if (mTargetFragment != null)
            {
                fragment.SetTargetFragment(mTargetFragment, mRequestCode);
            }
            else
            {
                args.PutInt(ARG_REQUEST_CODE, mRequestCode);
            }
            fragment.Cancelable = mCancelable;

            return(fragment);
        }
Пример #46
0
 /// <summary>
 /// Dump game state to the provided Bundle. Typically called when the
 /// Activity is being suspended.
 /// </summary>
 /// <returns> Bundle with this view's state </returns>
 public Bundle SaveState(Bundle map)
 {
     lock (mSurfaceHolder)
     {
         if (map != null)
         {
             map.PutInt(KEY_DIFFICULTY, Convert.ToInt32(mDifficulty));
             map.PutDouble(KEY_X, Convert.ToDouble(mX));
             map.PutDouble(KEY_Y, Convert.ToDouble(mY));
             map.PutDouble(KEY_DX, Convert.ToDouble(mDX));
             map.PutDouble(KEY_DY, Convert.ToDouble(mDY));
             map.PutDouble(KEY_HEADING, Convert.ToDouble(mHeading));
             map.PutInt(KEY_LANDER_WIDTH, Convert.ToInt32(mLanderWidth));
             map.PutInt(KEY_LANDER_HEIGHT, Convert.ToInt32(mLanderHeight));
             map.PutInt(KEY_GOAL_X, Convert.ToInt32(mGoalX));
             map.PutInt(KEY_GOAL_SPEED, Convert.ToInt32(mGoalSpeed));
             map.PutInt(KEY_GOAL_ANGLE, Convert.ToInt32(mGoalAngle));
             map.PutInt(KEY_GOAL_WIDTH, Convert.ToInt32(mGoalWidth));
             map.PutInt(KEY_WINS, Convert.ToInt32(mWinsInARow));
             map.PutDouble(KEY_FUEL, Convert.ToDouble(mFuel));
         }
     }
     return(map);
 }
Пример #47
0
 public override void Run()
 {
     try
     {
         ISharedPreferences mSharedPreference = context.GetSharedPreferences(Constant.Com_Fra, FileCreationMode.WorldWriteable);
         IEnvManagerSvr     newinfo           = RometeClientManager.GetClient(PsPropertiesUtil.GetProperties(context, "loadinfoUrl"), typeof(IEnvManagerSvr), 60000) as IEnvManagerSvr;
         AppEnvironment     appenvironment    = newinfo.GetUserEnv(mSharedPreference.GetString(Constant.PS_UTAG, ""), 0);
         Message            msg    = context.mainhandler.ObtainMessage();
         Bundle             bundle = new Bundle();
         bundle.PutString("HeaderURL", appenvironment.MainPage.HeadUrl);
         bundle.PutInt("HeaderHeight", appenvironment.MainPage.HeadHeight);
         bundle.PutString("LoadImg", appenvironment.SplashImg);
         ObjList  list       = appenvironment.MainPage.FuncDefs;
         string[] funsname   = new string[list.Count];
         string[] funurl     = new string[list.Count];
         string[] funiconurl = new string[list.Count];
         string[] funsbdnurl = new string[list.Count];
         for (int i = 0; i < list.Count; i++)
         {
             funsname[i]   = (list[i] as FuncEntry).Title;
             funurl[i]     = (list[i] as FuncEntry).Url;
             funiconurl[i] = (list[i] as FuncEntry).IconUrl;
             funsbdnurl[i] = (list[i] as FuncEntry).StateUrl;
         }
         bundle.PutStringArray("funsname", funsname);
         bundle.PutStringArray("funsurl", funurl);
         bundle.PutStringArray("funsiconurl", funiconurl);
         bundle.PutStringArray("funsbdnurl", funsbdnurl);
         msg.Data   = bundle;
         msg.What   = 1;
         msg.Target = context.mainhandler;
         msg.SendToTarget();
     }
     catch (System.Exception e)
     {
         throw;
     }
 }
Пример #48
0
        //@TargetApi(Build.VERSION_CODES.HONEYCOMB)
        public override void SetBadge(int badgeNumber)
        {
            if (badgeNumber < -1)
            {
                return;
            }

            if (badgeNumber == 0)
            {
                badgeNumber = -1;
            }

            try
            {
                var intent = new Intent("com.oppo.unsettledevent");
                intent.PutExtra("packageName", GetPackageName());
                intent.PutExtra("number", badgeNumber);
                intent.PutExtra("upgradeNumber", badgeNumber);
                mContext.SendBroadcast(intent);
            }
            catch (System.Exception ex)
            {
                int version = GetSupportVersion();
                if (version == 6)
                {
                    try
                    {
                        var extras = new Bundle();
                        extras.PutInt("app_badge_count", badgeNumber);
                        mContext.ContentResolver.Call(Android.Net.Uri.Parse("content://com.android.badge/badge"), "setAppBadgeCount", null, extras);
                    }
                    catch (Throwable th)
                    {
                        System.Console.WriteLine("(OPPO) unable to set badge: " + th.Message);
                    }
                }
            }
        }
Пример #49
0
        private void PackBundleForTOD()
        {
            Intent i = new Intent(this, typeof(TransportOrderDetails));
            Bundle b = new Bundle();

            b.PutInt("trid", trId);
            b.PutInt("leid", leId);
            b.PutString("lenum", leNummer);
            b.PutString("letyp", leTyp);
            b.PutString("sourceBin", sourceBin);
            b.PutString("targetBin", targetBin);
            b.PutInt("priority", priority);
            b.PutInt("transportAidId", transportAidID);
            b.PutString("from", from);
            b.PutInt("shipmentId", shipmentID);
            b.PutInt("places", places);
            b.PutInt("digitsToCutFromTargetBin", digitsToCutFromTargetBin);
            i.PutExtra("b", b);

            StartActivity(i);
        }
        private void RegistrationByFallbackCompleted(CustomerRegistrationCompletedEventArgs e)
        {
            string posButtonTxt = this.WizardActivity.GetString(Resource.String.add_new_customer);

            this._registrationFinishedOverlay = new RegistrationFinishedFragment();
            string message =
                string.Format(this.WizardActivity.GetString(Resource.String.unified_sms_registration_failed_n_tries), 3);
            Bundle arguments = new Bundle();

            arguments.PutBoolean(RegistrationFinishedFragment.WasRegistrationKey, true);
            arguments.PutBoolean(RegistrationFinishedFragment.SuccessKey, e.Succeeded);
            arguments.PutString(RegistrationFinishedFragment.MessageKey, message);
            arguments.PutString(RegistrationFinishedFragment.BtnPositiveKey, posButtonTxt);
            arguments.PutString(RegistrationFinishedFragment.BtnNegativeKey, this.OverlayNegativeButtonText);
            arguments.PutString(RegistrationFinishedFragment.IntentStartPointKey,
                                this.ActivityBase.StartPointIntent.ToString());
            int maxFallbackTries = Settings.Instance.MaxFallbackRetries;

            arguments.PutInt(RegistrationFinishedFragment.Retries, maxFallbackTries);
            this._registrationFinishedOverlay.Arguments = arguments;

            this.WizardActivity.ShowOverlay(this._registrationFinishedOverlay, true);
        }
Пример #51
0
 protected override void OnItemClick(object sender, int position)
 {
     try
     {
         base.OnItemClick(sender, position);
         var    movie  = (sender as MoviesAdapter).movies[position];
         Intent intent = new Intent(this.Context, typeof(MovieInfoActivity));
         Bundle b      = new Bundle();
         b.PutInt("movieId", movie.Id);
         b.PutString("movieName", movie.Title);
         b.PutString("movieReleaseDate", movie.ReleaseDate.HasValue ? movie.ReleaseDate.ToString() : null);
         b.PutString("movieLanguage", movie.OriginalLanguage);
         var backdrop = movie.BackdropPath;
         b.PutString("imageUrl", !string.IsNullOrWhiteSpace(backdrop) ? backdrop : movie.PosterPath);
         intent.PutExtras(b);
         StartActivity(intent);
         Activity.OverridePendingTransition(Resource.Animation.@Side_in_right, Resource.Animation.@Side_out_left);
     }
     catch (Exception ex)
     {
         Toast.MakeText(Context, ex.ToString(), ToastLength.Long).Show();
     }
 }
Пример #52
0
        private void OnMenuClick(object sender, int position)
        {
            var category = _categorySource.Get(position);

            if (category == null)
            {
                return;
            }

            var bundle = new Bundle();

            bundle.PutInt("position", position);
            bundle.PutBoolean("isDefault", _preferences.DefaultCategory == category.Id);

            var fragment = new EditCategoryMenuBottomSheet {
                Arguments = bundle
            };

            fragment.ClickRename     += OnRenameClick;
            fragment.ClickSetDefault += OnSetDefaultClick;
            fragment.ClickDelete     += OnDeleteClick;
            fragment.Show(SupportFragmentManager, fragment.Tag);
        }
Пример #53
0
        private void OnAddClick(object sender, EventArgs e)
        {
            var transaction = SupportFragmentManager.BeginTransaction();
            var old         = SupportFragmentManager.FindFragmentByTag("add_dialog");

            if (old != null)
            {
                transaction.Remove(old);
            }

            transaction.AddToBackStack(null);

            var bundle = new Bundle();

            bundle.PutInt("mode", (int)EditCategoryBottomSheet.Mode.New);

            var dialog = new EditCategoryBottomSheet {
                Arguments = bundle
            };

            dialog.Submit += OnAddDialogSubmit;
            dialog.Show(transaction, "add_dialog");
        }
Пример #54
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.fragment_terms, container, false);

            list = view.FindViewById <ListView>(Resource.Id.lvCustomList);
            var termsConditonAdapter = new TermsConditionAdapter(mainActivity, web);

            list.Adapter = termsConditonAdapter;
            // adapter = new TermsConditonAdapter(this, web);
            // list.SetAdapter(adapter);
            list.ItemClick += (o, e) =>
            {
                FragmentTransaction          transcation1      = FragmentManager.BeginTransaction();
                src.Fragments.Terms2Fragment promotionFragment = new src.Fragments.Terms2Fragment(mainActivity, e.Position);
                transcation1.Replace(Resource.Id.container, promotionFragment, "Terms2");
                transcation1.AddToBackStack("Terms2");
                Bundle bundle = new Bundle();
                bundle.PutInt("position", e.Position);
                transcation1.Commit();
            };
            return(view);
        }
Пример #55
0
        private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            Bundle bundle = new Bundle();
            FragmentTransaction fragTrans;

            fragTrans = FragmentManager.BeginTransaction();
            bundle.PutInt("idmember", listItem[e.Position].Id);
            if (sourcebtn.Equals("Apply"))
            {
                LoanFragment loan = new LoanFragment();
                loan.Arguments = bundle;
                fragTrans.Replace(Resource.Id.fragment_container, loan, "");
            }
            else if (sourcebtn.Equals("Pay"))
            {
                PaymentFragment pay = new PaymentFragment();
                pay.Arguments = bundle;
                fragTrans.Replace(Resource.Id.fragment_container, pay, "");
            }

            fragTrans.AddToBackStack(null);
            fragTrans.Commit();
        }
Пример #56
0
        public async void StartBackgroundTask(BackgroundTaskType backgroundTask, BackgroundTaskParameter parameter)
        {
            switch (backgroundTask)
            {
            case BackgroundTaskType.SYNC:
                await Task.Delay(10);

                var    top    = Mvx.IoCProvider.Resolve <IMvxAndroidCurrentTopActivity>();
                Bundle bundle = null;
                if (parameter != null)
                {
                    bundle = new Bundle();
                    bundle.PutInt(SyncBackgroundService.TaskListIdToSyncKey, parameter.SyncOnlyTaskListId);
                }
                top.Activity.StartForegroundServiceCompat <SyncBackgroundService>(bundle);
                break;

            case BackgroundTaskType.ANY:
            case BackgroundTaskType.MARK_AS_COMPLETED:
            default:
                throw new NotSupportedException("The bg task is not supported");
            }
        }
        private void AddSearchFragment()
        {
            if (mSearchFragment != null)
            {
                return;
            }
            var      ft             = SupportFragmentManager.BeginTransaction();
            Fragment searchFragment = new LocationSearchFragment()
            {
                UserVisibleHint = false
            };

            // Add AppWidgetId to fragment args
            if (mAppWidgetId != AppWidgetManager.InvalidAppwidgetId)
            {
                Bundle args = new Bundle();
                args.PutInt(AppWidgetManager.ExtraAppwidgetId, mAppWidgetId);
                searchFragment.Arguments = args;
            }

            ft.Add(Resource.Id.search_fragment_container, searchFragment);
            ft.CommitAllowingStateLoss();
        }
Пример #58
0
        protected override void OnNewIntent(Intent intent)
        {
            base.OnNewIntent(intent);

            string notification = intent.GetStringExtra("notification");

            if (notification == "measurement")
            {
                Bundle bundle = new Bundle();
                bundle.PutInt("id", intent.GetIntExtra("id", 0));
                bundle.PutInt("type", intent.GetIntExtra("type", 0));
                addMeasurementFragment.Arguments = bundle;
                ReplaceFragment(addMeasurementFragment);
            }
            else if (notification == "visit" || notification == "medicine")
            {
                EventFromNotificationFragment eventFragment = new EventFromNotificationFragment();
                Bundle bundle = new Bundle();
                bundle.PutInt("id", intent.GetIntExtra("id", 0));
                eventFragment.Arguments = bundle;
                ReplaceFragment(eventFragment);
            }
        }
        protected override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);
            // save data from TableLayout
            string[] temp       = new string[36];
            int[]    tempColors = new int[36];
            for (int d = 35; d >= 0; d--)
            {
                temp[d] = textViewArray[d].Text;
                Android.Graphics.Drawables.ColorDrawable backgroundColor = textViewArray[d].Background as Android.Graphics.Drawables.ColorDrawable;
                if (backgroundColor != null)
                {
                    int colorCode = backgroundColor.Color.ToArgb();
                    tempColors[d] = colorCode;
                }
            }
            // save selected sorting method button id
            int radioId = selectedSorting;

            outState.PutStringArray("savedArray", temp);
            outState.PutIntArray("savedColors", tempColors);
            outState.PutInt("savedSorting", radioId);
        }
        void NotificationMessage(object sender, EventArgs e)
        {
            // These are the values that we want to pass to the next activity
            Bundle valuesForActivity = new Bundle();

            valuesForActivity.PutInt("count", _count);

            // Create the PendingIntent with the back stack
            // When the user clicks the notification, SecondActivity will start up.
            Intent resultIntent = new Intent(this, typeof(TTTAsyncAwaitLoadImgNotedActivity));

            resultIntent.PutExtras(valuesForActivity); // Pass some values to SecondActivity.
            TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this);

            stackBuilder.AddParentStack(Class.FromType(typeof(TTTAsyncAwaitLoadImgNotedActivity)));
            stackBuilder.AddNextIntent(resultIntent);

            PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent(0, PendingIntentFlags.CancelCurrent);

            // Build the notification
            var builder = new Notification.Builder(this)
                          .SetAutoCancel(true)                                            // dismiss the notification from the notification area when the user clicks on it
                          .SetContentIntent(resultPendingIntent)                          // start up this activity when the user clicks the intent.
                          .SetContentTitle("点击按钮")                                        // Set the title
                                                                                          //.SetNumber(_count) // Display the count in the Content Info
                          .SetSmallIcon(Resource.Drawable.ic_addbtn)                      // This is the icon to display NECESSARY
                          .SetContentText(string.Format("你已经点击 {0} 次,多次点击也没用.", _count)); // the message to display.

            var builder2 = new Notification.Builder(this);

            // Finally publish the notification
            NotificationManager notificationManager = (NotificationManager)GetSystemService(NotificationService);

            notificationManager.Notify(ButtonClickNotificationId, builder.Build());

            _count++;
        }