⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appmemmgr.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (mmi_frm_appmem_check_enough_memory() &&
        !is_redrawing_old_screens())    /* not redrawn by small screen */
    {
        DisplayPopupCallBack(
            (U8*) GetString(STR_ID_APPMEM_NOTIFY_STARTING_NEW), 
            IMG_GLOBAL_INFO, 
            0, 
            UI_POPUP_NOTIFYDURATION_TIME_2000, 
            SUCCESS_TONE, 
            mmi_frm_appmem_invoke_release_mem_success_callback);
    }
    else
    {    
        EntryNewScreen(SCR_APPMEM_STOP_PROGRESSING, mmi_frm_appmem_exit_progressing_screen, NULL, NULL);     

        guiBuffer = GetCurrGuiBuffer(SCR_APPMEM_STOP_PROGRESSING);

        ShowCategory8Screen(
            0,
            0,
            0,                                  /* Left softkey */
            0,
            STR_GLOBAL_BACK,                    /* Right softkey */
            0,
            STR_ID_APPMEM_WAITING_FOR_STOP,     /* Message */
            IMG_GLOBAL_PROGRESS,
            guiBuffer);
 
        SetRightSoftkeyFunction(mmi_frm_appmem_jump_to_prompt_screen, KEY_EVENT_UP);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_stop_confirm_screen_yes
 * DESCRIPTION
 *  User confirm to stop an application
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_stop_confirm_screen_yes(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_mmi_frm_appmem_prompt.stop_state = MMI_FRM_APPMEM_STOP_STATE_WAITING;

    applib_mem_ap_stop_app_by_MMI_task(g_mmi_frm_appmem_prompt.app_id_confirm_to_stop);
    
    if (g_mmi_frm_appmem_prompt.stop_state != MMI_FRM_APPMEM_STOP_STATE_FINISHED)
    {
        /* mmi_frm_appmem_stop_finished_handler() was not invoked inside
           applib_mem_ap_stop_app_by_MMI_task(), we display progressing
           screen to wait for mmi_frm_appmem_stop_finished_handler() */ 
        mmi_frm_appmem_entry_progressing_screen();
    }

    g_mmi_frm_appmem_prompt.stop_state = MMI_FRM_APPMEM_STOP_STATE_IGNORE;    

}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_entry_stop_confirm_screen
 * DESCRIPTION
 *  Ask user to confirm to stop application
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_entry_stop_confirm_screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    DisplayConfirm(
        STR_GLOBAL_YES,
        IMG_GLOBAL_YES,
        STR_GLOBAL_NO,
        IMG_GLOBAL_NO,
        (UI_string_type) GetString(STR_ID_APPMEM_STOP),
        IMG_GLOBAL_QUESTION,
        WARNING_TONE);

    SetLeftSoftkeyFunction(mmi_frm_appmem_stop_confirm_screen_yes, KEY_EVENT_UP);
    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_get_item
 * DESCRIPTION
 *  Callback function to draw the info box of prompt screen
 * PARAMETERS
 *  item_index      [IN]        Index of menu item
 *  str_buff        [OUT]       Output text buffer
 *  img_buff_p      [OUT]       Output image buffer
 *  str_img_mask    [OUT]       (deprecated)
 * RETURNS
 *  Success or not
 *****************************************************************************/
static pBOOL mmi_frm_appmem_prompt_screen_get_item(
                S32 item_index, 
                UI_string_type str_buff, 
                PU8 *img_buff_p, 
                U8 str_img_mask)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    applib_mem_ap_usage_struct *applist;
    S8 size_str[32];
    S8 size_str_ucs2[32 * 2];
    S32 app_name_len;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_ASSERT(g_mmi_frm_appmem_prompt_screen &&
               item_index < g_mmi_frm_appmem_prompt_screen->num_app);

    applist = g_mmi_frm_appmem_prompt_screen->applist;
    
    UCS2Strncpy((S8*) str_buff, GetString((U16) applist[item_index].string_id), (MAX_SUB_MENU_SIZE / 2));
    app_name_len = UCS2Strlen((S8*) str_buff);

    if (applist[item_index].is_stopping)
    {
        UCS2Strncpy(
            (S8*) str_buff + (app_name_len * 2), 
            (S8*) GetString(STR_ID_APPMEM_ATTR_STOPPING),
            (MAX_SUB_MENU_SIZE / 2) - app_name_len);
    }
    else
    {
        sprintf((char*) size_str, " (%d K)", applist[item_index].mem_size / 1024);
        AnsiiToUnicodeString(size_str_ucs2, size_str);
        
        UCS2Strncpy(
            (S8*) str_buff + (app_name_len * 2), 
            size_str_ucs2, 
            (MAX_SUB_MENU_SIZE / 2) - app_name_len);
    }
    
    *img_buff_p = (PU8) GetImage((U16) applist[item_index].icon_id);

    return (pBOOL) MMI_TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_init_info
 * DESCRIPTION
 *  Initialize the info box
 * PARAMETERS
 *  void
 * RETURNS
 *  The minimum height of info box
 *****************************************************************************/
static S32 mmi_frm_appmem_prompt_screen_init_info(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 msg_length;
    UI_string_type msg;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    msg = (UI_string_type) GetString(STR_ID_APPMEM_PROMPT_STOP_APP);
    msg_length = gui_strlen(msg);

    create_multiline_inputbox_set_buffer(msg, msg_length, msg_length, 0);
    resize_multiline_inputbox(UI_device_width, UI_device_height);
    
    MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | 
        UI_MULTI_LINE_INPUT_BOX_VIEW_MODE | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR;

    show_multiline_inputbox_no_draw();

    /* Add (get_multiline_inputbox_line_height() / 4) for extra spacing */
    return get_multiline_inputbox_line_height() * MMI_multiline_inputbox.n_lines +
           MMI_multiline_inputbox.text_y + (get_multiline_inputbox_line_height() / 4);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_draw_info
 * DESCRIPTION
 *  Callback function to draw the info box of prompt screen
 * PARAMETERS
 *  idx     [IN]    menu item index
 *  x1      [IN]    x of left-top point
 *  y1      [IN]    y of left-top point
 *  x2      [IN]    x of right-bottom point
 *  y2      [IN]    y of right-bottom point
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_prompt_screen_draw_info(S32 idx, S32 x1, S32 y1, S32 x2, S32 y2)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    move_multiline_inputbox(x1, y1);
    resize_multiline_inputbox(x2 - x1 + 1, y2 - y1 + 1);
    show_multiline_inputbox_no_draw();
    
    show_multiline_inputbox();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_hide_info
 * DESCRIPTION
 *  Callback function to hide the info box of prompt screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_prompt_screen_hide_info(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_stop_highlighted
 * DESCRIPTION
 *  Stop the current highlighted application
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_prompt_screen_stop_highlighted(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 highlited_item;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/    
    MMI_ASSERT(GetExitScrnID() == SCR_APPMEM_STOP_PROMPT &&
               g_mmi_frm_appmem_prompt_screen);

    highlited_item = GetHighlightedItem();
    MMI_ASSERT(highlited_item < g_mmi_frm_appmem_prompt_screen->num_app);

    g_mmi_frm_appmem_prompt.app_id_confirm_to_stop = 
        g_mmi_frm_appmem_prompt_screen->applist[highlited_item].app_id;

    mmi_frm_appmem_entry_stop_confirm_screen();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_wait_highlighted
 * DESCRIPTION
 *  Wait a stopping application
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_prompt_screen_wait_highlighted(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/    
    mmi_frm_appmem_entry_progressing_screen();
}


/*****************************************************************************
 * FUNCTION
 *  mmi_frm_appmem_prompt_screen_highlight_hdlr
 * DESCRIPTION
 *  Highlight handler of prompt screen
 * PARAMETERS
 *  item_index  [IN]    currently highlighted menu index
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_frm_appmem_prompt_screen_highlight_hdlr(S32 item_index)
{
    /*----------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -