diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 67b9232..6791aaa 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -108,7 +108,6 @@ const float BUBBLE_MAX_Z = 0.0f; // 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; @@ -266,7 +265,7 @@ void DaliTableView::Initialize( Application& application ) Stage::GetCurrent().Add( mRootActor ); // Add logo - ImageView logo = CreateLogo( LOGO_PATH ); + ImageView logo = ImageView::New( LOGO_PATH ); logo.SetName( "LOGO_IMAGE" ); logo.SetAnchorPoint( AnchorPoint::TOP_CENTER ); logo.SetParentOrigin( Vector3( 0.5f, 0.1f, 0.5f ) ); @@ -517,18 +516,20 @@ Actor DaliTableView::CreateTile( const std::string& name, const std::string& tit 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. + // 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 ); + + // Set the Image URL and the custom shader + Property::Map imageMap; + imageMap.Add( ImageVisual::Property::URL, TILE_BACKGROUND_ALPHA ); + imageMap.Add( Visual::Property::SHADER, customShader ); + tileContent.SetProperty( Toolkit::ImageView::Property::IMAGE, imageMap ); + tileContent.SetColor( TILE_COLOR ); // We create a constraint to perform a precalculation on the scroll-view X offset @@ -782,12 +783,18 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count ) { float randSize = Random::Range( 10.0f, 400.0f ); int shapeType = static_cast( Random::Range( 0.0f, NUMBER_OF_SHAPE_IMAGES - 1 ) + 0.5f ); - ImageView dfActor = ImageView::New( SHAPE_IMAGE_TABLE[ shapeType ] ); + + ImageView dfActor = ImageView::New(); dfActor.SetSize( Vector2( randSize, randSize ) ); dfActor.SetParentOrigin( ParentOrigin::CENTER ); + // Set the Image URL and the custom shader at the same time Dali::Property::Map effect = Toolkit::CreateDistanceFieldEffect(); - dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, effect ); + Property::Map imageMap; + imageMap.Add( ImageVisual::Property::URL, SHAPE_IMAGE_TABLE[ shapeType ] ); + imageMap.Add( Visual::Property::SHADER, effect ); + dfActor.SetProperty( Toolkit::ImageView::Property::IMAGE, imageMap ); + dfActor.SetColor( BUBBLE_COLOR[ i%NUMBER_OF_BUBBLE_COLOR ] ); layer.Add( dfActor ); @@ -797,16 +804,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count ) layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors ); } -ImageView DaliTableView::CreateLogo( std::string imagePath ) -{ - ImageView logo = ImageView::New( imagePath ); - - logo.SetAnchorPoint( AnchorPoint::CENTER ); - logo.SetParentOrigin( ParentOrigin::CENTER ); - - return logo; -} - bool DaliTableView::PauseBackgroundAnimation() { PauseAnimation(); diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index c7cf0ab..099636c 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -266,15 +266,6 @@ private: // Application callbacks & implementation void AddBackgroundActors( Dali::Actor layer, int count ); /** - * Creates the logo. - * - * @param[in] imagePath The path to the image file to load - * - * @return The created image actor - */ - Dali::Toolkit::ImageView CreateLogo( std::string imagePath ); - - /** * Timer handler for ending background animation * * @return Return value for timer handler diff --git a/examples/progress-bar/progress-bar-example.cpp b/examples/progress-bar/progress-bar-example.cpp index aca1a53..f12fd28 100644 --- a/examples/progress-bar/progress-bar-example.cpp +++ b/examples/progress-bar/progress-bar-example.cpp @@ -53,6 +53,8 @@ public: { // Connect to the Application's Init signal mProgressValue = 0.0f; + mSecondaryProgressValue = 0.1f; + isDefaultTheme = true; mApplication.InitSignal().Connect( this, &ProgressBarExample::Create ); } @@ -80,20 +82,7 @@ private: mProgressBarDefault.SetAnchorPoint(AnchorPoint::TOP_CENTER); mProgressBarDefault.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); mProgressBarDefault.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); - - mProgressBarCustomStyle1 = ProgressBar::New(); - mProgressBarCustomStyle1.SetStyleName( "ProgressBarCustomStyle1" ); - mProgressBarCustomStyle1.SetParentOrigin(ParentOrigin::TOP_CENTER); - mProgressBarCustomStyle1.SetAnchorPoint(AnchorPoint::TOP_CENTER); - mProgressBarCustomStyle1.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); - mProgressBarCustomStyle1.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); - - mProgressBarCustomStyle2 = ProgressBar::New(); - mProgressBarCustomStyle2.SetStyleName( "ProgressBarCustomStyle2" ); - mProgressBarCustomStyle2.SetParentOrigin(ParentOrigin::TOP_CENTER); - mProgressBarCustomStyle2.SetAnchorPoint(AnchorPoint::TOP_CENTER); - mProgressBarCustomStyle2.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); - mProgressBarCustomStyle2.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT); + mProgressBarDefault.ValueChangedSignal().Connect( this, &ProgressBarExample::OnValueChanged ); Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1); contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH); @@ -111,7 +100,7 @@ private: mContentLayer.Add( contentTable ); // Image selector for progress bar - Toolkit::TableView progressBackground = Toolkit::TableView::New( 3, 1 ); + Toolkit::TableView progressBackground = Toolkit::TableView::New( 1, 1 ); progressBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); progressBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); progressBackground.SetBackgroundColor( BACKGROUND_COLOUR ); @@ -125,11 +114,9 @@ private: contentTable.Add( progressBackground ); progressBackground.Add( mProgressBarDefault ); - progressBackground.Add( mProgressBarCustomStyle1 ); - progressBackground.Add( mProgressBarCustomStyle2 ); // Create buttons - Toolkit::TableView buttonBackground = Toolkit::TableView::New( 1, 1 ); + Toolkit::TableView buttonBackground = Toolkit::TableView::New( 3, 1 ); buttonBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); buttonBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); buttonBackground.SetBackgroundColor( BACKGROUND_COLOUR ); @@ -150,6 +137,22 @@ private: buttonBackground.Add( mResetProgressButton ); + mSetIndeterminateButton = Toolkit::PushButton::New(); + mSetIndeterminateButton.SetProperty( Toolkit::Button::Property::LABEL, "Toggle Indeterminate" ); + mSetIndeterminateButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mSetIndeterminateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + mSetIndeterminateButton.ClickedSignal().Connect( this, &ProgressBarExample::OnSetIndeterminateButtonSelected ); + + buttonBackground.Add( mSetIndeterminateButton ); + + mChangeThemeButton = Toolkit::PushButton::New(); + mChangeThemeButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Theme" ); + mChangeThemeButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + mChangeThemeButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + mChangeThemeButton.ClickedSignal().Connect( this, &ProgressBarExample::OnChangeThemeButtonSelected ); + + buttonBackground.Add( mChangeThemeButton ); + // Create a timer to update the progress of all progress bars mTimer = Timer::New( TIMER_TIMEOUT_TIME ); mTimer.TickSignal().Connect( this, &ProgressBarExample::OnTimerTick ); @@ -159,9 +162,9 @@ private: bool OnTimerTick() { mProgressValue += PROGRESS_INCREMENT_VALUE; + mSecondaryProgressValue = mProgressValue + 0.1f; mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue); - mProgressBarCustomStyle1.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue); - mProgressBarCustomStyle2.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue); + mProgressBarDefault.SetProperty(ProgressBar::Property::SECONDARY_PROGRESS_VALUE, mSecondaryProgressValue); return ( mProgressValue < 1.0f ); // Only call again if progress has NOT got to the end } @@ -169,13 +172,51 @@ private: bool OnResetProgressButtonSelected( Toolkit::Button button ) { mProgressValue = 0.0f; + mSecondaryProgressValue = 0.1f; mProgressBarDefault.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f); - mProgressBarCustomStyle1.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f); - mProgressBarCustomStyle2.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f); + mProgressBarDefault.SetProperty(ProgressBar::Property::SECONDARY_PROGRESS_VALUE, 0.1f); mTimer.Start(); return true; } + void OnValueChanged( ProgressBar progressBar, float value, float secondaryValue ) + { + std::stringstream newLabel; + newLabel.precision( 2 ); + newLabel << std::fixed << "current : " << value << " / loaded : " << secondaryValue; + + mProgressBarDefault.SetProperty(ProgressBar::Property::LABEL_VISUAL, newLabel.str() ); + } + + bool OnSetIndeterminateButtonSelected( Toolkit::Button button ) + { + if( mProgressBarDefault.GetProperty(ProgressBar::Property::INDETERMINATE)) + { + mProgressBarDefault.SetProperty(ProgressBar::Property::INDETERMINATE, false); + } + else + { + mProgressBarDefault.SetProperty(ProgressBar::Property::INDETERMINATE, true); + } + return true; + } + + bool OnChangeThemeButtonSelected( Toolkit::Button button ) + { + StyleManager styleManager = StyleManager::Get(); + + if( isDefaultTheme ) + { + styleManager.ApplyTheme( THEME_PATH ); + isDefaultTheme = false; + } + else + { + styleManager.ApplyDefaultTheme(); + isDefaultTheme = true; + } + return true; + } void OnKeyEvent( const KeyEvent& event ) { if( event.state == KeyEvent::Down ) @@ -196,15 +237,17 @@ private: Toolkit::ToolBar mToolBar; ///< The View's Toolbar. Layer mContentLayer; ///< Content layer. ProgressBar mProgressBarDefault; - ProgressBar mProgressBarCustomStyle1; - ProgressBar mProgressBarCustomStyle2; Toolkit::PushButton mResetProgressButton; + Toolkit::PushButton mSetIndeterminateButton; + Toolkit::PushButton mChangeThemeButton; float mProgressValue; + float mSecondaryProgressValue; + bool isDefaultTheme; }; int DALI_EXPORT_API main( int argc, char **argv ) { - Application application = Application::New( &argc, &argv, THEME_PATH ); + Application application = Application::New( &argc, &argv ); ProgressBarExample test( application ); application.MainLoop(); return 0; diff --git a/examples/transitions/transition-application.cpp b/examples/transitions/transition-application.cpp index 2e90252..da81bb9 100644 --- a/examples/transitions/transition-application.cpp +++ b/examples/transitions/transition-application.cpp @@ -57,6 +57,7 @@ TransitionApplication::TransitionApplication( Application& application ) mTitle(), mShadowButton(), mActionButtons(), + mVisualIndex( Property::INVALID_INDEX ), mActionIndex( Property::INVALID_INDEX ) { application.InitSignal().Connect( this, &TransitionApplication::Create ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 737fa81..2e94c29 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.2.25 +Version: 1.2.26 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/images/progress-bar-progress.9.png b/resources/images/new-progress-bar-progress.9.png index aa5aa77..aa5aa77 100644 --- a/resources/images/progress-bar-progress.9.png +++ b/resources/images/new-progress-bar-progress.9.png diff --git a/resources/images/new-progress-bar-secondary-progress.9.png b/resources/images/new-progress-bar-secondary-progress.9.png new file mode 100644 index 0000000..279bba6 --- /dev/null +++ b/resources/images/new-progress-bar-secondary-progress.9.png diff --git a/resources/images/progress-bar.9.png b/resources/images/new-progress-bar-track.9.png index ec0bc90..ec0bc90 100644 --- a/resources/images/progress-bar.9.png +++ b/resources/images/new-progress-bar-track.9.png diff --git a/resources/images/progress-bar-2.9.png b/resources/images/progress-bar-2.9.png deleted file mode 100644 index 1ff4a7d..0000000 --- a/resources/images/progress-bar-2.9.png +++ /dev/null diff --git a/resources/images/progress-bar-progress-2.9.png b/resources/images/progress-bar-progress-2.9.png deleted file mode 100644 index 2d10990..0000000 --- a/resources/images/progress-bar-progress-2.9.png +++ /dev/null diff --git a/resources/scripts/shader-effect-ripple.json b/resources/scripts/shader-effect-ripple.json index aabc376..24a5fb3 100644 --- a/resources/scripts/shader-effect-ripple.json +++ b/resources/scripts/shader-effect-ripple.json @@ -16,7 +16,21 @@ "desiredWidth": 400, "desiredHeight": 400, "shader": { - "fragmentShader": "precision mediump float;\nuniform sampler2D sTexture;\nuniform vec4 uColor;\nuniform float uAmplitude;\nuniform float uTime;\nvarying vec2 vTexCoord;\nvoid main()\n{\n highp vec2 pos = -1.0 + 2.0 * vTexCoord;\n highp float len = length(pos);\n highp vec2 texCoord = vTexCoord + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;\n gl_FragColor = texture2D(sTexture, texCoord) * uColor;}\n\n" + "fragmentShader": [ + "precision mediump float;", + "uniform sampler2D sTexture;", + "uniform vec4 uColor;", + "uniform float uAmplitude;", + "uniform float uTime;", + "varying vec2 vTexCoord;", + "void main()", + "{", + " highp vec2 pos = -1.0 + 2.0 * vTexCoord;", + " highp float len = length(pos);", + " highp vec2 texCoord = vTexCoord + pos/len * sin( len * 12.0 - uTime * 4.0 ) * uAmplitude;", + " gl_FragColor = texture2D(sTexture, texCoord) * uColor;", + "}" + ] } }, "animatableProperties": { diff --git a/resources/style/mobile/progress-bar-example-theme.json.in b/resources/style/mobile/progress-bar-example-theme.json.in index 670937f..d9a47ee 100644 --- a/resources/style/mobile/progress-bar-example-theme.json.in +++ b/resources/style/mobile/progress-bar-example-theme.json.in @@ -14,33 +14,19 @@ * limitations under the License. * */ - { "styles": { - "ProgressBarCustomStyle1": + "ProgressBar": { - "progressValue": 0, "trackVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar.9.png", - "size":[5,24] + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-track.9.png" }, "progressVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress.9.png", - "size":[5,24] - } - }, - - "ProgressBarCustomStyle2": - { - "progressValue": 0, - "trackVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-2.9.png", - "size":[5,7] + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-progress.9.png" }, - "progressVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress-2.9.png", - "size":[5,7] + "secondaryProgressVisual":{ + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-secondary-progress.9.png" } } } diff --git a/resources/style/progress-bar-example-theme.json.in b/resources/style/progress-bar-example-theme.json.in index 670937f..971ee7d 100644 --- a/resources/style/progress-bar-example-theme.json.in +++ b/resources/style/progress-bar-example-theme.json.in @@ -18,29 +18,16 @@ { "styles": { - "ProgressBarCustomStyle1": + "ProgressBar": { - "progressValue": 0, "trackVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar.9.png", - "size":[5,24] + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-track.9.png" }, "progressVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress.9.png", - "size":[5,24] - } - }, - - "ProgressBarCustomStyle2": - { - "progressValue": 0, - "trackVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-2.9.png", - "size":[5,7] + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-progress.9.png" }, - "progressVisual":{ - "url":"{APPLICATION_RESOURCE_PATH}/images/progress-bar-progress-2.9.png", - "size":[5,7] + "secondaryProgressVisual":{ + "url":"{APPLICATION_RESOURCE_PATH}/images/new-progress-bar-secondary-progress.9.png" } } } diff --git a/shared/multi-language-strings.h b/shared/multi-language-strings.h index ffa8e6c..d19fb66 100644 --- a/shared/multi-language-strings.h +++ b/shared/multi-language-strings.h @@ -186,9 +186,29 @@ namespace MultiLanguageStrings "(Chinese)", "若要重新排列页面,您需要将视图类型更改为可自定义网格。" }, + { + "ꦧꦱꦗꦮ, basa Jawa", + "(Javanese)", + "ꦧꦱꦗꦮ ꦕꦫꦗꦮ ꦲꦏ꧀ꦱꦫꦗꦮ ꦲꦤꦕꦫꦏ ꧋ꦱꦧꦼꦤ꧀ꦲꦸꦮꦺꦴꦁꦏꦭꦲꦶꦫꦏꦺꦏꦤ꧀ꦛꦶꦩꦂꦢꦶꦏꦭꦤ꧀ꦢꦂꦧꦺꦩꦂꦠꦧꦠ꧀ꦭꦤ꧀ꦲꦏ꧀ꦲꦏ꧀ꦏꦁꦥꦝ꧉" + }, + { + "Basa Sunda, ᮘᮞ ᮞᮥᮔ᮪ᮓ", + "(Sundanese)", + "ᮃᮊ᮪ᮞᮛ ᮞᮥᮔ᮪ᮓ ᮀᮁᮂᮃᮄᮅᮆᮇᮈᮉᮊᮋᮌᮍᮎᮏᮐᮑᮒᮓᮔᮕᮖᮗᮘᮙᮚᮛᮜᮝᮞᮟᮠᮡᮢᮣᮤᮥᮦᮧᮨᮩ᮪᮫ᮬᮭᮮᮯ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹ᮺᮻᮼᮽᮾᮿ᳀᳁᳂᳃᳄᳅᳆᳇" + }, + { + "isiZulu", + "(Zulu)", + "Sawubona Mhlaba" + }, + { + "isiXhosa", + "(Xhosa)", + "Molo Lizwe" + }, }; - const unsigned int NUMBER_OF_LANGUAGES = 31u; + const unsigned int NUMBER_OF_LANGUAGES = 35u; } // MultiLanguageStrings