Merge "[3.0] Fixed dali-demo keyboard focus and updated appearance" into tizen_3.0
[platform/core/uifw/dali-demo.git] / demo / dali-table-view.cpp
index 1b7711c..4be3e18 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <algorithm>
 #include <sstream>
 #include <unistd.h>
+#include <dali/devel-api/images/distance-field.h>
+#include <dali-toolkit/devel-api/shader-effects/alpha-discard-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
 
 // INTERNAL INCLUDES
 #include "shared/view.h"
+#include "shared/utility.h"
 
 using namespace Dali;
 using namespace Dali::Toolkit;
@@ -34,36 +40,44 @@ using namespace Dali::Toolkit;
 namespace
 {
 
-const std::string BUTTON_BACKWARD( "Backward" );
-const std::string BUTTON_FORWARD( "Forward" );
-const std::string BUTTON_QUIT( "Quit" );
-const std::string BUTTON_OK( "Ok" );
-const std::string BUTTON_CANCEL( "Cancel" );
+const std::string LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" );
+const std::string TILE_BACKGROUND(DEMO_IMAGE_DIR "item-background.9.png");
+const std::string TILE_BACKGROUND_ALPHA( DEMO_IMAGE_DIR "demo-tile-texture.9.png" );
+const std::string TILE_FOCUS( DEMO_IMAGE_DIR "tile-focus.9.png" );
 
-const std::string DEFAULT_BACKGROUND_IMAGE_PATH( DALI_IMAGE_DIR "background-gradient.jpg" );
-const std::string LOGO_PATH( DALI_IMAGE_DIR "dali-logo.png" );
-const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" );
-const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png");
-const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png");
-const std::string TILE_BACKGROUND_ALPHA(DALI_IMAGE_DIR "item-background-alpha.png");
+// Keyboard focus constants.
+const float KEYBOARD_FOCUS_ANIMATION_DURATION = 1.0f;           ///< The total duration of the keyboard focus animation
+const float KEYBOARD_FOCUS_START_SCALE = 1.05f;                 ///< The starting scale of the focus highlight
+const float KEYBOARD_FOCUS_END_SCALE = 1.18f;                   ///< The end scale of the focus highlight
+const float KEYBOARD_FOCUS_END_ALPHA = 0.7f;                    ///< The end alpha of the focus highlight
+const float KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE = 0.16f;     ///< The duration of the initial fade (from translucent to the end-alpha) as a percentage of the overal animation duration.
 
-const char * const DEFAULT_TOOLBAR_TEXT( "TOUCH TO LAUNCH EXAMPLE" );
-
-const float BUTTON_PRESS_ANIMATION_TIME = 0.25f;                ///< Time to perform button scale effect.
+const float TILE_LABEL_PADDING = 8.0f;                          ///< Border between edge of tile and the example text
+const float BUTTON_PRESS_ANIMATION_TIME = 0.35f;                ///< Time to perform button scale effect.
 const float ROTATE_ANIMATION_TIME = 0.5f;                       ///< Time to perform rotate effect.
 const int MAX_PAGES = 256;                                      ///< Maximum pages (arbitrary safety limit)
 const int EXAMPLES_PER_ROW = 3;
 const int ROWS_PER_PAGE = 3;
 const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
-const float LOGO_MARGIN_RATIO = 0.5f / 0.9f;
+const float LOGO_MARGIN_RATIO = 0.1f / 0.3f;
 const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;
-const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f );     ///< ScrollView's relative size to its parent
-const Vector3 TABLE_RELATIVE_SIZE(0.9f, 0.9f, 0.8f );          ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
+const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f );      ///< ScrollView's relative size to its parent
+const Vector3 TABLE_RELATIVE_SIZE(0.95f, 0.9f, 0.8f );          ///< TableView's relative size to the entire stage. The Y value means sum of the logo and table relative heights.
 const float STENCIL_RELATIVE_SIZE = 1.0f;
 
 const float EFFECT_SNAP_DURATION = 0.66f;                       ///< Scroll Snap Duration for Effects
 const float EFFECT_FLICK_DURATION = 0.5f;                       ///< Scroll Flick Duration for Effects
 const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f);
+const Vector4 TILE_COLOR( 0.4f, 0.6f, 0.9f, 0.6f );
+
+const Vector4 BUBBLE_COLOR[] =
+{
+  Vector4( 0.3255f, 0.3412f, 0.6353f, 0.32f ),
+  Vector4( 0.3647f, 0.7569f, 0.8157f, 0.32f ),
+  Vector4( 0.3804f, 0.7412f, 0.6510f, 0.32f ),
+  Vector4( 1.f, 1.f, 1.f, 0.13f )
+};
+const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) );
 
 const int NUM_BACKGROUND_IMAGES = 18;
 const float BACKGROUND_SWIPE_SCALE = 0.025f;
@@ -74,90 +88,116 @@ const float SCALE_SPEED_SIN = 0.1f;
 
 const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs
 
-const float BACKGROUND_Z = -1.0f;
-const float BACKGROUND_SIZE_SCALE = 1.0f;
-const Vector4 BACKGROUND_COLOR( 1.0f, 1.0f, 1.0f, 1.0f );
+const Vector4 BACKGROUND_COLOR( 0.3569f, 0.5451f, 0.7294f, 1.0f );
 
 const float BUBBLE_MIN_Z = -1.0;
 const float BUBBLE_MAX_Z = 0.0f;
 
-// 3D Effect constants
-const Vector2 ANGLE_SWING_3DEFFECT( Math::PI_2 * 0.75, Math::PI_2 * 0.75f ); ///< Angle Swing in radians
-const Vector2 POSITION_SWING_3DEFFECT( 0.55f, 0.4f );             ///< Position Swing relative to stage size.
-const Vector3 ANCHOR_3DEFFECT_STYLE0( -105.0f, 30.0f, -240.0f ); ///< Rotation Anchor position for 3D Effect (Style 0)
-const Vector3 ANCHOR_3DEFFECT_STYLE1( 65.0f, -70.0f, -500.0f );  ///< Rotation Anchor position for 3D Effect (Style 1)
-
-//const std::string             DEFAULT_TEXT_STYLE_FONT_FAMILY("HelveticaNeue");
-//const std::string             DEFAULT_TEXT_STYLE_FONT_STYLE("Regular");
-//const Dali::Vector4           DEFAULT_TEXT_STYLE_COLOR(0.7f, 0.7f, 0.7f, 1.0f);
+// This shader takes a texture.
+// An alpha discard is performed.
+// The shader uses the tiles position within the scroll-view page and the scroll-views rotation position to create a parallax effect.
+const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER(
+  varying mediump vec2  vTexCoord;
+  varying mediump vec3  vIllumination;
+  uniform lowp    vec4  uColor;
+  uniform sampler2D     sTexture;
+  uniform mediump vec3  uCustomPosition;
+
+  void main()
+  {
+    if( texture2D( sTexture, vTexCoord ).a <= 0.0001 )
+    {
+      discard;
+    }
 
-//const std::string             TABLE_TEXT_STYLE_FONT_FAMILY("HelveticaNeue");
-//const std::string             TABLE_TEXT_STYLE_FONT_STYLE("Regular");
-//const Dali::PointSize         TABLE_TEXT_STYLE_POINT_SIZE( 8.0f );
-//const Dali::TextStyle::Weight TABLE_TEXT_STYLE_WEIGHT(Dali::TextStyle::LIGHT);
-//const Dali::Vector4           TABLE_TEXT_STYLE_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
+    mediump vec2 wrapTexCoord = vec2( ( vTexCoord.x / 4.0 ) + ( uCustomPosition.x / 4.0 ) + ( uCustomPosition.z / 2.0 ), vTexCoord.y / 4.0 );
+    mediump vec4 color = texture2D( sTexture, wrapTexCoord );
+    mediump float positionWeight = ( uCustomPosition.y + 0.3 ) * color.r * 2.0;
 
-Vector3 ScalePointSize(const Vector3& vec)
-{
-  return Vector3( DemoHelper::ScalePointSize( vec.x ), DemoHelper::ScalePointSize( vec.y ), DemoHelper::ScalePointSize( vec.z ) );
-}
-
-#define DP(x) DemoHelper::ScalePointSize(x)
+    gl_FragColor = vec4( positionWeight, positionWeight, positionWeight, 0.9 ) * uColor + vec4( uColor.xyz, 0.0 );
+  }
+);
 
 /**
  * Creates the background image
  */
