Commit e22394f525ccad9b97ab0fcb7869ce62ab66dc34

Authored by Adeel Kazmi
Committed by Gerrit Code Review
2 parents de91eaa5 a6bac419

Merge "Reduced complexity of dali-table-view" into devel/master

build/tizen/demo/CMakeLists.txt
@@ -6,6 +6,7 @@ SET(DEMO_SRCS @@ -6,6 +6,7 @@ SET(DEMO_SRCS
6 ${DEMO_SRCS} 6 ${DEMO_SRCS}
7 "${ROOT_SRC_DIR}/shared/resources-location.cpp" 7 "${ROOT_SRC_DIR}/shared/resources-location.cpp"
8 "${ROOT_SRC_DIR}/shared/dali-table-view.cpp" 8 "${ROOT_SRC_DIR}/shared/dali-table-view.cpp"
  9 + "${ROOT_SRC_DIR}/shared/bubble-animator.cpp"
9 ) 10 )
10 11
11 IF(WIN32) 12 IF(WIN32)
build/tizen/examples-reel/CMakeLists.txt
@@ -6,6 +6,7 @@ SET(EXAMPLES_REEL_SRCS @@ -6,6 +6,7 @@ SET(EXAMPLES_REEL_SRCS
6 ${EXAMPLES_REEL_SRCS} 6 ${EXAMPLES_REEL_SRCS}
7 "${ROOT_SRC_DIR}/shared/resources-location.cpp" 7 "${ROOT_SRC_DIR}/shared/resources-location.cpp"
8 "${ROOT_SRC_DIR}/shared/dali-table-view.cpp" 8 "${ROOT_SRC_DIR}/shared/dali-table-view.cpp"
  9 + "${ROOT_SRC_DIR}/shared/bubble-animator.cpp"
9 ) 10 )
10 11
11 IF(WIN32) 12 IF(WIN32)
build/tizen/tests-reel/CMakeLists.txt
@@ -6,6 +6,7 @@ SET(TESTS_REEL_SRCS @@ -6,6 +6,7 @@ SET(TESTS_REEL_SRCS
6 ${TESTS_REEL_SRCS} 6 ${TESTS_REEL_SRCS}
7 "${ROOT_SRC_DIR}/shared/resources-location.cpp" 7 "${ROOT_SRC_DIR}/shared/resources-location.cpp"
8 "${ROOT_SRC_DIR}/shared/dali-table-view.cpp" 8 "${ROOT_SRC_DIR}/shared/dali-table-view.cpp"
  9 + "${ROOT_SRC_DIR}/shared/bubble-animator.cpp"
9 ) 10 )
10 11
11 IF(WIN32) 12 IF(WIN32)
shared/bubble-animator.cpp 0 → 100644
  1 +/*
  2 + * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +// CLASS HEADER
  19 +#include "bubble-animator.h"
  20 +
  21 +#include <dali/public-api/animation/constraint.h>
  22 +#include <dali/public-api/math/random.h>
  23 +#include <dali/public-api/rendering/shader.h>
  24 +#include <dali-toolkit/public-api/controls/image-view/image-view.h>
  25 +#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
  26 +#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
  27 +#include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
  28 +
  29 +using namespace Dali;
  30 +using namespace Dali::Toolkit;
  31 +
  32 +namespace
  33 +{
  34 +const char* const BUBBLE_COLOR_STYLE_NAME[] =
  35 +{
  36 + "BubbleColor1",
  37 + "BubbleColor2",
  38 + "BubbleColor3",
  39 + "BubbleColor4"
  40 +};
  41 +constexpr int NUMBER_OF_BUBBLE_COLORS(sizeof(BUBBLE_COLOR_STYLE_NAME) / sizeof(BUBBLE_COLOR_STYLE_NAME[0]));
  42 +
  43 +const char* const SHAPE_IMAGE_TABLE[] =
  44 +{
  45 + DEMO_IMAGE_DIR "shape-circle.png",
  46 + DEMO_IMAGE_DIR "shape-bubble.png"
  47 +};
  48 +constexpr int NUMBER_OF_SHAPE_IMAGES(sizeof(SHAPE_IMAGE_TABLE) / sizeof(SHAPE_IMAGE_TABLE[0]));
  49 +
  50 +constexpr int NUM_BACKGROUND_IMAGES = 18;
  51 +constexpr float BACKGROUND_SPREAD_SCALE = 1.5f;
  52 +
  53 +constexpr unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs
  54 +
  55 +constexpr float BUBBLE_MIN_Z = -1.0;
  56 +constexpr float BUBBLE_MAX_Z = 0.0f;
  57 +
  58 +/**
  59 + * Constraint to return a position for a bubble based on the scroll value and vertical wrapping
  60 + */
  61 +struct AnimateBubbleConstraint
  62 +{
  63 +public:
  64 + AnimateBubbleConstraint(const Vector3& initialPos, float scale)
  65 + : mInitialX(initialPos.x),
  66 + mScale(scale)
  67 + {
  68 + }
  69 +
  70 + void operator()(Vector3& position, const PropertyInputContainer& inputs)
  71 + {
  72 + const Vector3& parentSize = inputs[1]->GetVector3();
  73 + const Vector3& childSize = inputs[2]->GetVector3();
  74 +
  75 + // Wrap bubbles vertically.
  76 + float range = parentSize.y + childSize.y;
  77 + // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder).
  78 + position.y -= range * (floor(position.y / range) + 0.5f);
  79 +
  80 + // Bubbles X position moves parallax to horizontal
  81 + // panning by a scale factor unique to each bubble.
  82 + position.x = mInitialX + (inputs[0]->GetVector2().x * mScale);
  83 + }
  84 +
  85 +private:
  86 + float mInitialX;
  87 + float mScale;
  88 +};
  89 +
  90 +} // unnamed namespace
  91 +
  92 +void BubbleAnimator::Initialize(Dali::Actor parent, Dali::Actor scrollView)
  93 +{
  94 + mScrollView = scrollView;
  95 +
  96 + // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show
  97 + Actor bubbleContainer = Actor::New();
  98 + bubbleContainer.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
  99 + bubbleContainer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
  100 + bubbleContainer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
  101 + AddBackgroundActors(bubbleContainer, NUM_BACKGROUND_IMAGES);
  102 + parent.Add(bubbleContainer);
  103 +
  104 + // Background animation
  105 + mAnimationTimer = Timer::New(BACKGROUND_ANIMATION_DURATION);
  106 + mAnimationTimer.TickSignal().Connect(this, &BubbleAnimator::PauseAnimation);
  107 + mAnimationTimer.Start();
  108 + mBackgroundAnimsPlaying = true;
  109 +}
  110 +
  111 +bool BubbleAnimator::PauseAnimation()
  112 +{
  113 + if(mBackgroundAnimsPlaying)
  114 + {
  115 + for(auto&& anim : mBackgroundAnimations)
  116 + {
  117 + anim.Stop();
  118 + }
  119 +
  120 + mBackgroundAnimsPlaying = false;
  121 + }
  122 + return false;
  123 +}
  124 +
  125 +void BubbleAnimator::PlayAnimation()
  126 +{
  127 + if(!mBackgroundAnimsPlaying)
  128 + {
  129 + for(auto&& anim : mBackgroundAnimations)
  130 + {
  131 + anim.Play();
  132 + }
  133 +
  134 + mBackgroundAnimsPlaying = true;
  135 + }
  136 +
  137 + mAnimationTimer.SetInterval(BACKGROUND_ANIMATION_DURATION);
  138 +}
  139 +void BubbleAnimator::InitializeBackgroundActors(Dali::Actor actor)
  140 +{
  141 + // Delete current animations
  142 + mBackgroundAnimations.clear();
  143 +
  144 + // Create new animations
  145 + const Vector3 size = actor.GetTargetSize();
  146 +
  147 + for(unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i)
  148 + {
  149 + Actor child = actor.GetChildAt(i);
  150 +
  151 + // Calculate a random position
  152 + Vector3 childPos(Random::Range(-size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.85f * BACKGROUND_SPREAD_SCALE),
  153 + Random::Range(-size.y, size.y),
  154 + Random::Range(BUBBLE_MIN_Z, BUBBLE_MAX_Z));
  155 +
  156 + child.SetProperty(Actor::Property::POSITION, childPos);
  157 +
  158 + // Define bubble horizontal parallax and vertical wrapping
  159 + Actor scrollView = mScrollView.GetHandle();
  160 + if( scrollView )
  161 + {
  162 + Constraint animConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, AnimateBubbleConstraint(childPos, Random::Range(-0.85f, 0.25f)));
  163 + animConstraint.AddSource(Source(scrollView, ScrollView::Property::SCROLL_POSITION));
  164 + animConstraint.AddSource(Dali::ParentSource(Dali::Actor::Property::SIZE));
  165 + animConstraint.AddSource(Dali::LocalSource(Dali::Actor::Property::SIZE));
  166 + animConstraint.SetRemoveAction(Constraint::DISCARD);
  167 + animConstraint.Apply();
  168 + }
  169 +
  170 + // Kickoff animation
  171 + Animation animation = Animation::New(Random::Range(30.0f, 160.0f));
  172 + animation.AnimateBy(Property(child, Actor::Property::POSITION), Vector3(0.0f, -2000.0f, 0.0f), AlphaFunction::LINEAR);
  173 + animation.SetLooping(true);
  174 + animation.Play();
  175 + mBackgroundAnimations.push_back(animation);
  176 + }
  177 +
  178 +}
  179 +
  180 +void BubbleAnimator::AddBackgroundActors(Actor layer, int count)
  181 +{
  182 + for(int i = 0; i < count; ++i)
  183 + {
  184 + float randSize = Random::Range(10.0f, 400.0f);
  185 + int shapeType = static_cast<int>(Random::Range(0.0f, NUMBER_OF_SHAPE_IMAGES - 1) + 0.5f);
  186 +
  187 + ImageView dfActor = ImageView::New();
  188 + dfActor.SetProperty(Actor::Property::SIZE, Vector2(randSize, randSize));
  189 + dfActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
  190 +
  191 + // Set the Image URL and the custom shader at the same time
  192 + Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect();
  193 + Property::Map imageMap;
  194 + imageMap.Add(ImageVisual::Property::URL, SHAPE_IMAGE_TABLE[shapeType]);
  195 + imageMap.Add(Toolkit::Visual::Property::SHADER, effect);
  196 + dfActor.SetProperty(Toolkit::ImageView::Property::IMAGE, imageMap);
  197 +
  198 + dfActor.SetStyleName(BUBBLE_COLOR_STYLE_NAME[i % NUMBER_OF_BUBBLE_COLORS]);
  199 +
  200 + layer.Add(dfActor);
  201 + }
  202 +
  203 + // Positioning will occur when the layer is relaid out
  204 + layer.OnRelayoutSignal().Connect(this, &BubbleAnimator::InitializeBackgroundActors);
  205 +}
