예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            game = new GameLogic();

            // Detect the orientation: landscape or portrait
            // Only the dual pane layout (landscape) has fragContainer2
            View fragContainer2 = FindViewById <View> (Resource.Id.fragContainer2);

            if (fragContainer2 != null)
            {
                isDualPane = true;
            }

            // Load the fragment used by both layouts (landscape and portrait)
            // Note: The fragment has the ID of its container
            FragmentTransaction ft = FragmentManager.BeginTransaction();
            var fragment1          = FragmentManager.FindFragmentById(Resource.Id.fragContainer1);

            if (fragment1 != null)
            {
                ft.Remove(fragment1);
            }
            var handFrag = new HandFrag();

            ft.Add(Resource.Id.fragContainer1, handFrag);
            ft.Commit();

            if (!isDualPane)
            {
                // Only the portrait layout (single pane) has a translate button
                Button translateButton = FindViewById <Button> (Resource.Id.translateButton);
                translateButton.Click += delegate(object sender, EventArgs e) {
                    var intent = new Intent();
                    intent.SetClass(this, typeof(TranslateActivity));
                    intent.PutExtra("hand_position_name", game.HandName);
                    StartActivity(intent);
                };
            }
            else
            {
                // Only add the Text fragment for landscape orientation (dual panes)
                ft = FragmentManager.BeginTransaction();
                var fragment2 = FragmentManager.FindFragmentById(Resource.Id.fragContainer2);
                if (fragment2 != null)
                {
                    ft.Remove(fragment2);
                }
                ft.Add(Resource.Id.fragContainer2, new TextFrag());
                ft.Commit();
            }
        }
예제 #2
0
        public override void DestroyItem(ViewGroup container, int position, Object objectValue)
        {
            var fragment = (Fragment)objectValue;

            if (_curTransaction == null)
            {
                _curTransaction = _fragmentManager.BeginTransaction();
            }

#if DEBUG
            Mvx.Trace("Removing item #" + position + ": f=" + objectValue + " v=" + ((Fragment)objectValue).View +
                      " t=" + fragment.Tag);
#endif

            while (_savedState.Count <= position)
            {
                _savedState.Add(null);
                _savedFragmentTags.Add(null);
            }

            _savedState[position]        = _fragmentManager.SaveFragmentInstanceState(fragment);
            _savedFragmentTags[position] = fragment.Tag;
            _fragments[position]         = null;

            _curTransaction.Remove(fragment);
        }
예제 #3
0
        /// <summary>
        /// Shows the specified Alert within the applciation.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="body">The body.</param>
        /// <param name="content">The content.</param>
        /// <param name="buttons">The buttons.</param>
        /// <returns></returns>
        public async Task Show(string title, string body, View content, List <AlertButton> buttons)
        {
            var tcs = new TaskCompletionSource <object>();
            var adf = new AlertDialogFragment
            {
                Title   = title,
                Body    = body,
                Content = content,
                Buttons = buttons,
                tsc     = tcs
            };

            var FragmentManager    = ((Activity)Forms.Context).FragmentManager;
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            //Remove fragment else it will crash as it is already added to backstack
            Fragment prev = FragmentManager.FindFragmentByTag("alert");

            if (prev != null)
            {
                ft.Remove(prev);
            }

            ft.AddToBackStack(null);
            adf.Cancelable = false;
            adf.Show(ft, "alert");

            Log.Debug("TSC", tcs.Task.Status.ToString());

            await tcs.Task;
        }
