diff --git a/examples/layouting/layouting-examples.cpp b/examples/layouting/layouting-examples.cpp index 085dffc..74d5ed7 100644 --- a/examples/layouting/layouting-examples.cpp +++ b/examples/layouting/layouting-examples.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,8 +37,11 @@ using namespace Dali::Toolkit; namespace { +const Vector4 BACKGROUND_GRADIENT_1 = Vector4( 0.0f, 0.352941176f, 0.654901961f, 1.0f ); +const Vector4 BACKGROUND_GRADIENT_2 = Vector4( 1.0f, 0.992156863f, 0.894117647f, 1.0f ); +const Vector2 BACKGROUND_GRADIENT_START_POSITION( 0.0f, -0.5f ); +const Vector2 BACKGROUND_GRADIENT_END_POSITION( 0.0f, 0.5f ); -const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "lake_front.jpg" ); const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); typedef std::unique_ptr< Demo::Example > ExamplePointer; @@ -78,8 +81,16 @@ private: auto stage = Stage::GetCurrent(); stage.KeyEventSignal().Connect( this, &LayoutingExample::OnKeyEvent ); - auto bg = ImageView::New( BACKGROUND_IMAGE ); + auto bg = Control::New(); bg.SetParentOrigin( ParentOrigin::CENTER ); + bg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + bg.SetProperty( + Control::Property::BACKGROUND, + Property::Map().Add( Toolkit::Visual::Property::TYPE, Visual::GRADIENT ) + .Add( GradientVisual::Property::STOP_COLOR, Property::Array().Add( BACKGROUND_GRADIENT_1 ) + .Add( BACKGROUND_GRADIENT_2 ) ) + .Add( GradientVisual::Property::START_POSITION, BACKGROUND_GRADIENT_START_POSITION ) + .Add( GradientVisual::Property::END_POSITION, BACKGROUND_GRADIENT_END_POSITION ) ); stage.Add( bg ); auto toolbar = ImageView::New( TOOLBAR_IMAGE ); toolbar.SetParentOrigin( ParentOrigin::TOP_CENTER ); @@ -97,7 +108,8 @@ private: toolbar.Add( mToolbarTitle ); mNextLayout = PushButton::New(); - mNextLayout.SetProperty( Toolkit::Button::Property::LABEL, "change layout"); + mNextLayout.SetStyleName( "ChangeLayoutButton" ); + mNextLayout.SetProperty( Toolkit::Button::Property::LABEL, "Change Layout" ); mNextLayout.ClickedSignal().Connect( this, &LayoutingExample::ChangeLayout ); mNextLayout.SetParentOrigin( ParentOrigin::TOP_RIGHT ); mNextLayout.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); diff --git a/examples/simple-text-field/simple-text-field.cpp b/examples/simple-text-field/simple-text-field.cpp index d96906b..3516e77 100644 --- a/examples/simple-text-field/simple-text-field.cpp +++ b/examples/simple-text-field/simple-text-field.cpp @@ -53,6 +53,7 @@ public: void Create( Application& application ) { Stage stage = Stage::GetCurrent(); + stage.KeyEventSignal().Connect(this, &SimpleTextFieldExample::OnKeyEvent); stage.SetBackgroundColor( Vector4( 0.04f, 0.345f, 0.392f, 1.0f ) ); TextField field = TextField::New(); @@ -68,6 +69,20 @@ public: stage.Add( field ); } + /** + * Main key event handler + */ + void OnKeyEvent(const KeyEvent& event) + { + if(event.state == KeyEvent::Down) + { + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } + } + private: Application& mApplication; diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index ae96df1..65e0e77 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.4.15 +Version: 1.4.16 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/style/mobile/demo-theme.json.in b/resources/style/mobile/demo-theme.json.in index 893bfac..d050213 100644 --- a/resources/style/mobile/demo-theme.json.in +++ b/resources/style/mobile/demo-theme.json.in @@ -194,6 +194,13 @@ "units": "USER_SPACE", "stopColor": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]] } + }, + + "ChangeLayoutButton": + { + "label":{ + "pointSize":5 + } } } }