コード例 #1
0
ファイル: MessageView.java プロジェクト: markadam/telegram
  public static Object prepareLayout(MessageWireframe wireframe, StelsApplication application1) {
    checkResources(application1);

    int maxWidthH;
    int maxWidthV;
    if (wireframe.message.isOut()) {
      maxWidthH =
          getBubblePadding(
              wireframe, outBubblePadding, UiMeasure.METRICS.widthPixels, application1);
      maxWidthV =
          getBubblePadding(
              wireframe, outBubblePadding, UiMeasure.METRICS.heightPixels, application1);
    } else {
      maxWidthH =
          getBubblePadding(wireframe, inBubblePadding, UiMeasure.METRICS.widthPixels, application1);
      maxWidthV =
          getBubblePadding(
              wireframe, inBubblePadding, UiMeasure.METRICS.heightPixels, application1);
    }

    // getBubblePadding(wireframe,)
    MessageLayout layoutV = new MessageLayout();
    layoutV.build(wireframe, maxWidthV, application1);
    MessageLayout layoutH = new MessageLayout();
    layoutH.build(wireframe, maxWidthH, application1);
    return new MessageLayout[] {layoutV, layoutH};
  }
コード例 #2
0
ファイル: MessageView.java プロジェクト: markadam/telegram
  @Override
  protected void measureBubbleContent(int desiredWidth) {
    if (messageLayout == null || messageLayout.layoutDesiredWidth != desiredWidth) {
      messageLayout = null;
      if (cachedLayout != null) {
        for (MessageLayout l : cachedLayout) {
          if (Math.abs(l.layoutDesiredWidth - desiredWidth) < 6) {
            messageLayout = l;
            break;
          }
        }
      }

      if (messageLayout == null) {
        messageLayout = new MessageLayout();
        messageLayout.build(wireframe, desiredWidth, application);
      }
    }

    setBubbleMeasuredContent(messageLayout.layoutRealWidth, messageLayout.layoutHeight);
  }