예제 #1
0
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case UPDATE_COPY_LINK:
              mCopyLinkDialog.dismiss();
              break;
            case UPDATE_RENAME_SHOW:
              int position = msg.getData().getInt("position");
              mRoomData.get(position).setmMeetType2(2);
              mAdapter.notifyDataSetChanged();
              if (mDebug) Log.e(TAG, "UPDATE_RENAME_SHOW");
              break;
            case UPDATE_LISTVIEW_SCROLL:
              mAdapter.notifyDataSetChanged();
              mListView.animate().translationY(-mDy).setDuration(2000);
              break;
            case UPDATE_RENAME_END:
              mAdapter.notifyDataSetChanged();
              if (mDy == 0) mListView.smoothScrollToPositionFromTop(0, 0, 1000);
              else {
                mListView.animate().translationYBy(mDy).setDuration(10);
                mListView.smoothScrollToPositionFromTop(0, 0, 500);
              }
              break;

            default:
              break;
          }
        };
예제 #2
0
  /**
   * getItemHeight
   *
   * @param listView
   * @return
   */
  private int getItemHeight(final ListView listView) {
    View view = mAdapter.getView(0, null, listView);

    view.measure(0, 0);
    int i = (int) ScreenUtils.dip2Dimension(10.0f, this);
    Log.e(TAG, " i " + i);
    return view.getMeasuredHeight();
  }
예제 #3
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;
    }
  }
예제 #4
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;
    }
  };
예제 #5
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;
        }
예제 #6
0
  /**
   * listViewSetScroll
   *
   * @param position
   */
  private void listViewSetScroll(int position) {

    int itemHeight = getItemHeight(mListView);
    float temp = mListView.getHeight() / (float) getItemHeight(mListView);
    int visibleItem = (int) Math.ceil(temp);
    int maxItemTop = mAdapter.getCount() - visibleItem;

    if (position <= maxItemTop) {
      mDy = 0;
      mListView.smoothScrollToPositionFromTop(position, 0, 2000);
    } else {

      int incompleteItemheight = mListView.getHeight() - (visibleItem - 1) * itemHeight;
      mDy = itemHeight * (position - maxItemTop - 1) + incompleteItemheight;
      Log.e(TAG, "maxItemTop " + maxItemTop + " incompleteItemheight " + incompleteItemheight);
      // mListView.smoothScrollToPositionFromTop(maxItemTop, 0, 1000);
      // mListView.smoothScrollToPosition(maxItemTop-1);
      mListView.setSelection(mListView.getBottom());
      // mListView.animate().translationY(-mDy).setDuration(2000);
      mUIHandler.sendEmptyMessageDelayed(UPDATE_LISTVIEW_SCROLL, 1500);
    }
  }
예제 #7
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;
          }
        }