shared/bubble-animator.h 0 → 100644
  1 +#ifndef DALI_DEMO_BUBBLE_ANIMATOR_H
  2 +#define DALI_DEMO_BUBBLE_ANIMATOR_H
  3 +
  4 +/*
  5 + * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + *
  19 + */
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <vector>
  23 +#include <dali/public-api/actors/actor.h>
  24 +#include <dali/public-api/adaptor-framework/timer.h>
  25 +#include <dali/public-api/animation/animation.h>
  26 +#include <dali/public-api/object/weak-handle.h>
  27 +#include <dali/public-api/signals/connection-tracker.h>
  28 +
  29 +/**
  30 + * Creates and animates random sized bubbles
  31 + */
  32 +class BubbleAnimator : public Dali::ConnectionTracker
  33 +{
  34 +public:
  35 +
  36 + /**
  37 + * @brief Initilizes the bubble background
  38 + *
  39 + * @param parent The actor to add all the bubbles to
  40 + * @param scrollView If provided, does a parallax effect when scrolling using this scroll-view (optional)
  41 + */
  42 + void Initialize(Dali::Actor parent, Dali::Actor scrollView = Dali::Actor());
  43 +
  44 + /**
  45 + * @brief Plays the bubble animation
  46 + */
  47 + void PlayAnimation();
  48 +
  49 +private:
  50 +
  51 + /**
  52 + * @brief Used by the timer to pause the animation
  53 + *
  54 + * @return Returns false to cancel the timer
  55 + */
  56 + bool PauseAnimation();
  57 +
  58 + /**
  59 + * @brief Initializes the background actors
  60 + *
  61 + * @param actor Actor which contains all the children
  62 + */
  63 + void InitializeBackgroundActors(Dali::Actor actor);
  64 +
  65 + /**
  66 + * Create background actors for the given layer
  67 + *
  68 + * @param[in] layer The layer to add the actors to
  69 + * @param[in] count The number of actors to generate
  70 + */
  71 + void AddBackgroundActors(Dali::Actor layer, int count);
  72 +
  73 +private:
  74 +
  75 + using AnimationList = std::vector<Dali::Animation>;
  76 +
  77 + Dali::WeakHandle<Dali::Actor> mScrollView; ///< Weak handle to the scroll view used to apply a parallax effect when scrolling.
  78 + AnimationList mBackgroundAnimations; ///< List of background bubble animations.
  79 + Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period.
  80 + bool mBackgroundAnimsPlaying{false}; ///< Are background animations playing.
  81 +};
  82 +
  83 +#endif // DALI_DEMO_BUBBLE_ANIMATOR_H
