Beispiel #1
0
        private void Addorder_Click(object sender, EventArgs e)
        {
            Fragment            fragment = new AddOrderFragment();
            FragmentTransaction ft       = FragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.fragment, fragment).Commit();
        }
Beispiel #2
0
 private void switchFragment()
 {
     Android.Support.V4.App.Fragment            newFrag             = new LoginActivity();                       //create a new instance of VolunteerActivity and save it
     Android.Support.V4.App.FragmentTransaction fragmentTransaction = SupportFragmentManager.BeginTransaction(); //begin the fragment transaction
     fragmentTransaction.Replace(Resource.Id.frameLayout1, newFrag, "LoginActivity");                            //replace the old fragment with the new on
     fragmentTransaction.Commit();                                                                               //commit the transaction
 }
        public override void OnViewRecycled(Java.Lang.Object holder)
        {
            if (mCurTransaction == null)
            {
                mCurTransaction = mFragmentManager.BeginTransaction();
            }
            if (DEBUG)
            {
                Log.Verbose(TAG, "Removing item #");
            }
            int tagId = GenTagId(((FragmentViewHolder)holder).AdapterPosition);

            Android.Support.V4.App.Fragment f = mFragmentManager.FindFragmentByTag(tagId.ToString());
            if (f != null)
            {
                if (DEBUG)
                {
                    Log.Verbose(TAG, "Removing fragment #");
                }
                mStates.Put(tagId, mFragmentManager.SaveFragmentInstanceState(f));
                mCurTransaction.Remove(f);
                mCurTransaction.CommitAllowingStateLoss();
                mCurTransaction = null;
                mFragmentManager.ExecutePendingTransactions();
            }
            if (((FragmentViewHolder)holder).ItemView is ViewGroup)
            {
                ((ViewGroup)((FragmentViewHolder)holder).ItemView).RemoveAllViews();
            }
            base.OnViewRecycled(holder);
        }
Beispiel #4
0
        protected override void SetupPageTransition(Android.Support.V4.App.FragmentTransaction transaction, bool isPush)
        {
            Page lastPage = null;

            if (isPush)
            {
                if (Element?.Navigation?.NavigationStack?.Count() >= 2)
                {
                    var previousPage = Element?.Navigation?.NavigationStack[Element.Navigation.NavigationStack.Count() - 2];
                    previousPage.PropertyChanged -= LastPage_PropertyChanged;
                }



                lastPage = Element?.Navigation?.NavigationStack?.Last();
                SetupToolbarCustomization(lastPage);
                lastPage.PropertyChanged += LastPage_PropertyChanged;
            }
            else if (Element?.Navigation?.NavigationStack?.Count() >= 2)
            {
                var previousPage = Element?.Navigation?.NavigationStack?.Last();
                previousPage.PropertyChanged -= LastPage_PropertyChanged;

                lastPage = Element?.Navigation?.NavigationStack[Element.Navigation.NavigationStack.Count() - 2];
                lastPage.PropertyChanged += LastPage_PropertyChanged;
                SetupToolbarCustomization(lastPage);
            }


            base.SetupPageTransition(transaction, isPush);
        }
Beispiel #5
0
        public virtual void ShowAllowingStateLoss(FragmentManager manager, string tag)
        {
            FragmentTransaction ft = manager.BeginTransaction();

            ft.Add(this, tag);
            ft.CommitAllowingStateLoss();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            App.FUNCTIONS.SetActionBarDrawable(this);

            SetContentView(Resource.Layout.GEMDonationsActivity);

            donationType = Intent.GetStringExtra("donationType") ?? "google";

            // Set ActionBar type
            App.STATE.SetActionBarTitle(SupportActionBar, "JW Chinese", "Donations");

            FragmentTransaction ft = SupportFragmentManager.BeginTransaction();
            DonationsFragment   donationsFragment;

            if (donationType == "google")
            {
                donationsFragment = DonationsFragment.newInstance(false, true, GOOGLE_PUBKEY, GOOGLE_CATALOG, Resources.GetStringArray(Resource.Array.donation_google_catalog_values), false, null, null, null, false, null, null, false, null);
            }
            else
            {
                donationsFragment = DonationsFragment.newInstance(false, false, null, null, null, true, PAYPAL_USER, PAYPAL_CURRENCY_CODE, GetString(Resource.String.donation_paypal_item), false, FLATTR_PROJECT_URL, FLATTR_URL, false, BITCOIN_ADDRESS);
            }

            ft.Replace(Resource.Id.donations_activity_container, (Fragment)donationsFragment, "donationsFragment");
            ft.Commit();
        }
