/*
-* Copyright (c) 2019 Samsung Electronics Co., Ltd.
+* Copyright (c) 2020 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.
{
// The value for scale-change between wearable-mobile
// Can be changed on App-Create time
-Vector2 STAGE_SIZE = Vector2( 360.0f, 360.0f );
-Vector2 SCALED_STAGE_SIZE = Vector2( 1.0f, 1.0f );
-Vector3 SCALED_STAGE_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f );
+Vector2 WINDOW_SIZE = Vector2( 360.0f, 360.0f );
+Vector2 SCALED_WINDOW_SIZE = Vector2( 1.0f, 1.0f );
+Vector3 SCALED_WINDOW_SIZE_3 = Vector3( 1.0f, 1.0f, 0.0f );
float SCALED_WIDTH = 1.0f;
float SCALED_HEIGHT = 1.0f;
float FONT_SCALE = 0.25f;
// The Init signal is received once (only) during the Application lifetime
void Create(Application& application)
{
- // Get a handle to the stage
- mStage = Stage::GetCurrent();
- mStage.KeyEventSignal().Connect( this, &CallController::OnKeyEvent );
+ // Get a handle to the main window
+ mWindow = application.GetWindow();
+ mWindow.KeyEventSignal().Connect( this, &CallController::OnKeyEvent );
// Apply custom style for background and button.
StyleManager::Get().ApplyTheme( BACKGROUND_STYLE_JSON );
// Get current device's width and height.
- STAGE_SIZE = mStage.GetSize();
- SCALED_STAGE_SIZE = STAGE_SIZE / 360.0f;
- SCALED_STAGE_SIZE_3 = Vector3( SCALED_STAGE_SIZE.x, SCALED_STAGE_SIZE.y, 0.0f );
- SCALED_WIDTH = SCALED_STAGE_SIZE.x < SCALED_STAGE_SIZE.y ? SCALED_STAGE_SIZE.x : SCALED_STAGE_SIZE.y;
+ const Window::WindowSize windowSize = mWindow.GetSize();
+ WINDOW_SIZE = Vector2(windowSize.GetWidth(), windowSize.GetHeight());
+ SCALED_WINDOW_SIZE = WINDOW_SIZE / 360.0f;
+ SCALED_WINDOW_SIZE_3 = Vector3( SCALED_WINDOW_SIZE.x, SCALED_WINDOW_SIZE.y, 0.0f );
+ SCALED_WIDTH = SCALED_WINDOW_SIZE.x < SCALED_WINDOW_SIZE.y ? SCALED_WINDOW_SIZE.x : SCALED_WINDOW_SIZE.y;
SCALED_HEIGHT = SCALED_WIDTH;
// Note that this is heuristic value
- FONT_SCALE = 0.25f * STAGE_SIZE.y / STAGE_SIZE.x;
+ FONT_SCALE = 0.25f * WINDOW_SIZE.y / WINDOW_SIZE.x;
mBackground = Control::New();
- mBackground.SetParentOrigin( ParentOrigin::CENTER );
- mBackground.SetAnchorPoint( AnchorPoint::CENTER );
- mBackground.SetSize( STAGE_SIZE );
+ mBackground.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mBackground.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mBackground.SetProperty( Actor::Property::SIZE, WINDOW_SIZE );
- mStage.Add( mBackground );
+ mWindow.Add( mBackground );
BuildParameter();
SetupActors();
void OnKeyEvent(const KeyEvent& event)
{
- if( event.state == KeyEvent::Down )
+ if( event.GetState() == KeyEvent::DOWN )
{
if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
{
SetupActiveActors();
}
- // Create and Add to stage when visible at call incomming
+ // Create and Add to window when visible at call incomming
void SetupComingActors()
{
mButtonIconDecall = ImageView::New();
mButtonIconDecall.SetImage( ICON_DECALL_IMAGE );
- mButtonIconDecall.SetParentOrigin( ParentOrigin::CENTER );
- mButtonIconDecall.SetAnchorPoint( AnchorPoint::CENTER );
- mButtonIconDecall.SetSize( ICON_DECALL_SIZE * SCALED_WIDTH );
- mButtonIconDecall.SetPosition( ICON_DECALL_POSITION * SCALED_WIDTH );
+ mButtonIconDecall.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mButtonIconDecall.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mButtonIconDecall.SetProperty( Actor::Property::SIZE, ICON_DECALL_SIZE * SCALED_WIDTH );
+ mButtonIconDecall.SetProperty( Actor::Property::POSITION, ICON_DECALL_POSITION * SCALED_WIDTH );
mButtonIconBattery = ImageView::New();
mButtonIconBattery.SetImage( ICON_BATTERY_IMAGE );
- mButtonIconBattery.SetParentOrigin( ParentOrigin::TOP_CENTER );
- mButtonIconBattery.SetAnchorPoint( AnchorPoint::TOP_CENTER );
- mButtonIconBattery.SetSize( ICON_BATTERY_SIZE * SCALED_WIDTH );
- mButtonIconBattery.SetPosition( ICON_BATTERY_POSITION * SCALED_WIDTH );
+ mButtonIconBattery.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
+ mButtonIconBattery.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
+ mButtonIconBattery.SetProperty( Actor::Property::SIZE, ICON_BATTERY_SIZE * SCALED_WIDTH );
+ mButtonIconBattery.SetProperty( Actor::Property::POSITION, ICON_BATTERY_POSITION * SCALED_WIDTH );
mCallStartButton = PushButton::New();
- mCallStartButton.SetParentOrigin( ParentOrigin::CENTER );
- mCallStartButton.SetAnchorPoint( AnchorPoint::CENTER );
- mCallStartButton.SetSize( BUTTON_CALL_START_SIZE * SCALED_WIDTH );
- mCallStartButton.SetPosition( BUTTON_CALL_START_POSITION * SCALED_WIDTH );
+ mCallStartButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mCallStartButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mCallStartButton.SetProperty( Actor::Property::SIZE, BUTTON_CALL_START_SIZE * SCALED_WIDTH );
+ mCallStartButton.SetProperty( Actor::Property::POSITION, BUTTON_CALL_START_POSITION * SCALED_WIDTH );
mCallStartButton.ClickedSignal().Connect( this, &CallController::OnButtonClicked );
mCallStartButton.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, ICON_CALL_IMAGE );
mCallStartButton.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, ICON_CALL_IMAGE );
mCallStartButton.SetProperty( Control::Property::BACKGROUND, ICON_CALL_IMAGE );
mCallStartButton.SetProperty( Button::Property::LABEL, "" );
- mStage.Add( mCallStartButton );
- mStage.Add( mButtonIconDecall );
- mStage.Add( mButtonIconBattery );
+ mWindow.Add( mCallStartButton );
+ mWindow.Add( mButtonIconDecall );
+ mWindow.Add( mButtonIconBattery );
mLabelIncoming = TextLabel::New( LABEL_INCOMING_STR );
- mLabelIncoming.SetParentOrigin( ParentOrigin::CENTER );
- mLabelIncoming.SetAnchorPoint( AnchorPoint::CENTER );
- mLabelIncoming.SetSize( LABEL_INCOMING_SIZE * SCALED_STAGE_SIZE );
- mLabelIncoming.SetPosition( LABEL_INCOMING_POSITION * SCALED_STAGE_SIZE_3 );
- mLabelIncoming.SetVisible( true );
+ mLabelIncoming.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mLabelIncoming.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mLabelIncoming.SetProperty( Actor::Property::SIZE, LABEL_INCOMING_SIZE * SCALED_WINDOW_SIZE );
+ mLabelIncoming.SetProperty( Actor::Property::POSITION, LABEL_INCOMING_POSITION * SCALED_WINDOW_SIZE_3 );
+ mLabelIncoming.SetProperty( Actor::Property::VISIBLE, true );
mLabelIncoming.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_INCOMING_FONT_COLOR );
mLabelIncoming.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_INCOMING_FONT_SIZE * FONT_SCALE );
mLabelIncoming.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelIncoming.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLabelName = TextLabel::New( LABEL_NAME_STR );
- mLabelName.SetParentOrigin( ParentOrigin::CENTER );
- mLabelName.SetAnchorPoint( AnchorPoint::CENTER );
- mLabelName.SetSize( LABEL_NAME_SIZE * SCALED_STAGE_SIZE );
- mLabelName.SetPosition( LABEL_NAME_POSITION * SCALED_STAGE_SIZE_3 );
- mLabelName.SetVisible( true );
+ mLabelName.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mLabelName.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mLabelName.SetProperty( Actor::Property::SIZE, LABEL_NAME_SIZE * SCALED_WINDOW_SIZE );
+ mLabelName.SetProperty( Actor::Property::POSITION, LABEL_NAME_POSITION * SCALED_WINDOW_SIZE_3 );
+ mLabelName.SetProperty( Actor::Property::VISIBLE, true );
mLabelName.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_NAME_FONT_COLOR );
mLabelName.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_NAME_FONT_SIZE * FONT_SCALE );
mLabelName.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelName.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLabelNumber = TextLabel::New( LABEL_NUMBER_STR );
- mLabelNumber.SetParentOrigin( ParentOrigin::CENTER );
- mLabelNumber.SetAnchorPoint( AnchorPoint::CENTER );
- mLabelNumber.SetSize( LABEL_NUMBER_SIZE * SCALED_STAGE_SIZE );
- mLabelNumber.SetPosition( LABEL_NUMBER_POSITION * SCALED_STAGE_SIZE_3 );
- mLabelNumber.SetVisible( true );
+ mLabelNumber.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mLabelNumber.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mLabelNumber.SetProperty( Actor::Property::SIZE, LABEL_NUMBER_SIZE * SCALED_WINDOW_SIZE );
+ mLabelNumber.SetProperty( Actor::Property::POSITION, LABEL_NUMBER_POSITION * SCALED_WINDOW_SIZE_3 );
+ mLabelNumber.SetProperty( Actor::Property::VISIBLE, true );
mLabelNumber.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_NUMBER_FONT_COLOR );
mLabelNumber.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_NUMBER_FONT_SIZE * FONT_SCALE );
mLabelNumber.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelNumber.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
mLabelDecline = TextLabel::New( LABEL_DECLINE_STR );
- mLabelDecline.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
- mLabelDecline.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
- mLabelDecline.SetSize( LABEL_DECLINE_SIZE * SCALED_STAGE_SIZE );
- mLabelDecline.SetPosition( LABEL_DECLINE_POSITION * SCALED_WIDTH );
- mLabelDecline.SetVisible( true );
+ mLabelDecline.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
+ mLabelDecline.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
+ mLabelDecline.SetProperty( Actor::Property::SIZE, LABEL_DECLINE_SIZE * SCALED_WINDOW_SIZE );
+ mLabelDecline.SetProperty( Actor::Property::POSITION, LABEL_DECLINE_POSITION * SCALED_WIDTH );
+ mLabelDecline.SetProperty( Actor::Property::VISIBLE, true );
mLabelDecline.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_DECLINE_FONT_COLOR );
mLabelDecline.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_DECLINE_FONT_SIZE * FONT_SCALE );
mLabelDecline.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelDecline.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mStage.Add( mLabelIncoming );
- mStage.Add( mLabelName );
- mStage.Add( mLabelNumber );
- mStage.Add( mLabelDecline );
+ mWindow.Add( mLabelIncoming );
+ mWindow.Add( mLabelName );
+ mWindow.Add( mLabelNumber );
+ mWindow.Add( mLabelDecline );
}
- // Create and Add to stage when visible at call active
+ // Create and Add to window when visible at call active
void SetupActiveActors()
{
mButtonClip = Control::New();
- mButtonClip.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
- mButtonClip.SetAnchorPoint( ParentOrigin::BOTTOM_CENTER );
- mButtonClip.SetSize( BUTTON_DECALL_SIZE * SCALED_WIDTH );
- mButtonClip.SetPosition( BUTTON_DECALL_CLIP_POSITION * SCALED_WIDTH );
+ mButtonClip.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
+ mButtonClip.SetProperty( Actor::Property::ANCHOR_POINT, ParentOrigin::BOTTOM_CENTER );
+ mButtonClip.SetProperty( Actor::Property::SIZE, BUTTON_DECALL_SIZE * SCALED_WIDTH );
+ mButtonClip.SetProperty( Actor::Property::POSITION, BUTTON_DECALL_CLIP_POSITION * SCALED_WIDTH );
mButtonIcon = ImageView::New();
mButtonIcon.SetImage( BUTTON_DECALL_ICON_IMAGE );
- mButtonIcon.SetParentOrigin( ParentOrigin::CENTER );
- mButtonIcon.SetAnchorPoint( AnchorPoint::CENTER );
- mButtonIcon.SetSize( BUTTON_DECALL_ICON_SIZE * SCALED_WIDTH );
- mButtonIcon.SetPosition( BUTTON_DECALL_ICON_POSITION * SCALED_WIDTH );
+ mButtonIcon.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mButtonIcon.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mButtonIcon.SetProperty( Actor::Property::SIZE, BUTTON_DECALL_ICON_SIZE * SCALED_WIDTH );
+ mButtonIcon.SetProperty( Actor::Property::POSITION, BUTTON_DECALL_ICON_POSITION * SCALED_WIDTH );
mCallEndButton = PushButton::New();
- mCallEndButton.SetParentOrigin( ParentOrigin::CENTER );
- mCallEndButton.SetAnchorPoint( AnchorPoint::CENTER );
- mCallEndButton.SetSize( BUTTON_DECALL_SIZE * SCALED_WIDTH );
- mCallEndButton.SetPosition( BUTTON_DECALL_POSITION * SCALED_WIDTH );
+ mCallEndButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mCallEndButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mCallEndButton.SetProperty( Actor::Property::SIZE, BUTTON_DECALL_SIZE * SCALED_WIDTH );
+ mCallEndButton.SetProperty( Actor::Property::POSITION, BUTTON_DECALL_POSITION * SCALED_WIDTH );
mCallEndButton.ClickedSignal().Connect( this, &CallController::OnButtonClicked );
mCallEndButton.SetProperty( Button::Property::SELECTED_BACKGROUND_VISUAL, "" );
mCallEndButton.SetProperty( Button::Property::UNSELECTED_BACKGROUND_VISUAL, "" );
mButtonClip.Add( mButtonIcon );
mLabelTime = TextLabel::New( LABEL_TIME_STR );
- mLabelTime.SetParentOrigin( ParentOrigin::CENTER );
- mLabelTime.SetAnchorPoint( AnchorPoint::CENTER );
- mLabelTime.SetSize( LABEL_TIME_SIZE * SCALED_STAGE_SIZE );
- mLabelTime.SetPosition( LABEL_TIME_POSITION * SCALED_STAGE_SIZE_3 );
- mLabelTime.SetVisible( false );
+ mLabelTime.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ mLabelTime.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ mLabelTime.SetProperty( Actor::Property::SIZE, LABEL_TIME_SIZE * SCALED_WINDOW_SIZE );
+ mLabelTime.SetProperty( Actor::Property::POSITION, LABEL_TIME_POSITION * SCALED_WINDOW_SIZE_3 );
+ mLabelTime.SetProperty( Actor::Property::VISIBLE, false );
mLabelTime.SetProperty( TextLabel::Property::TEXT_COLOR, LABEL_TIME_FONT_COLOR );
mLabelTime.SetProperty( TextLabel::Property::POINT_SIZE, LABEL_TIME_FONT_SIZE * FONT_SCALE );
mLabelTime.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
mLabelTime.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- mStage.Add( mLabelTime );
+ mWindow.Add( mLabelTime );
}
void SetupAnimation()
if( button == mCallStartButton )
{
mBackground.SetStyleName( BACKGROUND_ACTIVE_STYLE_STR );
- mStage.Add( mButtonClip );
+ mWindow.Add( mButtonClip );
mMoveFront.Play();
}
else if( button == mCallEndButton )
private:
Application& mApplication;
- Stage mStage;
+ Window mWindow;
Control mBackground;