如何把某个指定的java 从java menu list hide 掉?
[SOLUTION]
1.
1)需要修改mmi_java_fetch_mids_list。
这个接口是fetch mids list 的处理函数中, 下面以指定第2个default game 隐藏为例。
MMI_BOOL mmi_java_fetch_mids_list(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8
str_img_mask)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (needToSendGetListReq)
{
/* only check the first item_index fetch request */
if (item_index < g_java.total_java_app_mids
&& g_java.mids_info_start <= item_index &&
(g_java.mids_info_end == g_java.total_java_app_mids ||
item_index + MMI_MAX_MENUITEMS_IN_CONTENT < g_java.mids_info_end))
{
needToSendGetListReq = MMI_FALSE;
/* nothing to do, because data is in cache. */
}
else
{
/* search the cache */
int i;
int j;
U32 event_group;
mmi_java_mids_getlist_cnf_struct *ptr;
S32 saved_item_index = item_index;
/* scroll up, item_index - 3 for speeding up */
if (g_java.mids_info_start > saved_item_index)
{
saved_item_index -= JAVA_LIST_CACHE_COUNT - MMI_MAX_MENUITEMS_IN_CONTENT;
if (saved_item_index < 0)
{
saved_item_index = 0;
}
}
if (g_java.total_java_app_mids < saved_item_index + JAVA_LIST_CACHE_COUNT)
{
saved_item_index = g_java.total_java_app_mids - JAVA_LIST_CACHE_COUNT;
}
mmi_java_send_mids_get_list_req(saved_item_index, MMI_TRUE, &ptr, &g_java.mids_list_filter);
kal_retrieve_eg_events(g_jam_getlist_event_group, 1, KAL_OR_CONSUME,
(kal_uint32*)&event_group, KAL_SUSPEND);
if (mids_info_start == -1)
{
/* if hide the second one, please follow the code*/
for (i = 0,j = 0; i < ptr->mids_list_count; i++)
{
if (i != 1)
{
j++
}
g_java.mids_info[i] = ptr->pmids_list[j];
}
ptr->mids_list_count --;
}
else
{
for (i = 0; i < ptr->mids_list_count; i++)
{
g_java.mids_info[i] = ptr->pmids_list[i];
}
}
g_java.mids_info_start = ptr->start_indx;
g_java.mids_info_end = ptr->start_indx + ptr->mids_list_count;
g_java.total_java_app_mids = ptr->mids_count -1;
free_local_para((local_para_struct*) ptr);
needToSendGetListReq = MMI_FALSE;
}
}
else
{
if (!(item_index < g_java.total_java_app_mids
&& g_java.mids_info_start <= item_index && item_index < g_java.mids_info_end))
{
ASSERT(0);
}
}
if (g_java.total_java_app_mids == 0)
{
return MMI_TRUE;
}
ASSERT(g_java.mids_info_start <= item_index && item_index < g_java.mids_info_end);
/* fetch the icon */
if (img_buff_p)
{
if (g_java.mids_info[item_index - g_java.mids_info_start].mids_icon != NULL)
{
(*img_buff_p) = (PU8) g_java.mids_info[item_index - g_java.mids_info_start].mids_icon;
}
else
{
if (g_java.mids_info[item_index - g_java.mids_info_start].mid_count == 1)
{
(*img_buff_p) = (PU8) GetImage(IMG_JAVA_STAR1);
}
else
{
(*img_buff_p) = (PU8) GetImage(IMG_JAVA_STAR2);
}
}
}
/* fetch the item name */
if (str_buff)
{
mmi_ucs2ncpy(
(S8*) str_buff,
(const S8*)g_java.mids_info[item_index - g_java.mids_info_start].mids_name,
MAX_SUBMENU_CHARACTERS);
}
return MMI_TRUE;
}
[SOLUTION]
1.
1)需要修改mmi_java_fetch_mids_list。
这个接口是fetch mids list 的处理函数中, 下面以指定第2个default game 隐藏为例。
MMI_BOOL mmi_java_fetch_mids_list(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8
str_img_mask)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (needToSendGetListReq)
{
/* only check the first item_index fetch request */
if (item_index < g_java.total_java_app_mids
&& g_java.mids_info_start <= item_index &&
(g_java.mids_info_end == g_java.total_java_app_mids ||
item_index + MMI_MAX_MENUITEMS_IN_CONTENT < g_java.mids_info_end))
{
needToSendGetListReq = MMI_FALSE;
/* nothing to do, because data is in cache. */
}
else
{
/* search the cache */
int i;
int j;
U32 event_group;
mmi_java_mids_getlist_cnf_struct *ptr;
S32 saved_item_index = item_index;
/* scroll up, item_index - 3 for speeding up */
if (g_java.mids_info_start > saved_item_index)
{
saved_item_index -= JAVA_LIST_CACHE_COUNT - MMI_MAX_MENUITEMS_IN_CONTENT;
if (saved_item_index < 0)
{
saved_item_index = 0;
}
}
if (g_java.total_java_app_mids < saved_item_index + JAVA_LIST_CACHE_COUNT)
{
saved_item_index = g_java.total_java_app_mids - JAVA_LIST_CACHE_COUNT;
}
mmi_java_send_mids_get_list_req(saved_item_index, MMI_TRUE, &ptr, &g_java.mids_list_filter);
kal_retrieve_eg_events(g_jam_getlist_event_group, 1, KAL_OR_CONSUME,
(kal_uint32*)&event_group, KAL_SUSPEND);
if (mids_info_start == -1)
{
/* if hide the second one, please follow the code*/
for (i = 0,j = 0; i < ptr->mids_list_count; i++)
{
if (i != 1)
{
j++
}
g_java.mids_info[i] = ptr->pmids_list[j];
}
ptr->mids_list_count --;
}
else
{
for (i = 0; i < ptr->mids_list_count; i++)
{
g_java.mids_info[i] = ptr->pmids_list[i];
}
}
g_java.mids_info_start = ptr->start_indx;
g_java.mids_info_end = ptr->start_indx + ptr->mids_list_count;
g_java.total_java_app_mids = ptr->mids_count -1;
free_local_para((local_para_struct*) ptr);
needToSendGetListReq = MMI_FALSE;
}
}
else
{
if (!(item_index < g_java.total_java_app_mids
&& g_java.mids_info_start <= item_index && item_index < g_java.mids_info_end))
{
ASSERT(0);
}
}
if (g_java.total_java_app_mids == 0)
{
return MMI_TRUE;
}
ASSERT(g_java.mids_info_start <= item_index && item_index < g_java.mids_info_end);
/* fetch the icon */
if (img_buff_p)
{
if (g_java.mids_info[item_index - g_java.mids_info_start].mids_icon != NULL)
{
(*img_buff_p) = (PU8) g_java.mids_info[item_index - g_java.mids_info_start].mids_icon;
}
else
{
if (g_java.mids_info[item_index - g_java.mids_info_start].mid_count == 1)
{
(*img_buff_p) = (PU8) GetImage(IMG_JAVA_STAR1);
}
else
{
(*img_buff_p) = (PU8) GetImage(IMG_JAVA_STAR2);
}
}
}
/* fetch the item name */
if (str_buff)
{
mmi_ucs2ncpy(
(S8*) str_buff,
(const S8*)g_java.mids_info[item_index - g_java.mids_info_start].mids_name,
MAX_SUBMENU_CHARACTERS);
}
return MMI_TRUE;
}