예제 #4
0
        private void Fab_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, $"{nameof(Fab_Click)} - try to show ReportFragment like dialog - START");

            // DialogFragment.show() will take care of adding the fragment
            // in a transaction.  We also want to remove any currently showing
            // dialog, so make our own transaction and take care of that here.
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);


            // Create and show the dialog.
            DialogFragment newFragment = ReportFragment.NewInstance(null, delegate()
            {
                var r = LoadData();

                this.Activity.RunOnUiThread(() =>
                {
                    InitLayout(true, false);
                });
            });

            newFragment.Show(ft, "dialog");

            Log.Debug(TAG, $"{nameof(Fab_Click)} - try to show ReportFragment like dialog - END");
        }
        private void OnSingleButtonFragmentClick(Object sender, EventArgs e)
        {
            SingleButtonFragment singleButtonFragment = this.FragmentManager.FindFragmentByTag("button_fragment") as SingleButtonFragment;
            SudokuView           sudokuView           = this.View.FindViewById <SudokuView>(Resource.Id.sudoku_view);
            String addText    = this.Resources.GetString(Resource.String.add_button_text);
            String removeText = this.Resources.GetString(Resource.String.remove_button_text);
            String playText   = this.Resources.GetString(Resource.String.play_button_text);

            if (singleButtonFragment.Text == addText)
            {
                SudokuGenerator.AddNumbers(this.ViewModel.Sudoku);
                sudokuView.Update();
                this.ViewModel.ButtonText = singleButtonFragment.Text = removeText;
            }

            else if (singleButtonFragment.Text == removeText)
            {
                SudokuGenerator.RemoveNumbers(this.ViewModel.Sudoku);
                sudokuView.Update();
                this.ViewModel.ButtonText = singleButtonFragment.Text = playText;
            }

            else if (singleButtonFragment.Text == playText)
            {
                this.Stop();
                FragmentTransaction ft = this.FragmentManager.BeginTransaction();
                ft.Remove(singleButtonFragment);
                ft.Commit();
                this.Activity.Intent.PutExtra("action", (int)ActionType.Play);
                this.Activity.Intent.Extras.PutInt("action", (int)ActionType.Play);
                ActionType action = (ActionType)this.Activity.Intent.Extras.GetInt("action", (int)ActionType.None);
                this.ViewModel.ButtonText = null;
                this.Start();
            }
        }
        public void openTimeDialog(int id, Bundle bundle)
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();
            //Remove fragment else it will crash as it is already added to backstack
            Fragment prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }

            ft.AddToBackStack("time-dialog");
            // Create and show the dialog.


            //Add fragment

            Bundle taskdata = new Bundle();

            taskdata.PutInt("id", 3);
            taskdata.PutInt("hour", 3);
            taskdata.PutInt("minute", 7);
            Console.WriteLine("Opening new time dialog!");
            ReminderTimeDialog timeDialog = ReminderTimeDialog.NewInstance(taskdata);

            timeDialog.Arguments = taskdata;
            timeDialog.SetStyle(DialogFragmentStyle.NoTitle, 0);  //TODO: Create own theme and style
            timeDialog.Show(ft, "dialog");
            //ft.Commit();//added by winffee
        }
예제 #7
0
        private void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            Log.Debug(TAG, nameof(OnListItemClick));

            var item = listData.ElementAt(e.Position);
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);

            Log.Debug(TAG, $"{nameof(OnListItemClick)} - try to show ReportFragment like dialog - START");
            // Create and show the dialog.
            DialogFragment newFragment = ReportFragment.NewInstance(item.IncludeObjects(db), delegate()
            {
                var r = LoadData(((JavaLangObjectWrapper <DateTime>)dateFrom_button.Tag).Value, ((JavaLangObjectWrapper <DateTime>)dateTo_button.Tag).Value, costs_checkBox.Checked, earnings_checkBox.Checked);//.Result;
            });


            newFragment.Show(ft, "dialog");
            Log.Debug(TAG, $"{nameof(OnListItemClick)} - try to show ReportFragment like dialog - END");
        }
        public override void DestroyItem(ViewGroup container, int position, Java.Lang.Object objectValue)
        {
            var fragment = (Fragment)objectValue;

            if (_curTransaction == null)
            {
                _curTransaction = _fragmentManager.BeginTransaction();
            }

#if DEBUG
            MvxLog.Instance.Trace(
                $"Removing item #{position}: f={objectValue} v={((Fragment)objectValue).View} t={fragment.Tag}");
#endif

            while (_savedState.Count <= position)
            {
                _savedState.Add(null);
                _savedFragmentTags.Add(null);
            }

            _savedState[position]        = fragment.IsAdded ? _fragmentManager.SaveFragmentInstanceState(fragment) : null;
            _savedFragmentTags[position] = fragment.IsAdded ? fragment.Tag : null;
            _fragments[position]         = null;

            _curTransaction.Remove(fragment);
        }
