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;
// 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 )
}
}
+ 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;
Toolkit::PushButton mDeleteButton;
Toolkit::PushButton mInsertButton;
Toolkit::PushButton mReplaceButton;
+
+ LongPressGestureDetector mLongPressDetector;
};
void RunTest(Application& app)