Ejemplo n.º 1
0
        /**
         * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.
         * If the currently visible view is the last view, flip direction will be reversed for this transition.
         *
         * @param viewAnimator the {@code ViewAnimator}
         * @param dir the direction of flip
         * @param duration the transition duration in milliseconds
         */

        public static void FlipTransition(ViewAnimator viewAnimator, FlipDirection dir, long duration)
        {
            View fromView     = viewAnimator.CurrentView;
            int  currentIndex = viewAnimator.DisplayedChild;
            int  nextIndex    = (currentIndex + 1) % viewAnimator.ChildCount;

            View toView = viewAnimator.GetChildAt(nextIndex);

            Animation[] animc = AnimationFactory.FlipAnimation(fromView, toView,
                                                               (nextIndex < currentIndex ? dir.OtherDirection() : dir), duration, new AnticipateOvershootInterpolator());

            viewAnimator.OutAnimation = animc[0];
            viewAnimator.InAnimation  = animc[1];

            viewAnimator.ShowNext();
        }
Ejemplo n.º 2
0
 public override bool OnOptionsItemSelected(IMenuItem item)
 {
     switch (item.ItemId)
     {
     case Resource.Id.menu_toggle_log:
         mLogShown = !mLogShown;
         ViewAnimator output = FindViewById <ViewAnimator> (Resource.Id.sample_output);
         if (mLogShown)
         {
             output.DisplayedChild = 1;
         }
         else
         {
             output.DisplayedChild = 0;
         }
         SupportInvalidateOptionsMenu();
         return(true);
     }
     return(base.OnOptionsItemSelected(item));
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.sample_gallery_activity);

            animator = FindViewById<ViewAnimator>(Resource.Id.animator);
            imageView = FindViewById<ImageView>(Resource.Id.image);

            FindViewById(Resource.Id.go).Click += delegate
            {
                Intent gallery = new Intent(Intent.ActionPick, MediaStore.Images.Media.ExternalContentUri);
                StartActivityForResult(gallery, GalleryRequest);
            };

            if (savedInstanceState != null)
            {
                image = savedInstanceState.GetString(ImageKey);
                if (image != null)
                {
                    LoadImage();
                }
            }
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.sample_gallery_activity);

            animator  = FindViewById <ViewAnimator>(Resource.Id.animator);
            imageView = FindViewById <ImageView>(Resource.Id.image);

            FindViewById(Resource.Id.go).Click += delegate
            {
                Intent gallery = new Intent(Intent.ActionPick, MediaStore.Images.Media.ExternalContentUri);
                StartActivityForResult(gallery, GalleryRequest);
            };

            if (savedInstanceState != null)
            {
                image = savedInstanceState.GetString(ImageKey);
                if (image != null)
                {
                    LoadImage();
                }
            }
        }
Ejemplo n.º 5
0
        /**
         * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.
         * If the currently visible view is the last view, flip direction will be reversed for this transition.
         *
         * @param viewAnimator the {@code ViewAnimator}
         * @param dir the direction of flip
         */

        public static void FlipTransition(ViewAnimator viewAnimator, FlipDirection dir)
        {
            FlipTransition(viewAnimator, dir, _defaultFlipTransitionDuration);
        }
Ejemplo n.º 6
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView (Resource.Layout.Main);

			//MainView
			ivMainImg = FindViewById<ImageView> (Resource.Id.ivMainImg);
			txtMainTemp = FindViewById<TextView> (Resource.Id.txtMainTemp);
			txtMainMaxMin = FindViewById<TextView> (Resource.Id.txtMainMaxMin);

			ivMainImg.SetImageResource(Android.Resource.Color.Transparent);

			windowHolder = FindViewById<ViewAnimator> (Resource.Id.vaWindowHold);

			windowHolder.AddView(LayoutInflater.Inflate(Resource.Layout.SingleDayView, null));
			windowHolder.AddView(LayoutInflater.Inflate(Resource.Layout.FiveDayForecast, null));
			windowHolder.AddView(LayoutInflater.Inflate(Resource.Layout.SelectCity, null));

			//SingleDayView
			txtFeelsLikeTemp = FindViewById<TextView> (Resource.Id.txtFeelsLikeTemp);
			txtWindDisplay = FindViewById<TextView> (Resource.Id.txtWindDisplay);
			txtWeatherStory = FindViewById<TextView> (Resource.Id.txtWeatherStory);
			txtPressureValue = FindViewById<TextView> (Resource.Id.txtPressureValue);
			txtHumidityValue = FindViewById<TextView> (Resource.Id.txtHumidityValue);
			txtDewPointValue = FindViewById<TextView> (Resource.Id.txtDewPointValue);
			txtPrecipitationValue = FindViewById<TextView> (Resource.Id.txtPrecipitationValue);

			//FiveDayView
			lvForecast = FindViewById<ListView> (Resource.Id.lvForecast);

			//CitySelector
			lvCities = FindViewById<ListView> (Resource.Id.lvCities);
			cityNames = Resources.GetStringArray (Resource.Array.city_names);
			lvCities.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, cityNames);
			lvCities.ItemClick += OnCitySelect;

			//TouchEvents
			_gestureDetector = new GestureDetector(this);

			setSwipeMinDistance (100);
			setSwipeMaxDistance (350);
			setSwipeMinVelocity (100);
		}
Ejemplo n.º 7
0
        /**
	 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.  
	 * If the currently visible view is the last view, flip direction will be reversed for this transition.
	 *  
	 * @param viewAnimator the {@code ViewAnimator}
	 * @param dir the direction of flip
	 * @param duration the transition duration in milliseconds
	 */

        public static void FlipTransition(ViewAnimator viewAnimator, FlipDirection dir, long duration)
        {

            View fromView = viewAnimator.CurrentView;
            int currentIndex = viewAnimator.DisplayedChild;
            int nextIndex = (currentIndex + 1)%viewAnimator.ChildCount;

            View toView = viewAnimator.GetChildAt(nextIndex);

            Animation[] animc = AnimationFactory.FlipAnimation(fromView, toView,
                (nextIndex < currentIndex ? dir.OtherDirection() : dir), duration, new AnticipateOvershootInterpolator());

            viewAnimator.OutAnimation = animc[0];
            viewAnimator.InAnimation = animc[1];

            viewAnimator.ShowNext();
        }
Ejemplo n.º 8
0
        /**
	 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will initiate a {@link FlipAnimation} to show the next View.  
	 * If the currently visible view is the last view, flip direction will be reversed for this transition.
	 *  
	 * @param viewAnimator the {@code ViewAnimator}
	 * @param dir the direction of flip
	 */

        public static void FlipTransition(ViewAnimator viewAnimator, FlipDirection dir)
        {
            FlipTransition(viewAnimator, dir, _defaultFlipTransitionDuration);
        }