Ejemplo n.º 1
0
  /**
   * 设置内容
   *
   * @param number
   */
  private void setContent(String number) {
    mNumberString = number;

    mWeatherTextView.setVisibility(View.GONE);

    CommentHelper.getComments(mContext, mNumberString, myHandler);
    BusinessHelper.getNumberInfo(mContext, mNumberString, myHandler);
    CallHelper.getCallRecordsInfo(mContext, mNumberString, myHandler);
    CallHelper.getLastRecordInfo(mContext, mNumberString, myHandler);

    mNameString = ContactHelper.getPerson(mContext, mNumberString);
    String senderString = "";
    if (null != mNameString && mNameString.length() > 0 && !mNameString.equals(mNumberString)) {
      senderString = mNameString + "(" + mNumberString + ")";
    } else {
      senderString = mNumberString;
    }
    mSenderTextView.setText(senderString);
    mInfoTextView.setText(mContext.getString(R.string.getting_info));
  }
Ejemplo n.º 2
0
 @Override
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case MessageWhat.NET_REQUEST_NUMBER:
       if (null == msg.obj) {
         break;
       }
       mInfoString = (String) msg.obj;
       mInfoTextView.setText(mInfoString);
       if (mType == PhoneReceiver.INCOMING_CALL_MSG) {
         // 来电播报
         if (BaseUtil.isWiredHeadsetOn(mContext)) {
           if (SharedPreferencesHelper.getInstance()
               .getBoolean(
                   SharedPreferencesHelper.SETTING_BROADCAST_WHEN_WIREDHEADSETON, true)) {
             broadcastContent(createCallBroadcastContent());
             // 日志
             LogOperate.updateLog(mContext, LogCode.CALL_BROADCAST);
           }
         }
       }
       String[] infosStrings = mInfoString.split(" ");
       String city = "";
       if (infosStrings.length == 1) {
         if (infosStrings[0].length() < 5) {
           city = infosStrings[0];
         }
       } else if (infosStrings.length == 2) {
         if (infosStrings[1].contains("中国")) {
           city = infosStrings[0];
         } else {
           city = infosStrings[1];
         }
       } else {
         city = infosStrings[1];
       }
       if (!StringUtil.isEmpty(city)) {
         BusinessHelper.getWeatherInfo(mContext, city, myHandler);
       }
       break;
     case MessageWhat.NET_REQUEST_WEATHER:
       if (null != msg.obj) {
         mWeatherTextView.setText((String) msg.obj);
         mWeatherTextView.setVisibility(View.VISIBLE);
       }
       break;
     case MessageWhat.CALL_RECORDS:
       if (null != msg.obj) {
         mRecordsTextView.setText((String) msg.obj);
       }
       break;
     case MessageWhat.MSG_SHOW_COMMENTS:
       if (null != msg.obj) {
         mCommentsArray = null;
         try {
           mCommentsArray = new JSONArray((String) msg.obj);
           if (mCommentsArray.length() > 0) {
             mFlashingIndex = -1;
             mCommentLayout.setVisibility(View.VISIBLE);
             showFlashComment();
           }
         } catch (JSONException e) {
           DebugLog.d(TAG, e.toString());
         }
       }
       break;
     case MSG_SHOW_ONE_COMMENT:
       if (null != msg.obj) {
         mCommentTextView.setText((String) msg.obj);
         mFlashingAnimation.reset();
         mCommentTextView.startAnimation(mFlashingAnimation);
       }
       break;
     case MSG_REMOVE:
       remove();
       break;
     case MessageWhat.MSG_LAST_RECORD_DATE:
       if (null != msg.obj) {
         mLastRecordTextView.setText((String) msg.obj);
         mLastRecordTextView.setVisibility(View.VISIBLE);
       }
       break;
     default:
       break;
   }
   super.handleMessage(msg);
 }