Beispiel #7
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            MyView myholder = holder as MyView;

            myholder.Task.Text          = Mitems[position].task_name;
            myholder.Create_by.Text     = Mitems[position].task_created_by;
            myholder.Deadline_date.Text = Mitems[position].deadlineDate.ToString();
            // myholder.time_left.Text = Mitems[position].mark_to;
            var local = new LocalOnClickListener();

            myholder.Linear.SetOnClickListener(local);
            local.HandleOnClick = () =>
            {
                string id = Mitems[position].task_id;

                ComplainceFrag nextFrag = new ComplainceFrag();
                Android.Support.V4.App.FragmentTransaction ft = fragment.BeginTransaction();
                //ft.Replace(Resource.Id.container, nextFrag, "ComplainceFragment");
                ft.Hide(fragment.FindFragmentByTag("MainFrag"));
                ft.Add(Resource.Id.container, nextFrag, "ComplainceFragment");
                ft.AddToBackStack("TaskInboxFrag");
                ft.SetTransition(FragmentTransaction.TransitFragmentOpen);
                ft.Commit();
                // fragment.BeginTransaction().Replace(Resource.Id.container, nextFrag).Commit();
                Bundle bundle = new Bundle();
                bundle.PutString("task_id", id);
                nextFrag.Arguments = bundle;
            };


            myholder.time_left.Text = date_difference(DateTime.Now, Mitems[position].deadlineDate);
        }
        protected override void SetupPageTransition(Android.Support.V4.App.FragmentTransaction transaction, bool isPush)
        {
            switch (_transitionType)
            {
            case TransitionType.None:
                return;

            case TransitionType.Default:
                return;

            case TransitionType.Fade:
                if (isPush)
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_right, Resource.Animation.exit_left,
                                                    Resource.Animation.enter_left, Resource.Animation.exit_right);
                }
                else
                {
                    transaction.SetCustomAnimations(Resource.Animation.enter_left, Resource.Animation.exit_right,
                                                    Resource.Animation.enter_right, Resource.Animation.exit_left);
                }
                break;

            default:
                return;
            }
        }
Beispiel #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            //java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media from pid=17271, uid=10085 requires android.permission.READ_EXTERNAL_STORAGE
            //6.0及以上需要动态申请权限
            if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.M)
            {
                //RequestWriteSettings();
                bool isGrant = ActivityCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) == Permission.Granted;
                if (isGrant == false)
                {
                    ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.ReadExternalStorage }, PERMISSION_ReadExternalStorage);
                }
                else
                {
                    Songleton.Instance.AllSongs = MusicRetrieval.LoadSongs(this);
                    if (savedInstanceState == null)
                    {
                        SongListFragment songListFragment = new SongListFragment();
                        //MusicControlFragment musicControlFragment = new MusicControlFragment ();
                        MusicControls musicControls = new MusicControls();
                        //var trans = FragmentManager.BeginTransaction ();以下两条语句极度重要,解决大问题!
                        Android.Support.V4.App.FragmentManager     fragmentManager = SupportFragmentManager;
                        Android.Support.V4.App.FragmentTransaction trans           = fragmentManager.BeginTransaction();
                        trans.Add(Resource.Id.fragment_container, songListFragment, "songListFragment");
                        trans.Add(Resource.Id.music_controls_container, musicControls, "musicControls");
                        trans.Commit();
                    }
                    //在程序中获取string.xml中字符串和数值
                    Toast.MakeText(this, this.Resources.GetString(Resource.String.scan_songs) + Songleton.Instance.AllSongs.Count.ToString(), ToastLength.Short).Show();
                }
            }
        }
