public void add(int emotionId, int dispearTime, boolean isNew) {
    if (emotions == null) {
      emotions = new HashMap<Integer, Emotion>();
    }
    Emotion emotion = new Emotion(emotionId, dispearTime);
    emotions.put(emotionId, emotion);

    if (isNew) {
      if (emotion.getExpireTime() != 0) {
        ExpireTimerTask.getInstance().addTask(emotion, owner);
      }
      DAOManager.getDAO(PlayerEmotionListDAO.class).insertEmotion(owner, emotion);
      PacketSendUtility.sendPacket(
          owner, new SM_EMOTION_LIST((byte) 1, Collections.singletonList(emotion)));
    }
  }
Пример #2
0
  /**
   * Sets the emoticon for this view to the given emoticon.
   *
   * @param emoticon The emoticon for this view.
   * @note this method will just return when the given emoticon is null
   */
  public void setEmoticon(Emotion emoticon) {
    if (emoticon == null) return;
    this.emoticon = emoticon;

    Bitmap fullImage =
        BitmapFactory.decodeResource(getResources(), emoticon.getLowResolutionResourceId());
    this.setImageBitmap(ImageScaler.convert(fullImage, EMOTICON_SIZE, EMOTICON_SIZE));
    this.setScaleType(ScaleType.CENTER_INSIDE);
  }