微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > mt2503 在keylauncher idle界面支持显示service info

mt2503 在keylauncher idle界面支持显示service info

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]
在 keylauncher idle 界面,与 classic Idle 界面不同,目前不支持显示所有的 service info ,也不能显示extra info ;
为了显示 service info ,需要参考 classic idle ,添加一个更新的接口;并在 keylauncher 内部实现更新显示。
[SOLUTION]
下面的代码在 11B.W12.24 上验证通过。
请注意 红色的代码是添加修改的;
文件一: idlelauncherkey.c
1. 添加函数:
void MMI_idle_keylauncher_on_update_service_indication(mmi_idle_obj_struct *obj)
{
vapp_launcher_key_update_operate_info();
}

2.添加引用:
void mmi_idle_keylauncher_on_init(mmi_idle_obj_struct *obj)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
mmi_idle_keylauncher_struct *p;
mmi_idle_capability_struct *capability;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_idle_obj_on_init(obj);
p = (mmi_idle_keylauncher_struct *)obj;
/* Member variable. */
p->type = MMI_IDLE_TYPE_KEYLAUNCHER;
/* Member function. */
p->on_enter = mmi_idle_keylauncher_on_enter;
p->on_before_idle_display = mmi_idle_keylauncher_on_before_idle_display;
///
p->on_update_service_area = mmi_idle_keylauncher_on_update_service_indication;
/* Change the capabilities. */


文件二: vapp_launcher_key_gprot.h
添加:
extern void vapp_launcher_key_update_operate_info(void);

文件三: vapp_launcher_key.cpp
添加:
void vapp_launcher_key_update_operate_info(void)
{
if (mmi_idle_is_group_active())
{
s_vapp_launcher_key->m_signalUpdateOperateInfo.emit();
}
}

文件四: vapp_launcher_key_director.h
添加定义:
class VappKeyLauncherDirector : public VfxAppCatScr
{

// If we capture the pen event.
VfxBool m_isCapturedPen;
public:
VfxSignal0 m_signalUpdateOperateInfo;
};
#endif /* defined(__MMI_VUI_LAUNCHER_KEY__) */
#endif /* VAPP_KEYLAUNCHER_DIRECTOR_H */

文件五: vapp_launcher_key_primitive.h
添加定义 :
class VappKeyLauncherOperatorFrame : public VfxFrame
{
// Constructor / Destructor
public:
// Default constructor
VappKeyLauncherOperatorFrame();
// Override
protected:
virtual void onInit();
virtual void onDeinit();
private:
void initOperatorNameCell();
void update(VfxS32 maxWidth);
void updateFrameInfo(void);
static mmi_ret eventHandler(mmi_event_struct *event);
// Variable
private:
VappKeyLauncherOperatorElement *m_operElement[MMI_SIM_TOTAL];
// Used to show "Emergency call only" "Flight mode"
VfxTextFrame *m_text;
};