Beispiel #10
0
        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
        {
            if (requestCode == PERMISSION_ReadExternalStorage)
            {
                if (grantResults[0] == Permission.Granted)
                {
                    Songleton.Instance.AllSongs = MusicRetrieval.LoadSongs(this);
                    SongListFragment songListFragment = new SongListFragment();
                    //MusicControlFragment musicControlFragment = new MusicControlFragment ();
                    MusicControls musicControls = new MusicControls();
                    //var trans = FragmentManager.BeginTransaction ();以下两条语句极度重要,解决大问题!
                    Android.Support.V4.App.FragmentManager     fragmentManager = SupportFragmentManager;
                    Android.Support.V4.App.FragmentTransaction trans           = fragmentManager.BeginTransaction();
                    trans.Add(Resource.Id.fragment_container, songListFragment, "songListFragment");
                    trans.Add(Resource.Id.music_controls_container, musicControls, "musicControls");
                    trans.Commit();

                    if (Build.VERSION.SdkInt != Android.OS.BuildVersionCodes.NMr1)
                    {
                        Toast.MakeText(this, "读取数据权限已申请", ToastLength.Short).Show();
                    }
                }
                else
                {
                    if (Build.VERSION.SdkInt != Android.OS.BuildVersionCodes.NMr1)
                    {
                        Toast.MakeText(this, "申请读取数据权限被拒", ToastLength.Short).Show();
                    }
                }
            }
        }
        public override void OpenActivityOrFragment(Android.Content.Intent intent)
        {
            var pm = PackageManager;
            var resolveInfoList = pm.QueryIntentActivities(intent, PackageInfoFlags.MatchDefaultOnly);

            foreach (var resolveInfo in resolveInfoList)
            {
                FragmentReplaceInfo fri = OnSubstituteFragmentForActivityLaunch(resolveInfo.ActivityInfo.Name);
                if (fri != null)
                {
                    Bundle          arguments = IntentToFragmentArguments(intent);
                    FragmentManager fm        = SupportFragmentManager;

                    try {
                        Fragment fragment = (Fragment)fri.GetFragmentClass().NewInstance();
                        fragment.Arguments = arguments;

                        FragmentTransaction ft = fm.BeginTransaction();
                        ft.Replace(fri.GetContainerId(), fragment, fri.GetFragmentTag());
                        OnBeforeCommitReplaceFragment(fm, ft, fragment);
                        ft.Commit();
                    } catch (Exception e) {
                        new Exception("Error creating new fragment." + e.Message);
                    }
                    return;
                }
            }
            base.OpenActivityOrFragment(intent);
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			ArrayAdapter<string> ad = new ArrayAdapter<string> (ActionBar.ThemedContext, Android.Resource.Layout.SimpleListItem1, listContent);
			DrawerLayout drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
			ListView list = FindViewById<ListView> (Resource.Id.drawer);
			list.SetAdapter (ad);

			transaction = SupportFragmentManager.BeginTransaction ();
			transaction.Add (Resource.Id.main,fragments [0]);
			transaction.Commit ();

			list.ItemClick += (sender, e) => {
				var item = sender as ListView;
				var position = item.CheckedItemPosition;
				transaction = SupportFragmentManager.BeginTransaction();
				transaction.Replace(Resource.Id.main,fragments[position]);
				transaction.Commit();
				drawer.CloseDrawer(item);
			};
		}
        public void OnTabChanged(string tabId)
        {
            TabInfo newTab = this.mapTabInfo[tabId];

            newTab.args.PutString("ProcessID", ProcessID);
            //if (mLastTab != newTab)
            //{
            Android.Support.V4.App.FragmentTransaction ft = this.SupportFragmentManager.BeginTransaction();
            if (mLastTab != null)
            {
                if (mLastTab.fragment != null)
                {
                    ft.Detach(mLastTab.fragment);
                }
            }
            if (newTab != null)
            {
                if (newTab.fragment == null)
                {
                    newTab.fragment = Android.Support.V4.App.Fragment.Instantiate(this, Java.Lang.Class.FromType(newTab.clss).Name
                                                                                  , newTab.args);

                    ft.Add(Resource.Id.realtabcontent, newTab.fragment, newTab.tag);
                }
                else
                {
                    ft.Attach(newTab.fragment);
                }
            }

            mLastTab = newTab;
            ft.Commit();
            this.SupportFragmentManager.ExecutePendingTransactions();
            //}
        }