예제 #9
0
        public async Task Show(string title, string body, View content, List <AlertButton> buttons)
        {
            var tcs = new TaskCompletionSource <object>();

            var adf = new AlertDialogFragment
            {
                Title   = title,
                Body    = body,
                Content = content,
                Buttons = buttons
            };
            var FragmentManager = ((Activity)Forms.Context).FragmentManager;

            FragmentTransaction ft = FragmentManager.BeginTransaction();
            //Remove fragment else it will crash as it is already added to backstack
            Fragment prev = FragmentManager.FindFragmentByTag("alert");

            if (prev != null)
            {
                ft.Remove(prev);
            }

            if (title.Contains("welkom"))
            {
                tcs.SetResult(null);
            }

            ft.AddToBackStack(null);

            adf.Show(ft, "alert");

            await tcs.Task;
        }
예제 #10
0
        private void AddRecurringPayment_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(AddRecurringPayment_button_Click));

            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);

            Log.Debug(TAG, $"{nameof(AddRecurringPayment_button_Click)} - try to show RecurringPaymentFragment like dialog - START");
            // Create and show the dialog.
            DialogFragment newFragment = RecurringPaymentFragment.NewInstance(null, delegate()
            {
                var r = LoadData();
            });

            Log.Debug(TAG, $"{nameof(AddRecurringPayment_button_Click)} - 1");

            newFragment.Show(ft, "dialog");
            Log.Debug(TAG, $"{nameof(AddRecurringPayment_button_Click)} - try to show ReportFragment like dialog - END");
        }
예제 #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            // Load the fragment used by both layouts (landscape and portrait)
            // Note: The fragment has the ID of its container
            FragmentTransaction ft        = FragmentManager.BeginTransaction();
            Fragment            helloFrag = FragmentManager.FindFragmentById(Resource.Id.fragLayout);

            if (helloFrag != null)
            {
                ft.Remove(helloFrag);
            }
            helloFrag = new HelloFrag();
            ft.Add(Resource.Id.fragLayout, helloFrag);
            ft.Commit();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++);
            };
        }
예제 #12
0
        private void SaveTrack(StopTrackingDialog s, EventArgs ea)
        {
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("TrackNameDialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);

            TrackNameDialog dialogBox = TrackNameDialog.NewInstance(null);

            dialogBox.Show(ft, "TrackNameDialog");
            dialogBox.TrackNameDialogSave += (se, e) => {
                TrackModel tm = this.Tracker.GetOrInstantiateTrackModel();
                tm.Name = e.TrackName;
                System.Console.WriteLine("____FAKETRACKGENERATIOSTRING____");
                System.Console.WriteLine(tm.Track);
                Database.Database.GetInstance().InsertOrReplace(tm);
                this.Tracker.StopTracking();
                this.UpdateStartStopPauseButton();

                Toast.MakeText(this.Context, "Uw track is opgeslagen!", ToastLength.Short).Show();
                se.Dismiss();
                s.Dismiss();
            };
        }
예제 #13
0
        public override void OnDestroy()
        {
            base.OnDestroy();
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            ft.Remove(mapFrag);
            ft.Commit();
        }
예제 #14
0
    public void closeTimeDialog(ReminderTimeDialog dialog)
    {
        FragmentTransaction ft = FragmentManager.BeginTransaction();

        ft.Remove(dialog);
        ft.AddToBackStack("close-time");
        dialog.Dismiss();
        dateDialog.Dismiss();    // dismiss the date dialog after the time dialog;
    }
예제 #15
0
        public void removeFragment(Fragment myFrag, FragmentManager fragmentManager)
        {
            FragmentTransaction transaction = fragmentManager.BeginTransaction();

            transaction.SetCustomAnimations(Resource.Animator.slide_from_out_bottom, Resource.Animator.slide_in_bottom);
            transaction.Remove(myFrag);
            transaction.Commit();
            fragmentManager.PopBackStack();
        }
        protected virtual void PopChildFragment(FragmentManager fragmentManager, FragmentTransaction fragmentTransaction, string fragmentName)
        {
            var oldFragment = fragmentManager.FindFragmentByTag(fragmentName);

            if (oldFragment != null)
            {
                fragmentTransaction.Remove(oldFragment);
            }
        }
        public void closeDateDialog(ReminderDateDialog dialog)
        {
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            ft.Remove(dialog);

            ft.AddToBackStack("close-time");
            //ft.Commit();
            dateDialog = dialog;
            //Also tried i.e. dialog.Dismiss(); here
        }
예제 #18
0
        protected FragmentTransaction ClearPreviousFragments(string tag)
        {
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag(tag);

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);
            return(ft);
        }
