MTK 根据通话时间隐藏菜单

本文只限技术交流 资料来自公司同事

 

#include"CallsStruct.h" #include"mtpnp_pfal_master_callhistory.h" #include "app_datetime.h" #define JY_HIDEMENU_TIME_HOURS 0 //设置小时 #define JY_HIDEMENU_TIME_MINS 1 //设置分钟 static call_history_context_struct g_CallHistory_inf; //卡1通话时间记录 #ifdef __MMI_DUAL_SIM_MASTER__ static ST_MTPNP_CALL_TIME_S g_Slave_Ctime; //卡2通话时间记录 #endif call_history_context_struct *g_master_Ctime_JY = &g_CallHistory_inf; #ifdef __MMI_DUAL_SIM_MASTER__ //单卡还是双卡 BOOL JY_MENU() { S16 error; applib_time_struct dt; dt.nHour = JY_HIDEMENU_TIME_HOURS; dt.nMin = JY_HIDEMENU_TIME_MINS; memset((U8*) g_master_Ctime_JY, 0, sizeof(call_history_context_struct)); memset((U8 *) (&g_Slave_Ctime), 0, sizeof(ST_MTPNP_CALL_TIME_S)); ReadRecord(NVRAM_EF_CALL_TIME_LID, 1, (void*)&g_master_Ctime_JY->last_call_time, sizeof(applib_time_struct), &error); ReadRecord(NVRAM_EF_CALL_TIME_LID, 2, (void*)&g_master_Ctime_JY->total_out_time, sizeof(applib_time_struct), &error); ReadRecord(NVRAM_EF_CALL_TIME_LID, 3, (void*)&g_master_Ctime_JY->total_in_time, sizeof(applib_time_struct), &error); ReadRecord(NVRAM_EF_CALL_TIME_LID, 4, (void *)&g_Slave_Ctime.last_call_time, sizeof(applib_time_struct), &error); ReadRecord(NVRAM_EF_CALL_TIME_LID, 5, (void *)&g_Slave_Ctime.total_out_time, sizeof(applib_time_struct), &error); ReadRecord(NVRAM_EF_CALL_TIME_LID, 6, (void *)&g_Slave_Ctime.total_in_time, sizeof(applib_time_struct), &error); if((g_master_Ctime_JY->total_out_time.nHour*60 + g_master_Ctime_JY->total_out_time.nMin + g_master_Ctime_JY->total_in_time.nHour*60+ g_master_Ctime_JY->total_in_time.nMin+ g_Slave_Ctime.total_out_time.nHour*60 + g_Slave_Ctime.total_out_time.nMin+ g_Slave_Ctime.total_in_time.nHour*60 + g_Slave_Ctime.total_out_time.nMin) > (dt.nHour*60 + dt.nMin-1))//计算通话计时 { return FALSE; } else { return TRUE;//????????,??TRUE } } #else BOOL JY_MENU() { S16 error; applib_time_struct dt; dt.nHour = JY_HIDEMENU_TIME_HOURS; dt.nMin = JY_HIDEMENU_TIME_MINS; memset((U8 *) (&g_master_Ctime),0,sizeof(call_history_context_struct)); ReadRecord(NVRAM_EF_CALL_TIME_LID,1,(void *)g_master_Ctime_JY->last_call_time,sizeof(applib_time_struct),&error);//卡1未接电话 ReadRecord(NVRAM_EF_CALL_TIME_LID,2,(void *)g_master_Ctime_JY->total_out_time,sizeof(applib_time_struct),&error);//卡1已拨电话 ReadRecord(NVRAM_EF_CALL_TIME_LID,3,(void *)g_master_Ctime_JY->total_in_time,sizeof(applib_time_struct),&error);//卡1已接电话 if((g_master_Ctime->total_out_time.nHour*60 + g_master_Ctime->total_out_time.nMin + g_master_Ctime->total_in_time.nHour*60+ g_master_Ctime->total_in_time.nMin) > (dt.nHour*60 + dt.nMin-1))//计算通话计时 { return FALSE; } else { return TRUE;//????????,??TRUE } } #endif

 

如果入口函数处是以下形式

    GetSequenceStringIds(MAIN_MENU_FUNANDGAMES_MENUID, ItemList);

    GetSequenceImageIds(MAIN_MENU_FUNANDGAMES_MENUID, ItemIcons);

请修改为

    GetSequenceStringIds_Ext(MAIN_MENU_FUNANDGAMES_MENUID, ItemList);

    GetSequenceImageIds_Ext(MAIN_MENU_FUNANDGAMES_MENUID, ItemIcons);

 

调用在EntryMainMultimedia里面的   GetSequenceImageIds_Ext 之前:

   if(JY_MENU())
    {
     mmi_frm_hide_menu_item(MENU_ID_FUNANDGAMES_0_20101120_110847);//需要隐藏的菜单项
    }
    else   
    {
     mmi_frm_unhide_menu_item(MENU_ID_FUNANDGAMES_0_20101120_110847);//需要显示的菜单项
    }
    #endif

你可能感兴趣的:(struct,ext,MTK,menu,电话,2010)