diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index 81aacaf..eded833 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -26,6 +26,8 @@ #include #include #include +#include + #include #include #include @@ -136,6 +138,7 @@ const std::string ShortName( const std::string& name ) if( pos != std::string::npos ) { + pos++; return name.substr( pos ); } else @@ -249,44 +252,23 @@ public: mTitleActor.SetProperty( TextLabel::Property::TEXT, title ); } - bool OnToolSelectLayout( Toolkit::Button button ) + bool OnBackButtonPressed( Toolkit::Button button ) { - bool on = mItemView.IsVisible(); - - if( on ) - { - LeaveSelection(); - } - else - { - EnterSelection(); - } - + OnQuitOrBack(); return true; } - void LeaveSelection() - { - - } - - void EnterSelection() + void SetUpItemView() { Stage stage = Stage::GetCurrent(); - stage.SetBackgroundColor( Color::WHITE ); mTapDetector = TapGestureDetector::New(); mTapDetector.DetectedSignal().Connect( this, &ExampleApp::OnTap ); - if( mItemView ) - { - stage.Remove( mItemView ); - } - mFiles.clear(); mItemView = ItemView::New(*this); - stage.Add( mItemView ); + mItemView.SetParentOrigin(ParentOrigin::CENTER); mItemView.SetAnchorPoint(AnchorPoint::CENTER); mLayout = DefaultItemLayout::New( DefaultItemLayout::LIST ); @@ -354,28 +336,11 @@ public: } } - // Display item view on the stage - stage.Add( mItemView ); - - mItemView.SetVisible( true ); - mBuilderLayer.SetVisible( false ); - - SetTitle("Select"); - // Activate the layout Vector3 size(stage.GetSize()); mItemView.ActivateLayout(0, size, 0.0f/*immediate*/); } - void ExitSelection() - { - mTapDetector.Reset(); - - mItemView.SetVisible( false ); - mBuilderLayer.SetVisible( true ); - - SetTitle("View"); - } void OnTap( Actor actor, const TapGesture& tap ) { @@ -411,7 +376,7 @@ public: Stage stage = Stage::GetCurrent(); builder = Builder::New(); - builder.QuitSignal().Connect( this, &ExampleApp::OnBuilderQuit ); + builder.QuitSignal().Connect( this, &ExampleApp::OnQuitOrBack ); Property::Map defaultDirs; defaultDirs[ TOKEN_STRING(DEMO_IMAGE_DIR) ] = DEMO_IMAGE_DIR; @@ -485,10 +450,7 @@ public: size.y -= DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight; mBuilderLayer.SetSize( size ); - mBuilderLayer.LowerToBottom(); - Stage::GetCurrent().GetRootLayer().RaiseToTop(); - - ExitSelection(); + mNavigationView.Push( mBuilderLayer ); } void Create(Application& app) @@ -504,21 +466,43 @@ public: TOOLBAR_IMAGE, "" ); - SetTitle("Builder"); + SetTitle("Select Example"); mBuilderLayer = Layer::New(); - stage.GetRootLayer().Add(mBuilderLayer); - // Create an edit mode button. (left of toolbar) - Toolkit::PushButton editButton = Toolkit::PushButton::New(); - editButton.SetUnselectedImage( EDIT_IMAGE ); - editButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); - editButton.ClickedSignal().Connect( this, &ExampleApp::OnToolSelectLayout); - editButton.SetLeaveRequired( true ); - mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); - - EnterSelection(); + Toolkit::PushButton backButton = Toolkit::PushButton::New(); + backButton.SetUnselectedImage( EDIT_IMAGE ); + backButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); + backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed); + backButton.SetLeaveRequired( true ); + mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); + + mNavigationView = Toolkit::NavigationView::New(); + mNavigationView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + mNavigationView.SetAnchorPoint( AnchorPoint::TOP_LEFT); + + stage.Add( mNavigationView ); + + // Set up the background gradient. + Property::Array stopOffsets; + stopOffsets.PushBack( 0.0f ); + stopOffsets.PushBack( 1.0f ); + Property::Array stopColors; + stopColors.PushBack( Color::WHITE ); + stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue + const float percentageStageHeight = stage.GetSize().height * 0.6f; + + mNavigationView.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map() + .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT ) + .Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets ) + .Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors ) + .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageStageHeight ) ) + .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageStageHeight ) ) + .Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) ); + + SetUpItemView(); + mNavigationView.Push( mItemView ); mTimer = Timer::New( 500 ); // ms mTimer.TickSignal().Connect( this, &ExampleApp::OnTimer); @@ -546,14 +530,7 @@ public: { if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) { - if ( mItemView.IsVisible() ) - { - mApp.Quit(); - } - else - { - EnterSelection(); - } + OnQuitOrBack(); } } } @@ -561,15 +538,15 @@ public: /** * Event handler when Builder wants to quit (we only want to close the shown json unless we're at the top-level) */ - void OnBuilderQuit() + void OnQuitOrBack() { - if ( mItemView.IsVisible() ) + if ( mItemView.OnStage() ) { mApp.Quit(); } else { - EnterSelection(); + mNavigationView.Pop(); } } @@ -578,12 +555,13 @@ private: ItemLayoutPtr mLayout; ItemView mItemView; + Toolkit::NavigationView mNavigationView; Toolkit::Control mView; unsigned int mOrientation; Toolkit::ToolBar mToolBar; - TextLabel mTitleActor; ///< The Toolbar's Title. + TextLabel mTitleActor; Layer mBuilderLayer; diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index bd10f40..4e2b6d5 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -306,6 +306,7 @@ class ButtonsController: public ConnectionTracker mCheckboxButton1.SetName( "checkbox1" ); mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" ); mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); + mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.Add( mCheckboxButton1 ); } @@ -316,6 +317,7 @@ class ButtonsController: public ConnectionTracker mCheckboxButton2.SetLabelText( "CheckBox2 is selected" ); mCheckboxButton2.SetSelected( true ); mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); + mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.Add( mCheckboxButton2 ); } @@ -325,6 +327,7 @@ class ButtonsController: public ConnectionTracker mCheckboxButton3.SetName( "checkbox3" ); mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" ); mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); + mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.Add( mCheckboxButton3 ); } diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 0503ae9..55f8663 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/examples/renderer-stencil/renderer-stencil-example.cpp b/examples/renderer-stencil/renderer-stencil-example.cpp index 37d6fe7..e16cc48 100644 --- a/examples/renderer-stencil/renderer-stencil-example.cpp +++ b/examples/renderer-stencil/renderer-stencil-example.cpp @@ -119,15 +119,29 @@ private: // Hide the indicator bar application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); - // Creates the background image. + // Use a gradient visual to render the background gradient. Toolkit::Control background = Dali::Toolkit::Control::New(); background.SetAnchorPoint( Dali::AnchorPoint::CENTER ); background.SetParentOrigin( Dali::ParentOrigin::CENTER ); background.SetResizePolicy( Dali::ResizePolicy::FILL_TO_PARENT, Dali::Dimension::ALL_DIMENSIONS ); - Dali::Property::Map map; - map["rendererType"] = "IMAGE"; - map["url"] = BACKGROUND_IMAGE; - background.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map ); + + // Set up the background gradient. + Property::Array stopOffsets; + stopOffsets.PushBack( 0.0f ); + stopOffsets.PushBack( 1.0f ); + Property::Array stopColors; + stopColors.PushBack( Vector4( 0.17f, 0.24f, 0.35f, 1.0f ) ); // Dark, medium saturated blue ( top of screen) + stopColors.PushBack( Vector4( 0.45f, 0.70f, 0.80f, 1.0f ) ); // Medium bright, pastel blue (bottom of screen) + const float percentageStageHeight = stage.GetSize().height * 0.7f; + + background.SetProperty( Toolkit::Control::Property::BACKGROUND, Dali::Property::Map() + .Add( Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::GRADIENT ) + .Add( Toolkit::GradientVisual::Property::STOP_OFFSET, stopOffsets ) + .Add( Toolkit::GradientVisual::Property::STOP_COLOR, stopColors ) + .Add( Toolkit::GradientVisual::Property::START_POSITION, Vector2( 0.0f, -percentageStageHeight ) ) + .Add( Toolkit::GradientVisual::Property::END_POSITION, Vector2( 0.0f, percentageStageHeight ) ) + .Add( Toolkit::GradientVisual::Property::UNITS, Toolkit::GradientVisual::Units::USER_SPACE ) ); + stage.Add( background ); // Create a TextLabel for the application title. diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index ba6becd..5e03efa 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace Dali; @@ -112,8 +113,12 @@ public: // The Init signal is received once (only) during the Application lifetime Stage stage = Stage::GetCurrent(); - // Respond to key events - stage.KeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent); + // Respond to key events if not handled + Toolkit::KeyInputFocusManager keyInputFocusManager = Toolkit::KeyInputFocusManager::Get(); + if( keyInputFocusManager ) + { + keyInputFocusManager.UnhandledKeyEventSignal().Connect(this, &SizeNegotiationController::OnKeyEvent); + } // Creates a default view with a default tool bar. // The view is added to the stage. diff --git a/examples/video-view/video-view-example.cpp b/examples/video-view/video-view-example.cpp index ddbc1a8..c20b8f8 100644 --- a/examples/video-view/video-view-example.cpp +++ b/examples/video-view/video-view-example.cpp @@ -28,7 +28,7 @@ namespace const int INIT_HEIGHT( 400 ); const int BUTTON_SIZE( 80 ); - const char* const PLAY_FILE = DEMO_VIDEO_DIR "big_buck_bunny.mp4"; + const char* const PLAY_FILE = DEMO_VIDEO_DIR "demoVideo.mp4"; const char* const PLAY_IMAGE = DEMO_IMAGE_DIR "icon-play.png"; const char* const PAUSE_IMAGE = DEMO_IMAGE_DIR "Pause.png"; const char* const STOP_IMAGE = DEMO_IMAGE_DIR "icon-stop.png"; @@ -36,32 +36,6 @@ namespace const char* const FORWARD_IMAGE = DEMO_IMAGE_DIR "Forward.png"; const char* const BACKWARD_IMAGE = DEMO_IMAGE_DIR "Backward.png"; -const char* DEFAULT_FRAGMENT_SHADER = DALI_COMPOSE_SHADER( - varying mediump vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - uniform lowp vec4 uColor;\n - \n - void main()\n - {\n - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n - }\n -); - -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( - precision mediump float; - varying mediump vec2 vTexCoord;\n - uniform sampler2D sTexture;\n - uniform lowp vec4 uColor;\n - \n - void main()\n - {\n - vec2 st = vTexCoord.st;\n - vec3 irgb = texture2D( sTexture, st ).rgb;\n - vec3 negative = vec3( 1., 1., 1. ) - irgb;\n - gl_FragColor = vec4( mix( irgb, negative, 1.0), 1. ) * uColor;\n - }\n -); - } // namespace class VideoViewController: public ConnectionTracker @@ -73,7 +47,6 @@ class VideoViewController: public ConnectionTracker mIsPlay( false ), mIsStop( false ), mIsFullScreen( false ), - mSetCustomShader( false ), mScale( 1.f ) { // Connect to the Application's Init signal @@ -209,16 +182,6 @@ class VideoViewController: public ConnectionTracker Stage::GetCurrent().KeyEventSignal().Connect( this, &VideoViewController::OnKeyEvent ); - Property::Map customShader; - customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, FRAGMENT_SHADER ); - mCustomShader.Insert( Visual::Property::TYPE, Visual::IMAGE ); - mCustomShader.Insert( Visual::Property::SHADER, customShader ); - - Property::Map defaultShader; - customShader.Insert( Visual::Shader::Property::FRAGMENT_SHADER, DEFAULT_FRAGMENT_SHADER ); - mDefaultShader.Insert( Visual::Property::TYPE, Visual::IMAGE ); - mDefaultShader.Insert( Visual::Property::SHADER, customShader ); - mWindowSurfaceTarget.Insert( "RENDERING_TARGET", "windowSurfaceTarget" ); mNativeImageTarget.Insert( "RENDERING_TARGET", "nativeImageTarget" ); @@ -350,17 +313,6 @@ class VideoViewController: public ConnectionTracker if( !mIsFullScreen ) { mRotationAnimation.Play(); - - if( mSetCustomShader ) - { - mSetCustomShader = false; - mVideoView.SetProperty( VideoView::Property::VIDEO, mDefaultShader ); - } - else - { - mSetCustomShader = true; - mVideoView.SetProperty( VideoView::Property::VIDEO, mCustomShader ); - } } } @@ -389,7 +341,6 @@ private: bool mIsPlay; bool mIsStop; bool mIsFullScreen; - bool mSetCustomShader; PushButton mPlayButton; PushButton mPauseButton; @@ -405,8 +356,6 @@ private: float mPinchStartScale; Animation mRotationAnimation; - Property::Map mCustomShader; - Property::Map mDefaultShader; Property::Map mWindowSurfaceTarget; Property::Map mNativeImageTarget; }; diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 90d023f..86cc81a 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.9 +Version: 1.2.10 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/videos/big_buck_bunny.mp4 b/resources/videos/big_buck_bunny.mp4 deleted file mode 100644 index a7c4228..0000000 --- a/resources/videos/big_buck_bunny.mp4 +++ /dev/null diff --git a/resources/videos/demoVideo.mp4 b/resources/videos/demoVideo.mp4 new file mode 100755 index 0000000..cd7dcd0 --- /dev/null +++ b/resources/videos/demoVideo.mp4