Commit 483ee611c7cf108f4b1ac85f42636fdbf7067c2b

Authored by Agnelo Vaz
2 parents 8ab0decf d93cd39e

[dali_1.2.21] Merge branch 'devel/master'

Change-Id: I1c1490d73b64bf8960a0940b2cee663d7d608526
build/tizen/CMakeLists.txt
@@ -102,6 +102,7 @@ CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp ) @@ -102,6 +102,7 @@ CONFIGURE_FILE( resources-location.in ${DEMO_SHARED}/resources-location.cpp )
102 #Replace @DEMO_STYLE_IMAGE_DIR@ in following files 102 #Replace @DEMO_STYLE_IMAGE_DIR@ in following files
103 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json ) 103 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/demo-theme.json.in ${LOCAL_STYLE_DIR}/demo-theme.json )
104 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json ) 104 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json.in ${LOCAL_STYLE_DIR}/contact-cards-example-theme.json )
  105 +CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json.in ${LOCAL_STYLE_DIR}/progress-bar-example-theme.json )
105 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json ) 106 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-one.json.in ${LOCAL_STYLE_DIR}/style-example-theme-one.json )
106 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE_DIR}/style-example-theme-two.json ) 107 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-two.json.in ${LOCAL_STYLE_DIR}/style-example-theme-two.json )
107 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json ) 108 CONFIGURE_FILE( ${LOCAL_STYLE_DIR}/style-example-theme-three.json.in ${LOCAL_STYLE_DIR}/style-example-theme-three.json )
examples/progress-bar/progress-bar-example.cpp
@@ -25,7 +25,7 @@ using Dali::Toolkit::ProgressBar; @@ -25,7 +25,7 @@ using Dali::Toolkit::ProgressBar;
25 25
26 namespace 26 namespace
27 { 27 {
28 - 28 +const char * const THEME_PATH( DEMO_STYLE_DIR "progress-bar-example-theme.json" ); ///< The theme used for this example
29 const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg"; 29 const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg";
30 const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; 30 const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";
31 const char* const TOOLBAR_TITLE = "Progress Bar"; 31 const char* const TOOLBAR_TITLE = "Progress Bar";
@@ -36,11 +36,14 @@ const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); @@ -36,11 +36,14 @@ const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f );
36 const int MARGIN_SIZE = 10; 36 const int MARGIN_SIZE = 10;
37 const int TOP_MARGIN = 85; 37 const int TOP_MARGIN = 85;
38 38
  39 +const unsigned int TIMER_TIMEOUT_TIME = 50;
  40 +const float PROGRESS_INCREMENT_VALUE = 0.01f;
  41 +
39 } // namespace 42 } // namespace
40 43
41 -/** This example shows how to create and use PROGRESS BAR. 44 +/**
  45 + * @brief Shows how to create a default progress bar and custom styled progress bars.
42 */ 46 */
43 -  
44 class ProgressBarExample: public ConnectionTracker 47 class ProgressBarExample: public ConnectionTracker
45 { 48 {
46 public: 49 public:
@@ -53,10 +56,7 @@ public: @@ -53,10 +56,7 @@ public:
53 mApplication.InitSignal().Connect( this, &ProgressBarExample::Create ); 56 mApplication.InitSignal().Connect( this, &ProgressBarExample::Create );
54 } 57 }
55 58
56 - ~ProgressBarExample()  
57 - {  
58 - // Nothing to do here  
59 - } 59 +private:
60 60
61 void Create( Application& application ) 61 void Create( Application& application )
62 { 62 {
@@ -75,11 +75,25 @@ public: @@ -75,11 +75,25 @@ public:
75 TOOLBAR_IMAGE, 75 TOOLBAR_IMAGE,
76 TOOLBAR_TITLE ); 76 TOOLBAR_TITLE );
77 77
78 - mProgressBar = ProgressBar::New();  
79 - mProgressBar.SetParentOrigin(ParentOrigin::TOP_CENTER);  
80 - mProgressBar.SetAnchorPoint(AnchorPoint::TOP_CENTER);  
81 - mProgressBar.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);  
82 - mProgressBar.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); 78 + mProgressBarDefault = ProgressBar::New();
  79 + mProgressBarDefault.SetParentOrigin(ParentOrigin::TOP_CENTER);
  80 + mProgressBarDefault.SetAnchorPoint(AnchorPoint::TOP_CENTER);
  81 + mProgressBarDefault.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
  82 + mProgressBarDefault.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
  83 +
  84 + mProgressBarCustomStyle1 = ProgressBar::New();
  85 + mProgressBarCustomStyle1.SetStyleName( "ProgressBarCustomStyle1" );
  86 + mProgressBarCustomStyle1.SetParentOrigin(ParentOrigin::TOP_CENTER);
  87 + mProgressBarCustomStyle1.SetAnchorPoint(AnchorPoint::TOP_CENTER);
  88 + mProgressBarCustomStyle1.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
  89 + mProgressBarCustomStyle1.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
  90 +
  91 + mProgressBarCustomStyle2 = ProgressBar::New();
  92 + mProgressBarCustomStyle2.SetStyleName( "ProgressBarCustomStyle2" );
  93 + mProgressBarCustomStyle2.SetParentOrigin(ParentOrigin::TOP_CENTER);
  94 + mProgressBarCustomStyle2.SetAnchorPoint(AnchorPoint::TOP_CENTER);
  95 + mProgressBarCustomStyle2.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
  96 + mProgressBarCustomStyle2.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
