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

📄 mcanvas.java

📁 飞信的j2me源代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                        buddySec.isSelected = true;
                        strangerSec.isSelected = false;
                        MMIDlet.ml_BuddyList.isSelected = false;
                    } else
                    if(y > k + Setting.SELECT_ITEM_FILL_HEIGHT && y < k + Setting.SELECT_ITEM_FILL_HEIGHT * 2)
                    {
                        buddySec.isSelected = false;
                        strangerSec.isSelected = true;
                        MMIDlet.ml_BuddyList.isSelected = false;
                    }
                } else
                if(buddySec.isExpand && !strangerSec.isExpand)
                {
                    if(y > k && y < k + Setting.SELECT_ITEM_FILL_HEIGHT)
                    {
                        strangerSec.isSelected = false;
                        buddySec.isSelected = true;
                        MMIDlet.ml_BuddyList.isSelected = false;
                    } else
                    if(y > k + Setting.SELECT_ITEM_FILL_HEIGHT && y < i1)
                    {
                        if(MMIDlet.ml_BuddyList.size() > 0)
                        {
                            strangerSec.isSelected = false;
                            buddySec.isSelected = false;
                            MMIDlet.ml_BuddyList.isSelected = true;
                            currentList = MMIDlet.ml_BuddyList;
                            currentList.paintIndex = (y - k - Setting.SELECT_ITEM_FILL_HEIGHT) / (Setting.ITEM_HEIGHT + 1);
                            currentList.traverseIndex = currentList.paintIndex + currentList.start;
                            flag = startAuto_PageUp_OR_PageDown();
                        }
                    } else
                    if(y > k + (1 + Setting.DISPLAY_ITEM_NUM) * (Setting.ITEM_HEIGHT + 1) && y < k + (1 + Setting.DISPLAY_ITEM_NUM) * (Setting.ITEM_HEIGHT + 1) + Setting.SELECT_ITEM_FILL_HEIGHT)
                    {
                        buddySec.isSelected = false;
                        strangerSec.isSelected = true;
                        MMIDlet.ml_BuddyList.isSelected = false;
                    }
                } else
                if(strangerSec.isExpand && !buddySec.isExpand)
                    if(y > k && y < k + Setting.SELECT_ITEM_FILL_HEIGHT)
                    {
                        strangerSec.isSelected = false;
                        buddySec.isSelected = true;
                        MMIDlet.ml_StrangerList.isSelected = false;
                    } else
                    if(y > k + Setting.SELECT_ITEM_FILL_HEIGHT && y < k + Setting.SELECT_ITEM_FILL_HEIGHT * 2)
                    {
                        strangerSec.isSelected = true;
                        buddySec.isSelected = false;
                        MMIDlet.ml_StrangerList.isSelected = false;
                    } else
                    if(y > k + Setting.SELECT_ITEM_FILL_HEIGHT * 2 && y < k + Setting.SELECT_ITEM_FILL_HEIGHT * 2 + l * (Setting.ITEM_HEIGHT + 1))
                    {
                        if(MMIDlet.ml_StrangerList.size() > 0)
                        {
                            strangerSec.isSelected = false;
                            buddySec.isSelected = false;
                            MMIDlet.ml_StrangerList.isSelected = true;
                            currentList = MMIDlet.ml_StrangerList;
                            currentList.paintIndex = (y - k - Setting.SELECT_ITEM_FILL_HEIGHT * 2) / (Setting.ITEM_HEIGHT + 1);
                            currentList.traverseIndex = currentList.paintIndex + currentList.start;
                            flag = startAuto_PageUp_OR_PageDown();
                            return;
                        }
                    }
            } else
            if(tabNum == 1)
            {
                if(y > k && y < k + l * (Setting.ITEM_HEIGHT + 1))
                {
                    currentList = MMIDlet.ml_SessionList;
                    currentList.paintIndex = (y - k) / (Setting.ITEM_HEIGHT + 1);
                    currentList.traverseIndex = currentList.paintIndex + currentList.start;
                    flag = startAuto_PageUp_OR_PageDown();
                }
            } else
            if(tabNum == 2 && y > k && y < k + l * (Setting.ITEM_HEIGHT + 1))
            {
                currentList = MMIDlet.ml_BlackList;
                currentList.paintIndex = (y - k) / (Setting.ITEM_HEIGHT + 1);
                currentList.traverseIndex = currentList.paintIndex + currentList.start;
                flag = startAuto_PageUp_OR_PageDown();
            }
            if(!flag)
            {
                repaint();
                stopAnimation(6);
            }
        }
    }

    private boolean startAuto_PageUp_OR_PageDown()
    {
        if(currentList.paintIndex == 0 && !isAnimationsRunning(4))
        {
            frameTime = 1000;
            doAnimation(4);
            return true;
        }
        if(currentList.paintIndex == Setting.DISPLAY_ITEM_NUM - 1 && !isAnimationsRunning(2))
        {
            frameTime = 1000;
            doAnimation(2);
            return true;
        } else
        {
            return false;
        }
    }

    protected void pointerPressed(int i, int j)
    {
        pointerDragged(i, j);
    }

    protected void pointerReleased(int i, int j)
    {
        if(!MMIDlet.isKeypad)
        {
            if(isPaintFirstPage)
            {
                keyPressed(53);
                return;
            }
            if(isAnimationsRunning(2))
                stopAnimation(2);
            else
            if(isAnimationsRunning(4))
                stopAnimation(4);
            x = i;
            y = j;
            isPointed = false;
            int k = Setting.HEAD_HEIGHT + img_Tab.getHeight() / 3;
            int l = currentList.size();
            if(l > Setting.DISPLAY_ITEM_NUM)
                l = Setting.DISPLAY_ITEM_NUM;
            int i1 = k + (1 + l) * (Setting.ITEM_HEIGHT + 1);
            if(y < HEIGHT && y > HEIGHT - 15)
            {
                if(x < img_Commands.getWidth() + 5 && x > 0)
                    midlet.showMainList();
                else
                if(x < WIDTH && x > WIDTH - img_Commands.getWidth() - 5)
                    updateKeyState(MMIDlet.instance.rightKeyCode);
                else
                if(x < Setting.X_Oneself_Appearance + Setting.BUDDY_ICON_SIZE + 2 && x > Setting.X_Oneself_Appearance - 2)
                    midlet.showMyPresenceList();
                else
                if(x < Setting.X_Sound_Appearance + Setting.BUDDY_ICON_SIZE + 2 && x > Setting.X_Sound_Appearance - 2)
                    midlet.showSystemSetting();
                else
                if(x < Setting.X_Information + 5 && x > Setting.X_Absence_Information - 2)
                {
                    ChatSession chatsession = midlet.getLastChatSession();
                    if(chatsession != null)
                    {
                        chatsession.show(MMIDlet.display);
                    }
                }
            } else
            if(tabNum == 0)
            {
                if(y > Setting.HEAD_HEIGHT && y < k)
                {
                    if(WIDTH >= 240)
                    {
                        if(x < 202 && x > 180)
                            right();
                        else
                        if(x < 235 && x > 212)
                        {
                            right();
                            right();
                        }
                    } else
                    if(WIDTH >= 176)
                    {
                        if(x < 148 && x > 125)
                            right();
                        else
                        if(x < 175 && x > 151)
                        {
                            right();
                            right();
                        }
                    } else
                    if(WIDTH < 128);
                } else
                if(!buddySec.isExpand && !strangerSec.isExpand)
                {
                    if(y > k && y < k + Setting.SELECT_ITEM_FILL_HEIGHT * 2)
                        fire();
                } else
                if(buddySec.isExpand && !strangerSec.isExpand)
                {
                    if(y > k && y < i1)
                        fire();
                    else
                    if(y > k + (1 + Setting.DISPLAY_ITEM_NUM) * (Setting.ITEM_HEIGHT + 1) && y < k + (1 + Setting.DISPLAY_ITEM_NUM) * (Setting.ITEM_HEIGHT + 1) + Setting.SELECT_ITEM_FILL_HEIGHT)
                        fire();
                } else
                if(strangerSec.isExpand && !buddySec.isExpand && y > k && y < k + Setting.SELECT_ITEM_FILL_HEIGHT * 2 + l * (Setting.ITEM_HEIGHT + 1))
                    fire();
            } else
            if(tabNum == 1)
            {
                if(y > Setting.HEAD_HEIGHT && y < k)
                {
                    if(WIDTH >= 240)
                    {
                        if(x < 27 && x > 5)
                            left();
                        else
                        if(x < 235 && x > 212)
                            right();
                    } else
                    if(WIDTH >= 176)
                    {
                        if(x < 25 && x > 0)
                            left();
                        else
                        if(x < 176 && x > 150)
                            right();
                    } else
                    if(WIDTH < 128);
                } else
                if(y > k && y < k + l * (Setting.ITEM_HEIGHT + 1))
                    fire();
            } else
            if(tabNum == 2)
                if(y > Setting.HEAD_HEIGHT && y < k)
                {
                    if(WIDTH >= 240)
                    {
                        if(x < 27 && x > 5)
                        {
                            left();
                            left();
                        } else
                        if(x < 62 && x > 39)
                            left();
                    } else
                    if(WIDTH >= 176)
                    {
                        if(x < 25 && x > 0)
                        {
                            left();
                            left();
                        } else
                        if(x < 50 && x > 27)
                            left();
                    } else
                    if(WIDTH < 128);
                } else
                if(y > k && y < k + l * (Setting.ITEM_HEIGHT + 1))
                    fire();
            repaint();
        }
    }

    private void rightSoftAction()
    {
        if(1 == rightKeyAction)
        {
            currentList = MMIDlet.ml_BuddyList;
            if(currentList != null)
            {
                MMIDlet.selectedItem = currentList.currentItem();
                midlet.selectedBuddy = MMIDlet.selectedItem.buddy;
                midlet.showWriteMessage();
            }
        } else
        {
            midlet.showHelpList();
        }
    }

    public void run()
    {
        do
        {
            synchronized(this)
            {
                while(animation == 0) 
                    try
                    {
                        wait();
                    }
                    catch(InterruptedException interruptedexception) { }
            }
            spend = 0L;
            repaint();
            if(spend < (long)frameTime)
                try
                {
                    Thread.sleep((long)frameTime - spend);
                }
                catch(Exception exception) { }
        } while(true);
    }

    public synchronized void doAnimation(int i)
    {
        animation = animation | i;
        notify();
    }

    public synchronized void stopAnimation(int i)
    {
        animation = animation & ~i;
        if((i & 1) == 1)
            sp_FirstAnimation = null;
        notify();
    }

    /*public void commandAction(Command command, Displayable displayable)
    {
        if(command == cmd_MainMenu)
        {
            keyPressed(MMIDlet.instance.leftKeyCode);
            if(-1 == MMIDlet.str_ClientVersion.indexOf("SAM_I858"))
            {
                if(-1 == MMIDlet.str_ClientVersion.indexOf("PAN_VS6"))
                    break MISSING_BLOCK_LABEL_79;
            }
            midlet.showMainList();
        } else
        if(command == cmd_Exit)
            midlet.commandAction(Setting.cmd_Exit, this);
    }*/
    
    public void commandAction(javax.microedition.lcdui.Command c1, javax.microedition.lcdui.Displayable d2) {
        if (c1 == cmd_MainMenu) {
            keyPressed(MMIDlet.instance.leftKeyCode);
        }
        else {
            if (c1 == cmd_Exit) {
                midlet.commandAction(cmd_Exit, this);
            }
        }
    }


    public void strangerListEmpty()
    {
        if(strangerSec.isExpand)
        {
            strangerSec.isSelected = true;
            MMIDlet.ml_StrangerList.isSelected = false;
        }
    }

    public void buddyListEmpty()
    {
        if(buddySec.isExpand)
        {
            buddySec.isSelected = true;
            MMIDlet.ml_BuddyList.isSelected = false;
        }
    }

    public void showNotify()
    {
        setFullScreenMode(true);
        HEIGHT = getHeight();
    }
}

⌨️ 快捷键说明

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