Beispiel #14
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                mDrawerLayout.OpenDrawer((int)GravityFlags.Left);
                return(true);

            case Resource.Id.toolbarMenu_pricingType:
                //show dialog here
                SupportFragmentTransaction transaction       = SupportFragmentManager.BeginTransaction();
                PricingTypeDialogFragment  pricingTypeDialog = new PricingTypeDialogFragment();
                //pass current selected price type t
                var args = new Bundle();
                args.PutString("currentPricingType", mCurrentSelectedPriceType);
                pricingTypeDialog.Arguments = args;

                pricingTypeDialog.Show(transaction, "pricingTypeDialogFragment");
                return(true);

            case Resource.Id.toolbarMenu_customer:
                Android.Widget.Toast.MakeText(this, "Clicked Customer Icon!", Android.Widget.ToastLength.Long).Show();
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            mapGraph = MainApp.Instance.MainBuildingGraph.Value;

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

            fragments = new List <MainBuildingMapFragment>()
            {
                new MainBuildingMapFragment(Resource.Drawable.first_floor), new MainBuildingMapFragment(Resource.Drawable.second_floor), new MainBuildingMapFragment(Resource.Drawable.third_floor)
            };

            fragmentTransaction = Activity.SupportFragmentManager.BeginTransaction();
            fragmentTransaction.Add(Resource.Id.frame_mainbuilding, fragments[2], "MAP_MAINBUILDING_3");
            fragmentTransaction.Add(Resource.Id.frame_mainbuilding, fragments[1], "MAP_MAINBUILDING_2");
            fragmentTransaction.Detach(fragments[2]);
            fragmentTransaction.Detach(fragments[1]);
            fragmentTransaction.Add(Resource.Id.frame_mainbuilding, fragments[0], "MAP_MAINBUILDING_1");
            fragmentTransaction.Commit();

            var array = MainApp.Instance.RoomsDictionary.Select(x => x.Key).ToArray();

            editTextInputFrom              = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView_from);
            editTextInputFrom.FocusChange += EditTextFromFocusChanged;
            editTextInputFrom.Adapter      = new ArrayAdapter(Activity.BaseContext, Android.Resource.Layout.SimpleDropDownItem1Line, array);
            editTextInputFrom.AddTextChangedListener(this);

            editTextInputTo = view.FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView_to);
            editTextInputTo.SetOnEditorActionListener(this);
            editTextInputTo.FocusChange += EditTextToFocusChanged;
            editTextInputTo.Adapter      = new ArrayAdapter(Activity.BaseContext, Android.Resource.Layout.SimpleDropDownItem1Line, array);
            editTextInputTo.AddTextChangedListener(this);

            appBar = view.FindViewById <AppBarLayout>(Resource.Id.appbar_mainbuilding);
            appBar.AddOnOffsetChangedListener(this);

            fab        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_mainbuilding);
            fab.Click += Fab_Click;

            relativeLayout       = view.FindViewById <RelativeLayout>(Resource.Id.search_frame_mainbuilding);
            relativeLayoutParams = (AppBarLayout.LayoutParams)relativeLayout.LayoutParameters;

            frameLayout     = view.FindViewById <FrameLayout>(Resource.Id.frame_mainbuilding);
            fabLayoutParams = (CoordinatorLayout.LayoutParams)fab.LayoutParameters;

            var rl = view.FindViewById <RelativeLayout>(Resource.Id.relativelayout_floor_buttons_mainbuilding);

            rl.BringToFront();

            buttonUp        = view.FindViewById <FloatingActionButton>(Resource.Id.fab_up_mainbuilding);
            buttonUp.Click += ButtonUp_Click;
            buttonUp.Alpha  = 0.7f;

            buttonDown         = view.FindViewById <FloatingActionButton>(Resource.Id.fab_down_mainbuilding);
            buttonDown.Click  += ButtonDown_Click;
            buttonDown.Alpha   = 0.7f;
            buttonDown.Enabled = false;

            return(view);
        }
Beispiel #16
0
 private void NavigateToFragment(SupportFragment fragment, string tag)
 {
     fragmentTransaction = SupportFragmentManager.BeginTransaction();
     fragmentTransaction.Add(Resource.Id.fragmentContainer, fragment, tag);
     fragmentTransaction.Replace(Resource.Id.fragmentContainer, fragment, tag);
     fragmentTransaction.AddToBackStack(null);
     fragmentTransaction.Commit();
 }
