/// <summary>
        /// Static builder
        /// </summary>
        /// <param name="activity"></param>
        /// <returns></returns>
        public static ExplosionView AttachToWindow(Activity activity)
        {
            var rootView       = (ViewGroup)activity.FindViewById(Window.IdAndroidContent);
            var explosionField = new ExplosionView(activity);

            rootView.AddView(explosionField, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
            return(explosionField);
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            var button1 = FindViewById <ImageView>(Resource.Id.ivtwitter);
            var button2 = FindViewById <ImageView>(Resource.Id.ivfacebook);
            var button3 = FindViewById <ImageView>(Resource.Id.ivinstagram);
            var button4 = FindViewById <ImageView>(Resource.Id.ivlinkedin);
            var button5 = FindViewById <ImageView>(Resource.Id.ivreddit);
            var button6 = FindViewById <ImageView>(Resource.Id.ivsnapchat);

            // This creates the explosion view used to display the particals at the root of the content display.
            // This is expecting an activity ideally, so this would be a little different if used inside of a fragment, so bear that in mind.
            Xama.JTPorts.ExplosionView.ExplosionView explosionField = new Xama.JTPorts.ExplosionView.ExplosionView(this);

            // Could be hooked up to an on click event of your control if you wish.
            button1.Click += (s, e) =>
            {
                explosionField.Explode(button1);
            };
            button2.Click += (s, e) =>
            {
                explosionField.Explode(button2);
            };
            button3.Click += (s, e) =>
            {
                explosionField.Explode(button3);
            };
            button4.Click += (s, e) =>
            {
                explosionField.Explode(button4);
            };
            button5.Click += (s, e) =>
            {
                explosionField.Explode(button5);
            };
            button6.Click += (s, e) =>
            {
                explosionField.Explode(button6);
            };
        }