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 static void CreateFragment(FragmentManager manager, int viewContainerId, Fragment fragment, FragmentTransit transition = FragmentTransit.None)
 {
     try
     {
         var trans = manager.BeginTransaction();
         trans.Replace(viewContainerId, fragment);
         trans.SetTransition(transition);
         trans.Commit();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
		/**
     * 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;
		}
        protected virtual Task <bool> CloseViewPagerFragment(IMvxViewModel viewModel,
                                                             MvxViewPagerFragmentPresentationAttribute attribute)
        {
            ViewPager       viewPager       = null;
            FragmentManager fragmentManager = null;

            if (attribute.FragmentHostViewType != null)
            {
                var fragment = GetFragmentByViewType(attribute.FragmentHostViewType);
                if (fragment == null)
                {
                    throw new MvxException("Fragment not found", attribute.FragmentHostViewType.Name);
                }

                viewPager       = fragment.View.FindViewById <ViewPager>(attribute.ViewPagerResourceId);
                fragmentManager = fragment.ChildFragmentManager;
            }
            else
            {
                viewPager       = CurrentActivity.FindViewById <ViewPager>(attribute.ViewPagerResourceId);
                fragmentManager = CurrentFragmentManager;
            }

            if (viewPager?.Adapter is MvxCachingFragmentStatePagerAdapter adapter)
            {
                var ft           = fragmentManager.BeginTransaction();
                var fragmentInfo = FindFragmentInfoFromAttribute(attribute, adapter);
                var fragment     = fragmentManager.FindFragmentByTag(fragmentInfo.Tag);
                adapter.FragmentsInfo.Remove(fragmentInfo);
                ft.Remove(fragment);
                ft.CommitAllowingStateLoss();
                adapter.NotifyDataSetChanged();

                OnFragmentPopped(ft, fragment, attribute);
                return(Task.FromResult(true));
            }
            return(Task.FromResult(false));
        }
        // AuthenticationManager.ChallengeHandler function that prompts the user for login information to create a credential.
        private async Task <Credential> CreateCredentialAsync(CredentialRequestInfo info)
        {
            // Ignore token or certificate challenges (needs additional code and UI).
            if (info.AuthenticationType != AuthenticationType.NetworkCredential)
            {
                Console.WriteLine("Skipped authentication for " + info.ServiceUri.Host);
                return(null);
            }

            // See if authentication is already in progress.
            if (_loginTaskCompletionSrc != null)
            {
                return(null);
            }

            // Create a new TaskCompletionSource for the login operation.
            // Passing the CredentialRequestInfo object to the constructor will make it available from its AsyncState property.
            _loginTaskCompletionSrc = new TaskCompletionSource <Credential>(info);

            // Create a dialog (fragment) with login controls.
            LoginDialogFragment enterLoginDialog = new LoginDialogFragment();

            // Handle the login and the cancel events.
            enterLoginDialog.OnLoginClicked  += LoginClicked;
            enterLoginDialog.OnLoginCanceled += (s, e) =>
            {
                _loginTaskCompletionSrc.TrySetCanceled();
                _loginTaskCompletionSrc = null;
            };

            // Begin a transaction to show a UI fragment (the login dialog).
            FragmentTransaction transax = FragmentManager.BeginTransaction();

            enterLoginDialog.Show(transax, "login");

            // Return the login task, the result will be ready when completed (user provides login info and clicks the "Login" button).
            return(await _loginTaskCompletionSrc.Task);
        }
        private void ViewModelOnNavigationRequested(ForumsPageIndex page, object args)
        {
            Fragment fragment;

            switch (page)
            {
            case ForumsPageIndex.PageIndex:
                fragment = new ForumIndexPageFragment();
                break;

            case ForumsPageIndex.PageBoard:
                fragment = new ForumBoardPageFragment(args as ForumsBoardNavigationArgs);
                break;

            case ForumsPageIndex.PageTopic:
                fragment = new ForumTopicPageFragment(args as ForumsTopicNavigationArgs);
                break;

            case ForumsPageIndex.PageNewTopic:
                fragment = new ForumNewTopicPageFragment(args as ForumsNewTopicNavigationArgs);
                break;

            case ForumsPageIndex.PageStarred:
                return;

            default:
                throw new ArgumentOutOfRangeException(nameof(page), page, null);
            }

            var trans = FragmentManager.BeginTransaction();

            trans.SetCustomAnimations(Resource.Animator.animation_slide_btm,
                                      Resource.Animator.animation_fade_out,
                                      Resource.Animator.animation_slide_btm,
                                      Resource.Animator.animation_fade_out);
            trans.Replace(Resource.Id.ForumsContentFrame, fragment);
            trans.Commit();
        }
Beispiel #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MainDriverScreen);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            action = PicSelected;

            mListView            = FindViewById <ListView>(Resource.Id.DriversListView);
            mListView.ItemClick += MListView_ItemClick;
            mDrivers             = new List <Driver>();

            mAdapter          = new DriverListAdapter(this, Resource.Layout.DriverListViewRow, mDrivers, action);
            mListView.Adapter = mAdapter;
            PopulateDriverList();


            var editToolbar = FindViewById <Toolbar>(Resource.Id.driverMenu);

            editToolbar.InflateMenu(Resource.Menu.driver_menu);
            editToolbar.MenuItemClick += (sender, e) =>
            {
                string ContextMenuSelected = e.Item.TitleFormatted.ToString();

                switch (ContextMenuSelected)
                {
                case "Add New Driver":
                    FragmentTransaction transaction = FragmentManager.BeginTransaction();
                    var dialog = new Forms.AddNewDriver();
                    dialog.OnCreateDriver += Dialog_OnCreateDriver;
                    dialog.Show(transaction, "dialog");
                    break;
                }
            };
        }
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            TestFragment testFragment = new TestFragment();

            FrameLayout         fragCon = FindViewById <FrameLayout>(Resource.Id.fragContainer);
            FragmentTransaction transaction;

            switch (item.ItemId)
            {
            case Resource.Id.navigation_home:
                textMessage.SetText(Resource.String.title_home);
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, testFragment, "Home");
                transaction.AddToBackStack("Home");
                transaction.Commit();

                return(true);

            case Resource.Id.navigation_dashboard:
                textMessage.SetText(Resource.String.title_dashboard);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, testFragment, "Dashboard");
                transaction.AddToBackStack("Dashboard");
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_notifications:
                textMessage.SetText(Resource.String.title_notifications);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, testFragment, "Notifications");
                transaction.AddToBackStack("Dashboard");
                transaction.Commit();
                return(true);
            }
            return(false);
        }
Beispiel #9
0
        private async void BtnUpdateInfo_ClickAsync(object sender, EventArgs e)
        {
            FragmentTransaction transaction = FragmentManager.BeginTransaction();
            DialogInfo          dialog      = new DialogInfo();

            dialog.Show(transaction: transaction, "dialog info");
            ISharedPreferences prefs    = PreferenceManager.GetDefaultSharedPreferences(this.Activity);
            string             username = prefs.GetString("username", "");
            string             password = prefs.GetString("password", "");

            if (String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password))
            {
                Toast.MakeText(this.Activity, "Hãy thử đăng nhập lại !!!", ToastLength.Short).Show();
                //Show message failture
                return;
            }
            if (Connectivity.NetworkAccess == NetworkAccess.None)
            {
                dialog.Dismiss();
                Toast.MakeText(this.Activity, "Không thể kết nối với Wifi/3G/4G", ToastLength.Short).Show();
                return;
            }
            bool isLoginSuccess = await LoginUtility.CrawlData(username, password).ConfigureAwait(true);

            if (isLoginSuccess)
            {
                DatabaseUtility.GetDataScheduler();
                DatabaseUtility.GetDataExam();
                DatabaseUtility.SaveInfoDatabase();
                dialog.Dismiss();
                Toast.MakeText(this.Activity, "Cập nhật thành công !", ToastLength.Short).Show();
            }
            else
            {
                dialog.Dismiss();
                Toast.MakeText(this.Activity, "Cập nhật thất bại !", ToastLength.Short).Show();
            }
        }
Beispiel #10
0
        void LoadFragment(int id)
        {
            Fragment fragment = null;

            switch (id)
            {
            case Resource.Id.action_add:
                fragment = Fragment1.NewInstance();
                break;

            case Resource.Id.action_edit:
                fragment = Fragment2.NewInstance();
                break;

            case Resource.Id.action_remove:
                fragment = Fragment3.NewInstance();
                break;

            case Resource.Id.action_select:
                fragment = Fragment4.NewInstance();
                break;

            case Resource.Id.action_batata:
                fragment = Fragment5.NewInstance();
                break;
            }
            if (fragment == null)
            {
                return;
            }
            else
            {
                FragmentManager.BeginTransaction()
                .Replace(Resource.Id.content_frame, fragment)
                .AddToBackStack(fragment.Tag)
                .Commit();
            }
        }
        void ShowNoteContent(int noteId)
        {
            selectedNoteId = noteId;
            if (showingTwoFragments)
            {
                ListView.SetItemChecked(selectedNoteId, true);

                var NoteFragment = FragmentManager.FindFragmentById(Resource.Id.playquote_container) as NoteFragment;

                if (NoteFragment == null || NoteFragment.NoteId != noteId)
                {
                    var container = Activity.FindViewById(Resource.Id.playquote_container);

                    var quoteFrag          = NoteFragment.NewInstance(selectedNoteId);
                    FragmentTransaction ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.playquote_container, quoteFrag);
                    ft.AddToBackStack(null);
                    ft.SetTransition(FragmentTransit.FragmentFade);
                    ft.Commit();
                }
            }
            else
            {
                var intent = new Intent(Activity, typeof(NoteActivity));
                intent.PutExtra("current_note_id", noteId);
                StartActivity(intent);
            }
            var deleteButton = Activity.FindViewById <Button>(Resource.Id.button2);
            var updateButton = Activity.FindViewById <Button>(Resource.Id.button1);

            if (noteId > DatabaseToArray.NoteIds.Count() - 1)
            {
                noteId -= 1;
            }
            NoteCreationId      = DatabaseToArray.NoteIds[noteId];
            deleteButton.Click += DeleteButton_Click;
            updateButton.Click += UpdateButton_Click;
        }
Beispiel #12
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var            grid     = convertView;
            LayoutInflater inflater = (LayoutInflater)mContext.GetSystemService(Context.LayoutInflaterService);
            var            local    = new LocalOnClickListener();
            ViewHolder3    holder;

            if (grid == null)
            {
                holder = new ViewHolder3();
                grid   = inflater.Inflate(Resource.Layout.Attachment_layout, null);
                var view = grid.FindViewById <ImageView>(Resource.Id.imageview_attach);
                grid.Tag = new ViewHolder3()
                {
                    View = view
                };
            }

            holder = (ViewHolder3)grid.Tag;
            holder.View.SetImageResource(Resource.Drawable.audiofile);

            local.HandleOnClick = () =>
            {
                AudioFragment       nextFrag = new AudioFragment();
                FragmentTransaction ft       = fm.BeginTransaction();
                ft.Hide(fm.FindFragmentByTag("ComplainceFragment"));
                ft.Add(Resource.Id.container, nextFrag);
                ft.AddToBackStack(null);
                ft.SetTransition(FragmentTransaction.TransitFragmentOpen);
                ft.Commit();
                Bundle bundle = new Bundle();
                bundle.PutString("Path", myList[position].Path);
                nextFrag.Arguments = bundle;
            };
            holder.View.SetOnClickListener(local);

            return(grid);
        }
        public async void DeleteAccount()
        {
            //TODO: Change popup
            switch (Token)
            {
            case "Admin":
                await firebaseHelper.DeleteAccount <Admin>("Admins", EmailAddress);

                break;

            case "Teacher":
                await firebaseHelper.DeleteAccount <Teacher>("Teachers", EmailAddress);

                break;

            case "UniversityStudent":
                await firebaseHelper.DeleteAccount <UniversityStudent>("UniversityStudents", EmailAddress);

                break;

            case "SchoolStudent":
                await firebaseHelper.DeleteAccount <SchoolStudent>("SchoolStudents", EmailAddress);

                break;

            case "User":
                await firebaseHelper.DeleteAccount <User>("Users", EmailAddress);

                break;
            }
            await session.DeleteSession(EmailAddress);

            await firebaseHelper.DeleteAccount <Login>("Login", EmailAddress);

            alertWindow.Alert("", "Account deleted!", Activity);
            Android.Support.V4.App.Fragment loginFragment = new LoginFragment();
            FragmentManager.BeginTransaction().Replace(Resource.Id.parent_fragment, loginFragment).Commit();
        }
Beispiel #14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // Set up slide menu

            drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            // Init toolbar
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            // Attach item selected handler to navigation view
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

            // Create ActionBarDrawerToggle button and add it to the toolbar
            var drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, Resource.String.open_drawer, Resource.String.close_drawer);

            drawerLayout.SetDrawerListener(drawerToggle);
            drawerToggle.SyncState();


            SJSManager.Instance.InvalidateToken();
            SJSManager.Instance.GetDayAndAnnouncement(DateTime.Today, (DayAndAnnouncement o) => { });

            MainFragment        frag = new MainFragment();
            FragmentTransaction ft   = FragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.fragment_container, frag);
            ft.AddToBackStack(null);
            ft.Commit();
        }
Beispiel #15
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            houseFragment houseFragment = new houseFragment();

            FrameLayout         fragCon = FindViewById <FrameLayout>(Resource.Id.fragContainer);
            FragmentTransaction transaction;

            switch (item.ItemId)
            {
            case Resource.Id.navigation_House:
                textMessage.SetText(Resource.String.title_House);
                fragCon.RemoveAllViewsInLayout();
                fragCon.RemoveViews(0, fragCon.ChildCount);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, houseFragment, "Home");
                transaction.AddToBackStack("Home");
                transaction.Commit();

                return(true);

            case Resource.Id.navigation_agent:
                textMessage.SetText(Resource.String.title_agent);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, houseFragment, "agent");
                transaction.AddToBackStack("agent");
                transaction.Commit();
                return(true);

            case Resource.Id.navigation_User:
                textMessage.SetText(Resource.String.title_User);
                transaction = FragmentManager.BeginTransaction();
                transaction.Replace(Resource.Id.fragContainer, houseFragment, "User");
                transaction.AddToBackStack("User");
                transaction.Commit();
                return(true);
            }
            return(false);
        }
Beispiel #16
0
        private void ActivitiesWeek_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            try
            {
                long packedPosition = _activitiesWeek.GetExpandableListPosition(e.Position);

                if (ExpandableListView.GetPackedPositionType(packedPosition) == PackedPositionType.Child)
                {
                    // get item ID's
                    int groupPosition = ExpandableListView.GetPackedPositionGroup(packedPosition);
                    int childPosition = ExpandableListView.GetPackedPositionChild(packedPosition);

                    Activities   activity     = GlobalData.ActivitiesForWeek[groupPosition];
                    ActivityTime activityTime = activity.ActivityTimes[childPosition];

                    string startTime, endTime;

                    StringHelper.ActivityTimeBeginEndForConstant(activityTime.ActivityTime, out startTime, out endTime);

                    _timeFragment = new ActivityTimeDialogFragment(this, activity.ActivityDate, activityTime.ActivityTime, startTime, endTime, groupPosition, childPosition, "Add Activity");

                    var fragmentTransaction = FragmentManager.BeginTransaction();
                    _timeFragment.Show(fragmentTransaction, _timeFragment.Tag);

                    Log.Info(TAG, "ActivitiesWeek_ItemLongClick: groupPosition - " + groupPosition.ToString() + ", childPosition - " + childPosition.ToString());

                    e.Handled = true;
                }
            }
            catch (Exception ex)
            {
                Log.Error(TAG, "ActivitiesWeek_ItemLongClick: Exception - " + ex.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorActivitySelectChildItem), "ActivitiesActivity.ActivitiesWeek_ItemLongClick");
                }
            }
        }
Beispiel #17
0
        private async void LoadQ()
        {
            progressBar.Visibility = ViewStates.Visible;
            var firebase = new FirebaseClient(FirebaseURL);

            var thisQ = await firebase.Child("qs").Child("qs_" + myAttributes.cfid.ToString() + "_" + myAttributes.attribute1).OnceAsync <Queue>();

            if (thisQ.Count == 0)
            {
                Fragments.NoQsPresent fragment = new Fragments.NoQsPresent();
                Bundle arguments = new Bundle();
                arguments.PutString("Sender", "CurrentQs");
                fragment.Arguments = arguments;

                Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.qs_root_frame, fragment);
                trans.Commit();
            }

            List <string> mItems = new List <string>();

            foreach (var q in thisQ)
            {
                if (q.Object.position == "1")
                {
                    candidateName.Text = q.Object.studentname;
                    student_id1        = q.Object.studentid;
                }
                else
                {
                    mItems.Add(q.Object.studentname);
                }
            }
            QueueListViewAdapter adapter = new QueueListViewAdapter(mContainer.Context, mItems);

            queue.Adapter          = adapter;
            progressBar.Visibility = ViewStates.Invisible;
        }
Beispiel #18
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View view = inflater.Inflate(Resource.Layout.sign_account, container, false);

            mLogin    = view.FindViewById <Button>(Resource.Id.btnSignin);
            mRegister = view.FindViewById <Button>(Resource.Id.btnCreateAccount);
            mLanguage = view.FindViewById <ImageButton>(Resource.Id.btnLanguage);
            mTxtLang  = view.FindViewById <TextView>(Resource.Id.txtLanguage);

            mLogin.Click += (o, s) =>
            {
                var trans = FragmentManager.BeginTransaction();
                trans.Replace(Resource.Id.fragmentContainer, new Login(), "login");
                trans.SetCustomAnimations(Resource.Animation.slide_up, Resource.Animation.slide_up);
                trans.DisallowAddToBackStack();
                trans.Commit();
            };
            mRegister.Click += (o, s) =>
            {
                Intent i = new Intent(Context, typeof(RegistrationActivity));
                StartActivity(i);
            };
            mLanguage.Click += (o, s) =>
            {
                settings();
            };

            if (_lang == "en")
            {
                mTxtLang.Text = "En";
            }
            else
            {
                mTxtLang.Text = "Sw";
            }
            return(view);
        }
Beispiel #19
0
        private void InitFields()
        {
            this.mAddButton            = FindViewById <Button>(Resource.Id.buttonLocationAdd);
            this.mEditButton           = FindViewById <Button>(Resource.Id.buttonLocationEdit);
            this.mBackButton           = FindViewById <ImageButton>(Resource.Id.buttonLocationBack);
            this.mTextSelectedLocation = FindViewById <TextView>(Resource.Id.textViewManageLocationSelectedLocation);
            this.mListViewLocations    = this.FindViewById <RecyclerView>(Resource.Id.recyclerViewLocations);
            this.mListViewLocations.SetLayoutManager(new LinearLayoutManager(this));
            mAuthorizedId = LoginActivity.StaticUserClass.ID;

            LoadLocationData();
            mBackButton.Click += (object sender, EventArgs args) =>
            {
                Intent nextActivity = new Intent(this, typeof(PageMainActivity));
                StartActivity(nextActivity);
            };
            mEditButton.Click += (object sender, EventArgs args) =>
            {
                if (mSelectedLocation > -1)
                {
                    FragmentTransaction  transaction    = FragmentManager.BeginTransaction();
                    DialogLocationDetail dialogLocation = new DialogLocationDetail(mSelectedLocationClass);
                    dialogLocation.Show(transaction, "dialogue fragment");
                    dialogLocation.OnCompleteLocationDetail += EditLocationDialog_OnLocationEdit;
                }
                else
                {
                    Toast.MakeText(this, "Select Location First..", ToastLength.Long).Show();
                }
            };
            mAddButton.Click += (object sender, EventArgs args) =>
            {
                FragmentTransaction transaction    = FragmentManager.BeginTransaction();
                DialogAddLocation   dialogLocation = new DialogAddLocation();
                dialogLocation.Show(transaction, "dialogue fragment");
                dialogLocation.OnAddLocationComplete += AddLocationDialog_OnLocationAdd;
            };
        }
Beispiel #20
0
        public override void OnListItemClick(ListView l, View v, int position, long id)
        {
            base.OnListItemClick(l, v, position, id);
            var fragmentTransaction = FragmentManager.BeginTransaction();

            switch (position)
            {
            case 0:
                fragmentTransaction.Replace(Resource.Id.manouverContentFrameLayout, FragmentInflater.Instance(Resource.Layout.approach_stall_recovery_fragment));
                break;

            case 1:
                fragmentTransaction.Replace(Resource.Id.manouverContentFrameLayout, FragmentInflater.Instance(Resource.Layout.rejected_takeoff_fragment));
                break;

            case 2:
                fragmentTransaction.Replace(Resource.Id.manouverContentFrameLayout, FragmentInflater.Instance(Resource.Layout.gpws_response_fragment));
                break;

            case 3:
                fragmentTransaction.Replace(Resource.Id.manouverContentFrameLayout, FragmentInflater.Instance(Resource.Layout.traffic_avoidance_fragment));
                break;

            case 4:
                fragmentTransaction.Replace(Resource.Id.manouverContentFrameLayout, FragmentInflater.Instance(Resource.Layout.upset_recovery_fragment));
                break;

            case 5:
                fragmentTransaction.Replace(Resource.Id.manouverContentFrameLayout, FragmentInflater.Instance(Resource.Layout.windshear_fragment));
                break;

            default:
                break;
            }
            fragmentTransaction.SetTransition(4099);
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.Commit();
        }
Beispiel #21
0
        protected virtual bool TryPerformCloseFragmentTransaction(
            FragmentManager fragmentManager,
            MvxFragmentPresentationAttribute fragmentAttribute)
        {
            if (fragmentManager.BackStackEntryCount > 0)
            {
                var fragmentName = FragmentJavaName(fragmentAttribute.ViewType);
                fragmentManager.PopBackStackImmediate(fragmentName, PopBackStackFlags.Inclusive);
                return(true);
            }
            else if (CurrentFragmentManager.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);
        }
Beispiel #22
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            Button btn1        = FindViewById <Button>(Resource.Id.btnLibrary);
            Button btn2        = FindViewById <Button>(Resource.Id.btnMeeting);
            Button btnNewChild = FindViewById <Button>(Resource.Id.btnNewChild);

            FragmentManager fm = FragmentManager;

            TextView header = FindViewById <TextView>(Resource.Id.textHeader);

            header.Text = "Välkommen Din Apa!";

            //halllåååå

            header.Gravity = Android.Views.GravityFlags.Center;

            btn2.Click += delegate
            {
                StartActivity(typeof(MeetingActivity));
            };

            btnNewChild.Click += delegate
            {
                if (fm.BackStackEntryCount == 0)
                {
                    Fragment            createChildFragment = new Fragment1();
                    FragmentTransaction ft = fm.BeginTransaction();
                    ft.Add(Resource.Id.fragment_container, createChildFragment);
                    ft.AddToBackStack("createChildFragment");
                    ft.Commit();
                }
            };
        }
        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();
            }
        }
Beispiel #24
0
        void LoadFragment(int id)
        {
            Android.App.Fragment fragment = null;
            switch (id)
            {
            case Resource.Id.homeIcon:
                fragment = HomeFragment.NewInstance("", "");
                break;

            case Resource.Id.appointmentIcon:
                fragment = AppointmentFragment.NewInstance("", "");
                break;

            case Resource.Id.preorderIcon:
                fragment = PreOrderFragment.NewInstance("", "");
                break;

            case Resource.Id.promotionIcon:
                fragment = PromotionFragment.NewInstance("", "");
                break;

            case Resource.Id.accountIcon:
                fragment = AccountFragment.NewInstance("", "");
                break;
            }

            if (fragment == null)
            {
                return;
            }

            Android.App.FragmentTransaction transaction = FragmentManager.BeginTransaction();
            transaction.Replace(Resource.Id.frame_container, fragment);
            transaction.AddToBackStack(null);
            transaction.Commit();

            //FragmentManager.BeginTransaction().Replace(Resource.Id.frame_container, fragment).Commit();
        }
 private void MAdapterOnItemClick(object sender, BlockedUsers_AdapterClickEventArgs adapterClickEvents)
 {
     try
     {
         var Position = adapterClickEvents.Position;
         if (Position >= 0)
         {
             var item = mAdapter.GetItem(Position);
             if (item != null)
             {
                 //Pull up dialog
                 var transaction = FragmentManager.BeginTransaction();
                 var UserDialog  = new Dialog_BlockUser(item.user_id, item);
                 UserDialog.Show(transaction, "dialog fragment");
                 UserDialog._OnBlockUserUpComplete += UserDialogOnOnBlockUserUpComplete;
             }
         }
     }
     catch (Exception e)
     {
         Crashes.TrackError(e);
     }
 }
        private void GenericList_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            try
            {
                var adapter         = _genericList.Adapter;
                var selectedIndexID = (int)adapter.GetItemId(e.Position);
                var genericTextItem = GlobalData.GenericTextItemsList.Find(gen => gen.ID == selectedIndexID);

                GenericTextDialogFragment genFragment = new GenericTextDialogFragment(this, "Edit item", GetString(Resource.String.workedPastGenericTextDialogTitle), genericTextItem.TextValue, selectedIndexID);

                FragmentTransaction transaction = FragmentManager.BeginTransaction();

                genFragment.Show(transaction, genFragment.Tag);
            }
            catch (Exception ex)
            {
                Log.Error(TAG, "GenericList_ItemLongClick: Exception - " + ex.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, ex, GetString(Resource.String.ErrorWorkedPastEditEntry), "WorkedPastActivity.GenericList_ItemLongClick");
                }
            }
        }
Beispiel #27
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.signUpDialog, container, false);

            firstName = view.FindViewById <AutoCompleteTextView>(Resource.Id.ACTVime);
            lastName  = view.FindViewById <AutoCompleteTextView>(Resource.Id.ACTVprezime);
            email     = view.FindViewById <AutoCompleteTextView>(Resource.Id.ACTVemail);
            phone     = view.FindViewById <AutoCompleteTextView>(Resource.Id.ACTVphoneNumber);
            password  = view.FindViewById <AutoCompleteTextView>(Resource.Id.ACTVpassword);
            password2 = view.FindViewById <AutoCompleteTextView>(Resource.Id.ACTVpassword2);
            register  = view.FindViewById <Button>(Resource.Id.buttonSignUp);

            FragmentTransaction    transaction       = FragmentManager.BeginTransaction();
            termsAgreementFragment agreementFragment = new termsAgreementFragment();

            agreementFragment.Show(transaction, "agreementFragment");

            agreementFragment.OnTermsAgreementChosen += AgreementFragment_OnTermsAgreementChosen;

            register.Click += Register_Click;

            return(view);
        }
Beispiel #28
0
        /// <Docs>The menu item that was selected.</Docs>
        /// <returns>To be added.</returns>
        /// <para tool="javadoc-to-mdoc">This hook is called whenever an item in your options menu is selected.
        ///  The default implementation simply returns false to have the normal
        ///  processing happen (calling the item's Runnable or sending a message to
        ///  its Handler as appropriate). You can use this method for any items
        ///  for which you would like to do processing without those other
        ///  facilities.</para>
        /// <summary>
        /// Raises the options item selected event.
        /// </summary>
        /// <param name="item">Item.</param>
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                Activity.NavigateUpTo(new Intent(Activity, typeof(MasterActivity)));
                return(true);

            case Resource.Id.action_display_calendar:
                FragmentManager.BeginTransaction()
                .Add(Resource.Id.activity_detail_container, CalendarFragment.NewInstance(mActivityId))
                .AddToBackStack(null)
                .Hide(this)
                .Commit();
                return(true);

            case Resource.Id.action_new_activity_date:
                var dialog = new AddActivityDateDialogFragment();
                dialog.Show(this);
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            if (bundle == null)
            {
                Android.App.FragmentTransaction transaction = FragmentManager.BeginTransaction();
                //var fragment = new XamarinListView.FragmentAtmListview();
                var fragment = new XamarinListView.Fragments.AtmFinderFragement();
                transaction.Replace(Resource.Id.titles_fragment, fragment);
                transaction.Commit();
            }

            //var view = FindViewById<ViewPager>(Resource.Id.)

            //var adapter =
            //        new AtmFinderAdapter(SupportFragmentManager,
            //            new FirstFragement(), new AtmListviewFragment(), new PagerFragment());
            //var viewPager = FindViewById<Android.Support.V4.View.ViewPager>(Resource.Id.vpPager);
            //viewPager.Adapter = adapter;
        }
 public override void OnBackPressed()
 {
     base.OnBackPressed();
     if (mDrawerLayout.IsDrawerOpen((GravityCompat.Start)))
     {
         mDrawerLayout.CloseDrawer(GravityCompat.Start);
     }
     else
     {
         if (mFragment.Class.Equals(typeof(MapViewFragment)))
         {
             Intent intent = new Intent(Intent.ActionMain);
             intent.AddCategory(Intent.CategoryHome);
             intent.SetFlags(ActivityFlags.NewTask);
             StartActivity(intent);
         }
         else
         {
             mFragment = new MapViewFragment(this);
             FragmentManager.BeginTransaction().Replace(Resource.Id.nav_frame, mFragment).Commit();
         }
     }
 }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == Android.Resource.Id.Home)
            {
                Finish();
                return(true);
            }
            if (item.ItemId == Resource.Id.dumbbell)
            {
                var exerciseDialog = new CreateExerciseDialog();
                var transaction    = FragmentManager.BeginTransaction();

                exerciseDialog.OnCreateExersice += (sender, args) =>
                {
                    _currentWorkout.Exercises.Add(args.Exercise);
                    FileHelper.UpdateWorkout(_currentWorkout);
                    _adapter.NotifyDataSetChanged();
                };
                exerciseDialog.Show(transaction, "Create Exercise");
                return(true);
            }
            return(base.OnOptionsItemSelected(item));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);



            FirstFragment objFist = new FirstFragment();

            FragmentManager     fm = FragmentManager;
            FragmentTransaction ft = fm.BeginTransaction();

            ft.Add(Resource.Id.flContainer, objFist);


            SecondFragment second = new SecondFragment();

            ft.Add(Resource.Id.flContainer1, second);

            ft.CommitAllowingStateLoss();
        }
        public void ShowHelpWindow(Action onCloseAction, HelpDialogFragment.HelpWindows helpType)
        {
            var transaction = FragmentManager.BeginTransaction();

            transaction.SetTransition(FragmentTransit.FragmentFade);

            var prev = FragmentManager.FindFragmentByTag(helpDialogTag);

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

            transaction.AddToBackStack(null);

            var helpDialog = HelpDialogFragment.NewHelpDialogFragment();

            helpDialog.Type = helpType;
            helpDialog.OnCloseDialogAction = onCloseAction;
            helpDialog.Show(transaction, helpDialogTag);

            isHelpDialogShown = true;
        }
 public void Show(FragmentManager manager, String tag)
 {
     if (!mDismissed)
     {
         return;
     }
     mDismissed = false;
     FragmentTransaction ft = manager.BeginTransaction();
     ft.Add(this, tag);
     ft.AddToBackStack(null);
     ft.Commit();
 }