shared/dali-table-view.cpp
@@ -62,49 +62,17 @@ const float KEYBOARD_FOCUS_MID_KEY_FRAME_TIME = KEYBOARD_FOCUS_ANIMATION_DURAT @@ -62,49 +62,17 @@ const float KEYBOARD_FOCUS_MID_KEY_FRAME_TIME = KEYBOARD_FOCUS_ANIMATION_DURAT
62 62
63 const float TILE_LABEL_PADDING = 8.0f; ///< Border between edge of tile and the example text 63 const float TILE_LABEL_PADDING = 8.0f; ///< Border between edge of tile and the example text
64 const float BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button scale effect. 64 const float BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button scale effect.
65 -const float ROTATE_ANIMATION_TIME = 0.5f; ///< Time to perform rotate effect.  
66 -const int MAX_PAGES = 256; ///< Maximum pages (arbitrary safety limit)  
67 const int EXAMPLES_PER_ROW = 3; 65 const int EXAMPLES_PER_ROW = 3;
68 const int ROWS_PER_PAGE = 3; 66 const int ROWS_PER_PAGE = 3;
69 const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE; 67 const int EXAMPLES_PER_PAGE = EXAMPLES_PER_ROW * ROWS_PER_PAGE;
70 -const float LOGO_MARGIN_RATIO = 0.1f / 0.3f;  
71 -const float BOTTOM_PADDING_RATIO = 0.4f / 0.9f;  
72 -const Vector3 SCROLLVIEW_RELATIVE_SIZE(0.9f, 1.0f, 0.8f); ///< ScrollView's relative size to its parent  
73 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. 68 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.
74 -const float STENCIL_RELATIVE_SIZE = 1.0f;  
75 -  
76 -const float EFFECT_SNAP_DURATION = 0.66f; ///< Scroll Snap Duration for Effects  
77 -const float EFFECT_FLICK_DURATION = 0.5f; ///< Scroll Flick Duration for Effects  
78 -const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f);  
79 -  
80 -const char* const BUBBLE_COLOR_STYLE_NAME[] =  
81 - {  
82 - "BubbleColor1",  
83 - "BubbleColor2",  
84 - "BubbleColor3",  
85 - "BubbleColor4"};  
86 -const int NUMBER_OF_BUBBLE_COLORS(sizeof(BUBBLE_COLOR_STYLE_NAME) / sizeof(BUBBLE_COLOR_STYLE_NAME[0]));  
87 -  
88 -const char* const SHAPE_IMAGE_TABLE[] =  
89 - {  
90 - DEMO_IMAGE_DIR "shape-circle.png",  
91 - DEMO_IMAGE_DIR "shape-bubble.png"};  
92 -const int NUMBER_OF_SHAPE_IMAGES(sizeof(SHAPE_IMAGE_TABLE) / sizeof(SHAPE_IMAGE_TABLE[0]));  
93 -  
94 -const int NUM_BACKGROUND_IMAGES = 18;  
95 -const float BACKGROUND_SPREAD_SCALE = 1.5f;  
96 -  
97 -const unsigned int BACKGROUND_ANIMATION_DURATION = 15000; // 15 secs  
98 -  
99 -const float BUBBLE_MIN_Z = -1.0;  
100 -const float BUBBLE_MAX_Z = 0.0f;  
101 69
102 const char* const DEMO_BUILD_DATE = __DATE__ " " __TIME__; 70 const char* const DEMO_BUILD_DATE = __DATE__ " " __TIME__;
103 71
104 /** 72 /**
105 * Creates the background image 73 * Creates the background image
106 */ 74 */
107 -Control CreateBackground(std::string stylename) 75 +Actor CreateBackground(std::string stylename)
108 { 76 {
109 Control background = Control::New(); 77 Control background = Control::New();
110 background.SetStyleName(stylename); 78 background.SetStyleName(stylename);
@@ -116,38 +84,6 @@ Control CreateBackground(std::string stylename) @@ -116,38 +84,6 @@ Control CreateBackground(std::string stylename)
116 } 84 }
117 85
118 /** 86 /**
119 - * Constraint to return a position for a bubble based on the scroll value and vertical wrapping  
120 - */  
121 -struct AnimateBubbleConstraint  
122 -{  
123 -public:  
124 - AnimateBubbleConstraint(const Vector3& initialPos, float scale)  
125 - : mInitialX(initialPos.x),  
126 - mScale(scale)  
127 - {  
128 - }  
129 -  
130 - void operator()(Vector3& position, const PropertyInputContainer& inputs)  
131 - {  
132 - const Vector3& parentSize = inputs[1]->GetVector3();  
133 - const Vector3& childSize = inputs[2]->GetVector3();  
134 -  
135 - // Wrap bubbles vertically.  
136 - float range = parentSize.y + childSize.y;  
137 - // This performs a float mod (we don't use fmod as we want the arithmetic modulus as opposed to the remainder).  
138 - position.y -= range * (floor(position.y / range) + 0.5f);  
139 -  
140 - // Bubbles X position moves parallax to horizontal  
141 - // panning by a scale factor unique to each bubble.  
142 - position.x = mInitialX + (inputs[0]->GetVector2().x * mScale);  
143 - }  
144 -  
145 -private:  
146 - float mInitialX;  
147 - float mScale;  
148 -};  
149 -  
150 -/**  
151 * Constraint to precalculate values from the scroll-view 87 * Constraint to precalculate values from the scroll-view
152 * and tile positions to pass to the tile shader. 88 * and tile positions to pass to the tile shader.
153 */ 89 */
@@ -182,9 +118,94 @@ private: @@ -182,9 +118,94 @@ private:
182 float mTileXOffset; 118 float mTileXOffset;
183 }; 119 };
184 120
185 -bool CompareByTitle(const Example& lhs, const Example& rhs) 121 +/**
  122 + * Creates a popup that shows the version information of the DALi libraries and demo
  123 + */
  124 +Dali::Toolkit::Popup CreateVersionPopup(Application& application, ConnectionTrackerInterface& connectionTracker)
  125 +{
  126 + std::ostringstream stream;
  127 + stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl
  128 + << "(" << CORE_BUILD_DATE << ")\n";
  129 + stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl
  130 + << "(" << ADAPTOR_BUILD_DATE << ")\n";
  131 + stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl
  132 + << "(" << TOOLKIT_BUILD_DATE << ")\n";
  133 + stream << "DALi Demo:"
  134 + << "\n(" << DEMO_BUILD_DATE << ")\n";
  135 +
  136 + Dali::Toolkit::Popup popup = Dali::Toolkit::Popup::New();
  137 +
  138 + Toolkit::TextLabel titleActor = Toolkit::TextLabel::New("Version information");
  139 + titleActor.SetProperty(Actor::Property::NAME, "titleActor");
  140 + titleActor.SetProperty(Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER);
  141 + titleActor.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE);
  142 +
  143 + Toolkit::TextLabel contentActor = Toolkit::TextLabel::New(stream.str());
  144 + contentActor.SetProperty(Actor::Property::NAME, "contentActor");
  145 + contentActor.SetProperty(Toolkit::TextLabel::Property::MULTI_LINE, true);
  146 + contentActor.SetProperty(Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER);
  147 + contentActor.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE);
  148 + contentActor.SetProperty(Actor::Property::PADDING, Padding(0.0f, 0.0f, 20.0f, 0.0f));
  149 +
  150 + popup.SetTitle(titleActor);
  151 + popup.SetContent(contentActor);
  152 +
  153 + popup.SetResizePolicy(ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH);
  154 + popup.SetProperty(Actor::Property::SIZE_MODE_FACTOR, Vector3(0.75f, 1.0f, 1.0f));
  155 + popup.SetResizePolicy(ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT);
  156 +
  157 + application.GetWindow().Add(popup);
  158 +
  159 + // Hide the popup when touched outside
  160 + popup.OutsideTouchedSignal().Connect(
  161 + &connectionTracker,
  162 + [popup]() mutable
  163 + {
  164 + if(popup && (popup.GetDisplayState() == Toolkit::Popup::SHOWN))
  165 + {
  166 + popup.SetDisplayState(Popup::HIDDEN);
  167 + }
  168 + });
  169 +
  170 + return popup;
  171 +}
  172 +
  173 +/// Sets up the inner cube effect
  174 +Dali::Toolkit::ScrollViewEffect SetupInnerPageCubeEffect(const Vector2 windowSize, int totalPages)
