Commit ff252337b4a5c2ceac642cd2b18816701425178f

Authored by Eunki, Hong
1 parent c06d81af

Fix labeling bug at image-view.example

There was some bug when we click 'Change' button.
Now we fix it.
+
Third button will show 'current status'. Not 'next status'.
(previous version may confused to beginner)

Change-Id: I9e2509accc589de9d5bcafe72097d08c55eef24a
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
examples/image-view/image-view-example.cpp
@@ -76,7 +76,7 @@ enum { @@ -76,7 +76,7 @@ enum {
76 STATUS_NORMAL = 0, 76 STATUS_NORMAL = 0,
77 STATUS_ROUND = 1, 77 STATUS_ROUND = 1,
78 STATUS_BORDERLINE = 2, 78 STATUS_BORDERLINE = 2,
79 - STATUS_ROUNDED_BORDERLINE = 3, 79 + STATUS_ROUNDED_BORDERLINE = STATUS_ROUND | STATUS_BORDERLINE,
80 NUMBER_OF_STATUS, 80 NUMBER_OF_STATUS,
81 }; 81 };
82 const char* BUTTON_LABEL[NUMBER_OF_STATUS] = { 82 const char* BUTTON_LABEL[NUMBER_OF_STATUS] = {
@@ -162,7 +162,7 @@ public: @@ -162,7 +162,7 @@ public:
162 mTable.AddChild(button2, Toolkit::TableView::CellPosition(CellPlacement::MID_BUTTON, x)); 162 mTable.AddChild(button2, Toolkit::TableView::CellPosition(CellPlacement::MID_BUTTON, x));
163 163
164 Toolkit::PushButton button3 = Toolkit::PushButton::New(); 164 Toolkit::PushButton button3 = Toolkit::PushButton::New();
165 - button3.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(STATUS_NORMAL + 1) % NUMBER_OF_STATUS]); 165 + button3.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[STATUS_NORMAL]);
166 button3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER); 166 button3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
167 button3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER); 167 button3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
168 button3.ClickedSignal().Connect(this, &ImageViewController::RoundedCornerClicked); 168 button3.ClickedSignal().Connect(this, &ImageViewController::RoundedCornerClicked);
@@ -234,13 +234,19 @@ private: @@ -234,13 +234,19 @@ private:
234 mImageViewImageIndexStatus[buttonIndex] = 0; 234 mImageViewImageIndexStatus[buttonIndex] = 0;
235 } 235 }
236 236
237 - // Reset corner radius state value  
238 - mImageViewRoundedCornerStatus[buttonIndex] = STATUS_NORMAL;  
239 - button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS]);  
240 -  
241 Property::Map imagePropertyMap; 237 Property::Map imagePropertyMap;
242 imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE); 238 imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
243 imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]); 239 imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]);
  240 + if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_ROUND)
  241 + {
  242 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS_VALUE);
  243 + }
  244 + if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_BORDERLINE)
  245 + {
  246 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH_VALUE);
  247 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET_VALUE);
  248 + }
  249 +
244 mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap); 250 mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap);
245 } 251 }
246 return true; 252 return true;
@@ -254,14 +260,20 @@ private: @@ -254,14 +260,20 @@ private:
254 { 260 {
255 mImageViewRoundedCornerStatus[buttonIndex] = (mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS; 261 mImageViewRoundedCornerStatus[buttonIndex] = (mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS;
256 262
257 - button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS]); 263 + button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[mImageViewRoundedCornerStatus[buttonIndex]]);
258 264
259 Property::Map imagePropertyMap; 265 Property::Map imagePropertyMap;
260 imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE); 266 imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
261 imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]); 267 imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]);
262 - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImageViewRoundedCornerStatus[buttonIndex] & 1 ? CORNER_RADIUS_VALUE : 0.0f);  
263 - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mImageViewRoundedCornerStatus[buttonIndex] & 2 ? BORDERLINE_WIDTH_VALUE : 0.0f);  
264 - imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mImageViewRoundedCornerStatus[buttonIndex] & 2 ? BORDERLINE_OFFSET_VALUE : 0.0f); 268 + if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_ROUND)
  269 + {
  270 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS_VALUE);
  271 + }
  272 + if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_BORDERLINE)
  273 + {
  274 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH_VALUE);
  275 + imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET_VALUE);
  276 + }
265 277
266 mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap); 278 mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap);
267 } 279 }