diff options
author | Jiyun Yang <ji.yang@samsung.com> | 2020-06-10 20:35:27 +0900 |
---|---|---|
committer | Jiyun Yang <ji.yang@samsung.com> | 2020-06-16 15:25:04 +0900 |
commit | 06b445b0aa7e94c216bc69ab5ffa75168727e5ea (patch) | |
tree | 84c449479dc693f98600ed177fd137648aee3ade | |
parent | f7601d4da5155a7e01e23e9076ed489602c5a08a (diff) | |
download | dali-demo-tizen_5.5.tar.gz dali-demo-tizen_5.5.tar.bz2 dali-demo-tizen_5.5.zip |
[Tizen] Add circular style example to the progress-bar-examplesubmit/tizen_5.5_wearable_hotfix/20201026.184305submit/tizen_5.5/20200616.080950accepted/tizen/5.5/unified/wearable/hotfix/20201027.110638accepted/tizen/5.5/unified/20200616.155043tizen_5.5_wearable_hotfixtizen_5.5accepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified
Change-Id: I6d0b104c63c5ea88a7eebde892161d42352bb015
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
-rw-r--r-- | examples/progress-bar/progress-bar-example.cpp | 18 | ||||
-rw-r--r-- | resources/style/mobile/progress-bar-example-theme.json.in | 25 | ||||
-rw-r--r-- | resources/style/progress-bar-example-theme.json.in | 25 |
3 files changed, 67 insertions, 1 deletions
diff --git a/examples/progress-bar/progress-bar-example.cpp b/examples/progress-bar/progress-bar-example.cpp index 049b5598..29a2f1f5 100644 --- a/examples/progress-bar/progress-bar-example.cpp +++ b/examples/progress-bar/progress-bar-example.cpp @@ -17,6 +17,7 @@ #include "shared/view.h" #include <dali-toolkit/dali-toolkit.h> +#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar-devel.h> using namespace Dali; using namespace Dali::Toolkit; @@ -34,6 +35,7 @@ const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); // Layout sizes const int MARGIN_SIZE = 10; const int TOP_MARGIN = 85; +const int CIRCULAR_PROGRESS_BAR_SIZE = 64; const unsigned int TIMER_TIMEOUT_TIME = 50; const float PROGRESS_INCREMENT_VALUE = 0.01f; @@ -83,6 +85,12 @@ private: mProgressBarDefault.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); mProgressBarDefault.ValueChangedSignal().Connect( this, &ProgressBarExample::OnValueChanged ); + // Creates a progress bar in circular style + mProgressBarCircular = DevelProgressBar::New( DevelProgressBar::Style::CIRCULAR ); + mProgressBarCircular.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER ); + mProgressBarCircular.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER ); + mProgressBarCircular.SetProperty( Actor::Property::SIZE, Vector2( CIRCULAR_PROGRESS_BAR_SIZE, CIRCULAR_PROGRESS_BAR_SIZE ) ); + Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1); contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); contentTable.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); @@ -99,7 +107,7 @@ private: mContentLayer.Add( contentTable ); // Image selector for progress bar - Toolkit::TableView progressBackground = Toolkit::TableView::New( 1, 1 ); + Toolkit::TableView progressBackground = Toolkit::TableView::New( 2, 1 ); progressBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); progressBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); progressBackground.SetBackgroundColor( BACKGROUND_COLOUR ); @@ -113,6 +121,7 @@ private: contentTable.Add( progressBackground ); progressBackground.Add( mProgressBarDefault ); + progressBackground.Add( mProgressBarCircular ); // Create buttons Toolkit::TableView buttonBackground = Toolkit::TableView::New( 3, 1 ); @@ -164,6 +173,8 @@ private: mSecondaryProgressValue = mProgressValue + 0.1f; mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue); mProgressBarDefault.SetProperty(ProgressBar::Property::SECONDARY_PROGRESS_VALUE, mSecondaryProgressValue); + mProgressBarCircular.SetProperty( ProgressBar::Property::PROGRESS_VALUE, mProgressValue ); + mProgressBarCircular.SetProperty( ProgressBar::Property::SECONDARY_PROGRESS_VALUE, mSecondaryProgressValue ); return ( mProgressValue < 1.0f ); // Only call again if progress has NOT got to the end } @@ -174,6 +185,8 @@ private: mSecondaryProgressValue = 0.1f; mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f); mProgressBarDefault.SetProperty(ProgressBar::Property::SECONDARY_PROGRESS_VALUE, 0.1f); + mProgressBarCircular.SetProperty( ProgressBar::Property::PROGRESS_VALUE, 0.0f ); + mProgressBarCircular.SetProperty( ProgressBar::Property::SECONDARY_PROGRESS_VALUE, 0.1f ); mTimer.Start(); return true; } @@ -192,10 +205,12 @@ private: if( mProgressBarDefault.GetProperty<bool>(ProgressBar::Property::INDETERMINATE)) { mProgressBarDefault.SetProperty(ProgressBar::Property::INDETERMINATE, false); + mProgressBarCircular.SetProperty( ProgressBar::Property::INDETERMINATE, false ); } else { mProgressBarDefault.SetProperty(ProgressBar::Property::INDETERMINATE, true); + mProgressBarCircular.SetProperty( ProgressBar::Property::INDETERMINATE, true ); } return true; } @@ -236,6 +251,7 @@ private: Toolkit::ToolBar mToolBar; ///< The View's Toolbar. Layer mContentLayer; ///< Content layer. ProgressBar mProgressBarDefault; + ProgressBar mProgressBarCircular; Toolkit::PushButton mResetProgressButton; Toolkit::PushButton mSetIndeterminateButton; Toolkit::PushButton mChangeThemeButton; diff --git a/resources/style/mobile/progress-bar-example-theme.json.in b/resources/style/mobile/progress-bar-example-theme.json.in index d9a47ee5..92d0f7f0 100644 --- a/resources/style/mobile/progress-bar-example-theme.json.in +++ b/resources/style/mobile/progress-bar-example-theme.json.in @@ -28,6 +28,31 @@ "secondaryProgressVisual":{ "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-secondary-progress.9.png" } + }, + "CircularProgressBar": + { + "trackVisual":{ + "visualType":"ARC", + "mixColor":[1.0, 0.898, 0.769, 1.0], + "thickness":8.0 + }, + "progressVisual":{ + "visualType":"ARC", + "mixColor":[0.965, 0.494, 0.49, 1.0], + "thickness":8.0 + }, + "secondaryProgressVisual":{ + "visualType":"ARC", + "mixColor":[1.0, 0.757, 0.655, 1.0], + "thickness":8.0 + }, + "indeterminateVisual":{ + "visualType":"ARC", + "mixColor":[0.49, 0.478, 0.635, 1.0], + "thickness":8.0, + "startAngle":267.0, + "sweepAngle":75.0 + } } } } diff --git a/resources/style/progress-bar-example-theme.json.in b/resources/style/progress-bar-example-theme.json.in index 971ee7d7..0bb1aa3c 100644 --- a/resources/style/progress-bar-example-theme.json.in +++ b/resources/style/progress-bar-example-theme.json.in @@ -29,6 +29,31 @@ "secondaryProgressVisual":{ "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-secondary-progress.9.png" } + }, + "CircularProgressBar": + { + "trackVisual":{ + "visualType":"ARC", + "mixColor":[1.0, 0.898, 0.769, 1.0], + "thickness":8.0 + }, + "progressVisual":{ + "visualType":"ARC", + "mixColor":[0.965, 0.494, 0.49, 1.0], + "thickness":8.0 + }, + "secondaryProgressVisual":{ + "visualType":"ARC", + "mixColor":[1.0, 0.757, 0.655, 1.0], + "thickness":8.0 + }, + "indeterminateVisual":{ + "visualType":"ARC", + "mixColor":[0.49, 0.478, 0.635, 1.0], + "thickness":8.0, + "startAngle":267.0, + "sweepAngle":75.0 + } } } } |