Пример #1
0
 public GestureViewRenderer()
 {
     _gestureListener = new DroidGestureViewTouchListener();
     _gestureDetector = new GestureDetector(_gestureListener);
     _scaleListener = new DroidGestureViewScaleListener();
     _scaleDetector = new ScaleGestureDetector(Context, _scaleListener);
 }
        protected override void OnCreate (Bundle savedInstanceState)
        {
            bool pageLoadSelection = true;
            base.OnCreate (savedInstanceState);

            var doubleTapDetector = new GestureDetector (this, new DoubleTapGestureListener ());
            doubleTapDetector.DoubleTap += (sender, e) => ShowAlert ("DoubleTap Alert", "DoubleTap");
            // Create your application here
            SetContentView(Resource.Layout.TapTests);
            ActionBar.SetHomeButtonEnabled (true);
            ActionBar.SetDisplayHomeAsUpEnabled (true);

            Button tapButton = FindViewById<Button> (Resource.Id.tap_test_tap_button);
            Button doubleTapButton = FindViewById<Button> (Resource.Id.tap_test_double_tap_button);
            Button longPressButton = FindViewById<Button> (Resource.Id.tap_test_long_press_button);
            Spinner spinner = FindViewById<Spinner> (Resource.Id.tap_test_spinner);

            var adapter = ArrayAdapter.CreateFromResource (this, Resource.Array.tap_test_spinner_array, global::Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource (global::Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
                
            tapButton.Click += (sender, e) => ShowAlert ("Tap Alert", "Tap");
            doubleTapButton.Touch += (sender, e) => doubleTapDetector.OnTouchEvent (e.Event);
            longPressButton.LongClick += (sender, e) => ShowAlert ("LongPress Alert", "LongPress");
            spinner.ItemSelected += (sender, e) => {
                if (!pageLoadSelection) {
                    var selection = spinner.GetItemAtPosition(e.Position);
                    ShowAlert("You chose " + selection, selection.ToString());
                }
                pageLoadSelection = false;
            };
        }
Пример #3
0
    protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.MainScreenActivityView);
			//this.Window.AddFlags(WindowManagerFlags.Fullscreen);
			PopulateTabs ();
            _tabHost = FindViewById<TabHost>(Resource.Id.tabHost1);
            //set selected tab if there is a topic (coming from a notification)
            try
            {
			string topic = Intent.GetStringExtra("topic");
			if (topic != null) {

                    _tabHost.SetCurrentTabByTag (topic);
			}
			}
			catch(Exception e) {
				
			}
            
            _refresher = FindViewById<SwipeRefreshLayout>(Resource.Id.refresher1);
            _refresher.Refresh += delegate {
                PopulateSermons();
                PopulatePrayerRequests();
                PopulateElders();
                _refresher.Refreshing = false;
            };

            _gestureListener = new GestureListener();
            _gestureListener.LeftEvent += GestureRight;
            _gestureListener.RightEvent += GestureLeft;
            _gestureDetector = new GestureDetector(this, _gestureListener);
        }
		protected override void OnCreate (Bundle bundle)
		{
			RequestWindowFeature(WindowFeatures.NoTitle);
			base.OnCreate (bundle); 
			this.SetContentView(Resource.Layout.Home);

			String package = PackageName;


			Glistener = new GestureListener();
			Gdetector = new GestureDetector (this, Glistener);
			var trans = FragmentManager.BeginTransaction ();
			trans.Add (Resource.Id.frame_home,mHomeFragment3,"HomeFragment3");
			trans.Hide (mHomeFragment3);
			trans.Add (Resource.Id.frame_home,mHomeFragment2,"HomeFragment2");
			trans.Hide (mHomeFragment2);
			trans.Add (Resource.Id.frame_home,mHomeFragment1,"HomeFragment1");
			trans.Commit();
			currentFragment = mHomeFragment1;

			Button haz_plif = FindViewById <Button> (Resource.Id.haz_plif);
			FrameLayout fcontainer = FindViewById<FrameLayout> (Resource.Id.frame_home);

			haz_plif.Click += (object sender, EventArgs e) => {
					StartActivity(typeof(login));
					Finish ();
			};
			fcontainer.Touch += Fcontainer_Touch;

			RemoteViews rmv = new RemoteViews(package, Resource.Layout.Home);
			rmv.SetTextViewText(Resource.Id.haz_plif,"Elias was here");
		}
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Add our touch handlers.
            PinchDetector = new ScaleGestureDetector(this, this);
            MoveDetector = new MoveGestureDetector(this, this);
            RotationDetector = new RotateGestureDetector(this, this);

            Detector = new GestureDetector(this, this);
            Detector.IsLongpressEnabled = false;

            MainLayout = (RelativeLayout)FindViewById (Resource.Id.main);
            MainLayout.Touch += HandleTouch;

            // Disable touch handling by the views themselves.
            for(var i = 0; i < MainLayout.ChildCount; i++) {
                var view = MainLayout.GetChildAt(i);
                Log("OnCreate", "View {0} disabled.", i);
                view.Focusable = true;
                view.FocusableInTouchMode = true;
                view.RequestFocus();
            }

            BootstrapDropbox ();
        }
        public PhotoViewDroidAttacher(ImageView imageView)
        {
            mImageView = new Java.Lang.Ref.WeakReference(imageView);
            imageView.DrawingCacheEnabled = true;
            imageView.SetOnTouchListener (this);
            ViewTreeObserver observer = imageView.ViewTreeObserver;
            if (null != observer)
                observer.AddOnGlobalLayoutListener(this);

            // Make sure we using MATRIX Scale Type
            SetImageViewScaleTypeMatrix (imageView);

            if (imageView.IsInEditMode) {
                return;
            }

            // Create Gesture Detectors...
            mScaleDragDetector = VersionedGestureDetector.NewInstance(
                imageView.Context, this);
            mGestureDetector = new GestureDetector (imageView.Context, new MSimpleOnGestureListener (this));

            mGestureDetector.SetOnDoubleTapListener (new DefaultOnDoubleTapListener (this));

            SetZoomable (true);
        }
        public SwipeLayout(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            IsSwipeEnabled = true;
            gestureDetector = new GestureDetector (Context, new SwipeDetector (this));
            mDragHelperCallback = new SwipeLayoutDragHelperCallback (this);

            mDragHelper = ViewDragHelper.Create(this, mDragHelperCallback);
            mTouchSlop = ViewConfiguration.Get(context).ScaledTouchSlop;

            TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.SwipeLayout);
            int dragEdgeChoices = a.GetInt(Resource.Styleable.SwipeLayout_drag_edge, DRAG_RIGHT);
            mEdgeSwipesOffset[(int)DragEdge.Left] = a.GetDimension(Resource.Styleable.SwipeLayout_leftEdgeSwipeOffset, 0);
            mEdgeSwipesOffset[(int)DragEdge.Right] = a.GetDimension(Resource.Styleable.SwipeLayout_rightEdgeSwipeOffset, 0);
            mEdgeSwipesOffset[(int)DragEdge.Top] = a.GetDimension(Resource.Styleable.SwipeLayout_topEdgeSwipeOffset, 0);
            mEdgeSwipesOffset[(int)DragEdge.Bottom] = a.GetDimension(Resource.Styleable.SwipeLayout_bottomEdgeSwipeOffset, 0);
            ClickToClose = a.GetBoolean(Resource.Styleable.SwipeLayout_clickToClose, ClickToClose);

            if ((dragEdgeChoices & DRAG_LEFT) == DRAG_LEFT) {
                mDragEdges.Add(DragEdge.Left, null);
            }
            if ((dragEdgeChoices & DRAG_TOP) == DRAG_TOP) {
                mDragEdges.Add(DragEdge.Top, null);
            }
            if ((dragEdgeChoices & DRAG_RIGHT) == DRAG_RIGHT) {
                mDragEdges.Add(DragEdge.Right, null);
            }
            if ((dragEdgeChoices & DRAG_BOTTOM) == DRAG_BOTTOM) {
                mDragEdges.Add(DragEdge.Bottom, null);
            }
            int ordinal = a.GetInt(Resource.Styleable.SwipeLayout_show_mode, (int)ShowMode.PullOut);
            mShowMode = (ShowMode)System.Enum.ToObject(typeof(ShowMode), ordinal);
            a.Recycle();
        }
		protected override void OnElementChanged (ElementChangedEventArgs<Page> e)
		{
			base.OnElementChanged (e);
		
			_page = (e.NewElement) as GesturedContentPage;
			_gestureDetector = new GestureDetector (new InternalGestureCapture (_page));
		}
 protected override void OnCreate(Bundle bundle) {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.card_kitty);
     kittyImageView = (ImageView)FindViewById(Resource.Id.kittyImage);
     kittyProgressBar = (ProgressBar)FindViewById(Resource.Id.kittyProgress);
     gestureDetector = new GestureDetector(this);
 }