Beispiel #17
0
        public void OnTabSelected(Android.Support.V7.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
        {
            sectionsViewPager.CurrentItem = tab.Position;
//			Drawable icon = actionBar.getSelectedTab().getIcon();
//			if (icon != null) {
//				icon.setAlpha(255);
//			}
        }
Beispiel #18
0
        private void LvMonsterarten_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction();

            DialogAnzeigenMonsterbild d = new DialogAnzeigenMonsterbild(gefiltert.ElementAt(e.Position).Pic);

            d.Show(trans, "");
        }
Beispiel #19
0
        private void MCallBacks_CodeSent(object sender, EventArgs e)
        {
            Dialog = new PhoneVerificationDialog(VERIFICATION_TIMEOUT);

            Android.Support.V4.App.FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            Dialog.Show(ft, "tatattta");
        }
Beispiel #20
0
 public void ReplaceFragment(Context context, Android.Support.V4.App.Fragment newFragment)
 {
     Android.Support.V4.App.FragmentManager     fragmentManager = ((FragmentActivity)context).SupportFragmentManager;
     Android.Support.V4.App.FragmentTransaction ft = fragmentManager.BeginTransaction();
     ft.Replace(Resource.Id.home_frame_layout, newFragment);
     ft.AddToBackStack(null);
     ft.Commit();
 }
Beispiel #21
0
 /// <summary>
 /// Switches the fragment to the selected listview item.
 /// </summary>
 /// <param name="frag">Frag.</param>
 /// <param name="resource">Resource.</param>
 /// <param name="tag">Tag.</param>
 private void switchFragment(Android.Support.V4.App.Fragment frag, int resource, string tag)
 {
     Android.Support.V4.App.FragmentTransaction fragmentTransaction = this.Activity.SupportFragmentManager.BeginTransaction(); //begin the fragment transaction
     fragmentTransaction.SetCustomAnimations(Resource.Layout.EnterAnimation, Resource.Layout.ExitAnimation);                   //add animation to slide new fragment to the left
     fragmentTransaction.AddToBackStack("UserActivity");
     fragmentTransaction.Replace(resource, frag, tag);
     fragmentTransaction.Commit(); //commit the transaction
 }
Beispiel #22
0
 public void RemoveFragment(Context context, Fragment newFragment, string TAG)
 {
     Android.Support.V4.App.FragmentManager     fragmentManager = ((FragmentActivity)context).SupportFragmentManager;
     Android.Support.V4.App.FragmentTransaction ft = fragmentManager.BeginTransaction();
     ft.Remove(newFragment);
     ft.AddToBackStack(TAG);
     ft.Commit();
 }
Beispiel #23
0
        private void CallAutorisationFragment()
        {
            var autorisationFragment = new AutorisationFragment(DAO);
            v4FragmentTransaction fragmentTransaction = SupportFragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.mainFrameLayout, autorisationFragment);
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.Commit();
        }
Beispiel #24
0
        void ShowEmbeddedPageFragment(Fragment fragment)
        {
            FragmentTransaction ft = SupportFragmentManager.BeginTransaction();

            ft.AddToBackStack(null);
            ft.Replace(Resource.Id.fragment_frame_layout, fragment, "hello");

            ft.Commit();
        }
Beispiel #25
0
 public static void NavigateTo(int containerViewId, V4App.Fragment fragment, V4App.FragmentManager fragmentManager)
 {
     if (fragment != null)
     {
         V4App.FragmentTransaction ft = fragmentManager.BeginTransaction();
         ft.Replace(Resource.Id.content_frame, fragment);
         ft.Commit();
     }
 }
Beispiel #26
0
        private void MEventListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            //Show Dialog
            Android.Support.V4.App.FragmentTransaction transaction = FragmentManager.BeginTransaction();
            Dialog_Event dialog_event = new Dialog_Event();

            dialog_event.Show(transaction, "Event");
            Console.WriteLine(mEventList[e.Position].eventType);
        }
