summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Olshevskyi <i.olshevskyi@samsung.com>2017-07-05 14:55:41 +0300
committerIgor Olshevskyi <i.olshevskyi@samsung.com>2017-07-11 07:52:20 +0300
commitdda636ff229af26d617b91d94d234723bd49b0e3 (patch)
treeb67ddacf7b34107ae5baddf6e920be01a985da9a
parent4c4078c8575b0b281fd65d413b3ac70f0d615652 (diff)
downloadcall-ui-dda636ff229af26d617b91d94d234723bd49b0e3.tar.gz
call-ui-dda636ff229af26d617b91d94d234723bd49b0e3.tar.bz2
call-ui-dda636ff229af26d617b91d94d234723bd49b0e3.zip
TizenRefApp-8799 [Call UI] Implement showing Voice Control icon on Incoming Call
Change-Id: Ic52c8b5d669a1d6331f1df3173e9a9d2a4b63a77
-rw-r--r--edc/indicator.edc119
-rw-r--r--inc/model/IndicatorState.h1
-rw-r--r--inc/model/types.h1
-rw-r--r--inc/presenters/IndicatorPresenter.h7
-rw-r--r--inc/presenters/MainPage.h6
-rw-r--r--inc/types.h3
-rw-r--r--src/model/BatteryStateSource.cpp2
-rw-r--r--src/model/BatteryStateSource.h4
-rw-r--r--src/model/Call.cpp32
-rw-r--r--src/model/Call.h1
-rw-r--r--src/model/ConnectionStateSource.cpp2
-rw-r--r--src/model/ConnectionStateSource.h4
-rw-r--r--src/model/HdVoiceStateSource.cpp2
-rw-r--r--src/model/HdVoiceStateSource.h4
-rw-r--r--src/model/IIndicatorStateSource.h2
-rw-r--r--src/model/IndicatorStateProvider.cpp12
-rw-r--r--src/model/IndicatorStateProvider.h2
-rw-r--r--src/model/RssiStateSource.cpp2
-rw-r--r--src/model/RssiStateSource.h4
-rw-r--r--src/model/SimSlotStateSource.cpp2
-rw-r--r--src/model/SimSlotStateSource.h6
-rw-r--r--src/model/VoiceControlStateProvider.cpp121
-rw-r--r--src/model/VoiceControlStateProvider.h55
-rw-r--r--src/model/VoiceControlStateSource.cpp110
-rw-r--r--src/model/VoiceControlStateSource.h73
-rw-r--r--src/model/implTypes.h5
-rw-r--r--src/presenters/IndicatorPresenter.cpp87
-rw-r--r--src/presenters/MainPage.cpp74
28 files changed, 628 insertions, 115 deletions
diff --git a/edc/indicator.edc b/edc/indicator.edc
index 9fa4127..f47ce4b 100644
--- a/edc/indicator.edc
+++ b/edc/indicator.edc
@@ -20,11 +20,11 @@
#define CU_RSSI_IMAGE_DIR CU_INDI_ICONS_DIR"/4level"
#define CU_BATT_IMAGE_DIR CU_INDI_ICONS_DIR"/Battery"
-#define CU_BATT_ICON_H 32
-#define CU_BATT_ICON_W 22
+#define CU_INDI_CENTRAL_ICON_H 32
+#define CU_INDI_CENTRAL_ICON_W 22
-#define CU_INDI_ICON_H 26
-#define CU_INDI_ICON_W 24
+#define CU_INDI_REG_ICON_H 26
+#define CU_INDI_REG_ICON_W 24
#define CU_SWL_CONN_COORD_X 104
#define CU_SWL_CONN_COORD_Y 31
@@ -35,6 +35,9 @@
#define CU_SWL_BATT_COORD_X 169
#define CU_SWL_BATT_COORD_Y 14
+#define CU_SWL_VC_COORD_X 169
+#define CU_SWL_VC_COORD_Y 14
+
#define CU_SWL_SIM_COORD_X 201
#define CU_SWL_SIM_COORD_Y 20
@@ -42,19 +45,22 @@
#define CU_SWL_HD_CALL_COORD_Y 31
#define CU_SWL_CONN_REL1 CU_REL_W(CU_SWL_CONN_COORD_X) CU_REL_H(CU_SWL_CONN_COORD_Y)
-#define CU_SWL_CONN_REL2 CU_REL_W((CU_SWL_CONN_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_CONN_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_CONN_REL2 CU_REL_W((CU_SWL_CONN_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_CONN_COORD_Y+CU_INDI_REG_ICON_H))
#define CU_SWL_RSSI_REL1 CU_REL_W(CU_SWL_RSSI_COORD_X) CU_REL_H(CU_SWL_RSSI_COORD_Y)
-#define CU_SWL_RSSI_REL2 CU_REL_W((CU_SWL_RSSI_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_RSSI_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_RSSI_REL2 CU_REL_W((CU_SWL_RSSI_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_RSSI_COORD_Y+CU_INDI_REG_ICON_H))
#define CU_SWL_BATTERY_REL1 CU_REL_W(CU_SWL_BATT_COORD_X) CU_REL_H(CU_SWL_BATT_COORD_Y)
-#define CU_SWL_BATTERY_REL2 CU_REL_W((CU_SWL_BATT_COORD_X+CU_BATT_ICON_W)) CU_REL_H((CU_SWL_BATT_COORD_Y+CU_BATT_ICON_H))
+#define CU_SWL_BATTERY_REL2 CU_REL_W((CU_SWL_BATT_COORD_X+CU_INDI_CENTRAL_ICON_W)) CU_REL_H((CU_SWL_BATT_COORD_Y+CU_INDI_CENTRAL_ICON_H))
+
+#define CU_SWL_VC_REL1 CU_REL_W(CU_SWL_VC_COORD_X) CU_REL_H(CU_SWL_VC_COORD_Y)
+#define CU_SWL_VC_REL2 CU_REL_W((CU_SWL_VC_COORD_X+CU_INDI_CENTRAL_ICON_W)) CU_REL_H((CU_SWL_VC_COORD_Y+CU_INDI_CENTRAL_ICON_H))
#define CU_SWL_SIM_REL1 CU_REL_W(CU_SWL_SIM_COORD_X) CU_REL_H(CU_SWL_SIM_COORD_Y)
-#define CU_SWL_SIM_REL2 CU_REL_W((CU_SWL_SIM_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_SIM_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_SIM_REL2 CU_REL_W((CU_SWL_SIM_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_SIM_COORD_Y+CU_INDI_REG_ICON_H))
#define CU_SWL_HD_CALL_REL1 CU_REL_W(CU_SWL_HD_CALL_COORD_X) CU_REL_H(CU_SWL_HD_CALL_COORD_Y)
-#define CU_SWL_HD_CALL_REL2 CU_REL_W((CU_SWL_HD_CALL_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_HD_CALL_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_HD_CALL_REL2 CU_REL_W((CU_SWL_HD_CALL_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_HD_CALL_COORD_Y+CU_INDI_REG_ICON_H))
// Indicator main layout
@@ -86,6 +92,13 @@ group { "elm/layout/callui/indicator";
rel2 { relative: CU_SWL_BATTERY_REL2; to: "bg"; }
}
}
+ swallow { "swl.voice_control";
+ scale;
+ desc { "default";
+ rel1 { relative: CU_SWL_VC_REL1; to: "bg"; }
+ rel2 { relative: CU_SWL_VC_REL2; to: "bg"; }
+ }
+ }
swallow { "swl.sim";
scale;
desc { "default";
@@ -108,7 +121,7 @@ group { "elm/layout/callui/indicator";
#define CU_DESC_CONN_IMAGE(_value) \
desc { "state_"_value; \
inherit: "default"; \
- visible: 1; \
+ vis; \
image.normal: CU_CONN_IMAGE_DIR"/"_value".png"; \
} \
@@ -151,12 +164,12 @@ group { "elm/layout/callui/connection";
image { "img.connection_type";
scale;
desc { "default";
- min: CU_INDI_ICON_W CU_INDI_ICON_H;
- max: CU_INDI_ICON_W CU_INDI_ICON_H;
+ min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+ max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
fixed: 1 1;
image.normal: CU_CONN_IMAGE_DIR"/edge_connected.png";
color_class: "AO0111";
- visible: 0;
+ hid;
}
CU_DESC_CONN_IMAGE("edge_connected");
CU_DESC_CONN_IMAGE("gprs_connected");
@@ -174,11 +187,11 @@ group { "elm/layout/callui/connection";
scale;
desc { "default";
fixed: 1 1;
- min: CU_INDI_ICON_W CU_INDI_ICON_H;
- max: CU_INDI_ICON_W CU_INDI_ICON_H;
+ min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+ max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
image.normal: CU_CONN_IMAGE_DIR"/no_inout_connected.png";
color_class: "AO0111";
- visible: 0;
+ hid;
}
CU_DESC_CONN_IMAGE("no_inout_connected");
CU_DESC_CONN_IMAGE("in_connected");
@@ -272,8 +285,8 @@ group { "elm/layout/callui/rssi";
scale;
desc { "default";
fixed: 1 1;
- min: CU_INDI_ICON_W CU_INDI_ICON_H;
- max: CU_INDI_ICON_W CU_INDI_ICON_H;
+ min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+ max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
image.normal: CU_INDI_ICONS_DIR"/b_ic_indicator_02.png";
color_class: "AO0111";
}
@@ -296,7 +309,7 @@ group { "elm/layout/callui/rssi";
}
desc { "none";
inherit: "default";
- visible: 0;
+ hid;
}
}
}
@@ -381,8 +394,8 @@ group { "elm/layout/callui/battery";
scale;
desc { "default";
fixed: 1 1;
- min: CU_BATT_ICON_W CU_BATT_ICON_H;
- max: CU_BATT_ICON_W CU_BATT_ICON_H;
+ min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+ max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
image.normal: CU_BATT_IMAGE_DIR"/battery_bg.png";
color_class: "AO0111";
}
@@ -391,14 +404,14 @@ group { "elm/layout/callui/battery";
scale;
desc { "default";
fixed: 1 1;
- min: CU_BATT_ICON_W CU_BATT_ICON_H;
- max: CU_BATT_ICON_W CU_BATT_ICON_H;
+ min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+ max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
image.normal: CU_BATT_IMAGE_DIR"/battery_50.png";
color_class: "AO0111";
}
desc { "batt_lvl_hide";
inherit: "default";
- visible: 0;
+ hid;
}
DESCRIPTION_BATTERY(05);
DESCRIPTION_BATTERY(10);
@@ -425,33 +438,33 @@ group { "elm/layout/callui/battery";
scale;
desc { "default";
fixed: 1 1;
- min: CU_BATT_ICON_W CU_BATT_ICON_H;
- max: CU_BATT_ICON_W CU_BATT_ICON_H;
+ min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+ max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
image.normal: CU_BATT_IMAGE_DIR"/battery_00.png";
color_class: "AO0111";
- visible: 0;
+ hid;
}
desc { "low_battery";
inherit: "default";
- visible: 1;
+ vis;
}
desc { "charging";
inherit: "default";
image.normal: CU_BATT_IMAGE_DIR"/battery_charging.png";
color_class: "AO0251";
- visible: 1;
+ vis;
}
desc { "charging_problem";
inherit: "default";
image.normal: CU_BATT_IMAGE_DIR"/battery_not_charging.png";
color_class: "AO0254";
- visible: 1;
+ vis;
}
desc { "unknown";
inherit: "default";
image.normal: CU_BATT_IMAGE_DIR"/battery_unknown.png";
color_class: "AO0251";
- visible: 1;
+ vis;
}
}
}
@@ -511,6 +524,26 @@ group { "elm/layout/callui/battery";
}
}
+// Voice Control
+
+group { "elm/layout/callui/voice_control";
+ images {
+ image: CU_INDI_ICONS_DIR"/indi_voice_control.png" COMP;
+ }
+ parts {
+ image { "img.voice_control";
+ scale;
+ desc { "default";
+ fixed: 1 1;
+ min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+ max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+ image.normal: CU_INDI_ICONS_DIR"/indi_voice_control.png";
+ color_class: "AO0111";
+ }
+ }
+ }
+}
+
// SIM
group { "elm/layout/callui/sim";
@@ -526,38 +559,38 @@ group { "elm/layout/callui/sim";
scale;
desc { "default";
fixed: 1 1;
- min: CU_INDI_ICON_W CU_INDI_ICON_H;
- max: CU_INDI_ICON_W CU_INDI_ICON_H;
+ min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+ max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
image.normal: CU_INDI_ICONS_DIR"/indi_gear_sim_call.png";
color_class: "AO0111";
- visible: 0;
+ hid;
}
desc { "unknown";
inherit: "default";
}
desc { "gear_sim_call";
inherit: "default";
- visible: 1;
+ vis;
}
desc { "forwarded_call";
inherit: "default";
image.normal: CU_INDI_ICONS_DIR"/indi_forwarded_call.png";
- visible: 1;
+ vis;
}
desc { "mobile_sim_call";
inherit: "default";
image.normal: CU_INDI_ICONS_DIR"/indi_mobile_sim_call.png";
- visible: 1;
+ vis;
}
desc { "mobile_sim_01";
inherit: "default";
image.normal: CU_INDI_ICONS_DIR"/indi_mobile_sim_01.png";
- visible: 1;
+ vis;
}
desc { "mobile_sim_02";
inherit: "default";
image.normal: CU_INDI_ICONS_DIR"/indi_mobile_sim_02.png";
- visible: 1;
+ vis;
}
}
}
@@ -612,18 +645,18 @@ group { "elm/layout/callui/hd_voice";
scale;
desc { "default";
fixed: 1 1;
- min: CU_INDI_ICON_W CU_INDI_ICON_H;
- max: CU_INDI_ICON_W CU_INDI_ICON_H;
+ min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+ max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
image.normal: CU_INDI_ICONS_DIR"/indi_hd_voice_call.png";
color_class: "AO0111";
- visible: 0;
+ hid;
}
desc { "disabled";
inherit: "default";
}
desc { "enabled";
inherit: "default";
- visible: 1;
+ vis;
}
}
}
diff --git a/inc/model/IndicatorState.h b/inc/model/IndicatorState.h
index b0a4d5d..da7e45f 100644
--- a/inc/model/IndicatorState.h
+++ b/inc/model/IndicatorState.h
@@ -31,6 +31,7 @@ namespace callui {
bool getRoamingState(IndicatorState state);
int getBatteryLevel(IndicatorState state);
BatteryState getBatteryState(IndicatorState state);
+ bool getVoiceControlState(IndicatorState state);
SimSlot getSimSlotType(IndicatorState state);
bool getSimForwardState(IndicatorState state);
bool getHDVoiceState(IndicatorState state);
diff --git a/inc/model/types.h b/inc/model/types.h
index e6b1f57..ea83dc2 100644
--- a/inc/model/types.h
+++ b/inc/model/types.h
@@ -135,6 +135,7 @@ namespace callui {
NW_CONNECTION = 0,
RSSI,
BATTERY,
+ VOICE_CONTROL,
SIM_SLOT,
HD_VOICE
};
diff --git a/inc/presenters/IndicatorPresenter.h b/inc/presenters/IndicatorPresenter.h
index 6492a11..b0ac5dd 100644
--- a/inc/presenters/IndicatorPresenter.h
+++ b/inc/presenters/IndicatorPresenter.h
@@ -50,6 +50,8 @@ namespace callui {
ucl::Widget &getWidget();
+ void udapteIncomingCallMode(bool isIncomingCallMode);
+
private:
friend class ucl::ReffedObj<IndicatorPresenter>;
IndicatorPresenter(ucl::IRefCountObj &rc,
@@ -61,6 +63,7 @@ namespace callui {
ucl::Result createConnectionLayout();
ucl::Result createRssiLayout();
ucl::Result createBatteryLayout();
+ ucl::Result createVoiceControlLayout();
ucl::Result createSimLayout();
ucl::Result createHdVoiceLayout();
@@ -70,6 +73,8 @@ namespace callui {
void updateSimState();
void updateHdVoiceState();
+ void updateCentralIcon();
+
// IIndicatorStateListener
virtual void onStateChanged(IndicatorProperty property) override final;
@@ -81,7 +86,9 @@ namespace callui {
ucl::LayoutSRef m_batteryLayout;
ucl::LayoutSRef m_simLayout;
ucl::LayoutSRef m_hdCallLayout;
+ ucl::LayoutSRef m_voiceControlLayout;
IIndicatorStateProviderSRef m_provider;
+ bool m_isIncomingCallMode;
};
ucl::EdjeSignal getConnectionSignal(ConnectionType type);
diff --git a/inc/presenters/MainPage.h b/inc/presenters/MainPage.h
index 610b789..1d3ae89 100644
--- a/inc/presenters/MainPage.h
+++ b/inc/presenters/MainPage.h
@@ -57,7 +57,11 @@ namespace callui {
ucl::Result showWindow();
void updateCallMode();
- ucl::Result processIncomingCall();
+ ucl::Result processIncomingCallMode();
+ void resetIncomingCallMode();
+ ucl::Result processRegularCallModes();
+ void resetRegularCallModes();
+
ucl::Result createAcceptRejectPresenter();
ucl::Result createRejectMsgPresenter(const IRejectMsgProviderSRef &provider);
void RejectMsgStateCb(RejectMsgState state);
diff --git a/inc/types.h b/inc/types.h
index 890fc08..6bf8e12 100644
--- a/inc/types.h
+++ b/inc/types.h
@@ -22,6 +22,7 @@
#include "ucl/util/types.h"
#include "ucl/util/memory.h"
#include "ucl/util/delegation.h"
+#include "ucl/util/smartDelegation.h"
#include "ucl/misc/RefCountAware.h"
namespace callui {
@@ -34,6 +35,8 @@ namespace callui {
RES_OPERATION_FAILED = ucl::_RES_BEGIN - 4,
RES_NOT_CONNECTED = ucl::_RES_BEGIN - 5
};
+
+ using NotiHandler = ucl::WeakDelegate<void()>;
}
#endif // __CALLUI_TYPES_H__
diff --git a/src/model/BatteryStateSource.cpp b/src/model/BatteryStateSource.cpp
index 6c146a1..6eb2769 100644
--- a/src/model/BatteryStateSource.cpp
+++ b/src/model/BatteryStateSource.cpp
@@ -178,7 +178,7 @@ namespace callui {
return {m_bits.value};
}
- void BatteryStateSource::setStateChangeHandler(StateChangeHandler handler)
+ void BatteryStateSource::setStateChangeHandler(const NotiHandler &handler)
{
m_handler = handler;
}
diff --git a/src/model/BatteryStateSource.h b/src/model/BatteryStateSource.h
index 4506e56..09c2a79 100644
--- a/src/model/BatteryStateSource.h
+++ b/src/model/BatteryStateSource.h
@@ -33,7 +33,7 @@ namespace callui {
// IIndicatorStateSource
virtual IndicatorState getState() const override final;
- virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+ virtual void setStateChangeHandler(const NotiHandler &handler) override final;
private:
friend class ucl::ReffedObj<BatteryStateSource>;
@@ -68,7 +68,7 @@ namespace callui {
private:
Bits m_bits;
- StateChangeHandler m_handler;
+ NotiHandler m_handler;
};
}
diff --git a/src/model/Call.cpp b/src/model/Call.cpp
index dce95a0..e54cd56 100644
--- a/src/model/Call.cpp
+++ b/src/model/Call.cpp
@@ -28,10 +28,14 @@
#include "CallClient.h"
#include "CallManager.h"
#include "SoundManager.h"
+
+#include "VoiceControlStateProvider.h"
#include "IndicatorStateProvider.h"
+
#include "ConnectionStateSource.h"
#include "RssiStateSource.h"
#include "BatteryStateSource.h"
+#include "VoiceControlStateSource.h"
#include "SimSlotStateSource.h"
#include "HdVoiceStateSource.h"
@@ -129,20 +133,30 @@ namespace callui {
{
auto callClient = CallClient::newInstance();
if (!callClient) {
- LOG_RETURN(RES_FAIL, "Client::newInstance() failed!");
+ LOG_RETURN(RES_FAIL,
+ "Client::newInstance() failed!");
}
m_callManager = CallManager::newInstance(callClient, asWeak(*this));
if (!m_callManager) {
- LOG_RETURN(RES_FAIL, "CallManager::newInstance() failed!");
+ LOG_RETURN(RES_FAIL,
+ "CallManager::newInstance() failed!");
}
m_soundManager = SoundManager::newInstance(callClient);
if (!m_soundManager) {
- LOG_RETURN(RES_FAIL, "SoundManage::newInstance() failed!");
+ LOG_RETURN(RES_FAIL,
+ "SoundManage::newInstance() failed!");
}
- FAIL_RETURN(initInidcatorStateProvider(), "Init Indicator State Provider failed!");
+ m_voiceControlPrv = VoiceControlStateProvider::newInstance();
+ if (!m_voiceControlPrv) {
+ LOG_RETURN(RES_FAIL,
+ "VoiceControlStateProvider::newInstance() failed!");
+ }
+
+ FAIL_RETURN(initInidcatorStateProvider(),
+ "Init Indicator State Provider failed!");
return RES_OK;
}
@@ -181,6 +195,16 @@ namespace callui {
IndicatorProperty::BATTERY, batteryStSrc),
"setStateSource() failed!");
+ auto voiceControlStSrc =
+ VoiceControlStateSource::newInstance(m_voiceControlPrv);
+ if (!voiceControlStSrc) {
+ LOG_RETURN(RES_FAIL,
+ "VoiceControlStateSource::newInstance() failed!");
+ }
+ FAIL_RETURN(m_indicatorStPrv->setStateSource(
+ IndicatorProperty::VOICE_CONTROL, voiceControlStSrc),
+ "setStateSource() failed!");
+
m_simSlotStSrc = makeShared<SimSlotStateSource>(
m_callManager->getSimSlot(), getForwardedCallStatus());
FAIL_RETURN(m_indicatorStPrv->setStateSource(
diff --git a/src/model/Call.h b/src/model/Call.h
index 4459f54..cc18576 100644
--- a/src/model/Call.h
+++ b/src/model/Call.h
@@ -71,6 +71,7 @@ namespace callui {
SimSlotStateSourceSRef m_simSlotStSrc;
HdVoiceStateSourceSRef m_hdCallStSrc;
IndicatorStateProviderSRef m_indicatorStPrv;
+ VoiceControlStateProviderSRef m_voiceControlPrv;
};
}
diff --git a/src/model/ConnectionStateSource.cpp b/src/model/ConnectionStateSource.cpp
index ff33839..d2399e5 100644
--- a/src/model/ConnectionStateSource.cpp
+++ b/src/model/ConnectionStateSource.cpp
@@ -347,7 +347,7 @@ namespace callui {
return {m_bits.value};
}
- void ConnectionStateSource::setStateChangeHandler(StateChangeHandler handler)
+ void ConnectionStateSource::setStateChangeHandler(const NotiHandler &handler)
{
m_handler = handler;
}
diff --git a/src/model/ConnectionStateSource.h b/src/model/ConnectionStateSource.h
index f8dad33..041e397 100644
--- a/src/model/ConnectionStateSource.h
+++ b/src/model/ConnectionStateSource.h
@@ -33,7 +33,7 @@ namespace callui {
// IIndicatorStateSource
virtual IndicatorState getState() const override final;
- virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+ virtual void setStateChangeHandler(const NotiHandler &handler) override final;
private:
friend class ucl::ReffedObj<ConnectionStateSource>;
@@ -76,7 +76,7 @@ namespace callui {
private:
Bits m_bits;
- StateChangeHandler m_handler;
+ NotiHandler m_handler;
};
}
diff --git a/src/model/HdVoiceStateSource.cpp b/src/model/HdVoiceStateSource.cpp
index 396ee05..90df282 100644
--- a/src/model/HdVoiceStateSource.cpp
+++ b/src/model/HdVoiceStateSource.cpp
@@ -62,7 +62,7 @@ namespace callui {
return {m_bits.value};
}
- void HdVoiceStateSource::setStateChangeHandler(StateChangeHandler handler)
+ void HdVoiceStateSource::setStateChangeHandler(const NotiHandler &handler)
{
m_handler = handler;
}
diff --git a/src/model/HdVoiceStateSource.h b/src/model/HdVoiceStateSource.h
index 678fad6..7b98b7e 100644
--- a/src/model/HdVoiceStateSource.h
+++ b/src/model/HdVoiceStateSource.h
@@ -30,7 +30,7 @@ namespace callui {
// IIndicatorStateSource
virtual IndicatorState getState() const override final;
- virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+ virtual void setStateChangeHandler(const NotiHandler &handler) override final;
public:
union Bits {
@@ -46,7 +46,7 @@ namespace callui {
private:
Bits m_bits;
- StateChangeHandler m_handler;
+ NotiHandler m_handler;
};
}
diff --git a/src/model/IIndicatorStateSource.h b/src/model/IIndicatorStateSource.h
index d334a17..53eb2cc 100644
--- a/src/model/IIndicatorStateSource.h
+++ b/src/model/IIndicatorStateSource.h
@@ -26,7 +26,7 @@ namespace callui {
class IIndicatorStateSource : public ucl::Polymorphic {
public:
virtual IndicatorState getState() const = 0;
- virtual void setStateChangeHandler(StateChangeHandler handler) = 0;
+ virtual void setStateChangeHandler(const NotiHandler &handler) = 0;
};
}
diff --git a/src/model/IndicatorStateProvider.cpp b/src/model/IndicatorStateProvider.cpp
index 6175f71..4ef85e7 100644
--- a/src/model/IndicatorStateProvider.cpp
+++ b/src/model/IndicatorStateProvider.cpp
@@ -38,7 +38,8 @@ namespace callui {
m_source(source)
{
m_source->setStateChangeHandler(
- WEAK_DELEGATE(SourceHandler::onStateChanged, asWeak(*this)));
+ WEAK_DELEGATE(SourceHandler::onStateChanged,
+ asWeak(*this)));
}
IndicatorState getState() const
@@ -85,17 +86,20 @@ namespace callui {
return RES_OK;
}
- IndicatorState IndicatorStateProvider::getState(IndicatorProperty property) const
+ IndicatorState IndicatorStateProvider::getState(
+ IndicatorProperty property) const
{
return m_sources[convertEnumValueToInt(property)]->getState();
}
- void IndicatorStateProvider::setListener(IIndicatorStateListenerWRef listener)
+ void IndicatorStateProvider::setListener(
+ IIndicatorStateListenerWRef listener)
{
m_listener = listener;
}
- void IndicatorStateProvider::dispatchStateChanged(IndicatorProperty property) const
+ void IndicatorStateProvider::dispatchStateChanged(
+ IndicatorProperty property) const
{
if (const auto listener = m_listener.lock()) {
listener->onStateChanged(property);
diff --git a/src/model/IndicatorStateProvider.h b/src/model/IndicatorStateProvider.h
index 3c3a6ab..fd091a6 100644
--- a/src/model/IndicatorStateProvider.h
+++ b/src/model/IndicatorStateProvider.h
@@ -47,7 +47,7 @@ namespace callui {
private:
enum {
- STATE_COUNT = 5
+ STATE_COUNT = 6
};
class SourceHandler;
diff --git a/src/model/RssiStateSource.cpp b/src/model/RssiStateSource.cpp
index ef83230..71ce4d1 100644
--- a/src/model/RssiStateSource.cpp
+++ b/src/model/RssiStateSource.cpp
@@ -205,7 +205,7 @@ namespace callui {
return {m_bits.value};
}
- void RssiStateSource::setStateChangeHandler(StateChangeHandler handler)
+ void RssiStateSource::setStateChangeHandler(const NotiHandler &handler)
{
m_handler = handler;
}
diff --git a/src/model/RssiStateSource.h b/src/model/RssiStateSource.h
index 70747d1..967bf25 100644
--- a/src/model/RssiStateSource.h
+++ b/src/model/RssiStateSource.h
@@ -33,7 +33,7 @@ namespace callui {
// IIndicatorStateSource
virtual IndicatorState getState() const override final;
- virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+ virtual void setStateChangeHandler(const NotiHandler &handler) override final;
private:
friend class ucl::ReffedObj<RssiStateSource>;
@@ -67,7 +67,7 @@ namespace callui {
private:
Bits m_bits;
- StateChangeHandler m_handler;
+ NotiHandler m_handler;
};
}
diff --git a/src/model/SimSlotStateSource.cpp b/src/model/SimSlotStateSource.cpp
index a5fe2de..e65f4b7 100644
--- a/src/model/SimSlotStateSource.cpp
+++ b/src/model/SimSlotStateSource.cpp
@@ -72,7 +72,7 @@ namespace callui {
return {m_bits.value};
}
- void SimSlotStateSource::setStateChangeHandler(StateChangeHandler handler)
+ void SimSlotStateSource::setStateChangeHandler(const NotiHandler &handler)
{
m_handler = handler;
}
diff --git a/src/model/SimSlotStateSource.h b/src/model/SimSlotStateSource.h
index 836c406..686eb01 100644
--- a/src/model/SimSlotStateSource.h
+++ b/src/model/SimSlotStateSource.h
@@ -30,14 +30,14 @@ namespace callui {
// IIndicatorStateSource
virtual IndicatorState getState() const override final;
- virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+ virtual void setStateChangeHandler(const NotiHandler &handler) override final;
public:
union Bits {
struct {
uint8_t property : 4;
uint8_t simSlot : 4;
- bool isForwarded: 1;
+ uint8_t isForwarded: 1;
};
uint64_t value;
@@ -47,7 +47,7 @@ namespace callui {
private:
Bits m_bits;
- StateChangeHandler m_handler;
+ NotiHandler m_handler;
};
}
diff --git a/src/model/VoiceControlStateProvider.cpp b/src/model/VoiceControlStateProvider.cpp
new file mode 100644
index 0000000..d52999d
--- /dev/null
+++ b/src/model/VoiceControlStateProvider.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VoiceControlStateProvider.h"
+
+#include "common.h"
+
+// Temporary until VCONFLAG will not be added to a system
+#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL
+
+namespace callui {
+
+ using namespace ucl;
+
+ VoiceControlStateProvider::VoiceControlStateProvider():
+ m_enableState(false)
+ {
+ }
+
+ VoiceControlStateProvider::~VoiceControlStateProvider()
+ {
+ delSysStateCallback();
+ }
+
+ VoiceControlStateProviderSRef VoiceControlStateProvider::newInstance()
+ {
+ auto result = makeShared<VoiceControlStateProvider>();
+ FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+ return result;
+ }
+
+ Result VoiceControlStateProvider::prepare()
+ {
+ FAIL_RETURN(addSysStateCallback(),
+ "addSysStateCallbacks() failed!");
+
+ FAIL_RETURN(initState(), "initState() failed!");
+ return RES_OK;
+ }
+
+ Result VoiceControlStateProvider::initState()
+ {
+ auto val = 0;
+ if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) {
+ LOG_RETURN(RES_FAIL, "vconf_get_bool() failed!");
+ }
+ updateState(val);
+
+ return RES_OK;
+ }
+
+ bool VoiceControlStateProvider::getState() const
+ {
+ return m_enableState;
+ }
+
+ void VoiceControlStateProvider::addStateChangeHandler(
+ const NotiHandler &handler)
+ {
+ m_event += handler;
+ }
+
+ void VoiceControlStateProvider::removeStateChangeHandler(
+ const NotiHandler &handler)
+ {
+ m_event -= handler;
+ }
+
+ Result VoiceControlStateProvider::addSysStateCallback()
+ {
+ if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER,
+ CALLBACK_B(VoiceControlStateProvider::onStateChanged),
+ this) != 0) {
+ LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+ }
+ return RES_OK;
+ }
+
+ void VoiceControlStateProvider::delSysStateCallback()
+ {
+ vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER,
+ CALLBACK_B(VoiceControlStateProvider::onStateChanged));
+ }
+
+ void VoiceControlStateProvider::onStateChanged(
+ keynode_t *node)
+ {
+ auto val = 0;
+ if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) {
+ LOG_RETURN_VOID(RES_FAIL, "vconf_get_bool() failed!");
+ }
+
+ if (updateState(val) && !m_event.isEmpty()) {
+ m_event.dispatch();
+ }
+ }
+
+ bool VoiceControlStateProvider::updateState(bool isEnable)
+ {
+ if (m_enableState != isEnable) {
+ m_enableState = isEnable;
+ return true;
+ }
+ return false;
+ }
+
+
+}
diff --git a/src/model/VoiceControlStateProvider.h b/src/model/VoiceControlStateProvider.h
new file mode 100644
index 0000000..f0d493c
--- /dev/null
+++ b/src/model/VoiceControlStateProvider.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__
+#define __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__
+
+#include <vconf.h>
+
+#include "implTypes.h"
+
+namespace callui {
+
+ class VoiceControlStateProvider final {
+ public:
+ static VoiceControlStateProviderSRef newInstance();
+ virtual ~VoiceControlStateProvider();
+
+ bool getState() const;
+ void addStateChangeHandler(const NotiHandler &handler);
+ void removeStateChangeHandler(const NotiHandler &handler);
+
+ private:
+ friend class ucl::ReffedObj<VoiceControlStateProvider>;
+ VoiceControlStateProvider();
+
+ ucl::Result prepare();
+
+ ucl::Result addSysStateCallback();
+ void delSysStateCallback();
+ ucl::Result initState();
+ bool updateState(bool isEnable);
+
+ void onStateChanged(keynode_t *node);
+
+ private:
+ bool m_enableState;
+ ucl::Event<NotiHandler> m_event;
+ };
+
+}
+
+#endif // __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__
diff --git a/src/model/VoiceControlStateSource.cpp b/src/model/VoiceControlStateSource.cpp
new file mode 100644
index 0000000..5009110
--- /dev/null
+++ b/src/model/VoiceControlStateSource.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VoiceControlStateSource.h"
+
+#include "VoiceControlStateProvider.h"
+
+#include "common.h"
+
+namespace callui {
+
+ using namespace ucl;
+
+ VoiceControlStateSource::Bits::Bits():
+ property(convertEnumValueToInt(IndicatorProperty::VOICE_CONTROL)),
+ isEnable(0)
+ {
+ }
+
+ VoiceControlStateSource::Bits::Bits(const IndicatorState &state):
+ value(state.value)
+ {
+ if (property != convertEnumValueToInt(
+ IndicatorProperty::VOICE_CONTROL)) {
+ ELOG("State of incorrect property type [%d]", property);
+ *this = {};
+ }
+ }
+
+ VoiceControlStateSource::VoiceControlStateSource(IRefCountObj &rc,
+ const VoiceControlStateProviderSRef &provider):
+ RefCountAware(&rc),
+ m_vcProvider(provider)
+ {
+ m_vcProvider->addStateChangeHandler(WEAK_DELEGATE(
+ VoiceControlStateSource::onStateChangedEvent,
+ asWeak(*this)));
+
+ updateStateBits(m_vcProvider->getState());
+ }
+
+ VoiceControlStateSource::~VoiceControlStateSource()
+ {
+ m_vcProvider->removeStateChangeHandler(WEAK_DELEGATE(
+ VoiceControlStateSource::onStateChangedEvent,
+ asWeak(*this)));
+ }
+
+ VoiceControlStateSourceSRef VoiceControlStateSource::newInstance(
+ const VoiceControlStateProviderSRef &provider)
+ {
+ if (!provider) {
+ LOG_RETURN_VALUE(RES_FAIL, {}, "provider is NULL");
+ }
+
+ return makeShared<VoiceControlStateSource>(provider);
+ }
+
+ void VoiceControlStateSource::onStateChangedEvent()
+ {
+ if (updateStateBits(m_vcProvider->getState()) && m_handler) {
+ m_handler();
+ }
+ }
+
+ Result VoiceControlStateSource::initState()
+ {
+ updateStateBits(m_vcProvider->getState());
+ return RES_OK;
+ }
+
+ IndicatorState VoiceControlStateSource::getState() const
+ {
+ return {m_bits.value};
+ }
+
+ void VoiceControlStateSource::setStateChangeHandler(
+ const NotiHandler &handler)
+ {
+ m_handler = handler;
+ }
+
+ bool VoiceControlStateSource::updateStateBits(bool isEnable)
+ {
+ if (m_bits.isEnable != isEnable) {
+ m_bits.isEnable = isEnable;
+ return true;
+ }
+ return false;
+ }
+
+ bool getVoiceControlState(IndicatorState state)
+ {
+ return VoiceControlStateSource::Bits(state).isEnable;
+ }
+
+}
diff --git a/src/model/VoiceControlStateSource.h b/src/model/VoiceControlStateSource.h
new file mode 100644
index 0000000..b0864bb
--- /dev/null
+++ b/src/model/VoiceControlStateSource.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_VOICE_CONTROL_STATE_SOURCE_H__
+#define __CALLUI_VOICE_CONTROL_STATE_SOURCE_H__
+
+#include "IIndicatorStateSource.h"
+
+#include <vconf.h>
+
+#include "implTypes.h"
+
+namespace callui {
+
+ class VoiceControlStateSource final :
+ public IIndicatorStateSource,
+ public ucl::RefCountAware {
+ public:
+ static VoiceControlStateSourceSRef newInstance(
+ const VoiceControlStateProviderSRef &provider);
+ virtual ~VoiceControlStateSource();
+
+ // IIndicatorStateSource
+
+ virtual IndicatorState getState() const override final;
+ virtual void setStateChangeHandler(
+ const NotiHandler &handler) override final;
+
+ private:
+ friend class ucl::ReffedObj<VoiceControlStateSource>;
+ VoiceControlStateSource(ucl::IRefCountObj &rc,
+ const VoiceControlStateProviderSRef &provider);
+
+ ucl::Result prepare();
+
+ void onStateChangedEvent();
+ ucl::Result initState();
+ bool updateStateBits(bool isEnable);
+
+ public:
+ union Bits {
+ struct {
+ uint8_t property : 4;
+ uint8_t isEnable : 1;
+ };
+ uint64_t value;
+
+ Bits();
+ Bits(const IndicatorState &state);
+ };
+
+ private:
+ Bits m_bits;
+ NotiHandler m_handler;
+ VoiceControlStateProviderSRef m_vcProvider;
+ };
+
+}
+
+#endif // __CALLUI_VOICE_ANSWER_STATE_SOURCE_H__
diff --git a/src/model/implTypes.h b/src/model/implTypes.h
index e025c84..9575717 100644
--- a/src/model/implTypes.h
+++ b/src/model/implTypes.h
@@ -66,6 +66,9 @@ namespace callui {
UCL_DECLARE_REF_ALIASES(BatteryStateSource);
UCL_DECLARE_REF_ALIASES(SimSlotStateSource);
UCL_DECLARE_REF_ALIASES(HdVoiceStateSource);
+ UCL_DECLARE_REF_ALIASES(VoiceControlStateSource);
+
+ UCL_DECLARE_REF_ALIASES(VoiceControlStateProvider);
UCL_DECLARE_REF_ALIASES(ContactInfoProvider);
@@ -75,8 +78,6 @@ namespace callui {
using MuteStateEvent = ucl::Event<MuteStateHandler>;
using VolumeLevelEvent = ucl::Event<VolumeLevelHandler>;
- using StateChangeHandler = ucl::WeakDelegate<void()>;
-
using BluetoothVolumeHandler = ucl::WeakDelegate<void(int)>;
}
diff --git a/src/presenters/IndicatorPresenter.cpp b/src/presenters/IndicatorPresenter.cpp
index 7ec1d57..3ef7cb8 100644
--- a/src/presenters/IndicatorPresenter.cpp
+++ b/src/presenters/IndicatorPresenter.cpp
@@ -45,12 +45,15 @@ namespace callui { namespace { namespace impl {
constexpr LayoutTheme LAYOUT_HD_CALL
{"layout", "callui", "hd_voice"};
+ constexpr LayoutTheme LAYOUT_VOICE_CONTROL
+ {"layout", "callui", "voice_control"};
- constexpr EdjePart PART_CONNECTION {"swl.connection"};
- constexpr EdjePart PART_RSSI {"swl.rssi"};
- constexpr EdjePart PART_BATTERY {"swl.battery"};
- constexpr EdjePart PART_SIM {"swl.sim"};
- constexpr EdjePart PART_HD_VOICE {"swl.hd_voice"};
+ constexpr EdjePart PART_SWL_CONN {"swl.connection"};
+ constexpr EdjePart PART_SWL_RSSI {"swl.rssi"};
+ constexpr EdjePart PART_SWL_BATTERY {"swl.battery"};
+ constexpr EdjePart PART_SWL_VOICE_CONTROL {"swl.voice_control"};
+ constexpr EdjePart PART_SWL_SIM {"swl.sim"};
+ constexpr EdjePart PART_SWL_HD_VOICE {"swl.hd_voice"};
constexpr EdjeSignal SIGL_BATT_LVL_HIDE {"batt_lvl_hide"};
@@ -200,7 +203,8 @@ namespace callui {
IndicatorPresenter::IndicatorPresenter(IRefCountObj &rc,
const IIndicatorStateProviderSRef &provider):
Presenter(rc),
- m_provider(provider)
+ m_provider(provider),
+ m_isIncomingCallMode(false)
{
}
@@ -213,25 +217,23 @@ namespace callui {
{
FAIL_RETURN(Presenter::prepare(parent, PF_PASSIVE),
"Presenter::prepare() failed!");
-
FAIL_RETURN(createWidget(parentWidget),
"createWidget() failed!");
-
FAIL_RETURN(createConnectionLayout(),
"createConnectionLayout() failed!");
-
FAIL_RETURN(createRssiLayout(),
"createRssiLayout() failed!");
-
FAIL_RETURN(createBatteryLayout(),
"createBatteryLayout() failed!");
-
+ FAIL_RETURN(createVoiceControlLayout(),
+ "createBatteryLayout() failed!");
FAIL_RETURN(createSimLayout(),
"createSimLayout() failed!");
-
FAIL_RETURN(createHdVoiceLayout(),
"createHdCallLayout() failed!");
+ updateCentralIcon();
+
m_provider->setListener(asWeak(*this));
return RES_OK;
@@ -258,7 +260,7 @@ namespace callui {
if (!m_connLayout) {
LOG_RETURN(RES_FAIL, "Layout::build() failed!");
}
- m_widget->setContent(*m_connLayout, impl::PART_CONNECTION);
+ m_widget->setContent(*m_connLayout, impl::PART_SWL_CONN);
updateConnectionState();
@@ -273,7 +275,7 @@ namespace callui {
if (!m_rssiLayout) {
LOG_RETURN(RES_FAIL, "Layout::build() failed!");
}
- m_widget->setContent(*m_rssiLayout, impl::PART_RSSI);
+ m_widget->setContent(*m_rssiLayout, impl::PART_SWL_RSSI);
updateRssiState();
@@ -288,13 +290,27 @@ namespace callui {
if (!m_batteryLayout) {
LOG_RETURN(RES_FAIL, "Layout::build() failed!");
}
- m_widget->setContent(*m_batteryLayout, impl::PART_BATTERY);
+ m_widget->setContent(*m_batteryLayout, impl::PART_SWL_BATTERY);
updateBatteryState();
return RES_OK;
}
+ Result IndicatorPresenter::createVoiceControlLayout()
+ {
+ m_voiceControlLayout = Layout::Builder().
+ setTheme(impl::LAYOUT_VOICE_CONTROL).
+ build(*m_widget);
+ if (!m_voiceControlLayout) {
+ LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+ }
+
+ m_widget->setContent(*m_voiceControlLayout, impl::PART_SWL_VOICE_CONTROL);
+
+ return RES_OK;
+ }
+
Result IndicatorPresenter::createSimLayout()
{
m_simLayout = Layout::Builder().
@@ -303,7 +319,7 @@ namespace callui {
if (!m_simLayout) {
LOG_RETURN(RES_FAIL, "Layout::build() failed!");
}
- m_widget->setContent(*m_simLayout, impl::PART_SIM);
+ m_widget->setContent(*m_simLayout, impl::PART_SWL_SIM);
updateSimState();
@@ -318,7 +334,8 @@ namespace callui {
if (!m_hdCallLayout) {
LOG_RETURN(RES_FAIL, "Layout::build() failed!");
}
- m_widget->setContent(*m_hdCallLayout, impl::PART_HD_VOICE);
+
+ m_widget->setContent(*m_hdCallLayout, impl::PART_SWL_HD_VOICE);
updateHdVoiceState();
@@ -379,6 +396,39 @@ namespace callui {
return *m_widget;
}
+ void IndicatorPresenter::udapteIncomingCallMode(bool isIncomingCallMode)
+ {
+ if (m_isIncomingCallMode == isIncomingCallMode) {
+ return;
+ }
+ m_isIncomingCallMode = isIncomingCallMode;
+ updateCentralIcon();
+ }
+
+ void IndicatorPresenter::updateCentralIcon()
+ {
+ if (m_isIncomingCallMode) {
+ auto state = m_provider->getState(
+ IndicatorProperty::VOICE_CONTROL);
+
+ if (getVoiceControlState(state)) {
+ m_widget->setContent(*m_voiceControlLayout,
+ impl::PART_SWL_VOICE_CONTROL);
+ show(*m_voiceControlLayout);
+
+ m_widget->unsetContent(impl::PART_SWL_BATTERY);
+ hide(*m_batteryLayout);
+ return;
+ }
+ }
+ m_widget->unsetContent(impl::PART_SWL_VOICE_CONTROL);
+ hide(*m_voiceControlLayout);
+
+ m_widget->setContent(*m_batteryLayout,
+ impl::PART_SWL_BATTERY);
+ show(*m_batteryLayout);
+ }
+
void IndicatorPresenter::onStateChanged(IndicatorProperty property)
{
switch (property) {
@@ -391,6 +441,9 @@ namespace callui {
case IndicatorProperty::BATTERY:
updateBatteryState();
break;
+ case IndicatorProperty::VOICE_CONTROL:
+ updateCentralIcon();
+ break;
case IndicatorProperty::SIM_SLOT:
updateSimState();
break;
diff --git a/src/presenters/MainPage.cpp b/src/presenters/MainPage.cpp
index ea7683b..dc6fce8 100644
--- a/src/presenters/MainPage.cpp
+++ b/src/presenters/MainPage.cpp
@@ -202,7 +202,7 @@ namespace callui {
}
}
- Result MainPage::processIncomingCall()
+ Result MainPage::processIncomingCallMode()
{
auto incom = m_cm->getIncomingCall();
if (!incom) {
@@ -228,15 +228,49 @@ namespace callui {
}
m_rmLy->setText(STR_DECLINE_MESSAGES, impl::PART_TXT_REJECT_MSG);
- m_widget->setContent(m_rmLy->getEo(), impl::PART_SWL_REJECT_MSG);
+ m_widget->setContent(*m_rmLy, impl::PART_SWL_REJECT_MSG);
FAIL_RETURN(createRejectMsgPresenter(provider),
"createRejectMsgPresenter() failed!");
}
+ if (m_indicator) {
+ m_indicator->udapteIncomingCallMode(true);
+ }
+
+ return RES_OK;
+ }
+
+ void MainPage::resetIncomingCallMode()
+ {
+ m_rmPrs.reset();
+ m_acceptRejectPrs.reset();
+ m_rmLy.reset();
+
+ if (m_indicator) {
+ m_indicator->udapteIncomingCallMode(false);
+ }
+ }
+
+ Result MainPage::processRegularCallModes()
+ {
+ FAIL_RETURN(createAccessoryPresenter(),
+ "createAccessoryPresenter() failed");
+ FAIL_RETURN(createMoreOptionsPresenter(),
+ "createMoreOptionsPresenter() failed");
+ FAIL_RETURN(createBottomBtn(impl::STYLE_BB_END_CALL),
+ "createBottomBtn() failed");
+
return RES_OK;
}
+ void MainPage::resetRegularCallModes()
+ {
+ m_bottomBtn.reset();
+ m_accessoryPrs.reset();
+ m_moreOptionsPrs.reset();
+ }
+
void MainPage::updateCallMode()
{
auto incom = m_cm->getIncomingCall();
@@ -374,30 +408,18 @@ namespace callui {
}
FAIL_RETURN_VOID(showWindow(), "showWindow failed!");
- m_bottomBtn.reset();
-
if (m_mode == CallMode::INCOMING) {
- m_accessoryPrs.reset();
- m_moreOptionsPrs.reset();
-
- FAIL_RETURN_VOID(processIncomingCall(),
+ resetRegularCallModes();
+ FAIL_RETURN_VOID(processIncomingCallMode(),
"processIncomingCall() failed!");
} else {
- m_rmPrs.reset();
- m_acceptRejectPrs.reset();
- m_rmLy.reset();
-
+ resetIncomingCallMode();
if (m_mode == CallMode::END) {
- m_accessoryPrs.reset();
- m_moreOptionsPrs.reset();
+ resetRegularCallModes();
startEndCallTimer();
} else {
- FAIL_RETURN_VOID(createAccessoryPresenter(),
- "createAccessoryPresenter() failed");
- FAIL_RETURN_VOID(createMoreOptionsPresenter(),
- "createMoreOptionsPresenter() failed");
- FAIL_RETURN_VOID(createBottomBtn(impl::STYLE_BB_END_CALL),
- "createBottomBtn() failed");
+ FAIL_RETURN_VOID(processRegularCallModes(),
+ "processRegularCallModes() failed!");
}
}
@@ -461,7 +483,7 @@ namespace callui {
LOG_RETURN(RES_FAIL, "Indicator::build() failed!");
}
- m_widget->setContent(m_indicator->getWidget().getEo(), impl::PART_SWL_INDICATOR);
+ m_widget->setContent(m_indicator->getWidget(), impl::PART_SWL_INDICATOR);
return RES_OK;
}
@@ -554,7 +576,7 @@ namespace callui {
"AcceptRejectPresenter::build() failed!");
}
- m_widget->setContent(m_acceptRejectPrs->getWidget().getEo(),
+ m_widget->setContent(m_acceptRejectPrs->getWidget(),
impl::PART_SWL_ACCEPT_REJECT);
return RES_OK;
@@ -574,7 +596,8 @@ namespace callui {
}
}
- Result MainPage::createRejectMsgPresenter(const IRejectMsgProviderSRef &provider)
+ Result MainPage::createRejectMsgPresenter(
+ const IRejectMsgProviderSRef &provider)
{
m_rmPrs = RejectMsgPresenter::Builder().
setProvider(provider).
@@ -590,8 +613,7 @@ namespace callui {
"RejectMessagePresenter::build() failed!");
}
- m_widget->setContent(m_rmPrs->getWidget().getEo(),
- impl::PART_SWL_OVERLAY);
+ m_widget->setContent(m_rmPrs->getWidget(), impl::PART_SWL_OVERLAY);
return RES_OK;
}
@@ -611,7 +633,7 @@ namespace callui {
if (!m_callInfoPrs) {
LOG_RETURN(RES_FAIL, "CallerInfo::build() failed!");
}
- m_widget->setContent(m_callInfoPrs->getWidget().getEo(),
+ m_widget->setContent(m_callInfoPrs->getWidget(),
impl::PART_SWL_CALL_INFO);
return RES_OK;