//Called when the page is created protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); int mealId = Intent.GetIntExtra ("mealId", 0); Console.WriteLine ("Recipe Id: " + mealId); SetContentView (Resource.Layout.Walkthrough); vp = FindViewById<ViewPager> (Resource.Id.walkthrough_pager); //Store pointers to timer frames to be referenced by the fragments timerFrames = new TimerDisplayFrame[5]; timerFrames [0] = new TimerDisplayFrame(FindViewById<ViewGroup> (Resource.Id.walkthrough_frame_1)); timerFrames [1] = new TimerDisplayFrame(FindViewById<ViewGroup> (Resource.Id.walkthrough_frame_2)); timerFrames [2] = new TimerDisplayFrame(FindViewById<ViewGroup> (Resource.Id.walkthrough_frame_3)); timerFrames [3] = new TimerDisplayFrame(FindViewById<ViewGroup> (Resource.Id.walkthrough_frame_4)); timerFrames [4] = new TimerDisplayFrame(FindViewById<ViewGroup> (Resource.Id.walkthrough_frame_5)); timerPoolHandler = new TimerPoolHandler (timerFrames); //TODO fix steps = WebUtils.getRecipeSteps (mealId); fragmentCount = steps.Length + 1; Console.WriteLine (mealId); Console.WriteLine (steps.ToString()); vp.Adapter = new StepFragmentPagerAdapter (SupportFragmentManager, steps, timerPoolHandler); //Set up the progress dots to appear at the bottom of the screen ViewGroup pd = (ViewGroup) FindViewById (Resource.Id.walkthrough_progress_dots); NavDot[] progressDots = new NavDot[fragmentCount]; Drawable open = Resources.GetDrawable (Resource.Drawable.circle_open); for (int i = 0; i < progressDots.Length; i++) { NavDot dot = new NavDot (this); dot.SetMaxWidth(30); dot.SetImageDrawable (open); pd.AddView (dot); dot.Num = i; dot.Click += delegate { Console.WriteLine("Going to page " + dot.Num); vp.SetCurrentItem (dot.Num, true); }; progressDots [i] = dot; } progressDots[0].SetImageDrawable (Resources.GetDrawable(Resource.Drawable.circle_closed)); ViewGroup pbs = (ViewGroup)FindViewById (Resource.Id.walkthrough_progress_bars); vp.AddOnPageChangeListener (new StepChangeListener (progressDots, open, Resources.GetDrawable(Resource.Drawable.circle_closed))); }
public StepFragmentPagerAdapter(Android.Support.V4.App.FragmentManager fm, RecipeStep[] steps, TimerPoolHandler handler) : base(fm) { this.steps = steps; this.handler = handler; }
public StepFragment(RecipeStep s, TimerPoolHandler h) { this.recipeStep = s; this.handler = h; }