public static ContentFragment NewInstance(int resId) { ContentFragment contentFragment = new ContentFragment(); Bundle bundle = new Bundle(); bundle.PutInt("ContentResId", resId); contentFragment.Arguments = bundle; return(contentFragment); }
private IScreenShotable ReplaceFragment(IScreenShotable screenShotable, int topPosition) { res = res == Resource.Drawable.content_music ? Resource.Drawable.content_films : Resource.Drawable.content_music; View view = FindViewById(Resource.Id.content_frame); int finalRadius = Math.Max(view.Width, view.Height); var animator = ViewAnimationUtils.CreateCircularReveal(view, 0, topPosition, 0, finalRadius); animator.SetInterpolator(new Android.Views.Animations.AccelerateInterpolator()); animator.SetDuration(Yalantis.Com.Sidemenu.Util.ViewAnimator.CircularRevealAnimationDuration); FindViewById(Resource.Id.content_overlay).Background = new Android.Graphics.Drawables.BitmapDrawable(Resources, screenShotable.Bitmap); animator.Start(); ContentFragment contentFragment = ContentFragment.NewInstance(res); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, contentFragment).Commit(); return(contentFragment); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); contentFragment = ContentFragment.NewInstance(Resource.Drawable.content_music); SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.content_frame, contentFragment) .Commit(); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawerLayout.SetScrimColor(Android.Graphics.Color.Transparent); linearLayout = FindViewById <LinearLayout>(Resource.Id.left_drawer); linearLayout.SetOnClickListener(new ViewOnClick(v => { drawerLayout.CloseDrawers(); })); SetActionBar(); CreateMenuList(); viewAnimator = new Yalantis.Com.Sidemenu.Util.ViewAnimator(this, list, contentFragment, drawerLayout, this); }