Пример #10
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.Main);
     _textView = FindViewById<TextView>(Resource.Id.velocity_text_view);
     _textView.Text = "Fling Velocity: ";
     _gestureDetector = new GestureDetector(this);
 }
		private static void UnRegister(View oldElement, AndroidViews.View nativeView)
		{
			nativeView.GenericMotion -= HandleGenericMotion;
			nativeView.Touch -= HandleTouch;

			listener = null;
			detector = null;
		}
		private static void Register(View newElement, AndroidViews.View nativeView)
		{
			listener = new Android_GestureListener(newElement.GestureRecognizers.ToList());
			detector = new AndroidViews.GestureDetector(listener);

			nativeView.GenericMotion += HandleGenericMotion;
			nativeView.Touch += HandleTouch;
		}
Пример #13
0
        private new void Init(Context context, IAttributeSet attrs)
        {
            _scrollGestureDetector = new GestureDetector(context,
                new ScrollGestureDetector(_that, ViewConfiguration.Get(context).ScaledTouchSlop));
            AnchorFactor = 0;

            base.Init(context, attrs);
        }
        protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
        {
            base.OnElementChanged (e);

            _frame = e.NewElement as GesturedFrame;
            _gestureDetector = new GestureDetector (new InternalGestureCapture (_frame));

            this.ChildViewAdded += (object sender, ChildViewAddedEventArgs e2) => {
                e2.Child.Touch += (object sender2, TouchEventArgs e3) => _gestureDetector.OnTouchEvent (e3.Event);
            };
        }
		private void Initialize()
		{
			this.SetScaleType(ScaleType.Matrix);
			m_Matrix = new Matrix();
			if (Drawable != null)
			{
				m_IntrinsicWidth = Drawable.IntrinsicWidth;
				m_IntrinsicHeight = Drawable.IntrinsicHeight;
				this.SetOnTouchListener(this);
			}
			m_GestureDetector = new GestureDetector(m_Context, new ScaleImageViewGestureDetector(this));
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.CustomAnimationLayout);

            InitComponents();

            Views = new List<View>();
            GestureDetector = new GestureDetector(this, new GestureListener(this));
            SelectedViewIndex = -1;
        }
		public FloatingActionButton(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context,attrs,defStyleAttr,defStyleRes)
		{
			// When a view is clickable it will change its state to "pressed" on every click.
			Clickable = true;

			// Create a GestureDetector to detect single taps
			gestureDetector = new GestureDetector (context, new MySimpleOnGestureListener (this));

			//A new View is created
			revealView = new View (context);
			AddView (revealView, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
		}
		// ---------------------------------------------------------------------------
		//
		// METHODS
		//
		// ---------------------------------------------------------------------------

		//
		// Use this method to customize the native control as desired
		//
		protected override void OnElementChanged(ElementChangedEventArgs<Image> e) {
			base.OnElementChanged (e);
			if (e.NewElement != null) {
				// Grab the Xamarin.Forms element from the incoming event
				formsElement = e.NewElement as CustomImage;
				// Grab the native implementation of the Xamarin.Forms element from the incoming event
				nativeElement = Control as ImageView;
				// Use this object to handle the touch events coming from the native elemtn
				nativeElement.SetOnTouchListener (this);
				// Create a gesture detector, and use this object to handle its events
				_gestureDetector = new GestureDetector (this);
			}
		}
Пример #19
0
        public ItemTouchListener (RecyclerView recyclerView, IItemTouchListener listener)
        {

            if (recyclerView == null || listener == null) {
                throw new IllegalArgumentException ("RecyclerView and Listener arguments can not be null");
            }

            IsScrolling = false;
            this.recyclerView = recyclerView;
            this.listener = listener;
            gestureDetector = new GestureDetector (recyclerView.Context, this);
            recyclerView.AddOnScrollListener (new RecyclerViewScrollDetector (this));
        }
Пример #20
0
        private void Initialize()
        {
            
			this.Closed +=	new EventHandler<EventArgs>(GameWindow_Closed);            
			clientBounds = new Rectangle(0, 0, Context.Resources.DisplayMetrics.WidthPixels, Context.Resources.DisplayMetrics.HeightPixels);

            gesture = new GestureDetector(new GestureListener((AndroidGameActivity)this.Context));
			
            this.RequestFocus();
            this.FocusableInTouchMode = true;

            this.SetOnTouchListener(this);
        }
		protected override void OnElementChanged (ElementChangedEventArgs<TableView> e)
		{
			base.OnElementChanged (e);
			if (e.NewElement == null) {
				this.GenericMotion -= HandleGenericMotion;
				this.Touch -= HandleTouch;
			}
			if (e.OldElement == null&& e.NewElement!=null) {
				gestureListener = new IndiGestureListener((TableView)e.NewElement);
				gestureDetector = new GestureDetector(gestureListener);
				this.GenericMotion += HandleGenericMotion;
				this.Touch += HandleTouch;
			}
		}
Пример #22
0
 public RecyclerTouchListener(Context context, RecyclerView recyclerView, IOnClickListener clickListener)
 {
     this.clickListener = clickListener;
     var gestureListener = new GenericOnGestureListener();
     gestureListener.ActionOnLongPress = (e) =>
     {
         View child = recyclerView.FindChildViewUnder(e.GetX(), e.GetY());
         if (child != null && clickListener != null)
         {
             clickListener.OnLongClick(child, recyclerView.GetChildPosition(child));
         }
     };
     gestureListener.FuncOnSingleTapUp = (e) => true;
     gestureDetector = new GestureDetector(context, gestureListener);
 }
Пример #23
0
        /// <summary>
        ///     Sets up some of the local variables as well as Intrinsic and gesture detector
        /// </summary>
        private void InitializeElement()
        {
            SetScaleType(ScaleType.Matrix);
            _matrix = new Matrix();

            // If the current element is drawable
            if (Drawable != null)
            {
                _translationSize = new Size(Drawable.IntrinsicHeight, Drawable.IntrinsicWidth);
                SetOnTouchListener(this);
            }

            _gestureDetector = new GestureDetector(_context, new CustomImageViewGestureDetector(this));
            //SetAdjustViewBounds(true);
        }
		async Task Initialize ()
		{
			await InitDrawShape ();
			InitImage ();

			_gestureListener = new GestureListener (_shapeViewModel.Shape);
			_doubleTapDetector = new GestureDetector (this.Context, _gestureListener);

			_gestureListener.DoubleTap = () => {
				_shapeViewModel.DoubleTapCommand.Execute ();
			};
			_gestureListener.RequestLayout = (l, t, r, b) => {
				Layout (l, t, r, b);
				Invalidate ();
			};
		}
Пример #25
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			id = Intent.GetStringExtra ("ID");
			i = int.Parse(id);

			type = Intent.GetStringExtra ("TYPE");
			if (type == "RAM") {
				tyValide = "RAMCFM";
			} else {				
				tyValide = "LIVCFM";
			}
			DBRepository dbr = new DBRepository ();
			data = dbr.GetPositionsData (i);
			idprev = dbr.GetidPrev (i);
			idnext = dbr.GetidNext (i);

			SetContentView(Resource.Layout.DetailPosition);
			_gestureDetector = new GestureDetector(this);

			//AFFICHE DATA
			codelivraison = FindViewById<TextView>(Resource.Id.codelivraison);
			commande = FindViewById<TextView>(Resource.Id.commande);
			infolivraison = FindViewById<TextView>(Resource.Id.infolivraison);
			title = FindViewById<TextView>(Resource.Id.title);
			infosupp = FindViewById<TextView>(Resource.Id.infosupp);
			infoclient = FindViewById<TextView>(Resource.Id.infoclient);
			client = FindViewById<TextView>(Resource.Id.client);
			anomaliet = FindViewById<TextView> (Resource.Id.anomaliet);
			anomalie = FindViewById<TextView> (Resource.Id.infoanomalie);
			destfinal = FindViewById<TextView> (Resource.Id.destfinal);
			_imageView = FindViewById<ImageView> (Resource.Id._imageView);
			btnvalide = FindViewById<Button> (Resource.Id.valide);

			Button btnanomalie = FindViewById <Button> (Resource.Id.anomalie);



			btnvalide.Click += Btnvalide_Click;
			btnanomalie.Click += Btnanomalie_Click;

		}
		protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
		{
			base.OnElementChanged(e);

			if (e.NewElement == null)
			{
					this.GenericMotion -= HandleGenericMotion;
					this.Touch -= HandleTouch;
			}

			if (e.OldElement == null)
			{

				_listener = new CustomImageGestureListener(Element as CustomImage);
				_detector = new GestureDetector(_listener);
				this.GenericMotion += HandleGenericMotion;
				this.Touch += HandleTouch;
			}
		}
        /// <summary>
        /// Method called when the underlying ViewElement Changes.
        /// </summary>
        /// <param name="e">Passes information about the element that changed.</param>
        protected override void OnElementChanged(ElementChangedEventArgs<ActivityIndicator> e)
        {
            base.OnElementChanged(e);
            if (GestureActuator.ControlsToActuate
            .Contains<GestureActuator.ControlToActuate>(GestureActuator.ControlToActuate.ActivityIndicator))
            {
                if (e.NewElement == null)
                {
                    this.GenericMotion -= this.HandleGenericMotion;
                    this.Touch -= this.HandleTouch;
                }

                if (e.OldElement == null && e.NewElement != null)
                {
                    this.gestureListener = new IndiGestureListener((ActivityIndicator)e.NewElement);
                    this.gestureDetector = new GestureDetector(this.gestureListener);
                    this.GenericMotion += this.HandleGenericMotion;
                    this.Touch += this.HandleTouch;
                }
            }
        }