예제 #19
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var courseHoleByNumberList = JsonConvert.DeserializeObject <Tasky.CourseHoleByNumberList>(Arguments.GetString("holesByNumber"));

            View view = inflater.Inflate(Resource.Layout.HoleDetailsFragment_Layout2, container, false);

            Context context = Android.App.Application.Context;

            List <CourseTeeHole> chList = new List <CourseTeeHole>();
            var zzz = HoleManager.GetCourseHolesByHole(CourseID).CourseHoleDataLists.Where(x => x.HoleNumber == courseHoleByNumberList.HoleNumber).FirstOrDefault().CourseHoles;

            foreach (var courseHole in courseHoleByNumberList.CourseHoles)
            {
                chList.Add(courseHole);
            }

            _listView = view.FindViewById <ListView>(Resource.Id.HoleDetails_ListView);
            //_listView.Adapter = new HoleDetails_GridView_HoleInfo_Adapter(this, chList);
            _listView.Adapter = new HoleDetails_GridView_HoleInfo_Adapter(this, zzz);

            _listView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs e)
            {
                var   selected = courseHoleByNumberList.CourseHoles[e.Position];
                Toast toast    = Toast.MakeText(this.Context, "Item click " + selected.TeeName.ToString()
                                                + " hn " + selected.HoleNumber
                                                + " ctID " + selected.CourseTeeID, Android.Widget.ToastLength.Short);
                toast.Show();
            };

            _listView.ItemLongClick += delegate(object sender, AdapterView.ItemLongClickEventArgs e)
            {
                var selected = courseHoleByNumberList.CourseHoles[e.Position];     //list[e.Position];

                currentHoleNumber = courseHoleByNumberList.HoleNumber;
                FragmentTransaction ft = FragmentManager.BeginTransaction();
                //Remove fragment else it will crash as it is already added to backstack
                Fragment prev = FragmentManager.FindFragmentByTag("dialog");
                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);
                // Create and show the dialog.
                HoleDetails_DialogFragment newFragment = HoleDetails_DialogFragment.NewInstance(null, selected.CourseTeeID, currentHoleNumber, selected.ActualYardage, selected.Par);           //(null);
                newFragment.Dismissed += NewFragment_Dismissed;                                                                                                                                 //Add fragment
                newFragment.Show(ft, "dialog");
            };



            return(view);
        }
예제 #20
0
        private void HideAllFragment(FragmentTransaction fTransaction)
        {
            if (fgSysIntegrity != null)
            {
                fTransaction.Remove(fgSysIntegrity); fgSysIntegrity = null;
            }

            if (fgUrlCheck != null)
            {
                fTransaction.Remove(fgUrlCheck); fgUrlCheck = null;
            }

            if (fgAppsCheck != null)
            {
                fTransaction.Remove(fgAppsCheck); fgAppsCheck = null;
            }

            if (fgOthers != null)
            {
                fTransaction.Remove(fgOthers); fgOthers = null;
            }
        }
예제 #21
0
        public void Dismiss()
        {
            if (mDismissed)
            {
                return;
            }
            mDismissed = true;
            FragmentManager.PopBackStack();
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            ft.Remove(this);
            ft.Commit();
        }
예제 #22
0
        public SlideDateTimePicker(FragmentManager fm)
        {
            FragmentTransaction ft   = fm.BeginTransaction();
            Fragment            prev = fm.FindFragmentByTag(SlideDateTimeDialogFragment.TAG_SLIDE_DATE_TIME_DIALOG_FRAGMENT);

            if (prev != null)
            {
                ft.Remove(prev);
                ft.Commit();
            }

            mFragmentManager = fm;
        }