-ImageActor CreateBackground( std::string imagePath )
+Control CreateBackground( std::string stylename )
 {
-  Image image = ResourceImage::New( imagePath );
-  ImageActor background = ImageActor::New( image );
-
+  Control background = Control::New();
+  Stage::GetCurrent().Add( background );
+  background.SetStyleName( stylename );
+  background.SetName( "BACKGROUND" );
   background.SetAnchorPoint( AnchorPoint::CENTER );
   background.SetParentOrigin( ParentOrigin::CENTER );
-  background.SetZ( -1.0f );
-
+  background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
   return background;
 }
 
-// These values depend on the tile image
-const float IMAGE_BORDER_LEFT = 11.0f;
-const float IMAGE_BORDER_RIGHT = IMAGE_BORDER_LEFT;
-const float IMAGE_BORDER_TOP = IMAGE_BORDER_LEFT;
-const float IMAGE_BORDER_BOTTOM = IMAGE_BORDER_LEFT;
-
 /**
- * Constraint to return a position for a bubble based on the scroll value and vertical wrapping.
+ * Constraint to return a position for a bubble based on the scroll value and vertical wrapping
  */
 struct AnimateBubbleConstraint
 {
 public:
-  AnimateBubbleConstraint( const Vector3& initialPos, float scale, float size )
-      : mInitialX( initialPos.x ),
-        mScale( scale ),
-        mShapeSize( size )
+  AnimateBubbleConstraint( const Vector3& initialPos, float scale )
+  : mInitialX( initialPos.x ),
+    mScale( scale )
   {
   }
 
-  Vector3 operator()( const Vector3& current, const PropertyInput& scrollProperty, const PropertyInput& parentSize )
+  void operator()( Vector3& position, const PropertyInputContainer& inputs )
   {
-    Vector3 pos( current );
+    const Vector3& parentSize = inputs[1]->GetVector3();
+    const Vector3& childSize = inputs[2]->GetVector3();
 
-    // Wrap bubbles verically.
-    if( pos.y + mShapeSize * 0.5f < -parentSize.GetVector3().y * 0.5f )
-    {
-      pos.y += parentSize.GetVector3().y + mShapeSize;
-    }
+    // Wrap bubbles vertically.
+    float range = parentSize.y + childSize.y;
+    // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder).
+    position.y -= range * ( floor( position.y / range ) + 0.5f );
 
     // Bubbles X position moves parallax to horizontal
     // panning by a scale factor unique to each bubble.
-    pos.x = mInitialX + ( scrollProperty.GetVector3().x * mScale );
-    return pos;
+    position.x = mInitialX + ( inputs[0]->GetVector2().x * mScale );
   }
 
 private:
   float mInitialX;
   float mScale;
-  float mShapeSize;
+};
+
+/**
+ * Constraint to precalculate values from the scroll-view
+ * and tile positions to pass to the tile shader.
+ */
+struct TileShaderPositionConstraint
+{
+  TileShaderPositionConstraint( float pageWidth, float tileXOffset )
+  : mPageWidth( pageWidth ),
+    mTileXOffset( tileXOffset )
+  {
+  }
+
+  void operator()( Vector3& position, const PropertyInputContainer& inputs )
+  {
+    // Set up position.x as the tiles X offset (0.0 -> 1.0).
+    position.x = mTileXOffset;
+    // Set up position.z as the linear scroll-view X offset (0.0 -> 1.0).
+    position.z = 1.0f * ( -fmod( inputs[0]->GetVector2().x, mPageWidth ) / mPageWidth );
+    // Set up position.y as a rectified version of the scroll-views X offset.
+    // IE. instead of 0.0 -> 1.0, it moves between 0.0 -> 0.5 -> 0.0 within the same span.
+    if( position.z > 0.5f )
+    {
+      position.y = 1.0f - position.z;
+    }
+    else
+    {
+      position.y = position.z;
+    }
+  }
+
+private:
+  float mPageWidth;
+  float mTileXOffset;
 };
 
 bool CompareByTitle( const Example& lhs, const Example& rhs )
@@ -169,35 +209,24 @@ bool CompareByTitle( const Example& lhs, const Example& rhs )
 
 DaliTableView::DaliTableView( Application& application )
 : mApplication( application ),
-  mBackgroundLayer(),
   mRootActor(),
   mRotateAnimation(),
-  mBackground(),
-  mLogo(),
   mPressedAnimation(),
-  mScrollViewLayer(),
   mScrollView(),
   mScrollViewEffect(),
   mScrollRulerX(),
   mScrollRulerY(),
-  mButtons(),
   mPressedActor(),
   mAnimationTimer(),
   mLogoTapDetector(),
   mVersionPopup(),
-  mButtonsPageRelativeSize(),
   mPages(),
-  mTableViewImages(),
-  mBackgroundActors(),
   mBackgroundAnimations(),
   mExampleList(),
-  mExampleMap(),
-  mBackgroundImagePath( DEFAULT_BACKGROUND_IMAGE_PATH ),
   mTotalPages(),
   mScrolling( false ),
   mSortAlphabetically( false ),
-  mBackgroundAnimsPlaying( false ),
-  mVersionPopupShown( false )
+  mBackgroundAnimsPlaying( false )
 {
   application.InitSignal().Connect( this, &DaliTableView::Initialize );
 }
@@ -209,12 +238,6 @@ DaliTableView::~DaliTableView()
 void DaliTableView::AddExample( Example example )
 {
   mExampleList.push_back( example );
-  mExampleMap[ example.name ] = example;
-}
-
-void DaliTableView::SetBackgroundPath( std::string imagePath )
-{
-  mBackgroundImagePath = imagePath;
 }
 
 void DaliTableView::SortAlphabetically( bool sortAlphabetically )
