[dali_1.1.34] Merge branch 'devel/master' 00/69500/1
authorFerran Sole <ferran.sole@samsung.com>
Fri, 13 May 2016 10:55:29 +0000 (11:55 +0100)
committerFerran Sole <ferran.sole@samsung.com>
Fri, 13 May 2016 10:55:29 +0000 (11:55 +0100)
Change-Id: Ic465b246b9d29bf5d46aea73e10b9286d780c7c5

examples/item-view/item-view-example.cpp
packaging/com.samsung.dali-demo.spec

index c898c0c..ef33c4b 100644 (file)
@@ -133,6 +133,8 @@ const float LABEL_TEXT_SIZE_Y = 20.0f;
 
 const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f );
 
+const float SCROLL_TO_ITEM_ANIMATION_TIME = 5.f;
+
 static Vector3 DepthLayoutItemSizeFunctionPortrait( float layoutWidth )
 {
   float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT;
@@ -300,6 +302,10 @@ public:
     // Set the title and icon to the current layout
     SetLayoutTitle();
     SetLayoutImage();
+
+    mLongPressDetector = LongPressGestureDetector::New();
+    mLongPressDetector.Attach( mItemView );
+    mLongPressDetector.DetectedSignal().Connect( this, &ItemViewExample::OnLongPress );
   }
 
   Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction )
@@ -540,6 +546,35 @@ public:
     }
   }
 
+  void OnLongPress( Actor actor, const LongPressGesture& gesture )
+  {
+    switch( gesture.state )
+    {
+      case Gesture::Started:
+      {
+        const Size& size = Stage::GetCurrent().GetSize();
+
+        ItemRange range( 0u, 0u );
+        mItemView.GetItemsRange( range );
+
+        const unsigned int item = ( gesture.screenPoint.y < 0.5f * size.height ) ? range.begin : range.end;
+        mItemView.ScrollToItem( item, SCROLL_TO_ITEM_ANIMATION_TIME );
+
+        break;
+      }
+      case Gesture::Finished:
+      {
+        Property::Map attributes;
+        mItemView.DoAction( "stopScrolling", attributes );
+        break;
+      }
+      default:
+      {
+        break;
+      }
+    }
+  }
+
   bool OnDeleteButtonClicked( Toolkit::Button button )
   {
     ItemIdContainer removeList;
@@ -954,6 +989,8 @@ private:
   Toolkit::PushButton mDeleteButton;
   Toolkit::PushButton mInsertButton;
   Toolkit::PushButton mReplaceButton;
+
+  LongPressGestureDetector mLongPressDetector;
 };
 
 void RunTest(Application& app)
index 9cbe4ec..6a5fb49 100755 (executable)
@@ -2,7 +2,7 @@
 
 Name:       com.samsung.dali-demo
 Summary:    The OpenGLES Canvas Core Demo
-Version:    1.1.33
+Version:    1.1.34
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0