83 97
84 Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1); 98 Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1);
85 contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); 99 contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
@@ -97,18 +111,25 @@ public: @@ -97,18 +111,25 @@ public:
97 mContentLayer.Add( contentTable ); 111 mContentLayer.Add( contentTable );
98 112
99 // Image selector for progress bar 113 // Image selector for progress bar
100 - Toolkit::TableView progressBackground = Toolkit::TableView::New( 1, 1 ); 114 + Toolkit::TableView progressBackground = Toolkit::TableView::New( 3, 1 );
101 progressBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); 115 progressBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
102 progressBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); 116 progressBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
103 progressBackground.SetBackgroundColor( BACKGROUND_COLOUR ); 117 progressBackground.SetBackgroundColor( BACKGROUND_COLOUR );
104 progressBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); 118 progressBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
105 progressBackground.SetRelativeWidth( 0, 1.0f ); 119 progressBackground.SetRelativeWidth( 0, 1.0f );
106 - progressBackground.SetFitHeight( 0 ); 120 +
  121 + for( unsigned int i = 0; i < progressBackground.GetRows(); ++i )
  122 + {
  123 + progressBackground.SetFitHeight( i );
  124 + }
  125 +
107 contentTable.Add( progressBackground ); 126 contentTable.Add( progressBackground );
108 - progressBackground.Add( mProgressBar ); 127 + progressBackground.Add( mProgressBarDefault );
  128 + progressBackground.Add( mProgressBarCustomStyle1 );
  129 + progressBackground.Add( mProgressBarCustomStyle2 );
109 130
110 // Create buttons 131 // Create buttons
111 - Toolkit::TableView buttonBackground = Toolkit::TableView::New( 2, 1 ); 132 + Toolkit::TableView buttonBackground = Toolkit::TableView::New( 1, 1 );
112 buttonBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); 133 buttonBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
113 buttonBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); 134 buttonBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
114 buttonBackground.SetBackgroundColor( BACKGROUND_COLOUR ); 135 buttonBackground.SetBackgroundColor( BACKGROUND_COLOUR );
@@ -121,73 +142,70 @@ public: @@ -121,73 +142,70 @@ public:
121 142
122 contentTable.Add( buttonBackground ); 143 contentTable.Add( buttonBackground );
123 144
124 - mSetProgressButton = Toolkit::PushButton::New();  
125 - mSetProgressButton.SetLabelText( "Set Progress" );  
126 - mSetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );  
127 - mSetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );  
128 - mSetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnSetProgressButtonSelected );  
129 -  
130 - buttonBackground.Add( mSetProgressButton );  
131 -  
132 mResetProgressButton = Toolkit::PushButton::New(); 145 mResetProgressButton = Toolkit::PushButton::New();
133 - mResetProgressButton.SetLabelText( "Reset Progress" ); 146 + mResetProgressButton.SetLabelText( "Reset" );
134 mResetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); 147 mResetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
135 mResetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); 148 mResetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
136 mResetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnResetProgressButtonSelected ); 149 mResetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnResetProgressButtonSelected );
137 150
138 buttonBackground.Add( mResetProgressButton ); 151 buttonBackground.Add( mResetProgressButton );
139 - }  
140 -  
141 - bool OnResetProgressButtonSelected( Toolkit::Button button )  
142 - {  
143 - mProgressValue = 0.0f;  
144 - mProgressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);  
145 - return true;  
146 - }  
147 -  
148 - bool OnSetProgressButtonSelected( Toolkit::Button button )  
149 - {  
150 - mProgressValue += 0.1f;  
151 - mProgressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);  
152 - return true;  
153 - }  
154 -  
155 - void OnKeyEvent( const KeyEvent& event )  
156 - {  
157 - if( event.state == KeyEvent::Down )  
158 - {  
159 - if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )  
160 - {  
161 - // Exit application when click back or escape.  
162 - mApplication.Quit();  
163 - }  
164 - }  
165 - }  
166 152
167 -private: 153 + // Create a timer to update the progress of all progress bars
  154 + mTimer = Timer::New( TIMER_TIMEOUT_TIME );
  155 + mTimer.TickSignal().Connect( this, &ProgressBarExample::OnTimerTick );
  156 + mTimer.Start();
  157 + }
  158 +
  159 + bool OnTimerTick()
  160 + {
  161 + mProgressValue += PROGRESS_INCREMENT_VALUE;
  162 + mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
  163 + mProgressBarCustomStyle1.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
  164 + mProgressBarCustomStyle2.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
  165 +
  166 + return ( mProgressValue < 1.0f ); // Only call again if progress has NOT got to the end
  167 + }
  168 +
  169 + bool OnResetProgressButtonSelected( Toolkit::Button button )
  170 + {
  171 + mProgressValue = 0.0f;
  172 + mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
  173 + mProgressBarCustomStyle1.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
  174 + mProgressBarCustomStyle2.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
  175 + mTimer.Start();
  176 + return true;
  177 + }
  178 +
  179 + void OnKeyEvent( const KeyEvent& event )
  180 + {
  181 + if( event.state == KeyEvent::Down )
  182 + {
  183 + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  184 + {
  185 + // Exit application when click back or escape.
  186 + mApplication.Quit();
  187 + }
  188 + }
  189 + }
  190 +
  191 + // Data