@@ -225,75 +248,54 @@ void DaliTableView::SortAlphabetically( bool sortAlphabetically )
 void DaliTableView::Initialize( Application& application )
 {
   Stage::GetCurrent().KeyEventSignal().Connect( this, &DaliTableView::OnKeyEvent );
-
   const Vector2 stageSize = Stage::GetCurrent().GetSize();
 
   // Background
-  mBackground = CreateBackground( mBackgroundImagePath );
-  // set same size as parent actor
-  mBackground.SetSize( stageSize );
-  Stage::GetCurrent().Add( mBackground );
-
-  // Render entire content as overlays, as is all on same 2D plane.
-  mRootActor = TableView::New( 4, 1 );
-  mRootActor.SetAnchorPoint( AnchorPoint::CENTER );
-  mRootActor.SetParentOrigin( ParentOrigin::CENTER );
+  mRootActor = CreateBackground( "LauncherBackground" );
   Stage::GetCurrent().Add( mRootActor );
 
-  // Toolbar at top
-  Dali::Toolkit::ToolBar toolbar;
-  Dali::Layer toolBarLayer = DemoHelper::CreateToolbar(toolbar,
-                                                       DEFAULT_TOOLBAR_IMAGE_PATH,
-                                                       DEFAULT_TOOLBAR_TEXT,
-                                                       DemoHelper::DEFAULT_VIEW_STYLE);
-
-  mRootActor.AddChild( toolBarLayer, TableView::CellPosition( 0, 0 ) );
-  const float toolbarHeight = DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight;
-  mRootActor.SetFixedHeight( 0, toolbarHeight );
-
   // Add logo
-  mLogo = CreateLogo( LOGO_PATH );
-  const float paddingHeight = ( ( 1.f-TABLE_RELATIVE_SIZE.y ) * stageSize.y );
-  const float logoMargin = paddingHeight * LOGO_MARGIN_RATIO;
-  const float logoHeight = mLogo.GetImage().GetHeight() + logoMargin;
-  mRootActor.SetFixedHeight( 1, logoHeight );
+  ImageView logo = CreateLogo( LOGO_PATH );
+  logo.SetName( "LOGO_IMAGE" );
+  logo.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+  logo.SetParentOrigin( Vector3( 0.5f, 0.1f, 0.5f ) );
+  logo.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+  // The logo should appear on top of everything.
+  logo.SetDrawMode( DrawMode::OVERLAY_2D );
 
   // Show version in a popup when log is tapped
   mLogoTapDetector = TapGestureDetector::New();
-  mLogoTapDetector.Attach( mLogo );
+  mLogoTapDetector.Attach( logo );
   mLogoTapDetector.DetectedSignal().Connect( this, &DaliTableView::OnLogoTapped );
 
-  const float bottomMargin = paddingHeight * BOTTOM_PADDING_RATIO;
-  mButtonsPageRelativeSize = Vector3( TABLE_RELATIVE_SIZE.x, 1.f - ( toolbarHeight + logoHeight + bottomMargin) / stageSize.height, TABLE_RELATIVE_SIZE.z );
-  mRootActor.SetFixedHeight( 2, mButtonsPageRelativeSize.y * stageSize.height );
-
-  Alignment alignment = Alignment::New();
-  alignment.Add(mLogo);
-  mRootActor.AddChild( alignment, TableView::CellPosition( 1, 0 ) );
-
-  // scrollview occupying the majority of the screen
+  // Scrollview occupying the majority of the screen
   mScrollView = ScrollView::New();
+  mScrollView.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
+  mScrollView.SetParentOrigin( Vector3( 0.5f, 1.0f - 0.05f, 0.5f ) );
+  mScrollView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
+  mScrollView.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT );
+  mScrollView.SetSizeModeFactor( Vector3( 0.0f, 0.6f, 0.0f ) );
+
+  const float buttonsPageMargin = ( 1.0f - TABLE_RELATIVE_SIZE.x ) * 0.5f * stageSize.width;
+  mScrollView.SetPadding( Padding( buttonsPageMargin, buttonsPageMargin, 0.0f, 0.0f ) );
 
-  mScrollView.SetAnchorPoint( AnchorPoint::CENTER );
-  mScrollView.SetParentOrigin( ParentOrigin::CENTER );
-  // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT
-  // will cause scroll ends to appear in the wrong position.
-  mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::Property::SIZE, Dali::ParentSource( Dali::Actor::Property::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) );
   mScrollView.SetAxisAutoLock( true );
   mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
   mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
-  mScrollView.TouchedSignal().Connect( this, &DaliTableView::OnScrollTouched );
+  mScrollView.TouchSignal().Connect( this, &DaliTableView::OnScrollTouched );
 
-  mScrollViewLayer = Layer::New();
-  mScrollViewLayer.SetAnchorPoint( AnchorPoint::CENTER );
-  mScrollViewLayer.SetParentOrigin( ParentOrigin::CENTER );
-  mScrollViewLayer.SetDrawMode( DrawMode::OVERLAY );
+  mPageWidth = stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f;
 
   // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
-  SetupBackground( mScrollView, mScrollViewLayer, stageSize );
+  Actor bubbleContainer = Actor::New();
+  bubbleContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  bubbleContainer.SetAnchorPoint( AnchorPoint::CENTER );
+  bubbleContainer.SetParentOrigin( ParentOrigin::CENTER );
+  SetupBackground( bubbleContainer );
 
-  mScrollViewLayer.Add( mScrollView );
-  mRootActor.AddChild( mScrollViewLayer, TableView::CellPosition( 2, 0 ) );
+  mRootActor.Add( logo );
+  mRootActor.Add( bubbleContainer );
+  mRootActor.Add( mScrollView );
 
   // Add scroll view effect and setup constraints on pages
   ApplyScrollViewEffect();
@@ -302,11 +304,7 @@ void DaliTableView::Initialize( Application& application )
   Populate();
 
   // Remove constraints for inner cube effect
-  ApplyCubeEffectToActors();
-
-  // Set initial orientation
-  unsigned int degrees = application.GetOrientation().GetDegrees();
-  Rotate( degrees );
+  ApplyCubeEffectToPages();
 
   Dali::Window winHandle = application.GetWindow();
   winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT );
@@ -314,40 +312,93 @@ void DaliTableView::Initialize( Application& application )
   winHandle.AddAvailableOrientation( Dali::Window::PORTRAIT_INVERSE );
   winHandle.RemoveAvailableOrientation( Dali::Window::LANDSCAPE_INVERSE );
 
-  Dali::Orientation orientation = winHandle.GetOrientation();
-  orientation.ChangedSignal().Connect( this, &DaliTableView::OrientationChanged );
+  // Set initial orientation
+  unsigned int degrees = 0;
+  Rotate( degrees );
 
   winHandle.ShowIndicator( Dali::Window::INVISIBLE );
 
-  //
+  // Background animation
   mAnimationTimer = Timer::New( BACKGROUND_ANIMATION_DURATION );
   mAnimationTimer.TickSignal().Connect( this, &DaliTableView::PauseBackgroundAnimation );
   mAnimationTimer.Start();
   mBackgroundAnimsPlaying = true;
 
   KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &DaliTableView::OnKeyboardPreFocusChange );
