private void OnTapGestureDected(object source, TapGestureDetector.DetectedEventArgs e) { if (e.View == baseView) { View stickerBaseView = new View() { WidthSpecification = 200, HeightSpecification = 200 }; tgd.Attach(stickerBaseView); lpgd.Attach(stickerBaseView); pgd.Attach(stickerBaseView); baseView.Add(stickerBaseView); Random random = new Random(); int number = random.Next(1, 10); string path = ApplicationInfo.SharedResourcePath; string file = "fb_emoji_500_0" + number + ".png.gif"; string gif = path + file; ImageView stickerImageView = new ImageView(gif) { WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, ReleasePolicy = ReleasePolicyType.Never }; stickerBaseView.Add(stickerImageView); } }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); mDefaultLayer = window.GetDefaultLayer(); mDefaultLayer.Behavior = Layer.LayerBehavior.Layer3D; window.BackgroundColor = Color.Black; mRootView = new View() { Size = new Size(1920, 1080) }; mRootView.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical }; mDefaultLayer.Add(mRootView); CreateToolBarLayer(); CreateContentView(); CreateInsertButton(); CreateReplaceButton(); CreateDeleteButton(); CreateSpiralLayout(); CreateGridLayout(); CreateDepthLayout(); mLayout = new PropertyArray(); mLayout.PushBack(new PropertyValue(mSpiralLayout)); mLayout.PushBack(new PropertyValue(mDepthLayout)); mLayout.PushBack(new PropertyValue(mGridLayout)); mItemFactoryWrapper = new ItemFactoryWrapper(); mItemFactoryWrapper.GetNumberDelegate = GetNumberOfItems; mItemFactoryWrapper.NewItemDelegate = NewItemView; mItemView = new ItemView(mItemFactoryWrapper) { Size = new Size(800, 800, 800) }; mContentView.Add(mItemView); mItemView.Layout = mLayout; mItemView.MinimumSwipeDistance = MIN_SWIPE_DISTANCE; mItemView.MinimumSwipeSpeed = MIN_SWIPE_SPEED; SetLayout((int)mCurrentLayout); SetLayoutTitle(); SetLayoutImage(); mLongPressGestureDetector = new LongPressGestureDetector(); mLongPressGestureDetector.Attach(mItemView); mLongPressGestureDetector.Detected += OnLongPressGestureDetected; }
private void init(View view) { mTapGestureDetector = new TapGestureDetector(); mLongGestureDetector = new LongPressGestureDetector(); mPanGestureDetector = new PanGestureDetector(); mPinchGestureDetector = new PinchGestureDetector(); mTapGestureDetector.Attach(view); mLongGestureDetector.Attach(view); mPanGestureDetector.Attach(view); mPinchGestureDetector.Attach(view); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View(); frontView = new View { Size = new Size(300, 300), Position = new Position(150, 170), BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f), }; frontView.TouchEvent += OnFrontTouchEvent; // The default the maximum allowed time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetDoubleTapTimeout(300); tapGestureDetector = new TapGestureDetector(); tapGestureDetector.Attach(frontView); tapGestureDetector.SetMaximumTapsRequired(2); tapGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnTap {e.TapGesture.NumberOfTaps}\n"); }; backView = new TextLabel { Size = new Size(300, 300), Text = "Back View", Position = new Position(50, 70), PointSize = 11, BackgroundColor = new Color(1.0f, 1.0f, 0.0f, 1.0f), }; backView.TouchEvent += OnBackTouchEvent; // The default the minimum holding time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetLongPressMinimumHoldingTime(300); longPressGestureDetector = new LongPressGestureDetector(); longPressGestureDetector.Attach(backView); longPressGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnLongPress\n"); }; backView.Add(frontView); root.Add(backView); window.Add(root); }
public void Activate() { Window window = Window.Instance; window.GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer3D; window.BackgroundColor = Color.Black; CreateContentView(); //CreateToolBarView(); CreateToolBarLayer(); CreateLayoutButton(); CreateEditButton(); CreateInsertButton(); CreateReplaceButton(); CreateDeleteButton(); CreateGridLayout(); CreateDepthLayout(); CreateSpiralLayout(); mLayout = new PropertyArray(); mLayout.PushBack(new PropertyValue(mSpiralLayout)); mLayout.PushBack(new PropertyValue(mDepthLayout)); mLayout.PushBack(new PropertyValue(mGridLayout)); mItemFactoryWrapper = new ItemFactoryWrapper(); mItemFactoryWrapper.GetNumberDelegate = GetNumberOfItems; mItemFactoryWrapper.NewItemDelegate = NewItemView; mItemView = new Tizen.NUI.ItemView(mItemFactoryWrapper); //mItemView.BackgroundColor = Color.Blue; mItemView.ParentOrigin = Position.ParentOriginCenter; mItemView.PivotPoint = Position.PivotPointCenter; mItemView.Position2D = new Position2D(-100, 0); mItemView.PositionUsesPivotPoint = true; window.Add(mItemView); window.GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer3D; mItemView.Layout = mLayout; mItemView.SetMinimumSwipeDistance(MIN_SWIPE_DISTANCE); mItemView.SetMinimumSwipeSpeed(MIN_SWIPE_SPEED); SetLayout((int)mCurrentLayout); SetLayoutTitle(); SetLayoutImage(); mLongPressGestureDetector = new LongPressGestureDetector(); mLongPressGestureDetector.Attach(mItemView); mLongPressGestureDetector.Detected += OnLongPressGestureDetected; }
public RotarySelector() { rotarySelectorManager = new RotarySelectorManager(new Size(360, 360)); this.Add(rotarySelectorManager.GetRotaryPagination()); this.Add(rotarySelectorManager.GetRotaryLayerView()); longPressDetector = new LongPressGestureDetector(); longPressDetector.Detected += Detector_Detected; longPressDetector.Attach(rotarySelectorManager.GetRotaryLayerView().GetMainText()); panDetector = new PanGestureDetector(); panDetector.Attach(this); panDetector.Detected += PanDetector_Detected; this.WheelEvent += RotarySelector_WheelEvent; }
public void GestureDetectorDetach() { tlog.Debug(tag, $"GestureDetectorDetach START"); LongPressGestureDetector ret = new LongPressGestureDetector(); Assert.IsNotNull(ret, "should be not null"); Assert.IsInstanceOf <GestureDetector>(ret, "should be an instance of testing target class!"); View view = new View(); ret.Attach(view); ret.Detach(view); ret.Dispose(); tlog.Debug(tag, $"GestureDetectorDetach END (OK)"); Assert.Pass("GestureDetectorDetach"); }
public void GestureDetectorDetachAll() { tlog.Debug(tag, $"GestureDetectorDetachAll START"); var testingTarget = new LongPressGestureDetector(); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <LongPressGestureDetector>(testingTarget, "should be an instance of testing target class!"); using (View view = new View()) { testingTarget.Attach(view); testingTarget.DetachAll(); } testingTarget.Dispose(); tlog.Debug(tag, $"GestureDetectorDetachAll END (OK)"); Assert.Pass("GestureDetectorDetachAll"); }
public void GestureDetectorAttach() { tlog.Debug(tag, $"GestureDetectorAttach START"); var testingTarget = new LongPressGestureDetector(); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <LongPressGestureDetector>(testingTarget, "should be an instance of testing target class!"); using (View view = new View()) { Window.Instance.GetDefaultLayer().Add(view); testingTarget.Attach(view); testingTarget.Detach(view); Window.Instance.GetDefaultLayer().Remove(view); } testingTarget.Dispose(); tlog.Debug(tag, $"GestureDetectorAttach END (OK)"); Assert.Pass("GestureDetectorAttach"); }
public void AppendItem(RotarySelectorItem item) { rotarySelectorManager.AppendItem(item); longPressDetector.Attach(item); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View(); window.WheelEvent += (s, e) => { Tizen.Log.Error("NUI", $"window WheelEvent!!!!{e.Wheel.Type}\n"); }; frontView = new View { Size = new Size(300, 300), Position = new Position(150, 170), BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f), Focusable = true, FocusableInTouch = true, }; frontView.TouchEvent += OnFrontTouchEvent; frontView.WheelEvent += (s, e) => { Tizen.Log.Error("NUI", $"frontView WheelEvent!!!!{e.Wheel.Type}\n"); if (e.Wheel.Type == Wheel.WheelType.CustomWheel) { // rotary event } else if (e.Wheel.Type == Wheel.WheelType.MouseWheel) { // mouse wheel event } return(false); }; var middleView = new View { Size = new Size(300, 300), Position = new Position(110, 120), BackgroundColor = new Color(0.0f, 1.0f, 0.0f, 1.0f), Focusable = true, FocusableInTouch = true, }; // The default the maximum allowed time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetDoubleTapTimeout(300); tapGestureDetector = new TapGestureDetector(); tapGestureDetector.Attach(frontView); tapGestureDetector.SetMaximumTapsRequired(2); tapGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnTap {e.TapGesture.NumberOfTaps}\n"); }; backView = new TextLabel { Size = new Size(300, 300), Text = "Back View", Position = new Position(50, 70), PointSize = 11, BackgroundColor = new Color(1.0f, 1.0f, 0.0f, 1.0f), Focusable = true, FocusableInTouch = true, }; backView.TouchEvent += OnBackTouchEvent; backView.WheelEvent += (s, e) => { Tizen.Log.Error("NUI", $"backView WheelEvent!!!!{e.Wheel.Type}\n"); return(true); }; // The default the minimum holding time is 500ms. // If you want to change this time, do as below. // But keep in mind this is a global option. Affects all gestures. GestureOptions.Instance.SetLongPressMinimumHoldingTime(300); longPressGestureDetector = new LongPressGestureDetector(); longPressGestureDetector.Attach(backView); longPressGestureDetector.Detected += (s, e) => { Tizen.Log.Error("NUI", $"OnLongPress\n"); }; backView.Add(middleView); backView.Add(frontView); root.Add(backView); window.Add(root); }