protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Tuple<Beacon, Region> stuff = this.GetBeaconAndRegion();
            _beacon = stuff.Item1;
            _region = stuff.Item2;

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            SetContentView(Resource.Layout.distance_view);
            _dotView = FindViewById(Resource.Id.dot);

            _sonar = FindViewById(Resource.Id.sonar);
            _sonar.ViewTreeObserver.AddOnGlobalLayoutListener(this);

            _findBeacon = new FindSpecificBeacon(this);
            _findBeacon.BeaconFound += (sender, e) => RunOnUiThread(() =>{
                                                                        Log.Debug(Tag, "Found the beacon!");
                                                                        if (_segmentLength == -1)
                                                                        {
                                                                            return;
                                                                        }
                                                                        _dotView.Animate().TranslationY(ComputeDotPosY(e.FoundBeacon)).Start();
                                                                    });
        }
Ejemplo n.º 2
0
            public LoadingBarController(View flashBarView)
            {
                barView = flashBarView;
                barAnimator = barView.Animate ();
                messageView = barView.FindViewById<TextView> (Resource.Id.loadingBarMessage);

                HideBar (true);
            }
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var rootView = inflater.Inflate (Resource.Layout.ztranslation, container, false);


			//Find view to apply Z-translation to
			floatingShape = rootView.FindViewById (Resource.Id.circle);

			//Create the outlines
			mOutline = new Outline ();

			circleProvider = new CircleOutlineProvider ();
			circleProvider.GetOutline (floatingShape, mOutline);

			rectProvider = new RectOutlineProvider ();
			rectProvider.GetOutline (floatingShape, mOutline);
			/*
			//Define the view's shape
			floatingShape.OutlineProvider = circleProvider;
			//Clip view to outline
			floatingShape.ClipToOutline = true;
			*/
			var dragLayout = rootView.FindViewById<DragFrameLayout> (Resource.Id.main_layout);

			dragLayout.mDragFrameLayoutController = new DragFrameLayoutController ((bool captured) => {
				floatingShape.Animate ()
					.TranslationZ (captured ? 50 : 0)
					.SetDuration (100);
				Log.Debug (TAG, captured ? "drag" : "drop");
			});

			dragLayout.AddDragView (floatingShape);

			rootView.FindViewById (Resource.Id.raise_bt).Click += delegate {
				mElevation += ELEVATION_STEP;
				Log.Debug (TAG, string.Format ("Elevation: {0:0.#}", mElevation));
				floatingShape.Elevation = mElevation;
			};

			rootView.FindViewById (Resource.Id.lower_bt).Click += delegate {
				mElevation = Math.Max (mElevation - ELEVATION_STEP, 0);
				Log.Debug (TAG, string.Format ("Elevation: {0:0.#}", mElevation));
				floatingShape.Elevation = mElevation;
			};

			/* Create a spinner with options to change the shape of the object. */
			var spinner = rootView.FindViewById<Spinner> (Resource.Id.shapes_spinner);
			spinner.Adapter = new ArrayAdapter<string> (
				this.Activity,
				Android.Resource.Layout.SimpleSpinnerDropDownItem,
				this.Resources.GetStringArray (Resource.Array.shapes));

			spinner.OnItemSelectedListener = this;
			return rootView;
		}
Ejemplo n.º 4
0
        public FlashBarController(View flashBarView)
        {
            barView = flashBarView;
            barAnimator = barView.Animate ();

            messageView = barView.FindViewById<TextView> (Resource.Id.flashbar_message);
            var flashBarBtn = barView.FindViewById<Button> (Resource.Id.flashbar_button);
            flashBarBtn.Click += delegate {
                HideBar (false);
                if (flashBarCallback != null)
                    flashBarCallback ();
            };
            hideRunnable = () => HideBar(false);

            HideBar (true);
        }
Ejemplo n.º 5
0
        public bool OnTouch(View v, MotionEvent e)
        {
            switch (e.Action)
            {
                case MotionEventActions.Down:
                    _viewX = v.GetX() - e.RawX;
                    _viewY = v.GetY() - e.RawY;

                    break;
                case MotionEventActions.Move:

                    v.Animate()
                        .X(e.RawX + _viewX)
                       .Y(e.RawY + _viewY)
                       .SetDuration(0)
                       .Start();
                    break;
                default: return false;

            }
            return true;
        }
		protected void Animate (View view, int xTranslation, int alpha, SwipeAnimatorListenerAdapter animatorListener)
		{
			view.Animate ().TranslationX (xTranslation).Alpha (alpha).SetDuration (AnimationTime).SetListener (animatorListener);
		}