186 { 175 {
187 - return lhs.title < rhs.title; 176 + Dali::Path path = Dali::Path::New();
  177 + Dali::Property::Array points;
  178 + points.Resize(3);
  179 + points[0] = Vector3(windowSize.x * 0.5, 0.0f, windowSize.x * 0.5f);
  180 + points[1] = Vector3(0.0f, 0.0f, 0.0f);
  181 + points[2] = Vector3(-windowSize.x * 0.5f, 0.0f, windowSize.x * 0.5f);
  182 + path.SetProperty(Path::Property::POINTS, points);
  183 +
  184 + Dali::Property::Array controlPoints;
  185 + controlPoints.Resize(4);
  186 + controlPoints[0] = Vector3(windowSize.x * 0.5f, 0.0f, windowSize.x * 0.3f);
  187 + controlPoints[1] = Vector3(windowSize.x * 0.3f, 0.0f, 0.0f);
  188 + controlPoints[2] = Vector3(-windowSize.x * 0.3f, 0.0f, 0.0f);
  189 + controlPoints[3] = Vector3(-windowSize.x * 0.5f, 0.0f, windowSize.x * 0.3f);
  190 + path.SetProperty(Path::Property::CONTROL_POINTS, controlPoints);
  191 +
  192 + return ScrollViewPagePathEffect::New(path,
  193 + Vector3(-1.0f, 0.0f, 0.0f),
  194 + Toolkit::ScrollView::Property::SCROLL_FINAL_X,
  195 + Vector3(windowSize.x * TABLE_RELATIVE_SIZE.x, windowSize.y * TABLE_RELATIVE_SIZE.y, 0.0f),
  196 + totalPages);
  197 +}
  198 +
  199 +/// Sets up the scroll view rulers
  200 +void SetupScrollViewRulers(ScrollView& scrollView, const uint16_t windowWidth, const float pageWidth, const int totalPages)
  201 +{
  202 + // Update Ruler info. for the scroll-view
  203 + Dali::Toolkit::RulerPtr rulerX = new FixedRuler(pageWidth);
  204 + Dali::Toolkit::RulerPtr rulerY = new DefaultRuler();
  205 + rulerX->SetDomain(RulerDomain(0.0f, (totalPages + 1) * windowWidth * TABLE_RELATIVE_SIZE.x * 0.5f, true));
  206 + rulerY->Disable();
  207 + scrollView.SetRulerX(rulerX);
  208 + scrollView.SetRulerY(rulerY);
188 } 209 }
189 210
190 } // namespace 211 } // namespace
@@ -192,32 +213,22 @@ bool CompareByTitle(const Example&amp; lhs, const Example&amp; rhs) @@ -192,32 +213,22 @@ bool CompareByTitle(const Example&amp; lhs, const Example&amp; rhs)
192 DaliTableView::DaliTableView(Application& application) 213 DaliTableView::DaliTableView(Application& application)
193 : mApplication(application), 214 : mApplication(application),
194 mRootActor(), 215 mRootActor(),
195 - mRotateAnimation(),  
196 mPressedAnimation(), 216 mPressedAnimation(),
197 mScrollView(), 217 mScrollView(),
198 mScrollViewEffect(), 218 mScrollViewEffect(),
199 - mScrollRulerX(),  
200 - mScrollRulerY(),  
201 mPressedActor(), 219 mPressedActor(),
202 - mAnimationTimer(),  
203 mLogoTapDetector(), 220 mLogoTapDetector(),
204 mVersionPopup(), 221 mVersionPopup(),
205 mPages(), 222 mPages(),
206 - mBackgroundAnimations(),  
207 mExampleList(), 223 mExampleList(),
208 mPageWidth(0.0f), 224 mPageWidth(0.0f),
209 mTotalPages(), 225 mTotalPages(),
210 mScrolling(false), 226 mScrolling(false),
211 - mSortAlphabetically(false),  
212 - mBackgroundAnimsPlaying(false) 227 + mSortAlphabetically(false)
213 { 228 {
214 application.InitSignal().Connect(this, &DaliTableView::Initialize); 229 application.InitSignal().Connect(this, &DaliTableView::Initialize);
215 } 230 }
216 231
217 -DaliTableView::~DaliTableView()  
218 -{  
219 -}  
220 -  
221 void DaliTableView::AddExample(Example example) 232 void DaliTableView::AddExample(Example example)
222 { 233 {
223 mExampleList.push_back(example); 234 mExampleList.push_back(example);
@@ -271,14 +282,8 @@ void DaliTableView::Initialize(Application&amp; application) @@ -271,14 +282,8 @@ void DaliTableView::Initialize(Application&amp; application)
271 282
272 mPageWidth = windowSize.GetWidth() * TABLE_RELATIVE_SIZE.x * 0.5f; 283 mPageWidth = windowSize.GetWidth() * TABLE_RELATIVE_SIZE.x * 0.5f;
273 284
274 - // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show  
275 - Actor bubbleContainer = Actor::New();  
276 - bubbleContainer.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);  
277 - bubbleContainer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);  
278 - bubbleContainer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);  
279 - SetupBackground(bubbleContainer); 285 + mBubbleAnimator.Initialize(mRootActor, mScrollView);
280 286
281 - mRootActor.Add(bubbleContainer);  
282 mRootActor.Add(mScrollView); 287 mRootActor.Add(mScrollView);
283 288
284 // Add scroll view effect and setup constraints on pages 289 // Add scroll view effect and setup constraints on pages
@@ -307,16 +312,6 @@ void DaliTableView::Initialize(Application&amp; application) @@ -307,16 +312,6 @@ void DaliTableView::Initialize(Application&amp; application)
307 winHandle.RemoveAvailableOrientation(Dali::WindowOrientation::PORTRAIT_INVERSE); 312 winHandle.RemoveAvailableOrientation(Dali::WindowOrientation::PORTRAIT_INVERSE);
308 } 313 }
309 314
310 - // Set initial orientation  
311 - unsigned int degrees = 0;  
312 - Rotate(degrees);  
313 -  
314 - // Background animation  
315 - mAnimationTimer = Timer::New(BACKGROUND_ANIMATION_DURATION);  
316 - mAnimationTimer.TickSignal().Connect(this, &DaliTableView::PauseBackgroundAnimation);  
317 - mAnimationTimer.Start();  
318 - mBackgroundAnimsPlaying = true;  
319 -  
320 CreateFocusEffect(); 315 CreateFocusEffect();
321 } 316 }
322 317
@@ -393,10 +388,6 @@ void DaliTableView::ApplyCubeEffectToPages() @@ -393,10 +388,6 @@ void DaliTableView::ApplyCubeEffectToPages()
393 } 388 }
394 } 389 }
395 390
396 -void DaliTableView::OnButtonsPageRelayout(const Dali::Actor& actor)  
397 -{  
398 -}  
399 -  
400 void DaliTableView::Populate() 391 void DaliTableView::Populate()
401 { 392 {
402 const Window::WindowSize windowSize = mApplication.GetWindow().GetSize(); 393 const Window::WindowSize windowSize = mApplication.GetWindow().GetSize();
@@ -408,13 +399,13 @@ void DaliTableView::Populate() @@ -408,13 +399,13 @@ void DaliTableView::Populate()
408 { 399 {
409 if(mSortAlphabetically) 400 if(mSortAlphabetically)
410 { 401 {
411 - sort(mExampleList.begin(), mExampleList.end(), CompareByTitle); 402 + sort(mExampleList.begin(), mExampleList.end(), [](auto& lhs, auto& rhs)->bool { return lhs.title < rhs.title; } );
412 } 403 }
413 404
414 unsigned int exampleCount = 0; 405 unsigned int exampleCount = 0;
415 ExampleListConstIter iter = mExampleList.begin(); 406 ExampleListConstIter iter = mExampleList.begin();
416 407
417 - for(int t = 0; t < mTotalPages; t++) 408 + for(int t = 0; t < mTotalPages && iter != mExampleList.end(); t++)
418 { 409 {
419 // Create Table 410 // Create Table
420 TableView page = TableView::New(ROWS_PER_PAGE, EXAMPLES_PER_ROW); 411 TableView page = TableView::New(ROWS_PER_PAGE, EXAMPLES_PER_ROW);
@@ -427,9 +418,9 @@ void DaliTableView::Populate() @@ -427,9 +418,9 @@ void DaliTableView::Populate()
427 const float margin = 2.0f; 418 const float margin = 2.0f;
428 const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW; 419 const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW;
429 420
430 - for(int row = 0; row < ROWS_PER_PAGE; row++) 421 + for(int row = 0; row < ROWS_PER_PAGE && iter != mExampleList.end(); row++)
431 { 422 {
432 - for(int column = 0; column < EXAMPLES_PER_ROW; column++) 423 + for(int column = 0; column < EXAMPLES_PER_ROW && iter != mExampleList.end(); column++)
433 { 424 {
434 const Example& example = (*iter); 425 const Example& example = (*iter);
435 426
@@ -446,59 +437,14 @@ void DaliTableView::Populate() @@ -446,59 +437,14 @@ void DaliTableView::Populate()
446 page.AddChild(tile, TableView::CellPosition(row, column)); 437 page.AddChild(tile, TableView::CellPosition(row, column));
447 438
448 iter++; 439 iter++;
449 -  
450 - if(iter == mExampleList.end())  
451 - {  
452 - break;  
453 - }  
454 - }  
455 -  
456 - if(iter == mExampleList.end())  
457 - {  
458 - break;  
459 } 440 }
460 } 441 }
461 442
462 mPages.push_back(page); 443 mPages.push_back(page);
463 -  
464 - if(iter == mExampleList.end())  
465 - {  
466 - break;  
467 - }  
468 } 444 }
469 } 445 }
470 446
471 - // Update Ruler info.  
472 - mScrollRulerX = new FixedRuler(mPageWidth);  
473 - mScrollRulerY = new DefaultRuler();  
474 - mScrollRulerX->SetDomain(RulerDomain(0.0f, (mTotalPages + 1) * windowSize.GetWidth() * TABLE_RELATIVE_SIZE.x * 0.5f, true));  
475 - mScrollRulerY->Disable();  
476 - mScrollView.SetRulerX(mScrollRulerX);  
477 - mScrollView.SetRulerY(mScrollRulerY);  
478 -}  
479 -  
480 -void DaliTableView::Rotate(unsigned int degrees)  
481 -{  
482 - // Resize the root actor  
483 - const Window::WindowSize windowSize = mApplication.GetWindow().GetSize();  
484 - const Vector2 originalSize(windowSize.GetWidth(), windowSize.GetHeight());  
485 - Vector3 targetSize(originalSize.x, originalSize.y, 1.0f);  
486 -  
487 - if(degrees == 90 || degrees == 270)  
488 - {  
489 - targetSize = Vector3(originalSize.y, originalSize.x, 1.0f);  
490 - }  
491 -  
492 - if(mRotateAnimation)  
493 - {  
494 - mRotateAnimation.Stop();  
495 - mRotateAnimation.Clear();  
496 - }  
497 -  
498 - mRotateAnimation = Animation::New(ROTATE_ANIMATION_TIME);  
499 - mRotateAnimation.AnimateTo(Property(mRootActor, Actor::Property::ORIENTATION), Quaternion(Radian(Degree(360 - degrees)), Vector3::ZAXIS), AlphaFunction::EASE_OUT);  
500 - mRotateAnimation.AnimateTo(Property(mRootActor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_OUT);  
501 - mRotateAnimation.Play(); 447 + SetupScrollViewRulers(mScrollView, windowSize.GetWidth(), mPageWidth, mTotalPages);
502 } 448 }
503 449
504 Actor DaliTableView::CreateTile(const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Vector2& position) 450 Actor DaliTableView::CreateTile(const std::string& name, const std::string& title, const Dali::Vector3& sizeMultiplier, Vector2& position)
@@ -587,10 +533,9 @@ bool DaliTableView::DoTilePress(Actor actor, PointState::Type pointState) @@ -587,10 +533,9 @@ bool DaliTableView::DoTilePress(Actor actor, PointState::Type pointState)
587 if((!mScrolling) && (!mPressedAnimation)) 533 if((!mScrolling) && (!mPressedAnimation))
588 { 534 {
589 std::string name = actor.GetProperty<std::string>(Dali::Actor::Property::NAME); 535 std::string name = actor.GetProperty<std::string>(Dali::Actor::Property::NAME);
590 - const ExampleListIter end = mExampleList.end();  
591 - for(ExampleListIter iter = mExampleList.begin(); iter != end; ++iter) 536 + for(Example& example : mExampleList)
592 { 537 {
593 - if((*iter).name == name) 538 + if(example.name == name)
594 { 539 {
595 // do nothing, until pressed animation finished. 540 // do nothing, until pressed animation finished.
596 consumed = true; 541 consumed = true;
@@ -636,7 +581,7 @@ void DaliTableView::OnScrollStart(const Dali::Vector2&amp; position) @@ -636,7 +581,7 @@ void DaliTableView::OnScrollStart(const Dali::Vector2&amp; position)
636 { 581 {
637 mScrolling = true; 582 mScrolling = true;
638 583
639 - PlayAnimation(); 584 + mBubbleAnimator.PlayAnimation();
640 } 585 }
641 586
642 void DaliTableView::OnScrollComplete(const Dali::Vector2& position) 587 void DaliTableView::OnScrollComplete(const Dali::Vector2& position)
@@ -668,39 +613,11 @@ void DaliTableView::ApplyScrollViewEffect() @@ -668,39 +613,11 @@ void DaliTableView::ApplyScrollViewEffect()
668 } 613 }
669 614
670 // Just one effect for now 615 // Just one effect for now
671 - SetupInnerPageCubeEffect(); 616 + mScrollViewEffect = SetupInnerPageCubeEffect(mApplication.GetWindow().GetSize(), mTotalPages);
672 617
673 mScrollView.ApplyEffect(mScrollViewEffect); 618 mScrollView.ApplyEffect(mScrollViewEffect);
674 } 619 }
675 620
676 -void DaliTableView::SetupInnerPageCubeEffect()  
677 -{  
678 - const Window::WindowSize windowDimensions = mApplication.GetWindow().GetSize();  
679 - const Vector2 windowSize(windowDimensions.GetWidth(), windowDimensions.GetHeight());  
680 -  
681 - Dali::Path path = Dali::Path::New();  
682 - Dali::Property::Array points;  
683 - points.Resize(3);  
684 - points[0] = Vector3(windowSize.x * 0.5, 0.0f, windowSize.x * 0.5f);  
685 - points[1] = Vector3(0.0f, 0.0f, 0.0f);  
686 - points[2] = Vector3(-windowSize.x * 0.5f, 0.0f, windowSize.x * 0.5f);  
687 - path.SetProperty(Path::Property::POINTS, points);  
688 -  
689 - Dali::Property::Array controlPoints;  
690 - controlPoints.Resize(4);  
691 - controlPoints[0] = Vector3(windowSize.x * 0.5f, 0.0f, windowSize.x * 0.3f);  
692 - controlPoints[1] = Vector3(windowSize.x * 0.3f, 0.0f, 0.0f);  
693 - controlPoints[2] = Vector3(-windowSize.x * 0.3f, 0.0f, 0.0f);  
694 - controlPoints[3] = Vector3(-windowSize.x * 0.5f, 0.0f, windowSize.x * 0.3f);  
695 - path.SetProperty(Path::Property::CONTROL_POINTS, controlPoints);  
696 -  
697 - mScrollViewEffect = ScrollViewPagePathEffect::New(path,  
698 - Vector3(-1.0f, 0.0f, 0.0f),  
699 - Toolkit::ScrollView::Property::SCROLL_FINAL_X,  
700 - Vector3(windowSize.x * TABLE_RELATIVE_SIZE.x, windowSize.y * TABLE_RELATIVE_SIZE.y, 0.0f),  
701 - mTotalPages);  
702 -}  
703 -  
704 void DaliTableView::OnKeyEvent(const KeyEvent& event) 621 void DaliTableView::OnKeyEvent(const KeyEvent& event)
705 { 622 {
706 if(event.GetState() == KeyEvent::DOWN) 623 if(event.GetState() == KeyEvent::DOWN)
@@ -721,115 +638,6 @@ void DaliTableView::OnKeyEvent(const KeyEvent&amp; event) @@ -721,115 +638,6 @@ void DaliTableView::OnKeyEvent(const KeyEvent&amp; event)
721 } 638 }
722 } 639 }
723 640
724 -void DaliTableView::SetupBackground(Actor bubbleContainer)  
725 -{  
726 - // Add bubbles to the bubbleContainer.  
727 - // Note: The bubbleContainer is parented externally to this function.  
728 - AddBackgroundActors(bubbleContainer, NUM_BACKGROUND_IMAGES);  
729 -}  
730 -  
731 -void DaliTableView::InitialiseBackgroundActors(Actor actor)  
732 -{  
733 - // Delete current animations  
734 - mBackgroundAnimations.clear();  
735 -  
736 - // Create new animations  
737 - const Vector3 size = actor.GetTargetSize();  
738 -  
739 - for(unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i)  
740 - {  
741 - Actor child = actor.GetChildAt(i);  
742 -  
743 - // Calculate a random position  
744 - Vector3 childPos(Random::Range(-size.x * 0.5f * BACKGROUND_SPREAD_SCALE, size.x * 0.85f * BACKGROUND_SPREAD_SCALE),  
745 - Random::Range(-size.y, size.y),  
746 - Random::Range(BUBBLE_MIN_Z, BUBBLE_MAX_Z));  
747 -  
748 - child.SetProperty(Actor::Property::POSITION, childPos);  
749 -  
750 - // Define bubble horizontal parallax and vertical wrapping  
751 - Constraint animConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, AnimateBubbleConstraint(childPos, Random::Range(-0.85f, 0.25f)));  
752 - animConstraint.AddSource(Source(mScrollView, ScrollView::Property::SCROLL_POSITION));  
753 - animConstraint.AddSource(Dali::ParentSource(Dali::Actor::Property::SIZE));  
754 - animConstraint.AddSource(Dali::LocalSource(Dali::Actor::Property::SIZE));  
755 - animConstraint.SetRemoveAction(Constraint::DISCARD);  
756 - animConstraint.Apply();  
757 -  
758 - // Kickoff animation  
759 - Animation animation = Animation::New(Random::Range(30.0f, 160.0f));  
760 - animation.AnimateBy(Property(child, Actor::Property::POSITION), Vector3(0.0f, -2000.0f, 0.0f), AlphaFunction::LINEAR);  
761 - animation.SetLooping(true);  
762 - animation.Play();  
763 - mBackgroundAnimations.push_back(animation);  
764 - }  
765 -}  
766 -  
767 -void DaliTableView::AddBackgroundActors(Actor layer, int count)  
768 -{  
769 - for(int i = 0; i < count; ++i)  
770 - {  
771 - float randSize = Random::Range(10.0f, 400.0f);  
772 - int shapeType = static_cast<int>(Random::Range(0.0f, NUMBER_OF_SHAPE_IMAGES - 1) + 0.5f);  
773 -  
774 - ImageView dfActor = ImageView::New();  
775 - dfActor.SetProperty(Actor::Property::SIZE, Vector2(randSize, randSize));  
776 - dfActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);  
777 -  
778 - // Set the Image URL and the custom shader at the same time  
779 - Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect();  
780 - Property::Map imageMap;  
781 - imageMap.Add(ImageVisual::Property::URL, SHAPE_IMAGE_TABLE[shapeType]);  
782 - imageMap.Add(Toolkit::Visual::Property::SHADER, effect);  
783 - dfActor.SetProperty(Toolkit::ImageView::Property::IMAGE, imageMap);  
784 -  
785 - dfActor.SetStyleName(BUBBLE_COLOR_STYLE_NAME[i % NUMBER_OF_BUBBLE_COLORS]);  
786 -  
787 - layer.Add(dfActor);  
788 - }  
789 -  
790 - // Positioning will occur when the layer is relaid out  
791 - layer.OnRelayoutSignal().Connect(this, &DaliTableView::InitialiseBackgroundActors);  
792 -}  
793 -  
794 -bool DaliTableView::PauseBackgroundAnimation()  
795 -{  
796 - PauseAnimation();  
797 -  
798 - return false;  
799 -}  
800 -  
801 -void DaliTableView::PauseAnimation()  
802 -{  
803 - if(mBackgroundAnimsPlaying)  
804 - {  
805 - for(AnimationListIter animIter = mBackgroundAnimations.begin(); animIter != mBackgroundAnimations.end(); ++animIter)  
806 - {  
807 - Animation anim = *animIter;  
808 -  
809 - anim.Stop();  
810 - }  
811 -  
812 - mBackgroundAnimsPlaying = false;  
813 - }  
814 -}  
815 -  
816 -void DaliTableView::PlayAnimation()  
817 -{  
818 - if(!mBackgroundAnimsPlaying)  
819 - {  
820 - for(AnimationListIter animIter = mBackgroundAnimations.begin(); animIter != mBackgroundAnimations.end(); ++animIter)  
821 - {  
822 - Animation anim = *animIter;  
823 -  
824 - anim.Play();  
825 - }  
826 -  
827 - mBackgroundAnimsPlaying = true;  
828 - }  
829 -  
830 - mAnimationTimer.SetInterval(BACKGROUND_ANIMATION_DURATION);  
831 -}  
832 -  
833 Dali::Actor DaliTableView::OnKeyboardPreFocusChange(Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction) 641 Dali::Actor DaliTableView::OnKeyboardPreFocusChange(Dali::Actor current, Dali::Actor proposed, Dali::Toolkit::Control::KeyboardFocus::Direction direction)
834 { 642 {
835 Actor nextFocusActor = proposed; 643 Actor nextFocusActor = proposed;
@@ -914,50 +722,9 @@ void DaliTableView::OnLogoTapped(Dali::Actor actor, const Dali::TapGesture&amp; tap) @@ -914,50 +722,9 @@ void DaliTableView::OnLogoTapped(Dali::Actor actor, const Dali::TapGesture&amp; tap)
914 { 722 {
915 if(!mVersionPopup) 723 if(!mVersionPopup)
916 { 724 {
917 - std::ostringstream stream;  
918 - stream << "DALi Core: " << CORE_MAJOR_VERSION << "." << CORE_MINOR_VERSION << "." << CORE_MICRO_VERSION << std::endl  
919 - << "(" << CORE_BUILD_DATE << ")\n";  
920 - stream << "DALi Adaptor: " << ADAPTOR_MAJOR_VERSION << "." << ADAPTOR_MINOR_VERSION << "." << ADAPTOR_MICRO_VERSION << std::endl  
921 - << "(" << ADAPTOR_BUILD_DATE << ")\n";  
922 - stream << "DALi Toolkit: " << TOOLKIT_MAJOR_VERSION << "." << TOOLKIT_MINOR_VERSION << "." << TOOLKIT_MICRO_VERSION << std::endl  
923 - << "(" << TOOLKIT_BUILD_DATE << ")\n";  
924 - stream << "DALi Demo:"  
925 - << "\n(" << DEMO_BUILD_DATE << ")\n";  
926 -  
927 - mVersionPopup = Dali::Toolkit::Popup::New();  
928 -  
929 - Toolkit::TextLabel titleActor = Toolkit::TextLabel::New("Version information");  
930 - titleActor.SetProperty(Actor::Property::NAME, "titleActor");  
931 - titleActor.SetProperty(Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER);  
932 - titleActor.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE);  
933 -  
934 - Toolkit::TextLabel contentActor = Toolkit::TextLabel::New(stream.str());  
935 - contentActor.SetProperty(Actor::Property::NAME, "contentActor");  
936 - contentActor.SetProperty(Toolkit::TextLabel::Property::MULTI_LINE, true);  
937 - contentActor.SetProperty(Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::CENTER);  
938 - contentActor.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE);  
939 - contentActor.SetProperty(Actor::Property::PADDING, Padding(0.0f, 0.0f, 20.0f, 0.0f));  
940 -  
941 - mVersionPopup.SetTitle(titleActor);  
942 - mVersionPopup.SetContent(contentActor);  
943 -  
944 - mVersionPopup.SetResizePolicy(ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::WIDTH);  
945 - mVersionPopup.SetProperty(Actor::Property::SIZE_MODE_FACTOR, Vector3(0.75f, 1.0f, 1.0f));  
946 - mVersionPopup.SetResizePolicy(ResizePolicy::FIT_TO_CHILDREN, Dimension::HEIGHT);  
947 -  
948 - mVersionPopup.OutsideTouchedSignal().Connect(this, &DaliTableView::HideVersionPopup);  
949 - mApplication.GetWindow().Add(mVersionPopup); 725 + mVersionPopup = CreateVersionPopup(mApplication, *this);
950 } 726 }
951 727
952 mVersionPopup.SetDisplayState(Popup::SHOWN); 728 mVersionPopup.SetDisplayState(Popup::SHOWN);
953 } 729 }
954 } 730 }
955 -  
956 -void DaliTableView::HideVersionPopup()  
957 -{  
958 - // Only hide if currently fully shown. If transitioning-in, the transition will not be interrupted.  
959 - if(mVersionPopup && (mVersionPopup.GetDisplayState() == Toolkit::Popup::SHOWN))  
960 - {  
961 - mVersionPopup.SetDisplayState(Popup::HIDDEN);  
962 - }  
963 -}  
shared/dali-table-view.h
@@ -18,48 +18,14 @@ @@ -18,48 +18,14 @@
18 * 18 *
19 */ 19 */
20 20
  21 +// EXTERNAL INCLUDES
