예제 #1
0
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {

    if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
      if (hideKeyboard()) {
        return false;
      }

      if ((System.currentTimeMillis() - mExitTime) > 2000) {
        Toast.makeText(this, R.string.exit_once_more, 0).show();
        mExitTime = System.currentTimeMillis();
      } else {
        String sign = TeamMeetingApp.getMyself().getmAuthorization();
        // signout
        mNetWork.signOut(sign);
      }
      return true;
    }

    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
      return true;
    }

    return super.onKeyDown(keyCode, event);
  }
예제 #2
0
  /** For EventBus callback. */
  public void onEventMainThread(Message msg) {
    switch (EventType.values()[msg.what]) {
      case MSG_SIGNOUT_SUCCESS:
        if (mDebug) Log.e(TAG, "MSG_SIGNOUT_SUCCESS");
        finish();
        System.exit(0);
        break;

      case MSG_SIGNOUT_FAILED:
        if (mDebug) Log.e(TAG, "MSG_SIGNOUT_FAILED");
        break;

      case MSG_GET_ROOM_LIST_SUCCESS:
        if (mDebug) Log.e(TAG, "MSG_GET_ROOM_LIST_SUCCESS");
        mRoomData.clear();
        mRoomData.addAll(TeamMeetingApp.getMyself().getmRoomList());
        mAdapter.notifyDataSetChanged();

        if (mCreateRoomFlag) {
          Intent intent = new Intent(MainActivity.this, InvitePeopleActivity.class);
          startActivity(intent);
          overridePendingTransition(R.anim.activity_open_enter, R.anim.activity_open_exit);
          mCreateRoomFlag = false;
        }

        break;

      case MSG_GET_ROOM_LIST_FAILED:
        if (mDebug) Log.e(TAG, "MSG_GET_ROOM_LIST_FAILED");
        break;

      case MSG_APPLY_ROOM_SUCCESS:
        if (mDebug) Log.e(TAG, "MSG_APPLY_ROOM_SUCCESS");
        mNetWork.getRoomList(mSign, 1 + "", 20 + "");

        break;

      case MSG_APPLY_ROOMT_FAILED:
        if (mDebug) Log.e(TAG, "MSG_APPLY_ROOMT_FAILED");
        break;

      case MSG_UPDATE_MEET_ROOM_NAME_SUCCESS:
        if (mDebug) Log.e(TAG, "MSG_UPDATE_MEET_ROOM_NAME_SUCCESS");

        break;

      case MSG_UPDATE_MEET_ROOM_NAME_FAILED:
        if (mDebug) Log.e(TAG, "MSG_UPDATE_MEET_ROOM_NAME_FAILED");
        break;

      default:
        break;
    }
  }
예제 #3
0
  /** onActivityResult */
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    super.onActivityResult(requestCode, resultCode, data);

    String sign;
    int position;
    String meetingId;

    switch (resultCode) {
      case ExtraType.RESULT_CODE_ROOM_SETTING_MESSAGE_INVITE:
        break;
      case ExtraType.RESULT_CODE_ROOM_SETTING_WEIXIN_INVITE:
        break;
      case ExtraType.RESULT_CODE_ROOM_SETTING_COPY_LINK:
        mCopyLinkDialog = new CopyLinkDialog(this);
        mCopyLinkDialog.show();
        mUIHandler.sendEmptyMessageDelayed(UPDATE_COPY_LINK, 3000);
        break;
      case ExtraType.RESULT_CODE_ROOM_SETTING_NOTIFICATION:
        break;
      case ExtraType.RESULT_CODE_ROOM_SETTING_RENAME:
        mReNameFlag = true;
        sign = TeamMeetingApp.getMyself().getmAuthorization();
        position = data.getIntExtra("position", 0);
        mPosition = position;
        meetingId = data.getStringExtra("meetingId");
        String meetingName = data.getStringExtra("meetingName");
        listViewSetScroll(position);
        Message msg = new Message();
        msg.what = UPDATE_RENAME_SHOW;
        Bundle bundle = new Bundle();
        bundle.putInt("position", position);
        msg.setData(bundle);
        mUIHandler.sendMessageDelayed(msg, 3000);
        // mUIHandler.sendEmptyMessageDelayed(UPDATE_RENAME_SHOW, 5500);

        break;
      case ExtraType.RESULT_CODE_ROOM_SETTING_DELETE:
        sign = TeamMeetingApp.getMyself().getmAuthorization();
        position = data.getIntExtra("position", 0);
        meetingId = data.getStringExtra("meetingId");

        mNetWork.deleteRoom(sign, meetingId);
        mRoomData.remove(position);
        mAdapter.notifyDataSetChanged();

        break;

      default:
        break;
    }
  };
예제 #4
0
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

          String roomName = mCreateRoom.getText().toString();
          if (roomName.length() == 0 || roomName == null) {
            roomName = "Untitled room";
          }

          String sign = TeamMeetingApp.getMyself().getmAuthorization();
          mNetWork.applyRoom(sign, roomName, "0", "", "123");

          mAdapter.notifyDataSetChanged();

          mIMM.hideSoftInputFromWindow(mCreateRoom.getWindowToken(), 0);
          mCreateRoom.setVisibility(View.GONE);
          mRoomCancel.setVisibility(View.GONE);
          mCreateRoomFlag = true;

          return false;
        }
예제 #5
0
        @Override
        public void onItemClickListener(View v, int position) {
          // TODO Auto-generated method stub

          String sign;
          String meetingId;
          String meetingName;

          if (hideKeyboard()) {
            return;
          }

          Intent intent;
          switch (v.getId()) {
            case R.id.fl_front:
              meetingName = mRoomData.get(position).getmMeetName();
              intent = new Intent(mContext, MeetingActivity.class);
              intent.putExtra("meetingName", meetingName);
              mContext.startActivity(intent);
              break;

            case R.id.btn_delete:
              sign = TeamMeetingApp.getMyself().getmAuthorization();
              meetingId = mRoomData.get(position).getmMeetingId();
              mNetWork.deleteRoom(sign, meetingId);
              mRoomData.remove(position);
              mAdapter.notifyDataSetChanged();
              break;

            case R.id.imgbtn_more_setting:
              intent = new Intent(mContext, RoomSettingActivity.class);
              meetingName = mRoomData.get(position).getmMeetName();
              meetingId = mRoomData.get(position).getmMeetingId();
              intent.putExtra("meetingName", meetingName);
              intent.putExtra("meetingId", meetingId);
              intent.putExtra("position", position);
              startActivityForResult(intent, ExtraType.REQUEST_CODE_ROOM_SETTING);
              ((Activity) mContext)
                  .overridePendingTransition(R.anim.activity_open_enter, R.anim.activity_open_exit);

              break;
            case R.id.et_rename:
              EditText reName = (EditText) v.findViewById(R.id.et_rename);
              String newName = reName.getText().toString();
              String oldName = mRoomData.get(position).getmMeetName();

              if (!newName.equals(oldName)) {

                sign = TeamMeetingApp.getMyself().getmAuthorization();
                meetingId = mRoomData.get(position).getmMeetingId();
                mNetWork.updateMeetRoomName(sign, meetingId, newName);

                mRoomData.get(position).setmMeetName(newName);
              }

              mRoomData.get(position).setmMeetType2(1);
              mIMM.hideSoftInputFromWindow(reName.getWindowToken(), 0);
              mUIHandler.sendEmptyMessageDelayed(UPDATE_RENAME_END, 500);
              mReNameFlag = false;
              break;

            default:
              break;
          }
        }