// send to others, might be reply, send direct message private void processReplyDerectMessage(String content) { String[] touids = message_rev.getAddresses(); if (touids == null || touids.length == 0) return; if (insending == true) { Log.d(TAG, "is sending message=" + this); return; } // show dialog mContext.showDialog(DLG_SEND_MSG); failSends.clear(); MessageThread messageT = new MessageThread(); messageT.content = content; messageT.receivers = touids; messageT.source = this.to_uid; messageT.status_id = this.status_id; messageT.start(); synchronized (mLock) { try { mLock.wait(30 * 1000); if (sendHandler != null) { Message mds = sendHandler.obtainMessage(NEXT_RECEIVER); mds.getData().putInt("position", 0); sendHandler.sendMessage(mds); } else { Log.d(TAG, "why I am null=" + this); } } catch (InterruptedException e) { } } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { switch (requestCode) { case TWITTER_USER_SELECT: { if (resultCode == 100) { Log.d(TAG, "user select"); String[] uids = intent.getStringArrayExtra("snames"); if (uids == null || uids.length == 0) { Log.d(TAG, "no selected user"); } else { currentSelected.clear(); boolean isExist; String numbers = ""; for (int i = 0; i < uids.length; i++) { // check whether exist isExist = false; for (int j = 0; i < currentSelected.size(); j++) { if (currentSelected.get(j).equalsIgnoreCase(uids[i])) { isExist = true; break; } } if (isExist == false) { currentSelected.add(uids[i]); numbers += String.valueOf(uids[i]) + ","; } } String originalnum = ""; if (message_rev != null) { originalnum = message_rev.getAddresses(","); } if ("".equals(originalnum)) { message_rev.setAddresses(numbers, ","); } else { message_rev.setAddresses(originalnum + "," + numbers, ","); } } // no need more uids = null; } break; } default: super.onActivityResult(requestCode, resultCode, intent); break; } }
// remove who from address bar private void sucSend(String who) { String[] adds = message_rev.getAddresses(); // reconstruct the address String news = ""; for (int i = 0; i < adds.length; i++) { if (who.equalsIgnoreCase(adds[i].trim()) == false) { news += adds[i] + ","; } } if (news != null) { Message msd = handler.obtainMessage(TWITTER_MESSAGE_SET_ADD_BAR); msd.getData().putString("newaddress", news); handler.sendMessage(msd); } }