21 #include <dali-toolkit/dali-toolkit.h> 22 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali-toolkit/devel-api/controls/popup/popup.h> 23 #include <dali-toolkit/devel-api/controls/popup/popup.h>
23 #include <dali/dali.h> 24 #include <dali/dali.h>
24 25
25 -class Example;  
26 -  
27 -typedef std::vector<Example> ExampleList;  
28 -typedef ExampleList::iterator ExampleListIter;  
29 -typedef ExampleList::const_iterator ExampleListConstIter;  
30 -  
31 -typedef std::vector<Dali::Animation> AnimationList;  
32 -typedef AnimationList::iterator AnimationListIter;  
33 -typedef AnimationList::const_iterator AnimationListConstIter;  
34 -  
35 -/**  
36 - * Example information  
37 - *  
38 - * Represents a single Example.  
39 - */  
40 -struct Example  
41 -{  
42 - // Constructors  
43 -  
44 - /**  
45 - * @param[in] name unique name of example  
46 - * @param[in] title The caption for the example to appear on a tile button.  
47 - */  
48 - Example(std::string name, std::string title)  
49 - : name(name),  
50 - title(title)  
51 - {  
52 - }  
53 -  
54 - Example()  
55 - {  
56 - }  
57 -  
58 - // Data  
59 -  
60 - std::string name; ///< unique name of example  
61 - std::string title; ///< title (caption) of example to appear on tile button.  
62 -}; 26 +// INTERNAL INCLUDES
  27 +#include "bubble-animator.h"
  28 +#include "example.h"