Ejemplo n.º 7
0
		protected override void OnCreate(Bundle savedInstanceState)
		{
			base.OnCreate(savedInstanceState);
			this.OverridePendingTransition(Resource.Animation.slide_right,Resource.Animation.slide_left);
			PostRootView = this.BindingInflate(Resource.Layout.PostView, null);

			SetContentView (PostRootView);
			PostRootView.ViewTreeObserver.AddOnGlobalLayoutListener (this);

			txtName = (EditText)PostRootView.FindViewById (Resource.Id.post_view_comments_editText_name);
			txtEmail = (EditText)PostRootView.FindViewById (Resource.Id.post_view_comments_editText_email);

			if (Settings.wpLoggedIn) {
				txtName.Visibility = ViewStates.Gone;
				txtEmail.Visibility = ViewStates.Gone;
			}

			ObservableWebview web = (ObservableWebview)this.FindViewById (Resource.Id.post_view_webview);
			WebSettings settings = web.Settings;
			settings.DefaultTextEncodingName = "utf-8";


			PostViewModel.PropertyChanged += (sender, e) => {
				if(e.PropertyName == "Html") {
					web.LoadData (((PostViewModel)base.ViewModel).Html,"text/html; charset=utf-8","utf-8");
				}
			};

			CommentsView = PostRootView.FindViewById (Resource.Id.post_view_comments_layout);
			InputCommentEditText = PostRootView.FindViewById (Resource.Id.post_view_comments_editText);

			PostViewModel.CommentPressed += (sender, e) => {
				if (IsCommentsViewAnimating) return;
				if(CommentsView.Visibility == ViewStates.Visible){
					//hide softkeyboard
					HideSoftkeyboard ();
					//hide
					IsCommentsViewAnimating = true;
					var al = new AnimatorListener();
					al.OnAnimationEndAction  = (Animator animation) => {
						CommentsView.Visibility = ViewStates.Gone;
						IsCommentsViewAnimating = false;
					};
					CommentsView.Animate().TranslationX(CommentsView.Width).SetListener(al).SetDuration(200);
				} else {
					//show
					IsCommentsViewAnimating = true;
					var al = new AnimatorListener();
					al.OnAnimationEndAction  = (Animator animation) => {
						IsCommentsViewAnimating = false;
					};
					if (CommentsView.TranslationX < PostRootView.Width){
						//width of the view is zero before layout
						CommentsView.TranslationX = PostRootView.Width; //set to right
					}
					CommentsView.Visibility = ViewStates.Visible;
					CommentsView.Animate().TranslationX(0).SetListener(al).SetDuration(200);
				}
			};

			PostViewModel.PostCommentPressed += (sender, e) => {
				HideSoftkeyboard ();

				((EditText)InputCommentEditText).Text = string.Empty;//using binding
			};

			PostViewModel.ErrorHandler += (sender, e) => {
				ErrorEventArgs ee = (ErrorEventArgs)e;
				var dispatcher = Mvx.Resolve<IMvxMainThreadDispatcher> ();
				dispatcher.RequestMainThreadAction (() => {
					AlertDialog.Builder builder = new AlertDialog.Builder (this);
					builder.SetTitle (ee.Title);
					builder.SetMessage (ee.Message);
					builder.SetNegativeButton (ee.CloseTitle, (EventHandler<DialogClickEventArgs>)null);
					builder.Show ();
				});
			};


			View BottomView = PostRootView.FindViewById (Resource.Id.post_view_bottom_layout);
			web.BottomReached += (sender, e) => {
				if (IsBottomViewAnimating) return;
				if(BottomView.Visibility == ViewStates.Gone) {
					//show
					IsBottomViewAnimating = true;
					var al = new AnimatorListener();
					al.OnAnimationEndAction  = (Animator animation) => {
						IsBottomViewAnimating = false;
					};
					if (BottomView.TranslationY < PostRootView.Height){
						//width of the view is zero before layout
						BottomView.TranslationY = PostRootView.Height; //set to right
					}
					BottomView.Visibility = ViewStates.Visible;
					BottomView.Animate().TranslationY(0).SetListener(al).SetDuration(500);
				}
			};

			web.UnBottomReached += (sender, e) => {
				if (IsBottomViewAnimating) return;
				if(BottomView.Visibility == ViewStates.Visible){
					//hide
					IsBottomViewAnimating = true;
					var al = new AnimatorListener();
					al.OnAnimationEndAction  = (Animator animation) => {
						BottomView.Visibility = ViewStates.Gone;
						IsBottomViewAnimating = false;
					};
					BottomView.Animate().TranslationY(BottomView.Height).SetListener(al).SetDuration(500);
				} 
			};

			this.StartCalled += (sender, e) => PostViewModel.LoadPost();
			//this.OnBackPressed
		}
		private void RunShowActionAreaAnimation(View parent, View area)
		{
			area.PivotY = 0;
			area.PivotX = parent.Width / 2f;

			area.Alpha = 0.5f;
			area.RotationX = -90;
			area.Animate ().RotationX (0f).Alpha (1f).SetDuration (400);
		}
