public override void Show (FragmentManager manager, string tag) { // Make sure we don't show the dialog twice var frag = manager.FindFragmentByTag (tag); if (frag != null) return; base.Show (manager, tag); }
/// <summary> /// Display a progress dialog inside of a DialogFragment. /// </summary> void ShowIndeterminateProgressDialog() { MyProgressDialog progressDialog = FragmentManager.FindFragmentByTag(PROGRESS_DIALOG_TAG) as MyProgressDialog; if (progressDialog == null) { var tx = FragmentManager.BeginTransaction(); progressDialog = new MyProgressDialog(); progressDialog.Show(tx, PROGRESS_DIALOG_TAG); } }
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); }
private bool MapIsSetup() { if (_map == null) { var fragment = FragmentManager.FindFragmentByTag("map") as MapFragment; if (fragment != null) { _map = fragment.Map; } } return(_map != null); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); frag = FragmentManager.FindFragmentByTag(customFragmentTag) as CustomFragment; if (frag == null) { frag = new CustomFragment(Resource.Layout.Frag); FragmentManager.BeginTransaction().Add(Resource.Id.container, frag, customFragmentTag).Commit(); } frag.ButtonClick += (s, e) => SetContentView(Resource.Layout.Frag); }
private void AddRoutine(object sender, EventArgs eventArgs) { if (tv.Text.Length > 0) { handler.InsertRoutine(tv.Text); Android.Support.V4.App.Fragment fragment_workout = FragmentManager.FindFragmentByTag("WORKOUT_FRAGMENT"); if (fragment_workout == null || !fragment_workout.IsVisible) { FragmentManager.BeginTransaction().Replace(Resource.Id.flContent, new EditWorkoutFragment(), "WORKOUT_FRAGMENT").Commit(); } } }
private void showErrorDialog(DialogFragment errorDialog) { DialogFragment oldErrorDialog = (DialogFragment)FragmentManager.FindFragmentByTag(TAG_ERROR_DIALOG); if (oldErrorDialog != null) { oldErrorDialog.Dismiss(); } errorDialog.Show(FragmentManager, TAG_ERROR_DIALOG); }
private void BtnRemove1_Click(object sender, EventArgs e) { var fragment = FragmentManager.FindFragmentByTag <FragmentSimple>("fragmento1"); if (fragment != null) { var transaction = FragmentManager.BeginTransaction(); transaction.Remove(fragment); transaction.AddToBackStack("remove1"); transaction.Commit(); } }
public void StartDialogFragment(Android.App.DialogFragment fragment, string tag) { var ft = FragmentManager.BeginTransaction(); var prev = FragmentManager.FindFragmentByTag(tag); if (prev != null) { ft.Remove(prev); } ft.AddToBackStack(null); fragment.Show(ft, tag); }
public override void Show(FragmentManager manager, string tag) { // Make sure we don't show the dialog twice var frag = manager.FindFragmentByTag(tag); if (frag != null) { return; } base.Show(manager, tag); }
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); }
protected virtual void PushFragment(FragmentManager fragmentManager, FragmentTransaction fragmentTransaction, MvxFragmentPresentationAttribute fragmentAttribute, MvxViewModelRequest request, IMvxViewModel viewModel, string fragmentName, string fragmentTag = null) { if (string.IsNullOrEmpty(fragmentTag)) { fragmentTag = fragmentName; } var newFragment = fragmentManager.FindFragmentByTag(fragmentTag); if (newFragment != null) { OnBeforeFragmentChanging(fragmentTransaction, newFragment, fragmentAttribute); if (newFragment.IsDetached) { if (newFragment is IMvxFragmentView mvxFragment) { mvxFragment.ViewModel = viewModel; } if (request != null) { newFragment = SaveViewModelRequestInFragmentArguments(newFragment, request); } fragmentTransaction.Attach(newFragment); OnFragmentChanging(fragmentTransaction, newFragment, fragmentAttribute); } } else if (fragmentAttribute != null) { var fragment = CreateFragment(fragmentAttribute, fragmentName); fragment.ViewModel = viewModel; Fragment fragmentView = null; if (request != null) { fragmentView = SaveViewModelRequestInFragmentArguments(fragment.ToFragment(), request); } if (fragmentView != null) { OnBeforeFragmentChanging(fragmentTransaction, fragmentView, fragmentAttribute); fragmentTransaction.Add(fragmentAttribute.FragmentContentId, fragmentView, fragmentTag); OnFragmentChanging(fragmentTransaction, fragmentView, fragmentAttribute); } } }
async void BtnSubmit_ClickAsync(object sender, EventArgs e) { if (SpnTest.GetSelectedItem() != null) { inf_userinfo fabUser = (inf_userinfo)SpnTest.GetSelectedItem().Item; string url = "https://webapps.npcc.ae/ApplicationWebServices/api/paperless/assignfabricator"; inf_assignment objAssignment = new inf_assignment(); objAssignment.iAssignmentId = _spl.iAssignmentId; objAssignment.cFabricatorUser = fabUser.cUsername; int assignRes = await npcc_services.inf_CallWebServiceAsync <int, inf_assignment>(inf_method.Post, url, objAssignment); if (assignRes == 1) { DBRepository dBRepository = new DBRepository(); _spl.cStatus = "F"; dBRepository.UpdateSpool(_spl); common_functions.DisplayToast("Task assigned successfully!!", Context); } else if (assignRes == 2) { DBRepository dBRepository = new DBRepository(); _spl.cStatus = "F"; dBRepository.UpdateSpool(_spl); _ins._lsObjs.RemoveAt(_position); _ins.NotifyItemRemoved(_position); _ins.NotifyItemRangeChanged(_position, _ins._lsObjs.Count); common_functions.DisplayToast("Task assigned successfully!!", Context); } else { common_functions.DisplayToast("Error occurred while assigning the task, contact system admin!!", Context); } Assign _exportFragment = (Assign)FragmentManager.FindFragmentByTag("Assign"); if (_exportFragment != null) { _exportFragment.Dismiss(); } } else { common_functions.DisplayToast("You have to select a user!!", Context); } }
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; }
public void AddArticleButton() { //articulosComprados.Add(articulo); //FragmentoVistaOperador frag = (FragmentoVistaOperador)FragmentManager.FindFragmentByTag("VistaOperador"); //frag.AddArticle(articulo); FragmentoTirillaDePago fragmentoTirilla = (FragmentoTirillaDePago)FragmentManager.FindFragmentByTag("TIRILLA_DE_PAGO"); if (FragmentIsShowing("TIRILLA_DE_PAGO")) { } //fragmentoTirilla.AddProductToTirilla(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); if (FragmentManager.FindFragmentByTag(FRAGTAG) == null) { FragmentTransaction transaction = FragmentManager.BeginTransaction(); var fragment = new StorageClientFragment(); transaction.Add(fragment, FRAGTAG); transaction.Commit(); } }
public static BaseFragment GetCurrentFragment(this FragmentManager fragmentManager) { if (fragmentManager.BackStackEntryCount > 0) { var entry = fragmentManager.GetBackStackEntryAt(fragmentManager.BackStackEntryCount - 1); var fragment = fragmentManager.FindFragmentByTag(entry.Name) as BaseFragment; return(fragment); } return(null); }
public void addITR(TableLayout tl) { TableRow notes = new TableRow(this.Activity); notes.Tag = "notes"; note = new EditText(this.Activity); note.Hint = "Notes"; if (DataController.note != "") { note.Text = DataController.note; } note.Gravity = GravityFlags.Center; TableRow.LayoutParams stretchRow = new TableRow.LayoutParams(); stretchRow.Span = 6; notes.AddView(note, stretchRow); tl.AddView(notes); TableRow btnRow = new TableRow(this.Activity); btnRow.Tag = "btnRow"; Button requestITR = new Button(this.Activity); requestITR.Text = "ITR"; requestITR.Click += (object sender, EventArgs e) => { if (checkNetwork()) { Android.Support.V4.App.Fragment residentsFragment = null; residentsFragment = new ResidentsFragment(); ((ResidentsFragment)residentsFragment).SetResidentUpdate(residents); ((ResidentsFragment)residentsFragment).SetNotePrev(note.Text); Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction(); ft.Add(Resource.Id.content_frame, residentsFragment, "residentsFragment"); ft.Hide(FragmentManager.FindFragmentByTag("residentsPrevFragment")); ft.AddToBackStack(null); ft.Commit(); } else { showNetworkError(); } }; btnRow.AddView(requestITR, stretchRow); tl.AddView(btnRow); }
protected virtual bool TryPerformCloseFragmentTransaction( FragmentManager fragmentManager, MvxFragmentPresentationAttribute fragmentAttribute) { if (fragmentManager.BackStackEntryCount > 0) { var fragmentName = FragmentJavaName(fragmentAttribute.ViewType); fragmentManager.PopBackStackImmediate(fragmentName, 1); return(true); } else if (fragmentManager.Fragments.Count > 0 && fragmentManager.FindFragmentByTag(fragmentAttribute.ViewType.Name) != null) { var ft = fragmentManager.BeginTransaction(); var fragment = fragmentManager.FindFragmentByTag(fragmentAttribute.ViewType.Name); if (!fragmentAttribute.EnterAnimation.Equals(int.MinValue) && !fragmentAttribute.ExitAnimation.Equals(int.MinValue)) { if (!fragmentAttribute.PopEnterAnimation.Equals(int.MinValue) && !fragmentAttribute.PopExitAnimation.Equals(int.MinValue)) { ft.SetCustomAnimations(fragmentAttribute.EnterAnimation, fragmentAttribute.ExitAnimation, fragmentAttribute.PopEnterAnimation, fragmentAttribute.PopExitAnimation); } else { ft.SetCustomAnimations(fragmentAttribute.EnterAnimation, fragmentAttribute.ExitAnimation); } } if (fragmentAttribute.TransitionStyle != int.MinValue) { ft.SetTransitionStyle(fragmentAttribute.TransitionStyle); } ft.Remove(fragment); ft.CommitAllowingStateLoss(); return(true); } return(false); }
protected override void OnCreateActivity(Bundle state) { base.OnCreateActivity(state); SetContentView(Resource.Layout.EditTimeEntryActivity); var isGrouped = Intent.Extras.GetBoolean(IsGrouped, false); var fragment = FragmentManager.FindFragmentByTag(fragmentTag); var groupedFragment = FragmentManager.FindFragmentByTag(groupfragmentTag); var guids = Intent.GetStringArrayListExtra(ExtraGroupedTimeEntriesGuids); if (guids == null) { Finish(); } if (isGrouped) { if (groupedFragment == null) { groupedFragment = EditGroupedTimeEntryFragment.NewInstance(guids); FragmentManager.BeginTransaction() .Add(Resource.Id.FrameLayout, groupedFragment, groupfragmentTag) .Commit(); } else { FragmentManager.BeginTransaction() .Attach(groupedFragment) .Commit(); } } else { if (fragment == null) { fragment = EditTimeEntryFragment.NewInstance(guids[0]); FragmentManager.BeginTransaction() .Add(Resource.Id.FrameLayout, fragment, fragmentTag) .Commit(); } else { FragmentManager.BeginTransaction() .Attach(fragment) .Commit(); } } }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (string.IsNullOrWhiteSpace(_token)) { _token = Intent.GetStringExtra("Token"); _userName = Intent.GetStringExtra("UserName"); } if (savedInstanceState != null) { _token = savedInstanceState.GetString("Token"); _userName = savedInstanceState.GetString("UserName"); } SetContentView(Resource.Layout.Lab); var textViewUserName = FindViewById <TextView>(Resource.Id.textViewUserName); var _listViewEvidence = FindViewById <ListView>(Resource.Id.listViewEvidences); List <Evidence> evidenceList; var evidenceFragment = (EvidenceFragment)FragmentManager.FindFragmentByTag("evidence"); if (evidenceFragment == null) { HackAtHome.SAL.EvidenceService evidenceService = new HackAtHome.SAL.EvidenceService(); evidenceList = await evidenceService.GetListAsync(_token); evidenceFragment = new EvidenceFragment(); evidenceFragment.EvidenceList = evidenceList; FragmentManager.BeginTransaction().Add(evidenceFragment, "evidence").Commit(); } else { evidenceList = evidenceFragment.EvidenceList; } _listViewEvidence.Adapter = new HackAtHome.CustomAdapters.EvidencesAdapter( this , Resource.Layout.LabItem , Resource.Id.textViewLabItemDescription , Resource.Id.textViewLabItemStatus , evidenceList); _listViewEvidence.ItemClick += _listViewEvidence_ItemClick; textViewUserName.Text = _userName; }
protected void hideProgressDialog() { FragmentManager manager = GetFragmentManager(); if (manager != null) { DialogFragment progressDialog = (DialogFragment)manager .FindFragmentByTag(TAG_PROGRESS_DIALOG); if (progressDialog != null) { progressDialog.Dismiss(); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); debugAlertMessage("onafter_OnCreate"); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); debugAlertMessage("onafter_SetContentView"); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); //Toolbar will now take on default actionbar characteristics SetActionBar(toolbar); if (ActionBar != null) { ActionBar.Title = "Latest"; } debugAlertMessage("onafter_SetActionBar"); nextButton = FindViewById <Button>(Resource.Id.nextButton); WebView localWebView = FindViewById <WebView>(Resource.Id.LocalWebView); localWebView.Settings.JavaScriptEnabled = true; debugAlertMessage("onafter_findLocalWebView"); nextButton.Click += delegate { navigateToNextVideo(); }; string temp = SecurityHelper.Crypt("http://bestofyoutube.com/index.php?page="); // find the retained fragment on activity restarts mRetainedFragment = (RetainedFragment)FragmentManager.FindFragmentByTag(TAG_RETAINED_FRAGMENT); if (mRetainedFragment != null) { stateData = mRetainedFragment.getData(); loadWebViewUrl(); } else { //First time startup refresh(); } debugAlertMessage("onafter_refresh"); this.Window.AddFlags(WindowManagerFlags.Fullscreen); //this.Window.ClearFlags(WindowManagerFlags.Fullscreen); //this restores the notification bar }
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"); }
/// <summary> /// Restore state for dialog. /// </summary> /// <param name="manager">Manager.</param> /// <param name="savedInstanceState">Saved instance state.</param> /// <param name="key">Key.</param> /// <param name="dialogTag">Dialog tag.</param> public void RestoreDialogStatesFromKey(FragmentManager manager, Bundle savedInstanceState, string key, string dialogTag) { RestoreStatesFromKey(savedInstanceState, key); var dialogExisting = (CaldroidFragment)manager.FindFragmentByTag(dialogTag); if (dialogExisting != null) { dialogExisting.Dismiss(); Show(manager, dialogTag); } }
private void NfcUtilsButton_OnClick(object sender, EventArgs e) { NfcUtilsFragment nfcUtilsPairFrag = (NfcUtilsFragment)FragmentManager.FindFragmentByTag(FRAGMENT_TAG_NFC_UTILS); if (nfcUtilsPairFrag == null) { nfcUtilsPairFrag = NfcUtilsFragment.NewInstance(_activity.NfcTag); } FragmentManager.BeginTransaction() .Replace(Resource.Id.main_menu_container, nfcUtilsPairFrag, FRAGMENT_TAG_NFC_UTILS) .AddToBackStack(FRAGMENT_TAG_NFC_UTILS) .Commit(); }
private void ShowGaugeDialog(GaugeDeviceSensor sensor) { var ft = FragmentManager.BeginTransaction(); var prev = FragmentManager.FindFragmentByTag("dialog"); if (prev != null) { ft.Remove(prev); } ft.AddToBackStack(null); var frag = new GaugeDeviceControlDialogFragment(sensor.device); frag.Show(ft, "dialog"); }
private void NfcPairButton_OnClick(object sender, EventArgs e) { TapAndPairFragment tapAndPairFrag = (TapAndPairFragment)FragmentManager.FindFragmentByTag(FRAGMENT_TAG_NFC_PAIR); if (tapAndPairFrag == null) { tapAndPairFrag = TapAndPairFragment.NewInstance((int)ActivityCode.NFCPairMenu); } FragmentManager.BeginTransaction() .Replace(Resource.Id.main_menu_container, tapAndPairFrag, FRAGMENT_TAG_NFC_PAIR) .AddToBackStack(FRAGMENT_TAG_NFC_PAIR) .Commit(); }
public override void OnBackPressed() { //List<Team> teams = new List<Team>(); //try //{ // teams = AWSDataAccess.GetBetTeam(0); //} //catch (Exception exp) //{ // teams.Add(new Team() // { // Name = exp.Message, // Bet = exp.Message // }); //} AddBetFragment addBetFragment = FragmentManager.FindFragmentByTag("AddBet") as AddBetFragment; if (addBetFragment != null && addBetFragment.IsVisible) { FragmentTransaction ft = FragmentManager.BeginTransaction(); ft.Replace(Resource.Id.frameLayout1, new HomeFragment()); ft.Commit(); return; } ModifyBetFragment modBetFragment = FragmentManager.FindFragmentByTag("ModifyBet") as ModifyBetFragment; if (modBetFragment != null && modBetFragment.IsVisible) { FragmentTransaction ft = FragmentManager.BeginTransaction(); ft.Replace(Resource.Id.frameLayout1, new HomeFragment()); ft.Commit(); return; } CalculateBetFragment fragment = FragmentManager.FindFragmentByTag("CALCULATE") as CalculateBetFragment; if (fragment != null && fragment.IsVisible) { FragmentTransaction ft = FragmentManager.BeginTransaction(); ft.Replace(Resource.Id.frameLayout1, new ActiveBetFragment()); ft.Commit(); return; } Finish(); Android.OS.Process.KillProcess(Android.OS.Process.MyPid()); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.EnsureBindingContextIsSet(savedInstanceState); var ignored = base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(Resource.Layout.FirstTestEpisodeView, null); var btnAddTest1 = view.FindViewById <Button>(Resource.Id.addtest1); btnAddTest1.Focusable = true; btnAddTest1.FocusableInTouchMode = true; btnAddTest1.RequestFocus(); var vm = new TestViewModel(); vm.Parent = ViewModel; ViewModel.AddTestCommandAction = () => { vm.EditMode = false; var dialogFragment = new TestFragment() { DataContext = vm }; dialogFragment.Show(FragmentManager, "T1Episode01"); }; ViewModel.CloseTestCommandAction = () => { var frag = FragmentManager.FindFragmentByTag("T1Episode01"); if (null != frag) { ((TestFragment)frag).Dismiss(); } }; ViewModel.EditTestCommandAction = () => { vm.EditMode = true; var dialogFragment = new TestFragment() { DataContext = vm }; dialogFragment.Show(FragmentManager, "T1Episode01"); }; return(view); }
private void ShowReadFragment() { isRead = true; isWrite = false; isForceTeste = false; isFormat = false; mNfcReadFragment = (NFCReadFragment)FragmentManager.FindFragmentByTag(NFCReadFragment.TAG); if (mNfcReadFragment == null) { mNfcReadFragment = NFCReadFragment.NewInstance(); } mNfcReadFragment.Show(FragmentManager, NFCReadFragment.TAG); }
/** * 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; }
public override void Show(FragmentManager manager, string tag) { if (manager.FindFragmentByTag(tag) == null) base.Show(manager, tag); }