63 29
64 /** 30 /**
65 * Dali-Demo instance 31 * Dali-Demo instance
@@ -67,8 +33,18 @@ struct Example @@ -67,8 +33,18 @@ struct Example
67 class DaliTableView : public Dali::ConnectionTracker 33 class DaliTableView : public Dali::ConnectionTracker
68 { 34 {
69 public: 35 public:
  36 +
  37 + /**
  38 + * Constructor
  39 + *
  40 + * @param application A reference to the application class
  41 + */
70 DaliTableView(Dali::Application& application); 42 DaliTableView(Dali::Application& application);
71 - ~DaliTableView(); 43 +
  44 + /**
  45 + * Destructor
  46 + */
  47 + ~DaliTableView() = default;
72 48
73 public: 49 public:
74 /** 50 /**
@@ -90,17 +66,8 @@ public: @@ -90,17 +66,8 @@ public:
90 */ 66 */
91 void SortAlphabetically(bool sortAlphabetically); 67 void SortAlphabetically(bool sortAlphabetically);
92 68
93 -private: // Application callbacks & implementation  
94 - static const unsigned int FOCUS_ANIMATION_ACTOR_NUMBER = 2; ///< The number of elements used to form the custom focus effect  
95 -  
96 - /**  
97 - * Shape enum for create function  
98 - */  
99 - enum ShapeType  
100 - {  
101 - CIRCLE,  
102 - BUBBLE  
103 - }; 69 +private: // Application callbacks & implementation
  70 + static constexpr unsigned int FOCUS_ANIMATION_ACTOR_NUMBER = 2; ///< The number of elements used to form the custom focus effect
