예제 #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
  @Override
  protected void installViews() {
    mActivity = this;

    setContentView(R.layout.organize_activity);

    organizeView = findViewById(R.id.organize);

    mTitleBar.initOrganizeTitlebar();

    mTitleBar.setOrganizeTitleData(
        Globe.myself == null ? null : Globe.myself.getName(),
        Globe.myself == null ? null : Globe.myself.getSign());

    pop_view = findViewById(R.id.pop_view);

    pop_view.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            pop_view.setVisibility(View.GONE);
            mSearchBar.updateCursorState(false);
            SystemInfoManager.hideKeyBoard(getActivity());
          }
        });

    mSearchBar = (SearchBar) findViewById(R.id.searchbar);

    mStructNavView = (StructNavView) findViewById(R.id.structNavView);
    mStructNavView.setVisibility(View.GONE);

    mListView = (ListView) findViewById(R.id.organizeListView);

    mSearchRestltListView = (ListView) findViewById(R.id.searchResultListView);

    mSearchResultAdapter = new SearchResultAdapter(mContext);

    mChangeStatePop =
        new ChangeStatePop(
            LayoutInflater.from(mContext).inflate(R.layout.changestate_dialog, null, true));
  }