コード例 #1
0
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

          mSearchBar.updateCursorState(false);

          Node curNode = adapter.getItem(position);

          if (!curNode.isDept()) {

            if (adapter.getItem(position).getId() == EngineConst.uId) {
              EmployeeDetailActivity.launch(mContext);

            } else {
              Intent intent = new Intent(mContext, DialogueActivity.class);
              Bundle data = new Bundle();
              data.putInt("cid", EngineConst.cId);
              data.putInt("uid", curNode.getId());
              data.putString("name", curNode.getNodeData().nodeName);
              data.putBoolean("sex", curNode.getNodeData().isBoy);

              LogFactory.d(
                  "data",
                  "cid="
                      + EngineConst.cId
                      + "  uid ="
                      + curNode.getId()
                      + "  mName= "
                      + curNode.getNodeData().nodeName);

              Integer myMsgUserid = curNode.getId();
              if (!IMOApp.sendMsgUserId.isEmpty()) {
                if (IMOApp.sendMsgUserId.contains(curNode.getId())) {
                  IMOApp.sendMsgUserId.remove(myMsgUserid);
                  System.out.println("剩余的 msg id-----" + IMOApp.sendMsgUserId);
                  if (IMOApp.sendMsgUserId.isEmpty()) {
                    MainActivityGroup.getActivityGroup().mHandler.sendEmptyMessage(0);
                  }
                }
              }
              startActivity(intent.putExtras(data));
            }
          } else {

            mStructNavView.setVisibility(View.VISIBLE);
            adapter.showChildNodes(curNode);
            mListView.setSelection(0); // / for selected first node
            if (mStructNavView.getViewGroupChildCount() == 0) {
              mStructNavView.addItem(rootNodeDept.getNodeData().nodeName, rootNodeDept);
            }
            mStructNavView.addItem(curNode.getNodeData().nodeName, curNode);
            // 实现导航点击事件的封装。
            mStructNavView.setOnItemClickListener(adapter);
          }
        }
コード例 #2
0
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {

    if (isFinishing()) {
      return true;
    }

    if (keyCode == KeyEvent.KEYCODE_MENU) {}

    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
      LogFactory.d(TAG, "KEYCODE_BACK has clicked .");

      if (mStructNavView.getViewGroupChildCount() == 2) {
        mStructNavView.removeAllItemView();
        adapter.showChildNodes(rootNodeDept);
      } else {
        Node node = mStructNavView.getLastChildNode();
        if (node != null) {
          adapter.showChildNodes(node);
        } else {
          boolean keepOnline =
              (Boolean)
                  PreferenceManager.get(
                      Globe.SP_FILE, new Object[] {LoginActivity.LOGIN_KEEPONLINE, false});
          if (!keepOnline) {
            DialogFactory.promptExit(mContext).show();
          } else {
            IMOApp.getApp().hasRunInBackground = true;
            NoticeManager.updateRecoverAppNotice(notificationManager);
            Functions.backToDesk(this);
          }
        }
      }
      return true;
    }

    if (keyCode == KeyEvent.KEYCODE_SEARCH) {}

    return super.onKeyDown(keyCode, event);
  }
コード例 #3
0
        public void handleMessage(android.os.Message msg) {
          switch (msg.what) {
            case TYPE_GETTREE:
              getOrganizeTree();
              break;
            case TYPE_UPDATEPULLSTATE:
              if (adapter != null) adapter.notifyDataSetChanged();
              break;

            default:
              break;
          }
        };