Commit 4a0542cdee8fac2ef942fe1552fa14ae81f8dacb
[dali_1.1.34] Merge branch 'devel/master'
Change-Id: Ic465b246b9d29bf5d46aea73e10b9286d780c7c5
Showing
2 changed files
with
38 additions
and
1 deletions
examples/item-view/item-view-example.cpp
| @@ -133,6 +133,8 @@ const float LABEL_TEXT_SIZE_Y = 20.0f; | @@ -133,6 +133,8 @@ const float LABEL_TEXT_SIZE_Y = 20.0f; | ||
| 133 | 133 | ||
| 134 | const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); | 134 | const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f ); |
| 135 | 135 | ||
| 136 | +const float SCROLL_TO_ITEM_ANIMATION_TIME = 5.f; | ||
| 137 | + | ||
| 136 | static Vector3 DepthLayoutItemSizeFunctionPortrait( float layoutWidth ) | 138 | static Vector3 DepthLayoutItemSizeFunctionPortrait( float layoutWidth ) |
| 137 | { | 139 | { |
| 138 | float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; | 140 | float width = ( layoutWidth / ( DEPTH_LAYOUT_COLUMNS + 1.0f ) ) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT; |
| @@ -300,6 +302,10 @@ public: | @@ -300,6 +302,10 @@ public: | ||
| 300 | // Set the title and icon to the current layout | 302 | // Set the title and icon to the current layout |
| 301 | SetLayoutTitle(); | 303 | SetLayoutTitle(); |
| 302 | SetLayoutImage(); | 304 | SetLayoutImage(); |
| 305 | + | ||
| 306 | + mLongPressDetector = LongPressGestureDetector::New(); | ||
| 307 | + mLongPressDetector.Attach( mItemView ); | ||
| 308 | + mLongPressDetector.DetectedSignal().Connect( this, &ItemViewExample::OnLongPress ); | ||
| 303 | } | 309 | } |
| 304 | 310 | ||
| 305 | Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction ) | 311 | Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction ) |
| @@ -540,6 +546,35 @@ public: | @@ -540,6 +546,35 @@ public: | ||
| 540 | } | 546 | } |
| 541 | } | 547 | } |
| 542 | 548 | ||
| 549 | + void OnLongPress( Actor actor, const LongPressGesture& gesture ) | ||
| 550 | + { | ||
| 551 | + switch( gesture.state ) | ||
| 552 | + { | ||
| 553 | + case Gesture::Started: | ||
| 554 | + { | ||
| 555 | + const Size& size = Stage::GetCurrent().GetSize(); | ||
| 556 | + | ||
| 557 | + ItemRange range( 0u, 0u ); | ||
| 558 | + mItemView.GetItemsRange( range ); | ||
| 559 | + | ||
| 560 | + const unsigned int item = ( gesture.screenPoint.y < 0.5f * size.height ) ? range.begin : range.end; | ||
| 561 | + mItemView.ScrollToItem( item, SCROLL_TO_ITEM_ANIMATION_TIME ); | ||
| 562 | + | ||
| 563 | + break; | ||
| 564 | + } | ||
| 565 | + case Gesture::Finished: | ||
| 566 | + { | ||
| 567 | + Property::Map attributes; | ||
| 568 | + mItemView.DoAction( "stopScrolling", attributes ); | ||
| 569 | + break; | ||
| 570 | + } | ||
| 571 | + default: | ||
| 572 | + { | ||
| 573 | + break; | ||
| 574 | + } | ||
| 575 | + } | ||
| 576 | + } | ||
| 577 | + | ||
| 543 | bool OnDeleteButtonClicked( Toolkit::Button button ) | 578 | bool OnDeleteButtonClicked( Toolkit::Button button ) |
| 544 | { | 579 | { |
| 545 | ItemIdContainer removeList; | 580 | ItemIdContainer removeList; |
| @@ -954,6 +989,8 @@ private: | @@ -954,6 +989,8 @@ private: | ||
| 954 | Toolkit::PushButton mDeleteButton; | 989 | Toolkit::PushButton mDeleteButton; |
| 955 | Toolkit::PushButton mInsertButton; | 990 | Toolkit::PushButton mInsertButton; |
| 956 | Toolkit::PushButton mReplaceButton; | 991 | Toolkit::PushButton mReplaceButton; |
| 992 | + | ||
| 993 | + LongPressGestureDetector mLongPressDetector; | ||
| 957 | }; | 994 | }; |
| 958 | 995 | ||
| 959 | void RunTest(Application& app) | 996 | void RunTest(Application& app) |
packaging/com.samsung.dali-demo.spec
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | Name: com.samsung.dali-demo | 3 | Name: com.samsung.dali-demo |
| 4 | Summary: The OpenGLES Canvas Core Demo | 4 | Summary: The OpenGLES Canvas Core Demo |
| 5 | -Version: 1.1.33 | 5 | +Version: 1.1.34 |
| 6 | Release: 1 | 6 | Release: 1 |
| 7 | Group: System/Libraries | 7 | Group: System/Libraries |
| 8 | License: Apache-2.0 | 8 | License: Apache-2.0 |