예제 #23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.FrontActivity);

            // see if a dual-pane layout is loaded
            bool isDualPane = (FindViewById(Resource.Id.backFragment) != null);

            // Load the front fragment
            Fragment            frontFrag = FragmentManager.FindFragmentById(Resource.Id.frontFragment);
            FragmentTransaction ft        = FragmentManager.BeginTransaction();

            // Is there a fragment in the frame layout?
            if (frontFrag != null)
            {
                ft.Remove(frontFrag);
            }
            frontFrag = new FrontFragment(isDualPane);
            ft.Add(Resource.Id.frontFragment, frontFrag);
            ft.Commit();

            // Load the back fragment, if a dual-pane layout is loaded
            if (isDualPane)
            {
                var backFrag = FragmentManager.FindFragmentById(Resource.Id.backFragment);
                ft = FragmentManager.BeginTransaction();
                // Is there a fragment in the frame layout?
                if (backFrag != null)
                {
                    ft.Remove(backFrag);
                }
                backFrag = new BackFragment(isDualPane);
                ft.Add(Resource.Id.backFragment, backFrag);
                ft.Commit();
            }
        }
예제 #24
0
        private void Adapter_ClickedObject(object sender, object e)
        {
            FragmentTransaction ft   = Activity.SupportFragmentManager.BeginTransaction();
            Fragment            prev = Activity.SupportFragmentManager.FindFragmentByTag("eventdialog");

            if (prev != null)
            {
                ft.Remove(prev);
            }

            DialogFragment dialog = EventDialogFragment.Instance(e as MatchEventModel);

            dialog.Show(ft, "dialog");
        }
예제 #25
0
        private void ChangeUsernameButton_Click(object sender, EventArgs e)
        {
            FragmentTransaction ft   = FragmentManager.BeginTransaction();
            Fragment            prev = FragmentManager.FindFragmentByTag("Promena Username");

            if (prev != null)
            {
                ft.Remove(prev);
            }
            ft.AddToBackStack(null);
            ChangeUsernameDialog newFragment = new ChangeUsernameDialog();

            newFragment.Show(ft, "Promena Username");
        }
        /**
         * Creates a new instance of {@code SlideDateTimePicker}.
         *
         * @param fm  The {@code FragmentManager} from the calling activity that is used
         *            internally to show the {@code DialogFragment}.
         */
        public SlideDateTimePicker(FragmentManager fm)
        {
            // See if there are any DialogFragments from the FragmentManager
            FragmentTransaction fragmentTransaction = fm.BeginTransaction();
            Fragment            fragment            = fm.FindFragmentByTag(SlideDateTimeDialogFragment._tagSlideDateTimeDialogFragment);

            // Remove if found
            if (fragment != null)
            {
                fragmentTransaction.Remove(fragment);
                fragmentTransaction.Commit();
            }

            _fragmentManager = fm;
        }
예제 #27
0
        private void OnListItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            Log.Debug(TAG, nameof(OnListItemLongClick));

            var item = listData.ElementAt(e.Position);

            Android.App.AlertDialog.Builder builder = new Android.App.AlertDialog.Builder(this.Activity);
            builder.SetMessage(item.ToString())
            .SetPositiveButton(this.Activity.Resources.GetString(Resource.String.Edit), (s, args) =>
            {
                // DialogFragment.show() will take care of adding the fragment
                // in a transaction.  We also want to remove any currently showing
                // dialog, so make our own transaction and take care of that here.
                FragmentTransaction ft = FragmentManager.BeginTransaction();
                Fragment prev          = FragmentManager.FindFragmentByTag("dialog");
                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);

                Log.Debug(TAG, $"{nameof(OnListItemLongClick)} - try to show ReportFragment like dialog - START");
                // Create and show the dialog.
                DialogFragment newFragment = ReportFragment.NewInstance(item.IncludeObjects(db), delegate()
                {
                    var r = LoadData(((JavaLangObjectWrapper <DateTime>)dateFrom_button.Tag).Value, ((JavaLangObjectWrapper <DateTime>)dateTo_button.Tag).Value, costs_checkBox.Checked, earnings_checkBox.Checked);  //.Result;
                });


                newFragment.Show(ft, "dialog");
                Log.Debug(TAG, $"{nameof(OnListItemLongClick)} - try to show ReportFragment like dialog - END");
            })
            //.SetNegativeButton("No", dialogClickListener)
            .SetNegativeButton(this.Activity.Resources.GetString(Resource.String.Delete), (s, args) =>
            {
                if (db.Delete(item).Result)
                {
                    Toast.MakeText(this.Activity, Resources.GetString(Resource.String.Deleted), ToastLength.Short).Show();

                    var r = LoadData(((JavaLangObjectWrapper <DateTime>)dateFrom_button.Tag).Value, ((JavaLangObjectWrapper <DateTime>)dateTo_button.Tag).Value, costs_checkBox.Checked, earnings_checkBox.Checked);  //.Result;
                }
                else
                {
                    Toast.MakeText(this.Activity, Resources.GetString(Resource.String.WasntDeleted), ToastLength.Short).Show();
                }
            })
            .Show();
        }