Beispiel #27
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Android.Resource.Id.Home:
                mDrawerLayout.OpenDrawer((int)GravityFlags.Left);
                return(true);

            case Resource.Id.toolbarMenu_pricingType:
                if (!mDialogShown)     //avoid double click
                {
                    mDialogShown = true;
                    //show dialog here
                    SupportFragmentTransaction transaction       = SupportFragmentManager.BeginTransaction();
                    PricingTypeDialogFragment  pricingTypeDialog = new PricingTypeDialogFragment();
                    //pass current selected price type t
                    var args = new Bundle();
                    args.PutString("currentPricingType", mCurrentSelectedPriceType);
                    args.PutString("callerActivity", "MainActivity");
                    pricingTypeDialog.Arguments = args;
                    pricingTypeDialog.Show(transaction, "pricingTypeDialogFragment");
                }
                return(true);

            case Resource.Id.toolbarMenu_customer:
                if (!mDialogShown)
                {
                    mDialogShown = true;
                    Intent intent = new Intent(this, typeof(CheckoutSelectCustomerActivity));
                    intent.PutExtra("isCustomer", mCurrentSelectedPriceType == "RUNR" ? false : true);
                    StartActivityForResult(intent, 1);
                }
                return(true);

            case Resource.Id.menuItem_AddNewCustomer:
                if (!mDialogShown)    //customers fragment
                {
                    mDialogShown = true;
                    Intent intent = new Intent(this, typeof(CustomersFragmentAddCustomerActivity));
                    StartActivityForResult(intent, 33);
                }
                return(true);

            case Resource.Id.menuItem_AddNewRunner:
                if (!mDialogShown)    //customers fragment
                {
                    mDialogShown = true;
                    Intent intent = new Intent(this, typeof(RunnersFragmentAddRunnerActivity));
                    StartActivityForResult(intent, 40);
                }
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }
Beispiel #28
0
        void InitMap()
        {
            _mapFragment = new MainMapFragment().Init(FindViewById <ViewGroup>(stops.Resource.Id.mapCointatiner));


            Android.Support.V4.App.FragmentTransaction transaction = SupportFragmentManager.BeginTransaction();
            transaction.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade);
            transaction.Add(stops.Resource.Id.mapCointatiner, _mapFragment);
            transaction.Commit();
        }
Beispiel #29
0
        private void SignInDialog_mOnSignInComplete(object sender, OnSignInEventArgs e)
        {
            SetContentView(Resource.Layout.MainScreen);
            Android.Support.V4.App.FragmentManager     fragmentManager = SupportFragmentManager;
            Android.Support.V4.App.FragmentTransaction transaction     = fragmentManager.BeginTransaction();
            SlidingTabFragment fragment = new SlidingTabFragment();

            transaction.Replace(Resource.Id.sample_content_fragment, fragment);
            transaction.Commit();
        }
Beispiel #30
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     this.SetContentView(Resource.Layout.activity_example);
     Android.Support.V4.App.FragmentManager     fm = this.SupportFragmentManager;
     Android.Support.V4.App.FragmentTransaction ft = fm.BeginTransaction();
     ft.Replace(Resource.Id.container, selectedExampleFragment);
     ft.Commit();
     this.Title = ((ExampleFragment)selectedExampleFragment).Title();
     // Create your application here
 }
Beispiel #31
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your fragment here
            v4App.FragmentTransaction ft       = Activity.SupportFragmentManager.BeginTransaction();
            v4App.Fragment            fragment = new RegisterView(AccountType.Client);

            ft.Replace(Resource.Id.register_frame, fragment);
            ft.Commit();
        }
Beispiel #32
0
        protected override void OnCreate(Bundle bundle)
        {
            SetTheme (Resource.Style.Theme_Sherlock);
            base.OnCreate (bundle);
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            list = FindViewById<ListView> (Resource.Id.list);
            drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
            adapter = new CustomAdapter (this, list_text);
            list.Adapter = adapter;
            fragA = new FragmentA ();
            fragB = new FragmentB ();
            list.ItemClick += (sender, e) => {
                ListView item = sender as ListView;
                int pos = item.CheckedItemPosition;
                TextView t = (TextView) e.View.FindViewById(Resource.Id.textView1);
                string mess = t.Text;
                Bundle args = new Bundle();
                args.PutString("message", mess);
                transaction = SupportFragmentManager.BeginTransaction();
                switch (pos){
                case 0:
                    if(!fragA.IsVisible){
                        fragA.Arguments = args;
                        transaction.Replace(Resource.Id.frame, fragA);
                    }
                    break;
                case 1:
                    if(!fragB.IsVisible){
                        fragB.Arguments = args;
                        transaction.Replace(Resource.Id.frame, fragB);
                    }
                    break;

                }
                transaction.Commit();
                list.SetItemChecked(pos, true);
                drawer.CloseDrawer(list);

            };

            mDrawerToggle = new Android.Support.V4.App.ActionBarDrawerToggle(this, drawer,  Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close)
            {
            };
            drawer.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled (true);
            SupportActionBar.SetHomeButtonEnabled(true);
            // Get our button from the layout resource,
            // and attach an event to it
        }