104 71
105 /** 72 /**
106 * Initialize application. 73 * Initialize application.
@@ -117,13 +84,6 @@ private: // Application cal @@ -117,13 +84,6 @@ private: // Application cal
117 void Populate(); 84 void Populate();
118 85
119 /** 86 /**
120 - * Rotates RootActor orientation to that specified.  
121 - *  
122 - * @param[in] degrees The requested angle.  
123 - */  
124 - void Rotate(unsigned int degrees);  
125 -  
126 - /**  
127 * Creates a tile for the main menu. 87 * Creates a tile for the main menu.
128 * 88 *
129 * @param[in] name The unique name for this Tile 89 * @param[in] name The unique name for this Tile
@@ -175,15 +135,6 @@ private: // Application cal @@ -175,15 +135,6 @@ private: // Application cal
175 void OnPressedAnimationFinished(Dali::Animation& source); 135 void OnPressedAnimationFinished(Dali::Animation& source);
176 136
177 /** 137 /**
178 - * Signal emitted when the button has been clicked  
179 - *  
180 - * @param[in] button The Button that is clicked.  
181 - *  
182 - * @return Consume flag  
183 - */  
184 - bool OnButtonClicked(Dali::Toolkit::Button& button);  
185 -  
186 - /**  
187 * Signal emitted when scrolling has started. 138 * Signal emitted when scrolling has started.
188 * 139 *
189 * @param[in] position The current position of the scroll contents. 140 * @param[in] position The current position of the scroll contents.
@@ -219,58 +170,11 @@ private: // Application cal @@ -219,58 +170,11 @@ private: // Application cal
219 void ApplyCubeEffectToPages(); 170 void ApplyCubeEffectToPages();
220 171
221 /** 172 /**
222 - * Setup the inner cube effect  
223 - */  
224 - void SetupInnerPageCubeEffect();  
225 -  
226 - /**  
227 - * Apply a shader effect to a table tile  
228 - */  
229 - void ApplyEffectToTile(Dali::Actor tile);  
230 -  
231 - /**  
232 - * Apply effect to the content of a tile  
233 - */  
234 - void ApplyEffectToTileContent(Dali::Actor tileContent);  
235 -  
236 - /**  
237 * Key event handler 173 * Key event handler
238 */ 174 */
239 void OnKeyEvent(const Dali::KeyEvent& event); 175 void OnKeyEvent(const Dali::KeyEvent& event);
240 176
241 /** 177 /**
242 - * Create a depth field background  
243 - *  
244 - * @param[in] bubbleLayer Add the graphics to this layer  
245 - */  
246 - void SetupBackground(Dali::Actor bubbleLayer);  
247 -  
248 - /**  
249 - * Create background actors for the given layer  
250 - *  
251 - * @param[in] layer The layer to add the actors to  
252 - * @param[in] count The number of actors to generate  
253 - */  
254 - void AddBackgroundActors(Dali::Actor layer, int count);  
255 -  
256 - /**  
257 - * Timer handler for ending background animation  
258 - *  
259 - * @return Return value for timer handler  
260 - */  
261 - bool PauseBackgroundAnimation();  
262 -  
263 - /**  
264 - * Pause all animations  
265 - */  
266 - void PauseAnimation();  
267 -  
268 - /**  
269 - * Resume all animations  
270 - */  
271 - void PlayAnimation();  
272 -  
273 - /**  
274 * @brief Creates and sets up the custom effect used for the keyboard (and mouse) focus. 178 * @brief Creates and sets up the custom effect used for the keyboard (and mouse) focus.
275 */ 179 */
276 void CreateFocusEffect(); 180 void CreateFocusEffect();
@@ -314,44 +218,16 @@ private: // Application cal @@ -314,44 +218,16 @@ private: // Application cal
314 */ 218 */
315 void OnLogoTapped(Dali::Actor actor, const Dali::TapGesture& tap); 219 void OnLogoTapped(Dali::Actor actor, const Dali::TapGesture& tap);
316 220
317 - /**  
318 - * Hides the popup  
319 - */  
320 - void HideVersionPopup();  
321 -  
322 - /*  
323 - * @brief Callback called when the buttons page actor is relaid out  
324 - *  
325 - * @param[in] actor The page actor  
326 - */  
327 - void OnButtonsPageRelayout(const Dali::Actor& actor);  
328 -  
329 - /**  
330 - * @brief The is connected to the keyboard focus highlight actor, and called when it is placed on the scene.  
331 - * @param[in] actor The actor that has been placed on the scene.  
332 - */  
333 - void OnSceneConnect(Dali::Actor actor);  
334 -  
335 - /**  
336 - * @brief Callback called to set up background actors  
337 - *  
338 - * @param[in] actor The actor raising the callback  
339 - */  
340 - void InitialiseBackgroundActors(Dali::Actor actor);  
341 -  
342 private: 221 private:
343 Dali::Application& mApplication; ///< Application instance. 222 Dali::Application& mApplication; ///< Application instance.
344 - Dali::Toolkit::Control mRootActor; ///< All content (excluding background is anchored to this Actor)  
345 - Dali::Animation mRotateAnimation; ///< Animation to rotate and resize mRootActor. 223 + Dali::Actor mRootActor; ///< All content (excluding background is anchored to this Actor)
346 Dali::Animation mPressedAnimation; ///< Button press scaling animation. 224 Dali::Animation mPressedAnimation; ///< Button press scaling animation.
347 Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples) 225 Dali::Toolkit::ScrollView mScrollView; ///< ScrollView container (for all Examples)
348 Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view 226 Dali::Toolkit::ScrollViewEffect mScrollViewEffect; ///< Effect to be applied to the scroll view
349 - Dali::Toolkit::RulerPtr mScrollRulerX; ///< ScrollView X (horizontal) ruler  
350 - Dali::Toolkit::RulerPtr mScrollRulerY; ///< ScrollView Y (vertical) ruler  
351 Dali::Actor mPressedActor; ///< The currently pressed actor. 227 Dali::Actor mPressedActor; ///< The currently pressed actor.
352 - Dali::Timer mAnimationTimer; ///< Timer used to turn off animation after a specific time period  
353 Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo 228 Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo
354 Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information 229 Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information
  230 + BubbleAnimator mBubbleAnimator; ///< Provides bubble animations.