文件六: vapp_launcher_key_primitive.cpp
1. 添加实现:
void VappKeyLauncherOperatorFrame::updateFrameInfo()
{
update(getSize().width);
}
2. 添加处理信号:
void VappKeyLauncherOperatorFrame:nInit()
{
VfxFrame::onInit();
VappKeyLauncherDirector *pDirector = (VappKeyLauncherDirector*)((getParentFrame())->getParentFrame());
pDirector->m_signalUpdateOperateInfo.connect(this, &VappKeyLauncherOperatorFrame::updateFrameInfo);
setSize(LCD_WIDTH - 2 * VAPP_KEYLAUNCHER_OP_FRAME_X, MMI_SIM_TOTAL * VAPP_KEYLAUNCHER_OP_FRAME_HEIGHT);

3.添加获取 extra text:
void VappKeyLauncherOperatorElement::updateOperatorName(VfxS32 maxWidth)
{
srv_nw_name_service_indication_struct tmp_indication;
srv_nw_name_get_service_indication_string(mmi_frm_index_to_sim(m_simId), &tmp_indication);
m_textOPN->setString(VFX_WSTR_MEM(tmp_indication.line1));
if(tmp_indication.line2[0] == 0)
{
UI_string_type ext_text = wgui_cat033_get_extra_text();
if (ext_text != NULL)
{
//mmi_wcscpy((WCHAR *)tmp_indication.line2, ext_text);
mmi_wcsncpy((WCHAR *)tmp_indication.line2, ext_text, SRV_NW_NAME_MAX_STR_LEN);
}
}
m_textSPN->setString(VFX_WSTR_MEM(tmp_indication.line2));
VfxS32 yPos;
if(tmp_indication.line2[0] != 0)

4.去掉宏控制
void VappKeyLauncherIdlePage::onInit()
{
VfxControl::onInit();
#if defined(__MMI_MAINLCD_320X480__) || defined(__MMI_MAINLCD_240X400__)
// Start to create and draw datetime frame
VappLauncherKeyClock *m_date;
VFX_OBJ_CREATE_EX(m_date, VappLauncherKeyClock, this, (VfxPoint(0, 0)));
#endif
#if 1
//#ifndef __MMI_NCENTER_SUPPORT__
// Start to create and draw operator name if not support NCenter
VappKeyLauncherOperatorFrame *m_opName;
VFX_OBJ_CREATE(m_opName, VappKeyLauncherOperatorFrame, this);
m_opName->setPos(VAPP_KEYLAUNCHER_OP_FRAME_X, VAPP_KEYLAUNCHER_OP_FRAME_Y);
// Start to create and draw idle text mode (SAT)
VappKeyLauncherIdleModeText *m_idleMode;
VFX_OBJ_CREATE(m_idleMode, VappKeyLauncherIdleModeText, this);
m_idleMode->setRect(VAPP_KEYLAUNCHER_IDLE_MODE_FRAME_X,
VAPP_KEYLAUNCHER_IDLE_MODE_FRAME_Y,
VAPP_KEYLAUNCHER_IDLE_MODE_FRAME_WIDTH,
VAPP_KEYLAUNCHER_IDLE_MODE_FRAME_HEIGHT);
#endif /* __MMI_NCENTER_SUPPORT__ */
#ifdef __MMI_SEARCH_WEB__
// Start to create and draw baidu or google search bar
if (mmi_search_web_hot_key_is_enabled(MMI_SEARCH_WEB_HOT_KEY_touch_HINT))
{
VappKeyLauncherSearchBar *searchBar;
VFX_OBJ_CREATE(searchBar, VappKeyLauncherSearchBar, this);
if(mmi_phnset_shortcut_manager_get_shortcut_number() > 0)
searchBar->setPos(VAPP_KEYLAUNCHER_SEARCH_BAR_X, VAPP_KEYLAUNCHER_SEARCH_BAR_Y_A);
else
searchBar->setPos(VAPP_KEYLAUNCHER_SEARCH_BAR_X, VAPP_KEYLAUNCHER_SEARCH_BAR_Y_B);
}
#endif /* __MMI_SEARCH_WEB__ */
// Start to create and draw shortcut
createShortcutView();
}

附 :测试方法 :
在 srv_sat_is_idle_display_present 直接返回 TRUE ;
在 srv_sat_get_idle_display_text 中直接返回 string 。
1. 实现显示所有信息:
#if 1
/* 测试代码,将所有的信息合并成一条信息显示;可以滚动显示;在前面添加数字和冒号来区分是那张卡的信息。 */
#define MAX_SAT_STRING_LEN 256
WCHAR *g_sat_all_info_string;
U8 *GetSATIdleText(void)
{
mmi_sim_enum sim_id[] = {MMI_SIM1, MMI_SIM2, MMI_SIM3, MMI_SIM4};
S32 i;
WCHAR *str = NULL, *str2 = NULL;
if(g_sat_all_info_string == NULL)
{
g_sat_all_info_string = malloc(MAX_SAT_STRING_LEN);
}
mEMSet(g_sat_all_info_string, 0, MAX_SAT_STRING_LEN);
str2 = malloc(6);
memset(str2, 0, 6);
for (i = 0; i < MMI_SIM_TOTAL; i++)
{
if (srv_sat_is_idle_display_present(sim_id))
{
mmi_wsprintf_ex(str2, 6, (WCHAR*)L"%d:", (i+1));
g_sat_all_info_string = mmi_wcscat(g_sat_all_info_string, str2);
str = (U8*) srv_sat_get_idle_display_text(sim_id);
if(MAX_SAT_STRING_LEN > mmi_wcslen(g_sat_all_info_string) +
mmi_wcslen(str) + 12)
{
g_sat_all_info_string = mmi_wcscat(g_sat_all_info_string, str);
g_sat_all_info_string = mmi_wcscat(g_sat_all_info_string, L" ");
}
else
{
free(str2);
g_sat_all_info_string = mmi_wcsncat(g_sat_all_info_string, str,
(MAX_SAT_STRING_LEN - mmi_wcslen(&g_sat_all_info_string)));
return g_sat_all_info_string;
}
}
}
free(str2);
return g_sat_all_info_string;
}
#else
U8 *GetSATIdleText(void)
{
mmi_sim_enum sim_id[] = {MMI_SIM1, MMI_SIM2, MMI_SIM3, MMI_SIM4};
S32 i;
for (i = 0; i < MMI_SIM_TOTAL; i++)
{
if (srv_sat_is_idle_display_present(sim_id))
{
return (U8*) srv_sat_get_idle_display_text(sim_id);
}
}
return NULL;
}
#endif

2. 修改字体颜色为黑色
void VappKeyLauncherIdleModeText::setIdleModeText(const VfxWString &str)
{
if (m_idleModeStr == str)
{
return;
}
if (str.isNull())
{
m_idleModeText->cleARMovableFrame(); // stop scroll internally
}
else
{
VfxFontDesc fontDesc;
fontDesc.effect = VFX_FONT_DESC_EFFECT_BORDER;
fontDesc.size =
VFX_FONT_DESC_VF_SIZE(VAPP_KEYLAUNCHER_IDLE_MODE_TEXT_SIZE);
m_idleModeText->setMovableFrame(str, fontDesc);
//set text color black
m_idleModeText->setTextColor(VFX_COLOR_BLACK, VFX_COLOR_WHITE);
m_idleModeText->startScroll();
}
m_idleModeStr = str;
}

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top