Пример #28
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Run Splash View on start
			SetContentView (Resource.Layout.Splash);
			//ToggleButton QRCodeSettingOption=(ToggleButton)

			JSONParserProperty.GestureOption = true;

			_gestureDetector = new GestureDetector (this,new GestureListener());

		
			mProgress = (ProgressBar)FindViewById(Resource.Id.progress_bar);


			new Thread(new ThreadStart(() => {
				for (int i = 0; i <= 100; i++) {
					this.RunOnUiThread ( () => {
						mProgress.Progress = i;
					});
					Thread.Sleep(30);
				}
				this.RunOnUiThread(() => {
					//Need to implement logic to load 

					if(JSONParserProperty.GestureOption !=false)
					{
						StartActivity(typeof(HopSampleApp.GestureActivity));//Skip Splash View and go to ContactsActivity

					}else
					{

						StartActivity(typeof(HopSampleApp.VideoCallActivity));

					}
				});
			})).Start();
		}
        protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
        {
            base.OnElementChanged (e);

            if (e.NewElement == null) {
                if (_gestureDetector != null) {
                    _gestureDetector.Dispose ();
                    _gestureDetector = null;
                }

                return;
            }

            IGestureAwareView view = e.NewElement as IGestureAwareView;

            if (view == null) {
                throw new InvalidOperationException ();
            }

            if (_gestureDetector == null) {
                _gestureDetector = new GestureDetector (
                    new GestureDetectorListener (view));
            }
        }
Пример #30
0
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);

            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.PresentationView);

            (FindViewById<TextView> (Resource.Id.txtView)).Visibility = ViewStates.Gone;

            gestureDetector = new GestureDetector (this);
            _locMgr = GetSystemService (Context.LocationService) as LocationManager;

            preses = Presentations.GetPresentations ();
            ivSlide = FindViewById<ImageView> (Resource.Id.ivSlide);

            selectedPresent = Intent.GetIntExtra ("presentationID", 0);

            CreateTopLayout ();
            RefreshParts ();

            OnButtonTopClick (preses [selectedPresent].btn, null);

            OnButtonBottomClick(preses[selectedPresent].parts [Intent.GetIntExtra ("partID", 0)].btn, null);
        }