Esempio n. 1
0
        void ShowDetails(int playId)
        {
            currentPlayId = playId;
            if (isDualPane)
            {
                // We can display everything in-place with fragments.
                // Have the list highlight this item and show the data.
                ListView.SetItemChecked(playId, true);

                // Check what fragment is shown, replace if needed.
                var details = FragmentManager.FindFragmentById(Resource.Id.details) as DetailsFragment;
                if (details == null || details.ShownPlayId != playId)
                {
                    // Make new fragment to show this selection.
                    details = DetailsFragment.NewInstance(playId);

                    // Execute a transaction, replacing any existing
                    // fragment with this one inside the frame.
                    var ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.details, details);
                    ft.SetTransition(FragmentTransit.FragmentFade);
                    ft.Commit();
                }
            }
            else
            {
                // Otherwise we need to launch a new activity to display
                // the dialog fragment with selected text.
                var intent = new Intent();

                intent.SetClass(Activity, typeof(DetailsActivity));
                intent.PutExtra("current_play_id", playId);
                StartActivity(intent);
            }
        }
Esempio n. 2
0
        public static DetailsFragment NewInstance(int playId)
        {
            var detailsFrag = new DetailsFragment {
                Arguments = new Bundle()
            };

            detailsFrag.Arguments.PutInt("current_play_id", playId);
            return(detailsFrag);
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var index = Intent.Extras.GetInt("current_play_id", 0);

            var details             = DetailsFragment.NewInstance(index); // Details
            var fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.Add(Android.Resource.Id.Content, details);
            fragmentTransaction.Commit();
        }
 public static DetailsFragment NewInstance(int playId)
 {
     var detailsFrag = new DetailsFragment { Arguments = new Bundle() };
     detailsFrag.Arguments.PutInt("current_play_id", playId);
     return detailsFrag;
 }