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

📄 friendlist.java

📁 手机中用的MobileQQ源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            long l = KQQMIDlet.friendRecord.getUserIDbyIndex(j);
            if(KQQMIDlet.getMsgDlg.findMsgByUIN(l) >= 0)
                KQQMIDlet.getMsgDlg.show(true, l);
            else
                KQQMIDlet.sendMsgDlg.show(l, false);
            break;
        }
    }

    public void startTimer()
    {
        timerOn = true;
    }

    public void stopTimer()
    {
        timerOn = false;
    }

    public void OnTimer()
    {
        if(!timerOn)
            return;
        iTimeCnt++;
        if(inforCnt > 0)
            inforCnt--;
        repaint();
    }

    public boolean existFriend(String s)
    {
        int i = KQQMIDlet.friendRecord.getUserLocation(s);
        return i >= 0 && i < 300;
    }

    public void buildFriendList()
    {
        if(iFirstTimeToShow && KQQMIDlet.friendRecord.getFriendNum() == 0)
        {
            KQQMIDlet.instance.showMessage(KQQMIDlet.sysString.sTQQ, KQQMIDlet.sysString.sUHaveNoFriend, this, cmdBack, null);
            return;
        } else
        {
            iEnd = KQQMIDlet.friendRecord.GetActiveData(iaIndexBuf, iGroup, iShowAll);
            int i = KQQMIDlet.friendRecord.getUserLocation(iCurUIN);
            SetSelectByIndex(i);
            SetMainDrawData();
            iFirstTimeToShow = false;
            return;
        }
    }

    public void commandAction(Command command, Displayable displayable)
    {
        if(command == cmdMenu)
        {
            int i = GetSelect();
            if(i >= 0)
                KQQMIDlet.mainMenu.show(KQQMIDlet.friendRecord.getUserIDbyIndex(i));
            else
                KQQMIDlet.mainMenu.show(0L);
            return;
        }
        if(command == cmdExit)
        {
            KQQMIDlet.instance.showMessage(KQQMIDlet.sysString.sTQQ, KQQMIDlet.sysString.sYesToExit, this, cmdOKtoExit, cmdBack);
            return;
        }
        if(command == cmdBack)
        {
            KQQMIDlet.display.setCurrent(this);
            return;
        }
        try
        {
            if(command == cmdOKtoExit)
            {
                KQQMIDlet.friendRecord.stopTimer();
                KQQMIDlet.getMsgDlg.stopTimer();
                KQQMIDlet.mainForm.stopTimer();
                KQQMIDlet.instance.showMessage(KQQMIDlet.sysString.sTQQ, KQQMIDlet.sysString.sLogouting, this, null, null);
                KQQMIDlet.friendRecord.saveFriendInfor();
                KQQMIDlet.httpPoster.logout(KQQMIDlet.mainMenu);
                return;
            }
        }
        catch(Exception exception) { }
        return;
    }

    private void SetMainDrawData()
    {
        int i1 = 0;
        if(iEnd == 0)
        {
            iDrawNum = 0;
            for(int i = 0; i < 10; i++)
                iaDrawIndex[i] = -1;

            iCurUIN = 0L;
            repaint();
            return;
        }
        if(iSelect >= iEnd)
            iSelect = iEnd - 1;
        int j1 = iEnd;
        if(iEnd - i1 < iDrawBmpNum)
        {
            iCur = iSelect;
        } else
        {
            i1 = iSelect - iCur;
            if(i1 < 0)
            {
                i1 = 0;
                iCur = iSelect - i1;
            }
            if(i1 + iDrawBmpNum <= iEnd)
            {
                j1 = i1 + iDrawBmpNum;
            } else
            {
                int j = (i1 + iDrawBmpNum) - iEnd;
                iCur += j;
                i1 = iEnd - iDrawBmpNum;
                j1 = iEnd;
            }
        }
        iDrawNum = j1 - i1;
        for(int k = i1; k < j1; k++)
            iaDrawIndex[k - i1] = iaIndexBuf[k];

        for(int l = j1; l < 10; l++)
            iaDrawIndex[l] = -1;

        if(!iFirstTimeToShow)
        {
            int k1 = GetSelect();
            if(k1 >= 0)
                iCurUIN = KQQMIDlet.friendRecord.getUserIDbyIndex(k1);
            else
                iCurUIN = 0L;
        }
        repaint();
    }

    private int CheckMoveUp()
    {
        if(iSelect > 0)
        {
            iSelect--;
            return 1;
        } else
        {
            return 0;
        }
    }

    private int CheckMoveDown()
    {
        if(iSelect + 1 < iEnd)
        {
            iSelect++;
            return 1;
        } else
        {
            return 0;
        }
    }

    public int IfCanJumpUp()
    {
        return iSelect - iCur <= 0 ? 0 : 1;
    }

    public int IfCanJumpDown()
    {
        return iSelect - iCur < iEnd - iDrawBmpNum ? 1 : 0;
    }

    public int GetSelect()
    {
        if(iSelect >= iEnd)
            return -1;
        else
            return iaIndexBuf[iSelect];
    }

    public void OnFriend()
    {
        if(iGroup != 1)
        {
            iGroup = 1;
            iSelect = 0;
            iCur = 0;
            buildFriendList();
        }
    }

    public void OnStranger()
    {
        if(iGroup != 2)
        {
            iGroup = 2;
            iSelect = 0;
            iCur = 0;
            buildFriendList();
        }
    }

    public void OnFirst()
    {
        int i = GetSelect();
        if(i == -1)
        {
            return;
        } else
        {
            iSelect = 0;
            iCur = 0;
            SetMainDrawData();
            return;
        }
    }

    public void OnLast()
    {
        int i = GetSelect();
        if(i == -1)
        {
            return;
        } else
        {
            iSelect = iEnd - 1;
            iCur = iDrawBmpNum - 1;
            SetMainDrawData();
            return;
        }
    }

    public void OnActive()
    {
        long l = KQQMIDlet.getMsgDlg.getNextNeedRead();
        if(l == 0L)
            return;
        int i = KQQMIDlet.friendRecord.getUserLocation(l);
        switch(KQQMIDlet.friendRecord.getGroupByIndex(i))
        {
        case 1: // '\001'
            OnFriend();
            if(KQQMIDlet.friendRecord.OnlineAndAway(i) == 0)
                OnShowAll();
            break;

        case 2: // '\002'
            OnStranger();
            break;

        default:
            return;
        }
        SetSelectByIndex(i);
        SetMainDrawData();
    }

    private int SetSelectByIndex(int i)
    {
        for(int j = 0; j < iEnd; j++)
            if(iaIndexBuf[j] == i)
            {
                iSelect = j;
                return 1;
            }

        return 0;
    }

    public void OnPre()
    {
        if(IfCanJumpUp() == 0)
            return;
        iSelect -= iDrawBmpNum;
        if(iSelect < 0)
            iSelect = 0;
        if(iSelect < iCur)
        {
            iCur = 0;
            iSelect = 0;
        }
        SetMainDrawData();
    }

    public void OnNext()
    {
        if(IfCanJumpDown() == 0)
            return;
        iSelect += iDrawBmpNum;
        if(iSelect >= iEnd)
            iSelect = iEnd - 1;
        if(iEnd - iSelect < iDrawBmpNum - iCur)
        {
            iCur = iDrawBmpNum - 1;
            iSelect = iEnd - 1;
        }
        SetMainDrawData();
    }

    public void OnShowAll()
    {
        iShowAll = 1;
        buildFriendList();
    }

    public void OnShowOnline()
    {
        iShowAll = 0;
        buildFriendList();
    }

    public void OnSysMsg()
    {
        KQQMIDlet.getMsgDlg.show(false, 0L);
    }
}

⌨️ 快捷键说明

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