Set launcher background from stylesheet 84/48684/5
authorXiangyin Ma <x1.ma@samsung.com>
Thu, 24 Sep 2015 16:16:33 +0000 (17:16 +0100)
committerXiangyin Ma <x1.ma@samsung.com>
Thu, 1 Oct 2015 13:49:29 +0000 (14:49 +0100)
Change-Id: I3bb7ab3711311431cd0cbff0abc2cfdd11ee616d

demo/dali-table-view.cpp
demo/dali-table-view.h
examples/magnifier/magnifier-example.cpp
resources/images/Logo-for-demo.png [new file with mode: 0644]
resources/style/demo-theme.json
resources/style/mobile/demo-theme.json

index 990a787776a3da14f6cc1be12f3e4c341b1fdd8c..50b52a89607544c1acd60294521d544566d2c066 100644 (file)
@@ -43,8 +43,7 @@ const std::string BUTTON_QUIT( "Quit" );
 const std::string BUTTON_OK( "Ok" );
 const std::string BUTTON_CANCEL( "Cancel" );
 
-const std::string DEFAULT_BACKGROUND_IMAGE_PATH( DALI_IMAGE_DIR "background-gradient.jpg" );
-const std::string LOGO_PATH( DALI_IMAGE_DIR "dali-logo.png" );
+const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" );
 const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" );
 const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png");
 const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png");
@@ -88,14 +87,14 @@ const float BUBBLE_MAX_Z = 0.0f;
 /**
  * Creates the background image
  */
-ImageView CreateBackground( std::string imagePath )
+Control CreateBackground( std::string stylename )
 {
-  Image image = ResourceImage::New( imagePath );
-  ImageView background = ImageView::New( image );
+  Control background = Control::New();
+  Stage::GetCurrent().Add( background );
+  background.SetProperty( Control::Property::STYLE_NAME,stylename);
   background.SetName( "BACKGROUND" );
   background.SetAnchorPoint( AnchorPoint::CENTER );
   background.SetParentOrigin( ParentOrigin::CENTER );
-  background.SetZ( -1.0f );
   background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   return background;
@@ -171,7 +170,6 @@ DaliTableView::DaliTableView( Application& application )
   mBackgroundAnimations(),
   mExampleList(),
   mExampleMap(),
-  mBackgroundImagePath( DEFAULT_BACKGROUND_IMAGE_PATH ),
   mTotalPages(),
   mScrolling( false ),
   mSortAlphabetically( false ),
@@ -190,11 +188,6 @@ void DaliTableView::AddExample( Example example )
   mExampleMap[ example.name ] = example;
 }
 
-void DaliTableView::SetBackgroundPath( std::string imagePath )
-{
-  mBackgroundImagePath = imagePath;
-}
-
 void DaliTableView::SortAlphabetically( bool sortAlphabetically )
 {
   mSortAlphabetically = sortAlphabetically;
@@ -207,10 +200,10 @@ void DaliTableView::Initialize( Application& application )
   const Vector2 stageSize = Stage::GetCurrent().GetSize();
 
   // Background
-  ImageView background = CreateBackground( mBackgroundImagePath );
+  Control background = CreateBackground( "launcherbackground" );
   Stage::GetCurrent().Add( background );
 
-  // Render entire content as overlays, as is all on same 2D plane.
+  // Add root actor
   mRootActor = TableView::New( 4, 1 );
   mRootActor.SetAnchorPoint( AnchorPoint::CENTER );
   mRootActor.SetParentOrigin( ParentOrigin::CENTER );
index 8b1353d4167cafd3c2c4da6ec6b8236bbc3b169b..9db332db222788419dfbead5a678e8ede8811efb 100644 (file)
@@ -98,15 +98,6 @@ public:
    */
   void AddExample(Example example);
 
-  /**
-   * Sets the background image PATH.
-   *
-   * @param[in] imagePath The file path to the image to use as the background.
-   *
-   * @note Should be called before the Application MainLoop is started.
-   */
-  void SetBackgroundPath( std::string imagePath );
-
   /**
    * Sorts the example list alphabetically by Title if parameter is true.
    *
@@ -407,7 +398,6 @@ private:
   ExampleList                     mExampleList;              ///< List of examples.
   ExampleMap                      mExampleMap;               ///< Map LUT for examples.
 
-  std::string                     mBackgroundImagePath;      ///< The path to the background image.
   int                             mTotalPages;               ///< Total pages within scrollview.
 
   bool                            mScrolling:1;              ///< Flag indicating whether view is currently being scrolled
index b5632d56d225c2f7a0d629515b585a14d271f0d1..8f0945dca6514df0565424119b5cabc60fdc0b55 100644 (file)
@@ -223,7 +223,7 @@ public:
     Stage::GetCurrent().Add(overlay);
 
     mMagnifier = Toolkit::Magnifier::New();
-    mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
+    mMagnifier.SetSourceActor( mView );
     mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width );  // Size of magnifier is in relation to stage width
     mMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR );
     mMagnifier.SetScale(Vector3::ZERO);
@@ -240,7 +240,7 @@ public:
 
     // Create bouncing magnifier automatically bounces around screen.
     mBouncingMagnifier = Toolkit::Magnifier::New();
-    mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) );
+    mBouncingMagnifier.SetSourceActor( mView );
     mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width
     mBouncingMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR );
     overlay.Add( mBouncingMagnifier );
diff --git a/resources/images/Logo-for-demo.png b/resources/images/Logo-for-demo.png
new file mode 100644 (file)
index 0000000..ab8c2a4
Binary files /dev/null and b/resources/images/Logo-for-demo.png differ
index 96116467c725c41a99c7dd8c1d4eb6ae548470d8..64fe7861d67b267334ec13fee4f703dd0c788970 100644 (file)
@@ -59,6 +59,19 @@ distributing this software or its derivatives.
     "buttonlabel":
     {
       "point-size":11
+    },
+
+    "launcherbackground":
+    {
+      "background":
+      {
+        "renderer-type": "gradient-renderer",
+        "gradient-center": [240, 400],
+        "gradient-radius": 932,
+        "gradient-units": "user-space",
+        "gradient-stop-color": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]],
+        "gradient-stop-offset":[0.0,1.0]
+      }
     }
   }
 }
index b22e9871c9b01de42cd1cb0a75367332580ff86b..653fbeae5dc4a732be19b5002efd3a074c256948 100644 (file)
@@ -66,7 +66,7 @@ distributing this software or its derivatives.
     {
       "point-size":10
     },
-    
+
     "scrollview":
     {
       "overshoot-effect-color":"B018"
@@ -80,6 +80,19 @@ distributing this software or its derivatives.
     "buttonlabel":
     {
       "point-size":8
+    },
+
+    "launcherbackground":
+    {
+      "background":
+      {
+        "renderer-type": "gradient-renderer",
+        "gradient-center": [360, 640],
+        "gradient-radius": 1468,
+        "gradient-units": "user-space",
+        "gradient-stop-color": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]],
+        "gradient-stop-offset":[0.0,1.0]
+      }
     }
   }
 }