Esempio n. 1
0
  /**
   * 处理获取到的农历信息
   *
   * @param nongli
   */
  private void handlerNongli(final String nongli) {
    if (!StringUtil.isEmpty(nongli)) {
      StringBuilder today = new StringBuilder();
      today.append("今天是");
      if (nongli.trim().length() > 0) {
        today.append(nongli.replace("\n", "<br/>"));
        mToday.setText(Html.fromHtml(today.toString()));

        SharedPreferencesHelper.getInstance().setString(SharedPreferencesHelper.NONGLI, nongli);
      }
    }
  }
Esempio n. 2
0
  /**
   * 处理获取到的天气信息
   *
   * @param weather
   */
  private void handlerWeather(String weather) {
    if (!StringUtil.isEmpty(weather)) {
      SharedPreferencesHelper.getInstance().setString(SharedPreferencesHelper.WEATHER, weather);
      int index = weather.indexOf(" ");
      if (index > 0) {
        String city = weather.substring(0, index);
        weather = weather.substring(index + 1);
        mWeatherCity.setText(city + " " + mContext.getString(R.string.number_weather));
        String[] str = weather.split("\\|");

        mWeatherList.removeAllViews();
        for (int i = 0; i < str.length; i++) {
          mWeatherList.addView(WeatherHelper.createWeatherItem(mContext, str[i], i));
        }
      }
    }
  }
Esempio n. 3
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);
 }
Esempio n. 4
0
 /**
  * 处理获取到的空气信息
  *
  * @param air
  */
 private void handlerAir(String air) {
   if (!StringUtil.isEmpty(air)) {
     SharedPreferencesHelper.getInstance().setString(SharedPreferencesHelper.AIR, air);
     mWeatherCity.setText(air);
   }
 }