public static FeatureHighlightFragment newInstance(int title, int message, int image) { var f = new FeatureHighlightFragment(); Bundle bdl = new Bundle(2); bdl.PutInt(EXTRA_TITLE, title); bdl.PutInt(EXTRA_MESSAGE, message); bdl.PutInt(EXTRA_IMAGE, image); f.Arguments = bdl; return(f); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.main_feature_highlight_fragment, container, false); _pager = view.FindViewById <ViewPager>(Resource.Id.pager); var adapter = new GenericFragmentPagerAdaptor(ChildFragmentManager); adapter.AddFragment(FeatureHighlightFragment.newInstance(Resource.String.TourChadderTitle, Resource.String.TourChadderMessage, Resource.Drawable.tour_chadder)); adapter.AddFragment(FeatureHighlightFragment.newInstance(Resource.String.TourEraseTitle, Resource.String.TourEraseMessage, Resource.Drawable.tour_erase)); adapter.AddFragment(FeatureHighlightFragment.newInstance(Resource.String.TourDevicesTitle, Resource.String.TourDevicesMessage, Resource.Drawable.tour_devices)); _pager.Adapter = adapter; var mIndicator = view.FindViewById <CirclePageIndicator>(Resource.Id.indicator); mIndicator.SetViewPager(_pager); var btn = view.FindViewById <Button>(Resource.Id.login); btn.Click += (object sender, EventArgs e) => { var fragment = new LoginFragment(); var transaction = Activity.SupportFragmentManager.BeginTransaction(); transaction.SetCustomAnimations(Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight, Resource.Animation.SlideInRight, Resource.Animation.SlideOutLeft); transaction.Replace(Resource.Id.content_frame, fragment); transaction.AddToBackStack(null); transaction.Commit(); }; btn = view.FindViewById <Button>(Resource.Id.signup); btn.Click += (object sender, EventArgs e) => { var fragment = new RegisterFragment(); var transaction = Activity.SupportFragmentManager.BeginTransaction(); transaction.SetCustomAnimations(Resource.Animation.SlideInRight, Resource.Animation.SlideOutLeft, Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight); transaction.Replace(Resource.Id.content_frame, fragment); transaction.AddToBackStack(null); transaction.Commit(); }; return(view); }