예제 #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SQLiteOpenHelper recipeBookHelper = new RecipeBookSQLHelper(this);

            db = recipeBookHelper.ReadableDatabase;

            cursor = db.Query("RECIPE", new string[] { "_id, NAME" }, null, null, null, null, null);
            CursorAdapter recipes = new SimpleCursorAdapter(this, Android.Resource.Layout.SimpleListItem1, cursor, new string[] { "NAME" }, new int[] { Android.Resource.Id.Text1 }, 0);

            ListAdapter = recipes;

            ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                Intent intent = new Intent(this, typeof(RecipeActivity));
                intent.PutExtra(RecipeActivity.EXTRA_RECIPE_NUM, e.Position);
                StartActivity(intent);
            };

            ListView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) =>
            {
                //Toast.MakeText(this, ListAdapter.GetItem(e.Position).ToString(), ToastLength.Short).Show();
                // create ingredient fragment so ingredients can be previewed

                FragmentTransaction ft   = FragmentManager.BeginTransaction();
                Fragment            prev = FragmentManager.FindFragmentByTag("dialog");

                if (prev != null)
                {
                    ft.Remove(prev);
                }
                ft.AddToBackStack(null);

                Bundle strings      = new Bundle();
                int    recipeNumber = e.Position;

                cursor = db.Query("RECIPE", new string[] { "NAME", "INGREDIENTS", "DIRECTIONS" }, "_id = ?", new string[] { (++recipeNumber).ToString() }, null, null, null);
                if (cursor.MoveToFirst())
                {
                    strings.PutString("RName", cursor.GetString(0));
                    strings.PutString("RIngredients", cursor.GetString(1));
                }

                IngredientsDialog newFragment = IngredientsDialog.NewInstance(strings);
                newFragment.Show(ft, "dialog");
            };
        }
예제 #29
0
        private bool HideAll(FragmentTransaction manager, string keepOverlay)
        {
            var found = false;

            if (keepOverlay != LoadingOverLay)
            {
                var frag = Current.FragmentManager.FindFragmentByTag(LoadingOverLay);
                if (frag != null)
                {
                    manager.Remove(frag);
                    found = true;
                }
            }

            return(found);
        }
예제 #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Translate);

            FragmentTransaction ft = FragmentManager.BeginTransaction();
            var frag = FragmentManager.FindFragmentById(Resource.Id.fragContainer);

            if (frag != null)
            {
                ft.Remove(frag);
            }
            ft.Add(Resource.Id.fragContainer, new TextFrag());
            ft.Commit();
        }
		/**
		 * Replaces the old fragment with the new one and adds the old to the backstack,
		 *if bool addToBackStack is set to true
		 **/
		public void switchFragment(string oldFragmentTag, string newFragmentTag, Fragment newFragment, bool addToBackStack) {
			menu.Opened = false;
			activeFragment = newFragmentTag;
			trans = FragmentManager.BeginTransaction();
			Fragment oldFragment = FragmentManager.FindFragmentByTag(oldFragmentTag);

			if(addToBackStack && oldFragment != null)
				trans.AddToBackStack(oldFragmentTag);

			if(oldFragment != null)
				trans.Remove(oldFragment);
			trans.Add(Resource.Id.fragmentContainer, newFragment, newFragmentTag);
			trans.Commit();
		}
예제 #32
0
			public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) 
			{
				ft.Remove (fragment);
			}