-  KeyboardFocusManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
+  KeyboardFocusManager::Get().FocusedActorEnterKeySignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
+  AccessibilityManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
+
+  mFocusContainer = ImageView::New( TILE_FOCUS );
+  mFocusContainer.SetParentOrigin( ParentOrigin::CENTER );
+  mFocusContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  mFocusContainer.SetInheritScale( false );
+  mFocusContainer.SetColorMode( USE_OWN_COLOR );
+  mFocusContainer.SetName( "focusActor" );
+  mFocusContainer.OnStageSignal().Connect( this, &DaliTableView::OnStageConnect );
+
+  mFocusInner = ImageView::New( TILE_FOCUS );
+  mFocusInner.SetParentOrigin( ParentOrigin::CENTER );
+  mFocusInner.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  mFocusInner.SetInheritScale( false );
+  mFocusInner.SetColorMode( USE_OWN_COLOR );
+  mFocusInner.SetName( "focusActor" );
+  mFocusInner.OnStageSignal().Connect( this, &DaliTableView::OnStageConnect );
+  mFocusContainer.Add( mFocusInner );
+
+  // Setup the keyboard focus highlight.
+  Vector3 startScale( KEYBOARD_FOCUS_START_SCALE, KEYBOARD_FOCUS_START_SCALE, KEYBOARD_FOCUS_START_SCALE );
+  Vector3 endScale( KEYBOARD_FOCUS_END_SCALE, KEYBOARD_FOCUS_END_SCALE, KEYBOARD_FOCUS_END_SCALE );
+  mFocusAnimation = Animation::New( KEYBOARD_FOCUS_ANIMATION_DURATION );
+  mFocusAnimationInner = Animation::New( KEYBOARD_FOCUS_ANIMATION_DURATION );
+
+  mFocusContainer.SetScale( startScale );
+  mFocusInner.SetScale( startScale );
+  mFocusContainer.SetOpacity( 0.0f );
+  mFocusInner.SetOpacity( 0.0f );
+  const float initialFadeDuration = KEYBOARD_FOCUS_ANIMATION_DURATION * KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE;
+
+  mFocusAnimation.AnimateTo( Property( mFocusContainer, Actor::Property::COLOR_ALPHA ), KEYBOARD_FOCUS_END_ALPHA, AlphaFunction::LINEAR, TimePeriod( 0.0f, initialFadeDuration ) );
+  mFocusAnimation.AnimateTo( Property( mFocusContainer, Actor::Property::SCALE ), endScale, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
+  mFocusAnimation.AnimateTo( Property( mFocusContainer, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
+
+  mFocusAnimationInner.AnimateTo( Property( mFocusInner, Actor::Property::COLOR_ALPHA ), KEYBOARD_FOCUS_END_ALPHA, AlphaFunction::LINEAR, TimePeriod( 0.0f, initialFadeDuration ) );
+  mFocusAnimationInner.AnimateTo( Property( mFocusInner, Actor::Property::SCALE ), endScale, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
+  mFocusAnimationInner.AnimateTo( Property( mFocusInner, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
+
+  // Play the animation on the 1st glow object.
+  mFocusAnimation.SetLooping( true );
+  mFocusAnimation.Play();
+  // Stagger the animation on the 2st glow object half way through.
+  mFocusAnimationInner.SetLooping( true );
+  mFocusAnimationInner.PlayFrom( KEYBOARD_FOCUS_ANIMATION_DURATION / 2.0f );
+
+  KeyboardFocusManager::Get().SetFocusIndicatorActor( mFocusContainer );
 }
 
-void DaliTableView::ApplyCubeEffectToActors()
+void DaliTableView::OnStageConnect( Dali::Actor actor )
 {
-  for( ActorIter pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter )
+  // If this is one of the keyboard focus actors, place it behind the object it is focusing.
+  if( actor.GetName() == "focusActor" )
   {
-    Actor page = *pageIter;
+    actor.GetRendererAt( 0 ).SetProperty( Dali::Renderer::Property::DEPTH_INDEX, -40000 );
+  }
+}
 
-    unsigned int numChildren = page.GetChildCount();
-    Actor pageActor = page;
-    for( unsigned int i=0; i<numChildren; ++i)
-    {
-      // Remove old effect's manual constraints.
-      Actor child = pageActor.GetChildAt(i);
-      if( child )
-      {
-        ApplyCubeEffectToActor( child );
-      }
-    }
+void DaliTableView::ApplyCubeEffectToPages()
+{
+  ScrollViewPagePathEffect effect = ScrollViewPagePathEffect::DownCast( mScrollViewEffect );
+  unsigned int pageCount(0);
+  for( std::vector< Actor >::iterator pageIter = mPages.begin(); pageIter != mPages.end(); ++pageIter )
+  {
+    Actor page = *pageIter;
+    effect.ApplyToPage( page, pageCount++ );
   }
 }
+
+void DaliTableView::OnButtonsPageRelayout( const Dali::Actor& actor )
+{
+}
+
 void DaliTableView::Populate()
 {
   const Vector2 stageSize = Stage::GetCurrent().GetSize();
@@ -367,21 +418,16 @@ void DaliTableView::Populate()
 
     for( int t = 0; t < mTotalPages; t++ )
     {
-      // Create Table. (contains up to 9 Examples)
-      Actor page = Actor::New();
-
-      // Add tableView to container.
-      mScrollView.Add( page );
-
+      // Create Table
+      TableView page = TableView::New( ROWS_PER_PAGE, EXAMPLES_PER_ROW );
       page.SetAnchorPoint( AnchorPoint::CENTER );
       page.SetParentOrigin( ParentOrigin::CENTER );
-      page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
-
-      // add cells to table
-      const float margin = 4.0f;
+      page.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+      mScrollView.Add( page );
 
       // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi.
-      const Size tileSize((stageSize.x * mButtonsPageRelativeSize.x / EXAMPLES_PER_ROW) - margin, (stageSize.y * mButtonsPageRelativeSize.y / ROWS_PER_PAGE) - margin );
+      const float margin = 2.0f;
+      const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;
 
       for(int row = 0; row < ROWS_PER_PAGE; row++)
       {
@@ -389,21 +435,19 @@ void DaliTableView::Populate()
         {
           const Example& example = ( *iter );
 
-          Actor tile = CreateTile( example.name, example.title, tileSize, true );
-          FocusManager focusManager = FocusManager::Get();
-          focusManager.SetFocusOrder( tile, ++exampleCount );
-          focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_LABEL,
+          // Calculate the tiles relative position on the page (between 0 & 1 in each dimension).
+          Vector2 position( static_cast<float>( column ) / ( EXAMPLES_PER_ROW - 1.0f ), static_cast<float>( row ) / ( EXAMPLES_PER_ROW - 1.0f ) );
+          Actor tile = CreateTile( example.name, example.title, Vector3( tileParentMultiplier, tileParentMultiplier, 1.0f ), position );
+          AccessibilityManager accessibilityManager = AccessibilityManager::Get();
+          accessibilityManager.SetFocusOrder( tile, ++exampleCount );
+          accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_LABEL,
                                                   example.title );
-          focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_TRAIT, "Tile" );
-          focusManager.SetAccessibilityAttribute( tile, Dali::Toolkit::FocusManager::ACCESSIBILITY_HINT,
+          accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_TRAIT, "Tile" );
+          accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_HINT,
                                                   "You can run this example" );
 
-          Vector3 position( margin * 0.5f + (tileSize.x + margin) * column - stageSize.width * mButtonsPageRelativeSize.x * 0.5f,
-                           margin * 0.5f + (tileSize.y + margin) * row - stageSize.height * mButtonsPageRelativeSize.y * 0.5f,
-                            0.0f);
-          tile.SetPosition( position + Vector3( tileSize.x, tileSize.y, 0.0f ) * 0.5f );
-          tile.SetSize( tileSize );
-          page.Add( tile );
+          tile.SetPadding( Padding( margin, margin, margin, margin ) );
+          page.AddChild( tile, TableView::CellPosition( row, column ) );
 
           iter++;
 
@@ -420,7 +464,7 @@ void DaliTableView::Populate()
       }
 
       // Set tableview position
-      Vector3 pagePos( stageSize.x * mButtonsPageRelativeSize.x * t, 0.0f, 0.0f );
+      Vector3 pagePos( stageSize.width * TABLE_RELATIVE_SIZE.x * t, 0.0f, 0.0f );
       page.SetPosition( pagePos );
 
       mPages.push_back( page );
@@ -433,19 +477,14 @@ void DaliTableView::Populate()
   }
 
   // Update Ruler info.
-  mScrollRulerX = new FixedRuler( stageSize.width * mButtonsPageRelativeSize.x );
+  mScrollRulerX = new FixedRuler( mPageWidth );
   mScrollRulerY = new DefaultRuler();
-  mScrollRulerX->SetDomain( RulerDomain( 0.0f, mTotalPages * stageSize.width * mButtonsPageRelativeSize.x, true ) );
+  mScrollRulerX->SetDomain( RulerDomain( 0.0f, (mTotalPages+1) * stageSize.width * TABLE_RELATIVE_SIZE.x * 0.5f, true ) );
   mScrollRulerY->Disable();
   mScrollView.SetRulerX( mScrollRulerX );
   mScrollView.SetRulerY( mScrollRulerY );
 }
 
-void DaliTableView::OrientationChanged( Orientation orientation )
-{
-  // TODO: Implement if orientation change required
-}
-
 void DaliTableView::Rotate( unsigned int degrees )
 {
   // Resize the root actor
@@ -464,84 +503,89 @@ void DaliTableView::Rotate( unsigned int degrees )
   }
 
   mRotateAnimation = Animation::New( ROTATE_ANIMATION_TIME );
-  mRotateAnimation.RotateTo( mRootActor, Degree( 360 - degrees ), Vector3::ZAXIS, AlphaFunctions::EaseOut );
-  mRotateAnimation.Resize( mRootActor, targetSize, AlphaFunctions::EaseOut );
+  mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::ORIENTATION ), Quaternion( Radian( Degree( 360 - degrees ) ), Vector3::ZAXIS ), AlphaFunction::EASE_OUT );
+  mRotateAnimation.AnimateTo( Property( mRootActor, Actor::Property::SIZE ), targetSize, AlphaFunction::EASE_OUT );
   mRotateAnimation.Play();
 }
 
-Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Size& parentSize, bool addBackground )
+Actor DaliTableView::CreateTile( const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Vector2& position )
 {
-  Actor tile = Actor::New();
-  tile.SetName( name );
-  tile.SetAnchorPoint( AnchorPoint::CENTER );
-  tile.SetParentOrigin( ParentOrigin::CENTER );
-
-  // create background image
-  if( addBackground )
-  {
-    Image bg = ResourceImage::New( TILE_BACKGROUND );
-    ImageActor image = ImageActor::New( bg );
-    image.SetAnchorPoint( AnchorPoint::CENTER );
-    image.SetParentOrigin( ParentOrigin::CENTER );
-    // make the image 100% of tile
-    image.SetSizeMode( SIZE_EQUAL_TO_PARENT );
-    // move image back to get text appear in front
-    image.SetZ( -1 );
-    image.SetStyle( ImageActor::STYLE_NINE_PATCH );
-    image.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) );
-    tile.Add( image );
-
-    // Add stencil
-    ImageActor stencil = NewStencilImage();
-    stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT );
-    image.Add( stencil );
-  }
+  Actor content = Actor::New();
+  content.SetName( name );
+  content.SetAnchorPoint( AnchorPoint::CENTER );
+  content.SetParentOrigin( ParentOrigin::CENTER );
+  content.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  content.SetSizeModeFactor( sizeMultiplier );
+
+  Toolkit::ImageView tileContent = ImageView::New();
+  tileContent.SetParentOrigin( ParentOrigin::CENTER );
+  tileContent.SetAnchorPoint( AnchorPoint::CENTER );
+  tileContent.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+
+  // Add the image via the property first.
+  tileContent.SetProperty( Toolkit::ImageView::Property::IMAGE, TILE_BACKGROUND_ALPHA );
+  // Register a property with the ImageView. This allows us to inject the scroll-view position into the shader.
+  Property::Value value = Vector3( 0.0f, 0.0f, 0.0f );
+  Property::Index propertyIndex = tileContent.RegisterProperty( "uCustomPosition", value );
+
+  // Add a shader to the image (details in shader source).
+  Property::Map map;
+  Property::Map customShader;
+  customShader[ Visual::Shader::Property::FRAGMENT_SHADER ] = FRAGMENT_SHADER_TEXTURED;
+  map[ Visual::Property::SHADER ] = customShader;
+  tileContent.SetProperty( Toolkit::ImageView::Property::IMAGE, map );
+  tileContent.SetColor( TILE_COLOR );
+
+  // We create a constraint to perform a precalculation on the scroll-view X offset
+  // and pass it to the shader uniform, along with the tile's position.
+  Constraint shaderPosition = Constraint::New < Vector3 > ( tileContent, propertyIndex, TileShaderPositionConstraint( mPageWidth, position.x ) );
+  shaderPosition.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) );
+  shaderPosition.SetRemoveAction( Constraint::Discard );
+  shaderPosition.Apply();
+  content.Add( tileContent );
+
+  // Create an ImageView for the 9-patch border around the tile.
+  ImageView borderImage = ImageView::New( TILE_BACKGROUND );
+  borderImage.SetAnchorPoint( AnchorPoint::CENTER );
+  borderImage.SetParentOrigin( ParentOrigin::CENTER );
+  borderImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+  borderImage.SetOpacity( 0.8f );
+  tileContent.Add( borderImage );
 
   TextLabel label = TextLabel::New();
-  label.SetParentOrigin( ParentOrigin::TOP_LEFT );
-  label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  label.SetAnchorPoint( AnchorPoint::CENTER );
+  label.SetParentOrigin( ParentOrigin::CENTER );
+  label.SetStyleName( "LauncherLabel" );
   label.SetProperty( TextLabel::Property::MULTI_LINE, true );
   label.SetProperty( TextLabel::Property::TEXT, title );
-  label.SetColor( Color::BLACK );
-  tile.Add( label );
+  label.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+  label.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+  label.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
 
-  // FIXME - This is a kludge because size negotiation is not finished
-  label.SetSize( parentSize );
+  // Pad around the label as its size is the same as the 9-patch border. It will overlap it without padding.
+  label.SetPadding( Padding( TILE_LABEL_PADDING, TILE_LABEL_PADDING, TILE_LABEL_PADDING, TILE_LABEL_PADDING ) );
+  content.Add( label );
 
   // Set the tile to be keyboard focusable
-  tile.SetKeyboardFocusable(true);
+  content.SetKeyboardFocusable( true );
 
   // connect to the touch events
-  tile.TouchedSignal().Connect( this, &DaliTableView::OnTilePressed );
-  tile.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
+  content.TouchSignal().Connect( this, &DaliTableView::OnTilePressed );
+  content.HoveredSignal().Connect( this, &DaliTableView::OnTileHovered );
 
-  return tile;
+  return content;
 }
 
-ImageActor DaliTableView::NewStencilImage()
+bool DaliTableView::OnTilePressed( Actor actor, const TouchData& event )
 {
-  Image alpha = ResourceImage::New( TILE_BACKGROUND_ALPHA );
-
-  ImageActor stencilActor = ImageActor::New( alpha );
-  stencilActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
-  stencilActor.SetNinePatchBorder( Vector4( IMAGE_BORDER_LEFT, IMAGE_BORDER_TOP, IMAGE_BORDER_RIGHT, IMAGE_BORDER_BOTTOM ) );
-
-  stencilActor.SetParentOrigin( ParentOrigin::CENTER );
-  stencilActor.SetAnchorPoint( AnchorPoint::CENTER );
-  stencilActor.SetDrawMode( DrawMode::STENCIL );
-
-  Dali::ShaderEffect shaderEffect = AlphaDiscardEffect::New();
-  stencilActor.SetShaderEffect( shaderEffect );
-
-  return stencilActor;
+  return DoTilePress( actor, event.GetState( 0 ) );
 }
 
-bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event )
+bool DaliTableView::DoTilePress( Actor actor, PointState::Type pointState )
 {
   bool consumed = false;
 
-  const TouchPoint& point = event.GetPoint( 0 );
-  if( TouchPoint::Down == point.state )
+  if( PointState::DOWN == pointState )
   {
     mPressedActor = actor;
     consumed = true;
@@ -549,21 +593,22 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event )
 
   // A button press is only valid if the Down & Up events
   // both occurred within the button.
-  if( ( TouchPoint::Up == point.state ) &&
+  if( ( PointState::UP == pointState ) &&
       ( mPressedActor == actor ) )
   {
-    std::string name = actor.GetName();
-    ExampleMapConstIter iter = mExampleMap.find( name );
-
-    FocusManager focusManager = FocusManager::Get();
-
-    if( iter != mExampleMap.end() )
+    // ignore Example button presses when scrolling or button animating.
+    if( ( !mScrolling ) && ( !mPressedAnimation ) )
     {
-      // ignore Example button presses when scrolling or button animating.
-      if( ( !mScrolling ) && ( !mPressedAnimation ) )
+      std::string name = actor.GetName();
+      const ExampleListIter end = mExampleList.end();
+      for( ExampleListIter iter = mExampleList.begin(); iter != end; ++iter )
       {
-        // do nothing, until pressed animation finished.
-        consumed = true;
+        if( (*iter).name == name )
+        {
+          // do nothing, until pressed animation finished.
+          consumed = true;
+          break;
+        }
       }
     }
 
@@ -574,10 +619,14 @@ bool DaliTableView::OnTilePressed( Actor actor, const TouchEvent& event )
 
       // scale the content actor within the Tile, as to not affect the placement within the Table.
       Actor content = actor.GetChildAt(0);
-      mPressedAnimation.ScaleTo( content, Vector3( 0.9f, 0.9f, 1.0f ), AlphaFunctions::EaseInOut, 0.0f,
-                                 BUTTON_PRESS_ANIMATION_TIME * 0.5f );
-      mPressedAnimation.ScaleTo( content, Vector3::ONE, AlphaFunctions::EaseInOut, BUTTON_PRESS_ANIMATION_TIME * 0.5f,
-                                 BUTTON_PRESS_ANIMATION_TIME * 0.5f );
+      mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3( 0.7f, 0.7f, 1.0f ), AlphaFunction::EASE_IN_OUT,
+                                 TimePeriod( 0.0f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) );
+      mPressedAnimation.AnimateTo( Property( content, Actor::Property::SCALE ), Vector3::ONE, AlphaFunction::EASE_IN_OUT,
+                                 TimePeriod( BUTTON_PRESS_ANIMATION_TIME * 0.5f, BUTTON_PRESS_ANIMATION_TIME * 0.5f ) );
+
+      // Rotate button on the Y axis when pressed.
+      mPressedAnimation.AnimateBy( Property( content, Actor::Property::ORIENTATION ), Quaternion( Degree( 0.0f ), Degree( 180.0f ), Degree( 0.0f ) ) );
+
       mPressedAnimation.Play();
       mPressedAnimation.FinishedSignal().Connect( this, &DaliTableView::OnPressedAnimationFinished );
     }
@@ -591,59 +640,38 @@ void DaliTableView::OnPressedAnimationFinished( Dali::Animation& source )
   if( mPressedActor )
   {
     std::string name = mPressedActor.GetName();
-    ExampleMapConstIter iter = mExampleMap.find( name );
 
-    if( iter == mExampleMap.end() )
+    std::stringstream stream;
+    stream << DEMO_EXAMPLE_BIN << name.c_str();
+    pid_t pid = fork();
+    if( pid == 0)
     {
-      if( name == BUTTON_QUIT )
-      {
-        // Move focus to the OK button
-        FocusManager focusManager = FocusManager::Get();
-
-        // Enable the group mode and wrap mode
-        focusManager.SetGroupMode( true );
-        focusManager.SetWrapMode( true );
-      }
-    }
-    else
-    {
-      const Example& example( iter->second );
-
-      std::stringstream stream;
-      stream << DALI_EXAMPLE_BIN << example.name.c_str();
-      pid_t pid = fork();
-      if( pid == 0)
-      {
-        execlp( stream.str().c_str(), example.name.c_str(), NULL );
-        DALI_ASSERT_ALWAYS(false && "exec failed!");
-      }
+      execlp( stream.str().c_str(), name.c_str(), NULL );
+      DALI_ASSERT_ALWAYS(false && "exec failed!");
     }
     mPressedActor.Reset();
   }
 }
 
-void DaliTableView::OnScrollStart( const Dali::Vector3& position )
+void DaliTableView::OnScrollStart( const Dali::Vector2& position )
 {
   mScrolling = true;
 
   PlayAnimation();
 }
 
-void DaliTableView::OnScrollComplete( const Dali::Vector3& position )
+void DaliTableView::OnScrollComplete( const Dali::Vector2& position )
 {
   mScrolling = false;
 
   // move focus to 1st item of new page
-  FocusManager focusManager = FocusManager::Get();
-  focusManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
-
-  ApplyCubeEffectToActors();
+  AccessibilityManager accessibilityManager = AccessibilityManager::Get();
+  accessibilityManager.SetCurrentFocusActor(mPages[mScrollView.GetCurrentPage()].GetChildAt(0) );
 }
 
-bool DaliTableView::OnScrollTouched( Actor actor, const TouchEvent& event )
+bool DaliTableView::OnScrollTouched( Actor actor, const TouchData& event )
 {
-  const TouchPoint& point = event.GetPoint( 0 );
-  if( TouchPoint::Down == point.state )
+  if( PointState::DOWN == event.GetState( 0 ) )
   {
     mPressedActor = actor;
   }
@@ -668,21 +696,29 @@ void DaliTableView::ApplyScrollViewEffect()
 
 void DaliTableView::SetupInnerPageCubeEffect()
 {
-  mScrollViewEffect = ScrollViewCubeEffect::New();
-  mScrollView.SetScrollSnapDuration( EFFECT_SNAP_DURATION );
-  mScrollView.SetScrollFlickDuration( EFFECT_FLICK_DURATION );
-  mScrollView.RemoveConstraintsFromChildren();
-}
-
-void DaliTableView::ApplyCubeEffectToActor( Actor actor )
-{
-  actor.RemoveConstraints();
+  const Vector2 stageSize = Stage::GetCurrent().GetSize();
 
-  ScrollViewCubeEffect cubeEffect = ScrollViewCubeEffect::DownCast(mScrollViewEffect);
-  cubeEffect.ApplyToActor( actor,
-                           ScalePointSize( ( rand() & 1 ) ? ANCHOR_3DEFFECT_STYLE0 : ANCHOR_3DEFFECT_STYLE1 ),
-                           ANGLE_SWING_3DEFFECT,
-                           POSITION_SWING_3DEFFECT * Vector2(Stage::GetCurrent().GetSize()));
+  Dali::Path path = Dali::Path::New();
+  Dali::Property::Array points;
+  points.Resize(3);
+  points[0] = Vector3( stageSize.x*0.5, 0.0f,  stageSize.x*0.5f);
+  points[1] = Vector3( 0.0f, 0.0f, 0.0f );
+  points[2] = Vector3( -stageSize.x*0.5f, 0.0f, stageSize.x*0.5f);
+  path.SetProperty( Path::Property::POINTS, points );
+
+  Dali::Property::Array controlPoints;
+  controlPoints.Resize(4);
+  controlPoints[0] = Vector3( stageSize.x*0.5f, 0.0f, stageSize.x*0.3f );
+  controlPoints[1] = Vector3( stageSize.x*0.3f, 0.0f, 0.0f );
+  controlPoints[2] = Vector3(-stageSize.x*0.3f, 0.0f, 0.0f );
+  controlPoints[3] = Vector3(-stageSize.x*0.5f, 0.0f,  stageSize.x*0.3f );
+  path.SetProperty( Path::Property::CONTROL_POINTS, controlPoints );
+
+
+  mScrollViewEffect = ScrollViewPagePathEffect::New(path,
+                                                    Vector3(-1.0f,0.0f,0.0f),
+                                                    Toolkit::ScrollView::Property::SCROLL_FINAL_X,
+                                                    Vector3(stageSize.x*TABLE_RELATIVE_SIZE.x,stageSize.y*TABLE_RELATIVE_SIZE.y,0.0f),mTotalPages);
 }
 
 void DaliTableView::OnKeyEvent( const KeyEvent& event )
@@ -691,9 +727,11 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event )
   {
     if ( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
     {
-      if ( mVersionPopup && mVersionPopupShown )
+      // If there's a Popup, Hide it if it's contributing to the display in any way (EG. transitioning in or out).
+      // Otherwise quit.
+      if ( mVersionPopup && ( mVersionPopup.GetDisplayState() != Toolkit::Popup::HIDDEN ) )
       {
-        HideVersionPopup();
+        mVersionPopup.SetDisplayState( Popup::HIDDEN );
       }
       else
       {
@@ -703,75 +741,77 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event )
   }
 }
 
-void DaliTableView::SetupBackground( Actor bubbleContainer, Actor backgroundLayer, const Vector2& size )
+void DaliTableView::SetupBackground( Actor bubbleContainer )
 {
-  // Create distance field shape.
-  BufferImage distanceField;
+  // Create distance field shapes.
+  BufferImage distanceFields[2];
   Size imageSize( 512, 512 );
-  CreateShapeImage( CIRCLE, imageSize, distanceField );
 
-  // Create solid background colour.
-  ImageActor backgroundColourActor = Dali::Toolkit::CreateSolidColorActor( BACKGROUND_COLOR );
-  backgroundColourActor.SetAnchorPoint( AnchorPoint::CENTER );
-  backgroundColourActor.SetParentOrigin( ParentOrigin::CENTER );
-  backgroundColourActor.SetSize( size * BACKGROUND_SIZE_SCALE );
-  backgroundColourActor.SetZ( BACKGROUND_Z );
-  backgroundColourActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
-  backgroundLayer.Add( backgroundColourActor );
+  CreateShapeImage( CIRCLE, imageSize, distanceFields[0] );
+  CreateShapeImage( BUBBLE, imageSize, distanceFields[1] );
 
   // Add bubbles to the bubbleContainer.
   // Note: The bubbleContainer is parented externally to this function.
-  AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceField, size );
+  AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceFields );
 }
 