355 231
356 /** 232 /**
357 * This struct encapsulates all data relevant to each of the elements used within the custom keyboard focus effect. 233 * This struct encapsulates all data relevant to each of the elements used within the custom keyboard focus effect.
@@ -364,7 +240,6 @@ private: @@ -364,7 +240,6 @@ private:
364 FocusEffect mFocusEffect[FOCUS_ANIMATION_ACTOR_NUMBER]; ///< The elements used to create the custom focus effect 240 FocusEffect mFocusEffect[FOCUS_ANIMATION_ACTOR_NUMBER]; ///< The elements used to create the custom focus effect
365 241
366 std::vector<Dali::Actor> mPages; ///< List of pages. 242 std::vector<Dali::Actor> mPages; ///< List of pages.
367 - AnimationList mBackgroundAnimations; ///< List of background bubble animations  
368 ExampleList mExampleList; ///< List of examples. 243 ExampleList mExampleList; ///< List of examples.
369 244
370 float mPageWidth; ///< The width of a page within the scroll-view, used to calculate the domain 245 float mPageWidth; ///< The width of a page within the scroll-view, used to calculate the domain
@@ -372,7 +247,6 @@ private: @@ -372,7 +247,6 @@ private:
372 247
373 bool mScrolling : 1; ///< Flag indicating whether view is currently being scrolled 248 bool mScrolling : 1; ///< Flag indicating whether view is currently being scrolled
374 bool mSortAlphabetically : 1; ///< Sort examples alphabetically. 249 bool mSortAlphabetically : 1; ///< Sort examples alphabetically.
375 - bool mBackgroundAnimsPlaying : 1; ///< Are background animations playing  
376 }; 250 };
377 251
378 #endif // DALI_DEMO_TABLEVIEW_H 252 #endif // DALI_DEMO_TABLEVIEW_H
shared/example.h 0 → 100644
  1 +#ifndef DALI_DEMO_EXAMPLE_H
  2 +#define DALI_DEMO_EXAMPLE_H
  3 +
  4 +/*
  5 + * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + *
  19 + */
  20 +
  21 +// EXTERNAL INCLUDES
  22 +#include <string>
  23 +#include <vector>
  24 +
  25 +/**
  26 + * Example information
  27 + *
  28 + * Represents a single Example.
  29 + */
  30 +struct Example
  31 +{
  32 + // Constructors
  33 +
  34 + /**
  35 + * @param[in] name unique name of example
  36 + * @param[in] title The caption for the example to appear on a tile button.
  37 + */
  38 + Example(std::string name, std::string title)
  39 + : name(name),
  40 + title(title)
  41 + {
  42 + }
  43 +
  44 + ~Example() = default;
  45 +
  46 + // Data
  47 +
  48 + std::string name; ///< unique name of example
  49 + std::string title; ///< title (caption) of example to appear on tile button.
  50 +};
  51 +
  52 +using ExampleList = std::vector<Example>;
  53 +using ExampleListConstIter = ExampleList::const_iterator;
  54 +
  55 +#endif // DALI_DEMO_SHARED_EXAMPLE_H