168 192
169 Application& mApplication; 193 Application& mApplication;
  194 + Timer mTimer;
170 Toolkit::Control mView; ///< The View instance. 195 Toolkit::Control mView; ///< The View instance.
171 Toolkit::ToolBar mToolBar; ///< The View's Toolbar. 196 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
172 Layer mContentLayer; ///< Content layer. 197 Layer mContentLayer; ///< Content layer.
173 - ProgressBar mProgressBar;  
174 - Toolkit::PushButton mSetProgressButton; 198 + ProgressBar mProgressBarDefault;
  199 + ProgressBar mProgressBarCustomStyle1;
  200 + ProgressBar mProgressBarCustomStyle2;
175 Toolkit::PushButton mResetProgressButton; 201 Toolkit::PushButton mResetProgressButton;
176 float mProgressValue; 202 float mProgressValue;
177 }; 203 };
178 204
179 -void RunTest( Application& application ) 205 +int DALI_EXPORT_API main( int argc, char **argv )
180 { 206 {
  207 + Application application = Application::New( &argc, &argv, THEME_PATH );
181 ProgressBarExample test( application ); 208 ProgressBarExample test( application );
182 application.MainLoop(); 209 application.MainLoop();
183 -}  
184 -  
185 -// Entry point for Linux & Tizen applications  
186 -int DALI_EXPORT_API main( int argc, char **argv )  
187 -{  
188 - Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );  
189 -  
190 - RunTest( application );  
191 -  
192 return 0; 210 return 0;
193 } 211 }
packaging/com.samsung.dali-demo.spec
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 Name: com.samsung.dali-demo 3 Name: com.samsung.dali-demo
4 Summary: The OpenGLES Canvas Core Demo 4 Summary: The OpenGLES Canvas Core Demo
5 -Version: 1.2.20 5 +Version: 1.2.21
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0
resources/images/progress-bar-2.9.png 0 → 100644

177 Bytes

resources/images/progress-bar-progress-2.9.png 0 → 100644

182 Bytes

resources/images/progress-bar-progress.9.png 0 → 100644

199 Bytes

resources/images/progress-bar.9.png 0 → 100644

182 Bytes

resources/style/.gitignore
1 demo-theme.json 1 demo-theme.json
2 contact-cards-example-theme.json 2 contact-cards-example-theme.json
  3 +progress-bar-example-theme.json
3 style-example-theme-three.json 4 style-example-theme-three.json
4 style-example-theme-two.json 5 style-example-theme-two.json
5 style-example-theme-one.json 6 style-example-theme-one.json
resources/style/mobile/progress-bar-example-theme.json.in 0 → 100644
  1 +/*
  2 + * Copyright (c) 2016 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 +{
  19 + "styles":
  20 + {
  21 + "ProgressBarCustomStyle1":
  22 + {
  23 + "progressValue": 0,
  24 + "trackVisual":{
  25 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar.9.png",
  26 + "size":[5,24]
  27 + },
  28 + "progressVisual":{
  29 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress.9.png",
  30 + "size":[5,24]
  31 + }
  32 + },
  33 +
  34 + "ProgressBarCustomStyle2":
  35 + {
  36 + "progressValue": 0,
  37 + "trackVisual":{
  38 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-2.9.png",
  39 + "size":[5,7]
  40 + },
  41 + "progressVisual":{
  42 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress-2.9.png",
  43 + "size":[5,7]
  44 + }
  45 + }
  46 + }
  47 +}
resources/style/progress-bar-example-theme.json.in 0 → 100644
  1 +/*
  2 + * Copyright (c) 2016 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 +{
  19 + "styles":
  20 + {
  21 + "ProgressBarCustomStyle1":
  22 + {
  23 + "progressValue": 0,
  24 + "trackVisual":{
  25 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar.9.png",
  26 + "size":[5,24]
  27 + },
  28 + "progressVisual":{
  29 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress.9.png",
  30 + "size":[5,24]
  31 + }
  32 + },
  33 +
  34 + "ProgressBarCustomStyle2":
  35 + {
  36 + "progressValue": 0,
  37 + "trackVisual":{
  38 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-2.9.png",
  39 + "size":[5,7]
  40 + },
  41 + "progressVisual":{
  42 + "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress-2.9.png",
  43 + "size":[5,7]
  44 + }
  45 + }
  46 + }
  47 +}