* limitations under the License.
*/
+#define CU_ACCESSORY_SOUND_BTNS_PAD_LEFT_MIN 9 0
+#define CU_ACCESSORY_SOUND_BTNS_PAD_MIDDLE_MIN 50 26
+
group { "elm/layout/callui/accessory";
parts {
+ spacer { "sound.btns.pad.left";
+ scale;
+ desc { "default";
+ fixed: 1 0;
+ align: 0.0 0.0;
+ min: CU_ACCESSORY_SOUND_BTNS_PAD_LEFT_MIN;
+ rel2.relative: 0.0 1.0;
+ }
+ }
+ spacer { "sound.btns.pad.middle";
+ scale;
+ desc { "default";
+ fixed: 1 1;
+ align: 0.0 0.5;
+ min: CU_ACCESSORY_SOUND_BTNS_PAD_MIDDLE_MIN;
+ rel1 { relative: 1.0 0.5; to_x: "sound.btns.pad.left"; }
+ rel2 { relative: 1.0 0.5; to_x: "sound.btns.pad.left"; }
+ }
+ }
+ swallow { "swl.sound";
+ scale;
+ desc { "default";
+ fixed: 1 1;
+ align: 0.5 1.0;
+ min: CU_ACCESSORY_SOUND_BTN_SIZE;
+ max: CU_ACCESSORY_SOUND_BTN_SIZE;
+ rel1 { relative: 0.0 0.0; to: "sound.btns.pad.middle"; }
+ rel2 { relative: 1.0 0.0; to: "sound.btns.pad.middle"; }
+ }
+ }
+ swallow { "swl.mute";
+ scale;
+ desc { "default";
+ fixed: 1 1;
+ align: 0.5 0.0;
+ min: CU_ACCESSORY_SOUND_BTN_SIZE;
+ max: CU_ACCESSORY_SOUND_BTN_SIZE;
+ rel1 { relative: 0.0 1.0; to: "sound.btns.pad.middle"; }
+ rel2 { relative: 1.0 1.0; to: "sound.btns.pad.middle"; }
+ }
+ }
swallow { "swl.volume_control"
scale;
desc { "default";
#define CU_BTN_VOLUME_EFF_PRESSED_SIZE 144 144
#define CU_BTN_VOLUME_ICON_SIZE 64 64
+#define CU_BTN_ACCESSORY_EFF_DEFAULT_SIZE 160 160
+#define CU_BTN_ACCESSORY_EFF_PRESSED_SIZE 144 144
+#define CU_BTN_ACCESSORY_ICON_SIZE 50 50
+
#define CU_BTN_INCOM_CALL(_name, _icon, _bg_cc, _effect_cc, _icon_norm_cc, _icon_pressed_cc) \
group { "elm/button/base/"_name; \
script { \
} \
}
+
+#define CU_BTN_ACCESSORY(_name, _icon, _icon_rel_y, _icon_align_y) \
+group { "elm/button/base/"_name; \
+ images { \
+ image: "w_call_button_press_circle.png" COMP; \
+ image: _icon COMP; \
+ } \
+ parts { \
+ spacer { "sizer"; \
+ scale; \
+ desc { "default"; \
+ max: CU_ACCESSORY_SOUND_BTN_SIZE; \
+ } \
+ } \
+ image { "image.bg"; \
+ nomouse; \
+ scale; \
+ desc { "default"; \
+ fixed: 1 1; \
+ rel.to: "icon"; \
+ min: CU_BTN_ACCESSORY_EFF_DEFAULT_SIZE; \
+ image.normal: "w_call_button_press_circle.png"; \
+ color: 255 255 255 0; \
+ } \
+ desc { "pressed_effect"; \
+ inherit: "default"; \
+ min: CU_BTN_ACCESSORY_EFF_PRESSED_SIZE; \
+ color: 255 255 255 33; \
+ } \
+ desc { "pressed"; \
+ inherit: "pressed_effect"; \
+ min: CU_BTN_ACCESSORY_EFF_DEFAULT_SIZE; \
+ } \
+ } \
+ image { "icon"; \
+ scale; \
+ desc { "default"; \
+ align: 0.5 _icon_align_y; \
+ rel1 { relative: 0.0 _icon_rel_y; to: "sizer"; } \
+ rel2 { relative: 1.0 _icon_rel_y; to: "sizer"; } \
+ min: CU_BTN_ACCESSORY_ICON_SIZE; \
+ max: CU_BTN_ACCESSORY_ICON_SIZE; \
+ image.normal: _icon; \
+ color_class: AO011; \
+ } \
+ desc { "on"; \
+ inherit: "default"; \
+ color_class: AO012; \
+ } \
+ desc { "off"; \
+ inherit: "default"; \
+ } \
+ desc { "disabled"; \
+ inherit: "default"; \
+ color_class: AO012D; \
+ } \
+ } \
+ rect { "event"; \
+ scale; \
+ desc { "default"; \
+ fixed: 1 1; \
+ rel.to: "sizer"; \
+ color: 0 0 0 0; \
+ } \
+ desc { "disabled"; \
+ inherit: "default"; \
+ hid; \
+ } \
+ } \
+ } \
+ programs { \
+ program { \
+ signal: "mouse,clicked,*"; \
+ source: "event"; \
+ action: SIGNAL_EMIT "elm,action,click" ""; \
+ } \
+ program { \
+ signal: "mouse,down,*"; \
+ source: "event"; \
+ sequence { \
+ action: STATE_SET "pressed_effect"; \
+ target: "image.bg"; \
+ action: STATE_SET "pressed"; \
+ target: "image.bg"; \
+ transition: TRANSITION_GLIDE(0.3); \
+ } \
+ } \
+ program { \
+ signal: "mouse,up,*"; \
+ source: "event"; \
+ action: STATE_SET "default"; \
+ target: "image.bg"; \
+ transition: LINEAR 0.535; \
+ } \
+ program { \
+ signal: "turn.on"; \
+ source: ""; \
+ action: STATE_SET "on"; \
+ target: "icon"; \
+ } \
+ program { \
+ signal: "turn.off"; \
+ source: ""; \
+ action: STATE_SET "off"; \
+ target: "icon"; \
+ } \
+ program { \
+ signal: "elm,state,enabled"; \
+ source: "elm"; \
+ action: STATE_SET "default"; \
+ target: "event"; \
+ target: "icon"; \
+ } \
+ program { \
+ signal: "elm,state,disabled"; \
+ source: "elm"; \
+ action: STATE_SET "disabled"; \
+ target: "event"; \
+ target: "icon"; \
+ } \
+ } \
+}
+
CU_BTN_INCOM_CALL("callui/accept", "w_call_incoming_icon_accept.png", "AO01131", "AO01132", "AO0113", "AO0113P")
CU_BTN_INCOM_CALL("callui/reject", "w_call_incoming_icon_reject.png", "AO01151", "AO01152", "AO0115", "AO0115P")
CU_BTN_BOTTOM("callui/call_back", "w_incoming_icon_call.png", "AO0171", "AO0171P", "B013A", "B013")
CU_BTN_VOLUME_CONTROL("callui/minus", "b_slider_icon_minus.png")
-CU_BTN_VOLUME_CONTROL("callui/plus", "b_slider_icon_plus.png")
\ No newline at end of file
+CU_BTN_VOLUME_CONTROL("callui/plus", "b_slider_icon_plus.png")
+
+CU_BTN_ACCESSORY("callui/volume", "w_outgoing_icon_volume.png", 1.0, 1.0)
+CU_BTN_ACCESSORY("callui/mute", "w_outgoing_icon_mute.png", 0.0, 0.0)
\ No newline at end of file
color_class { name: "FO22L1iD";
color: 255 255 255 90;
}
-
+ color_class { name: "AO011";
+ color: 255 255 255 255;
+ }
+ color_class { name: "AO012";
+ color: 0 149 255 255;
+ }
+ color_class { name: "AO012D";
+ color: 255 255 255 77;
+ }
}
#include "Presenter.h"
#include "ucl/gui/Layout.h"
+#include "ucl/gui/StyledWidget.h"
#include "types.h"
public:
Builder();
Builder &setSoundManager(const ISoundManagerSRef &sm);
+ Builder &setMuteControlDisabled(bool isDisabled);
AccessoryPresenterSRef build(ucl::ElmWidget &parent) const;
private:
ISoundManagerSRef m_sm;
+ bool m_isMuteControlDisabled;
};
public:
ucl::Widget &getWidget();
void hideVolumeControls();
+ void setMuteControlDisabled(bool isDisabled);
private:
friend class ucl::RefCountObj<AccessoryPresenter>;
AccessoryPresenter(ucl::RefCountObjBase &rc,
const ISoundManagerSRef &sm);
- ucl::Result prepare(ucl::ElmWidget &parent);
+ ucl::Result prepare(ucl::ElmWidget &parent, bool isMuteControlDisabled = false);
ucl::Result createWidget(ucl::ElmWidget &parent);
ucl::Result createVolumeControl();
+ ucl::Result createVolumeBtn();
+ ucl::Result createMuteBtn();
+ void onVolumeBtnClicked(ucl::Widget &widget, void *eventInfo);
+ void onMuteBtnClicked(ucl::Widget &widget, void *eventInfo);
+
void registerCallbacks();
void unregisterCallbacks();
void onVolumeControlEventCb(VolumeControlEvent event);
void onAudioStateChanged(AudioStateType state);
void onVolumeLevelChanged(int value);
+ void onMuteStateChanged(bool isMuted);
+ void updateMuteBtn(bool isMuted);
Eina_Bool onVCTimerCb();
void startVCTimer();
private:
ucl::LayoutSRef m_widget;
+ ucl::StyledWidgetSRef m_volumeBtn;
+ ucl::StyledWidgetSRef m_muteBtn;
VolumeControlSRef m_vc;
ISoundManagerSRef m_sm;
Ecore_Timer *m_vcTimer;
~Builder();
Builder &setNaviframe(const ucl::NaviframeSRef &navi);
Builder &setCall(const ICallSRef &call);
- MainPageSRef build(ExitRequestHandler onExitRequest) const;
+ MainPageSRef build(const ExitRequestHandler handler) const;
private:
ucl::NaviframeSRef m_navi;
ICallSRef m_call;
private:
friend class ucl::RefCountObj<MainPage>;
- MainPage(ucl::RefCountObjBase &rc, const ucl::NaviframeSRef &navi,
- ExitRequestHandler onExitRequest, const ICallSRef &call);
+ MainPage(ucl::RefCountObjBase &rc,
+ const ucl::NaviframeSRef &navi,
+ const ExitRequestHandler handler,
+ const ICallSRef &call);
virtual ~MainPage();
ucl::Result prepare();
void onPowerKeyUp(ucl::Widget &widget, void *eventInfo);
void processKeyPress();
+ bool detectMuteControlDisableState();
+
// Presenter
virtual void onActivateBy(const DeactivatorInfo &info) final override;
#define CU_REL_W(val) (val/CU_WIN_W)
#define CU_REL_H(val) (val/CU_WIN_H)
+#define CU_ACCESSORY_SOUND_BTN_SIZE 50 86
+
collections {
base_scale: 1.3;
{"layout", "callui", "accessory"};
constexpr EdjePart PART_SWL_VOLUME_CONTROL {"swl.volume_control"};
+ constexpr EdjePart PART_SWL_SOUND {"swl.sound"};
+ constexpr EdjePart PART_SWL_MUTE {"swl.mute"};
+ constexpr ElmStyle STYLE_BTN_VOLUME {"callui/volume"};
+ constexpr ElmStyle STYLE_BTN_MUTE {"callui/mute"};
+
+ constexpr EdjeSignal SIGNAL_TURN_ON {"turn.on"};
+ constexpr EdjeSignal SIGNAL_TURN_OFF {"turn.off"};
}}}
namespace callui {
using namespace ucl;
- AccessoryPresenter::Builder::Builder()
+ AccessoryPresenter::Builder::Builder():
+ m_isMuteControlDisabled(false)
{
}
return *this;
}
+ AccessoryPresenter::Builder &AccessoryPresenter::Builder::setMuteControlDisabled(bool isDisabled)
+ {
+ m_isMuteControlDisabled = isDisabled;
+ return *this;
+ }
+
AccessoryPresenterSRef AccessoryPresenter::Builder::build(ElmWidget &parent) const
{
if (!m_sm) {
}
auto result = makeShared<AccessoryPresenter>(m_sm);
- FAIL_RETURN_VALUE(result->prepare(parent), {}, "result->prepare() failed!");
+ FAIL_RETURN_VALUE(result->prepare(parent, m_isMuteControlDisabled),
+ {}, "result->prepare() failed!");
return result;
}
m_vcTimer(nullptr),
m_audioState(m_sm->getAudioState())
{
-
}
AccessoryPresenter::~AccessoryPresenter()
unregisterCallbacks();
}
- Result AccessoryPresenter::prepare(ElmWidget &parent)
+ Result AccessoryPresenter::prepare(ElmWidget &parent, bool isMuteControlDisabled)
{
FAIL_RETURN(Presenter::prepare(parent), "Presenter::prepare() failed");
FAIL_RETURN(createVolumeControl(), "createVolumeControl() failed");
+ FAIL_RETURN(createVolumeBtn(), "createVolumeBtn() failed");
+
+ FAIL_RETURN(createMuteBtn(), "createMuteBtn() failed");
+
registerCallbacks();
+ setMuteControlDisabled(isMuteControlDisabled);
+
return RES_OK;
}
m_vc->hideControls();
}
+ void AccessoryPresenter::setMuteControlDisabled(bool isDisabled)
+ {
+ if (isDisabled) {
+ disable(*m_muteBtn);
+ } else {
+ enable(*m_muteBtn);
+ updateMuteBtn(m_sm->getMuteState());
+ }
+ }
+
Result AccessoryPresenter::createWidget(ElmWidget &parent)
{
m_widget = Layout::Builder().
return RES_OK;
}
+ Result AccessoryPresenter::createVolumeBtn()
+ {
+ Evas_Object *eo = elm_button_add(*m_widget);
+ if (!eo) {
+ LOG_RETURN(RES_FAIL, "eo is NULL");
+ }
+
+ m_volumeBtn = makeShared<StyledWidget>(eo, true);
+ m_volumeBtn->setStyle(impl::STYLE_BTN_VOLUME);
+ m_volumeBtn->addEventHandler(BTN_CLICKED,
+ WEAK_DELEGATE(AccessoryPresenter::onVolumeBtnClicked,
+ asWeak(*this)));
+ m_widget->setContent(*m_volumeBtn, impl::PART_SWL_SOUND);
+ show(*m_volumeBtn);
+
+ return RES_OK;
+ }
+
+ Result AccessoryPresenter::createMuteBtn()
+ {
+ Evas_Object *eo = elm_button_add(*m_widget);
+ if (!eo) {
+ LOG_RETURN(RES_FAIL, "eo is NULL");
+ }
+ m_muteBtn = makeShared<StyledWidget>(eo, true);
+ m_muteBtn->setStyle(impl::STYLE_BTN_MUTE);
+ m_muteBtn->addEventHandler(BTN_CLICKED,
+ WEAK_DELEGATE(AccessoryPresenter::onMuteBtnClicked,
+ asWeak(*this)));
+
+ m_widget->setContent(*m_muteBtn, impl::PART_SWL_MUTE);
+ show(*m_muteBtn);
+
+ return RES_OK;
+ }
+
+ void AccessoryPresenter::onVolumeBtnClicked(Widget &widget, void *eventInfo)
+ {
+ m_vc->showControls();
+ startVCTimer();
+ }
+
+ void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo)
+ {
+ m_sm->setMuteState(!m_sm->getMuteState());
+ }
+
void AccessoryPresenter::registerCallbacks()
{
addRotaryEventHandler(CALLBACK_A(
m_sm->addVolumeStateHandler(DELEGATE(
AccessoryPresenter::onVolumeLevelChanged, this));
+
+ m_sm->addMuteStateHandler(DELEGATE(
+ AccessoryPresenter::onMuteStateChanged, this));
}
void AccessoryPresenter::unregisterCallbacks()
m_sm->removeVolumeStateHandler(DELEGATE(
AccessoryPresenter::onVolumeLevelChanged, this));
+
+ m_sm->removeMuteStateHandler(DELEGATE(
+ AccessoryPresenter::onMuteStateChanged, this));
}
Eina_Bool AccessoryPresenter::onVCTimerCb()
{
updateVolume(value);
}
+
+ void AccessoryPresenter::onMuteStateChanged(bool isMuted)
+ {
+ if (!elm_object_disabled_get(*m_muteBtn))
+ updateMuteBtn(isMuted);
+ }
+
+ void AccessoryPresenter::updateMuteBtn(bool isMuted)
+ {
+ isMuted ? m_muteBtn->emit(impl::SIGNAL_TURN_ON) :
+ m_muteBtn->emit(impl::SIGNAL_TURN_OFF);
+ }
}
}
MainPageSRef MainPage::Builder::build(
- const ExitRequestHandler onExitRequest) const
+ const ExitRequestHandler handler) const
{
- if (!onExitRequest) {
+ if (!handler) {
LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {},
"onExitRequest is NULL");
}
}
auto result = makeShared<MainPage>(
- m_navi, onExitRequest, m_call);
+ m_navi, handler, m_call);
FAIL_RETURN_VALUE(result->prepare(), {},
"result->prepare() failed!");
MainPage::MainPage(RefCountObjBase &rc,
const NaviframeSRef &navi,
- const ExitRequestHandler onExitRequest,
+ const ExitRequestHandler handler,
const ICallSRef &call) :
- Page(rc, navi, onExitRequest),
+ Page(rc, navi, handler),
m_call(call),
m_mode(CallMode::UNDEFINED),
m_ecTimer(nullptr),
m_accessoryPrs.reset();
startEndCallTimer();
} else {
- createAccessoryPresenter();
- createBottomBtn(impl::STYLE_BB_END_CALL);
+ FAIL_RETURN_VOID(createAccessoryPresenter(),
+ "createAccessoryPresenter() failed");
+ FAIL_RETURN_VOID(createBottomBtn(impl::STYLE_BB_END_CALL),
+ "createBottomBtn() failed");
+
+ if (m_mode == CallMode::OUTGOING ||
+ (m_mode == CallMode::DURING &&
+ (m_cm->getAvailableCalls() == CALL_FLAG_HELD))) {
+ m_accessoryPrs->setMuteControlDisabled(true);
+ } else {
+ m_accessoryPrs->setMuteControlDisabled(false);
+ }
}
}
"createCallInfoPresenter() failed!");
}
+ bool MainPage::detectMuteControlDisableState()
+ {
+ return (m_mode == CallMode::OUTGOING ||
+ (m_mode == CallMode::DURING &&
+ (m_cm->getAvailableCalls() == CALL_FLAG_HELD)));
+ }
+
Result MainPage::createAccessoryPresenter()
{
if (m_accessoryPrs) {
+ ILOG("Already exists. No need to create new one");
+ m_accessoryPrs->setMuteControlDisabled(
+ detectMuteControlDisableState());
return RES_OK;
}
m_accessoryPrs = AccessoryPresenter::Builder().
+ setMuteControlDisabled(detectMuteControlDisableState()).
setSoundManager(m_call->getSoundManager()).
build(*m_widget);