Ejemplo n.º 9
0
        public bool OnTouch(View view, MotionEvent e)
        {
            switch (e.Action)
            {
                case MotionEventActions.Down:
                    LastTouchY = e.GetY();
                    return true;
                case MotionEventActions.Move:
                    float CurrentYTouched = e.GetY();
                    float Change = LastTouchY - CurrentYTouched;

                    float translationY = view.TranslationY;

                    translationY -= Change;

                    if (translationY < 0)
                    { //Um zu gewährleisten, dass man das Fragment immer hoch ziehen kann
                        translationY = 0;
                    }
                    else if (translationY > view.Height*360/400)
                    {
                        translationY = view.Height*360/400;
                    }

                    view.TranslationY = translationY;

                    return true;
                case MotionEventActions.Outside:
                    if (view.TranslationY <= 340)
                    {
                        view.Animate().SetDuration(500).SetInterpolator(new Android.Views.Animations.OvershootInterpolator(5)).TranslationY(360);
                    }
                    return true;
                default:
                    return true;
            }
        }
Ejemplo n.º 10
0
			public override View GetView (int position, View convertView, ViewGroup parent)
			{
				if (convertView == null) {
					var inflater = LayoutInflater.FromContext (context);
					convertView = inflater.Inflate (Resource.Layout.ProductListItem, parent, false);
					convertView.Id = 0x60000000;
				}
				convertView.Id++;
				var imageView = convertView.FindViewById<ImageView> (Resource.Id.productImage);
				var nameLabel = convertView.FindViewById<TextView> (Resource.Id.productTitle);
				var priceLabel = convertView.FindViewById<TextView> (Resource.Id.productPrice);
				var progressView = convertView.FindViewById<ProgressBar> (Resource.Id.productImageSpinner);

				var product = Products [position];
				nameLabel.Text = product.Name;
				priceLabel.Text = product.PriceDescription;

				LoadProductImage (convertView, progressView, imageView, product);

				if (((newItems >> position) & 1) == 0) {
					newItems |= 1L << position;
					var density = context.Resources.DisplayMetrics.Density;
					convertView.TranslationY = 60 * density;
					convertView.RotationX = 12;
					convertView.ScaleX = 1.1f;
					convertView.PivotY = 180 * density;
					convertView.PivotX = parent.Width / 2;
					convertView.Animate ()
						.TranslationY (0)
						.RotationX (0)
						.ScaleX (1)
						.SetDuration (450)
						.SetInterpolator (appearInterpolator)
						.Start ();
				}

				return convertView;
			}
Ejemplo n.º 11
0
		public bool OnTouch(View v, MotionEvent e)
		{
			if (v == TakePictureImageView)
			{
				if (!CameraStarted)
				{
					float dx = 0;
					switch (e.Action)
					{
						case MotionEventActions.Down:
							dx = e.RawX;
							break;
						case MotionEventActions.Move:
							float change = e.RawX + dx - TakePictureImageView.LayoutParameters.Width / 2;
							if (change > FlipImageView.GetX())
							{
								View.SetOnTouchListener(null);
								UploadPicture();
							}

							else if (change < CommentImageView.GetX())
							{
								View.SetOnTouchListener(null);
								ToPostPage();
							}
							else {
								v.Animate().X(change).SetDuration(0).Start();
							}
							break;
						case MotionEventActions.Up:
							v.Animate().TranslationX(0).SetDuration(100).Start();
							break;
						default:
							break;
					}
				}
				else {
					TakePicture();
					return false;
				}
			}
			return true;
		}