-void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage distanceField, const Dali::Vector2& size )
+void DaliTableView::InitialiseBackgroundActors( Actor actor )
 {
-  for( int i = 0; i < count; ++i )
-  {
-    float randSize = Random::Range( 10.0f, 400.0f );
-    float hue = Random::Range( 0.3f, 1.0f );
-    Vector4 randColour( hue, hue*0.5, 0.0f, Random::Range( 0.3f, 0.6f ));
+  // Delete current animations
+  mBackgroundAnimations.clear();
 
-    ImageActor dfActor = ImageActor::New( distanceField );
-    mBackgroundActors.push_back( dfActor );
-    dfActor.SetSize( Vector2( randSize, randSize ) );
-    dfActor.SetParentOrigin( ParentOrigin::CENTER );
+  // Create new animations
+  const Vector3 size = actor.GetTargetSize();
 
-    Toolkit::DistanceFieldEffect effect = Toolkit::DistanceFieldEffect::New();
-    dfActor.SetShaderEffect( effect );
-    dfActor.SetColor( randColour );
-    effect.SetOutlineParams( Vector2( 0.55f, 0.00f ) );
-    effect.SetSmoothingEdge( 0.5f );
-    layer.Add( dfActor );
+  for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
+  {
+    Actor child = actor.GetChildAt( i );
+
+    // Calculate a random position
+    Vector3 childPos( Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.85f * BACKGROUND_SPREAD_SCALE ),
+                      Random::Range( -size.y, size.y ),
+                      Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
 
-    // Setup animation
-    Vector3 actorPos(
-        Random::Range( -size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.5f * BACKGROUND_SPREAD_SCALE ),
-        Random::Range( -size.y * 0.5f - randSize, size.y * 0.5f + randSize ),
-        Random::Range( BUBBLE_MIN_Z, BUBBLE_MAX_Z ) );
-    dfActor.SetPosition( actorPos );
+    child.SetPosition( childPos );
 
     // Define bubble horizontal parallax and vertical wrapping
-    Constraint animConstraint = Constraint::New < Vector3 > ( Actor::Property::POSITION,
-      Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
-      Dali::ParentSource( Dali::Actor::Property::SIZE ),
-      AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) );
-    dfActor.ApplyConstraint( animConstraint );
+    Constraint animConstraint = Constraint::New < Vector3 > ( child, Actor::Property::POSITION, AnimateBubbleConstraint( childPos, Random::Range( -0.85f, 0.25f ) ) );
+    animConstraint.AddSource( Source( mScrollView, ScrollView::Property::SCROLL_POSITION ) );
+    animConstraint.AddSource( Dali::ParentSource( Dali::Actor::Property::SIZE ) );
+    animConstraint.AddSource( Dali::LocalSource( Dali::Actor::Property::SIZE ) );
+    animConstraint.SetRemoveAction( Constraint::Discard );
+    animConstraint.Apply();
 
     // Kickoff animation
-    Animation animation = Animation::New( Random::Range( 40.0f, 200.0f ) );
-    KeyFrames keyframes = KeyFrames::New();
-    keyframes.Add( 0.0f, actorPos );
-    Vector3 toPos( actorPos );
-    toPos.y -= ( size.y + randSize );
-    keyframes.Add( 1.0f, toPos );
-    animation.AnimateBetween( Property( dfActor, Actor::Property::POSITION ), keyframes );
+    Animation animation = Animation::New( Random::Range( 30.0f, 160.0f ) );
+    animation.AnimateBy( Property( child, Actor::Property::POSITION ), Vector3( 0.0f, -2000.0f, 0.0f ), AlphaFunction::LINEAR );
     animation.SetLooping( true );
     animation.Play();
     mBackgroundAnimations.push_back( animation );
   }
 }
 
+void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* distanceField )
+{
+  for( int i = 0; i < count; ++i )
+  {
+    float randSize = Random::Range( 10.0f, 400.0f );
+    int distanceFieldType = static_cast<int>( Random::Range( 0.0f, 1.0f ) + 0.5f );
+    ImageView dfActor = ImageView::New( distanceField[ distanceFieldType ] );
+    dfActor.SetSize( Vector2( randSize, randSize ) );
+    dfActor.SetParentOrigin( ParentOrigin::CENTER );
+
+    Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect();
+    dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect );
+    dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] );
+
+    layer.Add( dfActor );
+  }
+
+  // Positioning will occur when the layer is relaid out
+  layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors );
+}
+
 void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut )
 {
   // this bitmap will hold the alpha map for the distance field shader
@@ -786,8 +826,8 @@ void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, Buf
     case CIRCLE:
       GenerateCircle( size, imageDataA8 );
       break;
-    case SQUARE:
-      GenerateSquare( size, imageDataA8 );
+    case BUBBLE:
+      GenerateCircle( size, imageDataA8, true );
       break;
     default:
       break;
@@ -801,18 +841,7 @@ void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, Buf
   }
 }
 
-void DaliTableView::GenerateSquare( const Size& size, std::vector< unsigned char >& distanceFieldOut )
-{
-  for( int h = 0; h < size.height; ++h )
-  {
-    for( int w = 0; w < size.width; ++w )
-    {
-      distanceFieldOut.push_back( 0xFF );
-    }
-  }
-}
-
-void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut )
+void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut, bool hollow )
 {
   const float radius = size.width * 0.5f * size.width * 0.5f;
   Vector2 center( size.width / 2, size.height / 2 );
@@ -824,25 +853,22 @@ void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char
       Vector2 pos( w, h );
       Vector2 dist = pos - center;
 
-      if( dist.x * dist.x + dist.y * dist.y > radius )
-      {
-        distanceFieldOut.push_back( 0x00 );
-      }
-      else
-      {
-        distanceFieldOut.push_back( 0xFF );
-      }
+      float distance = ( dist.x * dist.x ) + ( dist.y * dist.y );
+
+      // If hollow, check the distance against a min & max value, otherwise just use the max value.
+      unsigned char fillByte = ( hollow ? ( ( distance <= radius ) && ( distance > ( radius * 0.7f ) ) ) : ( distance <= radius ) ) ? 0xFF : 0x00;
+
+      distanceFieldOut.push_back( fillByte );
     }
   }
 }
 