Beispiel #33
0
        public void OnTabReselected(SherlockActionBar.Tab tab, FragmentTransaction transaction)
        {
            _currentTabTag = (String)tab.Tag;

            switch (_currentTabTag)
            {
                case "track":
                    RenderTrackItTabFragment(transaction);
                    break;
            }
        }
        public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
        {
            // When the given tab is selected, switch to the corresponding page in
            // the ViewPager.
            int pos = tab.Position;
            mViewPager.CurrentItem = pos;

            Fragment fragment = ((FragmentPagerAdapter) mViewPager.Adapter).GetItem(pos);
            if (fragment is FragmentListener)
            {
                ((FragmentListener) fragment).OnFragmentSelected();
            }
        }
 public void OnTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction)
 {
 }
Beispiel #36
0
        private void RenderTrackItTabFragment(FragmentTransaction transaction)
        {
            if (_isMapView)
            {
                if (_fightitFragment != null)
                {
                    transaction.Hide(_fightitFragment);
                }

                InitMapFragment();
                transaction.Show(_mapFragment);
                SetupMapIfNeeded();
            }
            else
            {
                if (_mapFragment != null)
                {
                    transaction.Hide(_mapFragment);
                }

                if (_fightitFragment == null)
                {
                    _fightitFragment = new FightItFragment();
                    transaction.Add(Resource.Id.fragmentContainer, _fightitFragment, "fight");
                }
                else
                {
                    transaction.Show(_fightitFragment);
                }
            }

            if (_listToggleButton != null)
            {
                _listToggleButton.Text = _isMapView ? "List" : "Map";
                _listToggleButton.Visibility = ViewStates.Visible;
            }
        }
Beispiel #37
0
        public void OnTabUnselected(SherlockActionBar.Tab tab, FragmentTransaction transaction)
        {
            DebugHelper.WriteDebugEntry("In IntroActivity OnTabUnselected()");
            var unselectedTabTag = (String)tab.Tag;

            switch (unselectedTabTag)
            {
                case "report":
                    if (_reportFragment != null)
                    {
                        transaction.Hide(_reportFragment);
                    }

                    break;

                case "track":
                case "fight":
                    if (_mapFragment != null)
                    {
                        transaction.Hide(_mapFragment);
                    }

                    if (_fightitFragment != null)
                    {
                        transaction.Hide(_fightitFragment);
                    }

                    break;


            }


        }
Beispiel #38
0
        public void OnTabSelected(SherlockActionBar.Tab tab, FragmentTransaction transaction)
        {
            DebugHelper.WriteDebugEntry("In IntroActivity OnTabSelected(): " + tab.Tag);
            _currentTabTag = (String)tab.Tag;

            switch (_currentTabTag)
            {


                case "track":
                    RenderTrackItTabFragment(transaction);
                    break;

                case "report":
                    if (_reportFragment == null)
                    {
                        _reportFragment = new ReportCrueltyFragment();
                        transaction.Add(Resource.Id.fragmentContainer, _reportFragment, "report");
                    }
                    else
                    {
                        transaction.Show(_reportFragment);
                    }

                    if (_listToggleButton != null)
                    {
                        _listToggleButton.Visibility = ViewStates.Gone;
                    }

                    break;
            }

        }
		/**
	     * Called just before a fragment replacement transaction is committed in response to an intent
	     * being fired and substituted for a fragment.
	     */
		protected virtual void OnBeforeCommitReplaceFragment (FragmentManager fm, FragmentTransaction ft, Fragment fragment)
		{
		}
 public void OnTabUnselected(ActionBar.Tab tab, FragmentTransaction ft)
 {
 }
Beispiel #41
0
		public void OnTabReselected (Tab tab, FragmentTransaction transaction)
		{
		}