-ImageActor DaliTableView::CreateLogo( std::string imagePath )
+ImageView DaliTableView::CreateLogo( std::string imagePath )
 {
-  Image image = ResourceImage::New( imagePath );
-  ImageActor logo = ImageActor::New( image );
+  ImageView logo = ImageView::New( imagePath );
 
   logo.SetAnchorPoint( AnchorPoint::CENTER );
-  logo.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
+  logo.SetParentOrigin( ParentOrigin::CENTER );
 
   return logo;
 }
@@ -862,7 +888,7 @@ void DaliTableView::PauseAnimation()
     {
       Animation anim = *animIter;
 
-      anim.Pause();
+      anim.Stop();
     }
 
     mBackgroundAnimsPlaying = false;
@@ -886,37 +912,37 @@ void DaliTableView::PlayAnimation()
   mAnimationTimer.SetInterval( BACKGROUND_ANIMATION_DURATION );
 }
 
-Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction )
+Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction )
 {
   Actor nextFocusActor = proposed;
 
-  if ( !current && !proposed  )
+  if( !current && !proposed  )
   {
     // Set the initial focus to the first tile in the current page should be focused.
     nextFocusActor = mPages[mScrollView.GetCurrentPage()].GetChildAt(0);
   }
-  else if( !proposed || (proposed && proposed == mScrollViewLayer) )
+  else if( !proposed )
   {
     // ScrollView is being focused but nothing in the current page can be focused further
     // in the given direction. We should work out which page to scroll to next.
     int currentPage = mScrollView.GetCurrentPage();
     int newPage = currentPage;
-    if( direction == Dali::Toolkit::Control::Left )
+    if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT )
     {
       newPage--;
     }
-    else if( direction == Dali::Toolkit::Control::Right )
+    else if( direction == Dali::Toolkit::Control::KeyboardFocus::RIGHT )
     {
       newPage++;
     }
 
-    newPage = std::max(0, std::min(static_cast<int>(mScrollRulerX->GetTotalPages() - 1), newPage));
+    newPage = std::max(0, std::min(mTotalPages - 1, newPage));
     if( newPage == currentPage )
     {
-      if( direction == Dali::Toolkit::Control::Left )
+      if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT )
       {
-        newPage = mScrollRulerX->GetTotalPages() - 1;
-      } else if( direction == Dali::Toolkit::Control::Right )
+        newPage = mTotalPages - 1;
+      } else if( direction == Dali::Toolkit::Control::KeyboardFocus::RIGHT )
       {
         newPage = 0;
       }
@@ -925,7 +951,7 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::
     // Scroll to the page in the given direction
     mScrollView.ScrollTo(newPage);
 
-    if( direction == Dali::Toolkit::Control::Left )
+    if( direction == Dali::Toolkit::Control::KeyboardFocus::LEFT )
     {
       // Work out the cell position for the last tile
       int remainingExamples = mExampleList.size() - newPage * EXAMPLES_PER_PAGE;
@@ -933,7 +959,7 @@ Dali::Actor DaliTableView::OnKeyboardPreFocusChange( Dali::Actor current, Dali::
       int colPos = remainingExamples >= EXAMPLES_PER_PAGE ? EXAMPLES_PER_ROW - 1 : ( remainingExamples % EXAMPLES_PER_PAGE - rowPos * EXAMPLES_PER_ROW - 1 );
 
       // Move the focus to the last tile in the new page.
-      nextFocusActor = mPages[newPage].GetChildAt(colPos * EXAMPLES_PER_ROW + rowPos);
+      nextFocusActor = mPages[newPage].GetChildAt(rowPos * EXAMPLES_PER_ROW + colPos);
     }
     else
     {
@@ -952,9 +978,7 @@ void DaliTableView::OnFocusedActorActivated( Dali::Actor activatedActor )
     mPressedActor = activatedActor;
 
     // Activate the current focused actor;
-    TouchEvent touchEventUp;
-    touchEventUp.points.push_back( TouchPoint ( 0, TouchPoint::Up, 0.0f, 0.0f ) );
-    OnTilePressed(mPressedActor, touchEventUp);
+    DoTilePress( mPressedActor, PointState::UP );
   }
 }
 
@@ -966,43 +990,48 @@ bool DaliTableView::OnTileHovered( Actor actor, const HoverEvent& event )
 
 void DaliTableView::OnLogoTapped( Dali::Actor actor, const Dali::TapGesture& tap )
 {
-  if ( !mVersionPopupShown )
+  // Only show if currently fully hidden. If transitioning-out, the transition will not be interrupted.
+  if ( !mVersionPopup || ( mVersionPopup.GetDisplayState() == Toolkit::Popup::HIDDEN ) )
   {
     if ( !mVersionPopup )
     {
       std::ostringstream stream;
-      stream << "DALi Core: "    << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")" << std::endl << std::endl;
-      stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")" << std::endl << std::endl;
-      stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")";
+      stream << "DALi Core: "    << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl << "(" << CORE_BUILD_DATE << ")\n";
+      stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl << "(" << ADAPTOR_BUILD_DATE << ")\n";
+      stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl << "(" << TOOLKIT_BUILD_DATE << ")\n";
 
       mVersionPopup = Dali::Toolkit::Popup::New();
-      mVersionPopup.SetTitle( stream.str() );
-      mVersionPopup.SetParentOrigin( ParentOrigin::CENTER );
-      mVersionPopup.SetAnchorPoint( AnchorPoint::CENTER );
-      mVersionPopup.HideTail();
-      mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
-      mVersionPopup.HiddenSignal().Connect( this, &DaliTableView::PopupHidden );
 
-      Dali::Stage::GetCurrent().Add( mVersionPopup );
+      Toolkit::TextLabel titleActor = Toolkit::TextLabel::New( "Version information" );
+      titleActor.SetName( "titleActor" );
+      titleActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+
+      Toolkit::TextLabel contentActor = Toolkit::TextLabel::New( stream.str() );
+      contentActor.SetName( "contentActor" );
+      contentActor.SetProperty( Toolkit::TextLabel::Property::MULTI_LINE, true );
+      contentActor.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+      contentActor.SetPadding( Padding( 0.0f, 0.0f, 20.0f, 0.0f ) );
+
+      mVersionPopup.SetTitle( titleActor );
+      mVersionPopup.SetContent( contentActor );
+
+      mVersionPopup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH );
+      mVersionPopup.SetSizeModeFactor( Vector3( 0.75f, 1.0f, 1.0f ) );
+      mVersionPopup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT );
+
+      mVersionPopup.OutsideTouchedSignal().Connect( this, &DaliTableView::HideVersionPopup );
+      Stage::GetCurrent().Add( mVersionPopup );
     }
 
-    mVersionPopup.Show();
-    mVersionPopupShown = true;
+    mVersionPopup.SetDisplayState( Popup::SHOWN );
   }
 }
 
 void DaliTableView::HideVersionPopup()
 {
-  if ( mVersionPopup )
-  {
-    mVersionPopup.Hide();
-  }
-}
-
-void DaliTableView::PopupHidden()
-{
-  if ( mVersionPopup )
+  // Only hide if currently fully shown. If transitioning-in, the transition will not be interrupted.
+  if ( mVersionPopup && ( mVersionPopup.GetDisplayState() == Toolkit::Popup::SHOWN ) )
   {
-    mVersionPopupShown = false;
+    mVersionPopup.SetDisplayState( Popup::HIDDEN );
   }
 }