Exemplo n.º 1
0
public class JDShopView extends ViewGroupViewImpl {
  private static WebView webView;
  private ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(480, 800, 480, 800, 0, 0, ViewLayout.FILL);
  private final ViewLayout webviewLayout =
      ViewLayout.createViewLayoutWithBoundsLT(
          480,
          800,
          480,
          800,
          0,
          0,
          ViewLayout.FILL | ViewLayout.SLTR | ViewLayout.SC | ViewLayout.CW | ViewLayout.SVH);

  @SuppressLint({"JavascriptInterface"})
  public JDShopView(Context paramContext) {
    super(paramContext);
    setBackgroundColor(17170443);
    webView = new WebView(paramContext);
    webView.setWebChromeClient(new WebChromeClient() {});
    webView.setWebViewClient(new WebViewClient() {});
    WebSettings localWebSettings = webView.getSettings();
    localWebSettings.setJavaScriptEnabled(true);
    localWebSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    localWebSettings.setAppCacheEnabled(false);
    localWebSettings.setJavaScriptEnabled(true);
    addView(webView);
  }

  protected void onLayout(
      boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    int i = paramInt3 - paramInt1;
    int j = paramInt4 - paramInt2;
    this.standardLayout.scaleToBounds(i, j);
    this.webviewLayout.scaleToBounds(this.standardLayout);
    webView.layout(
        this.webviewLayout.getLeft(),
        this.webviewLayout.getTop(),
        this.webviewLayout.getRight(),
        this.webviewLayout.getBottom());
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    int i = View.MeasureSpec.getSize(paramInt1);
    int j = View.MeasureSpec.getSize(paramInt2);
    this.standardLayout.scaleToBounds(i, j);
    webView.measure(
        this.webviewLayout.getWidthMeasureSpec(), this.webviewLayout.getHeightMeasureSpec());
    setMeasuredDimension(this.standardLayout.width, this.standardLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("setData")) webView.loadUrl((String) paramObject);
  }
}
Exemplo n.º 2
0
class BroadcastorScrollView extends HorizontalScrollViewImpl implements IEventHandler {
  private BroadcastorRowView mRowView;
  private final ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(500, 160, 500, 160, 0, 0, ViewLayout.FILL);

  @TargetApi(9)
  public BroadcastorScrollView(Context paramContext) {
    super(paramContext);
    setHorizontalScrollBarEnabled(false);
    if (QtApiLevelManager.isApiLevelSupported(9)) setOverScrollMode(2);
    this.mRowView = new BroadcastorRowView(paramContext);
    addView(this.mRowView);
    this.mRowView.setEventHandler(this);
  }

  public void close(boolean paramBoolean) {
    this.mRowView.close(paramBoolean);
    super.close(paramBoolean);
  }

  public void onEvent(Object paramObject1, String paramString, Object paramObject2) {
    if (paramString.equalsIgnoreCase("flowerToPoint")) {
      paramObject1 = (Point) paramObject2;
      paramObject1.offset(-getScrollX(), 0);
      dispatchActionEvent(paramString, paramObject1);
    }
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.standardLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.standardLayout.measureView(this.mRowView);
    setMeasuredDimension(this.standardLayout.width, this.standardLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    this.mRowView.update(paramString, paramObject);
  }
}
Exemplo n.º 3
0
public class ChannelDetailItemView extends QtListItemView {
  private static final String DOWNLOADED = "已下载";
  private static final String DOWNLOADING = "正在下载";
  private static final int INDEX_CLOSE = 2;
  private static final int INDEX_ITEM = 0;
  private static final int INDEX_TRIANGLE = 1;
  private static final int INDEX_UNKNOWN = -1;
  private final long TEN_MINUTE = 600000L;
  private final ViewLayout channelnameLayout =
      this.itemLayout.createChildLT(720, 35, 30, 16, ViewLayout.SCALE_FLAG_SLTCW);
  private final DrawFilter filter = SkinManager.getInstance().getDrawFilter();
  private int hash = -24;
  private final ViewLayout itemLayout =
      ViewLayout.createViewLayoutWithBoundsLT(
          720, 126, 720, 126, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout lineLayout =
      this.itemLayout.createChildLT(720, 1, 30, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout livingLayout =
      this.itemLayout.createChildLT(10, 90, 0, 18, ViewLayout.SCALE_FLAG_SLTCW);
  boolean mBelongToPodcasterInfo = false;
  private final Paint mChannelNamePaint = new TextPaint();
  private int mDownloadState;
  private final TextPaint mDownloadStatePaint = new TextPaint();
  private boolean mHasChannelName = false;
  private final Paint mHighlightPaint = new Paint();
  private boolean mInTouchMode = false;
  private boolean mIsLiving = false;
  private int mItemHeight = 100;
  private float mLastMotionX = 0.0F;
  private float mLastMotionY = 0.0F;
  private final Paint mLinePaint = new Paint();
  private final Rect mLivingRect = new Rect();
  private Node mNode;
  private final Paint mPaint = new Paint();
  private boolean mRemind = false;
  private boolean mSameDay = false;
  private int mSelectedIndex = -1;
  private final Paint mStatePaint = new TextPaint();
  private final TextPaint mTimePaint = new TextPaint();
  private int mTitleHeight = 30;
  private StaticLayout mTitleLayout;
  private final Rect mTriangularRect = new Rect();
  private final TextPaint mUpdateTimePaint = new TextPaint();
  private final ViewLayout otherInfoLayout =
      this.itemLayout.createChildLT(720, 24, 30, 14, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout programLayout =
      this.itemLayout.createChildLT(720, 45, 30, 20, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout recentCloseButtonLayout =
      this.itemLayout.createChildLT(20, 26, 20, 30, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout recentIndicatorLayout =
      this.itemLayout.createChildLT(20, 26, 32, 30, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout recentItemLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 86, 720, 50, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout recentLineLayout =
      this.itemLayout.createChildLT(720, 1, 30, 1, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout recentTitleLayout =
      this.itemLayout.createChildLT(570, 50, 80, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout remindLayout =
      this.itemLayout.createChildLT(22, 22, 30, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final Rect textBound = new Rect();
  private final ViewLayout triangularLayout =
      this.itemLayout.createChildLT(22, 22, 20, 20, ViewLayout.SCALE_FLAG_SLTCW);

  public ChannelDetailItemView(Context paramContext, int paramInt) {
    super(paramContext);
    this.hash = paramInt;
    this.mHighlightPaint.setColor(SkinManager.getTextColorHighlight2());
    this.mHighlightPaint.setStyle(Paint.Style.FILL);
    this.mDownloadStatePaint.setColor(SkinManager.getTextColorHighlight2());
    this.mChannelNamePaint.setColor(SkinManager.getTextColorSubInfo());
    this.mTimePaint.setColor(SkinManager.getTextColorThirdLevel());
    this.mUpdateTimePaint.setColor(SkinManager.getTextColorThirdLevel());
    this.mLinePaint.setColor(SkinManager.getDividerColor_new());
    setOnClickListener(this);
    setItemSelectedEnable();
  }

  private void doClickEvent() {
    if ((this.mNode == null) || (this.mSelectedIndex == -1)) return;
    if (this.mSelectedIndex == 2) {
      QTMSGManage.getInstance().sendStatistcsMessage("resumerecent_close");
      EventDispacthManager.getInstance().dispatchAction("closerecentplay", null);
      return;
    }
    Object localObject;
    if (this.mSelectedIndex == 1) {
      localObject = new CustomPopActionParam.Builder();
      ((CustomPopActionParam.Builder) localObject).setTitle(getTitle()).addNode(this.mNode);
      if (this.mDownloadState == 0) ((CustomPopActionParam.Builder) localObject).addButton(1);
      ((CustomPopActionParam.Builder) localObject).addButton(0);
      localObject = ((CustomPopActionParam.Builder) localObject).create();
      EventDispacthManager.getInstance().dispatchAction("showoperatepop", localObject);
      return;
    }
    int i;
    if (this.mNode.nodeName.equalsIgnoreCase("program")) {
      i = ((ProgramNode) this.mNode).getCurrPlayStatus();
      localObject = null;
    }
    while (true) {
      if (i == 2) {
        if (InfoManager.getInstance().root().mPersonalCenterNode.reserveNode.isExisted(this.mNode))
          InfoManager.getInstance()
              .root()
              .mPersonalCenterNode
              .reserveNode
              .cancelReserve(((ProgramNode) this.mNode).id);
        while (true) {
          invalidate();
          label194:
          if (!this.mBelongToPodcasterInfo) break label319;
          QTMSGManage.getInstance().sendStatistcsMessage("PodcasterInfo", "收听");
          return;
          if (this.mNode.nodeName.equalsIgnoreCase("ondemandprogram")) {
            localObject = null;
            i = 3;
            break;
          }
          if (!this.mNode.nodeName.equalsIgnoreCase("playhistory")) break label329;
          QTMSGManage.getInstance().sendStatistcsMessage("resumerecent_play");
          localObject = ((PlayHistoryNode) this.mNode).playNode;
          i = 1;
          break;
          InfoManager.getInstance()
              .root()
              .mPersonalCenterNode
              .reserveNode
              .addReserveNode((ProgramNode) this.mNode);
        }
      }
      ControllerManager localControllerManager = ControllerManager.getInstance();
      if (localObject != null) ;
      while (true) {
        localControllerManager.redirectToPlayViewByNode((Node) localObject, true);
        break label194;
        label319:
        break;
        localObject = this.mNode;
      }
      label329:
      localObject = null;
      i = 1;
    }
  }

  private void drawBg(Canvas paramCanvas) {
    if ((isItemPressed()) && (this.mSelectedIndex == 0)) {
      int i = paramCanvas.save();
      paramCanvas.clipRect(0, 0, this.itemLayout.width, this.mItemHeight);
      paramCanvas.drawColor(SkinManager.getItemHighlightMaskColor_new());
      paramCanvas.restoreToCount(i);
    }
  }

  private int drawChannelName(Canvas paramCanvas, int paramInt) {
    int i = paramInt;
    if (this.mHasChannelName) {
      String str = ((ProgramNode) this.mNode).getChannelName();
      this.mChannelNamePaint.getTextBounds(str, 0, str.length(), this.textBound);
      paramCanvas.drawText(
          str,
          this.channelnameLayout.leftMargin,
          this.channelnameLayout.topMargin
              + paramInt
              + (this.channelnameLayout.height - this.textBound.height()),
          this.mChannelNamePaint);
      i = paramInt + (this.channelnameLayout.topMargin + this.channelnameLayout.height);
    }
    return i;
  }

  private int drawDownloadState(Canvas paramCanvas, int paramInt) {
    Object localObject2 = null;
    Object localObject1 = localObject2;
    switch (this.mDownloadState) {
      default:
        localObject1 = localObject2;
      case 0:
      case 2:
      case 1:
      case 3:
    }
    while (localObject1 == null) {
      return this.mTriangularRect.left;
      localObject1 = "正在下载";
      continue;
      localObject1 = "已下载";
    }
    this.mDownloadStatePaint.getTextBounds(
        (String) localObject1, 0, ((String) localObject1).length(), this.textBound);
    paramCanvas.drawText(
        (String) localObject1,
        this.mTriangularRect.left - this.textBound.width() - this.otherInfoLayout.leftMargin,
        this.otherInfoLayout.topMargin
            + paramInt
            + (this.otherInfoLayout.height - this.textBound.height()),
        this.mDownloadStatePaint);
    return this.mTriangularRect.left - this.textBound.width() - this.otherInfoLayout.leftMargin;
  }

  private float drawDurationTime(Canvas paramCanvas, int paramInt) {
    if (this.mNode.nodeName.equalsIgnoreCase("program")) ;
    String str;
    switch (((ProgramNode) this.mNode).getCurrPlayStatus()) {
      default:
        str = "";
      case 1:
      case 2:
      case 3:
    }
    while (true) {
      int i = drawDownloadState(paramCanvas, paramInt);
      this.mTimePaint.getTextBounds(str, 0, str.length(), this.textBound);
      paramCanvas.drawText(
          str,
          i - this.textBound.width() - this.otherInfoLayout.leftMargin,
          this.otherInfoLayout.topMargin
              + paramInt
              + (this.otherInfoLayout.height - this.textBound.height()) / 2,
          this.mTimePaint);
      return i - this.textBound.width() - this.otherInfoLayout.leftMargin;
      str =
          TimeUtil.msToDate3(((ProgramNode) this.mNode).getAbsoluteStartTime() * 1000L)
              + "-"
              + TimeUtil.msToDate3(((ProgramNode) this.mNode).getAbsoluteEndTime() * 1000L);
      continue;
      str = getDurationTime(((ProgramNode) this.mNode).getDuration());
    }
  }

  private void drawLine(Canvas paramCanvas) {
    paramCanvas.drawLine(
        this.lineLayout.leftMargin,
        this.mItemHeight - this.lineLayout.height,
        this.itemLayout.width,
        this.mItemHeight - this.lineLayout.height,
        this.mLinePaint);
  }

  private void drawLivingLabel(Canvas paramCanvas) {
    paramCanvas.drawRect(this.mLivingRect, this.mHighlightPaint);
  }

  private void drawNormalItem(Canvas paramCanvas) {
    drawBg(paramCanvas);
    drawStateInfo(paramCanvas, drawChannelName(paramCanvas, drawTitle(paramCanvas)));
    drawLine(paramCanvas);
  }

  private void drawRecentBg(Canvas paramCanvas) {
    Paint localPaint = new Paint();
    localPaint.setStyle(Paint.Style.FILL);
    localPaint.setColor(-1513237);
    paramCanvas.drawRect(
        0.0F, 0.0F, this.recentItemLayout.width, this.recentItemLayout.height, localPaint);
  }

  private void drawRecentCloseButton(Canvas paramCanvas) {
    paramCanvas.drawBitmap(
        Bitmap.createScaledBitmap(
            BitmapFactory.decodeResource(getResources(), 2130837725),
            this.recentCloseButtonLayout.width,
            this.recentCloseButtonLayout.height,
            false),
        this.recentItemLayout.width
            - this.recentCloseButtonLayout.width
            - this.recentCloseButtonLayout.leftMargin,
        (this.recentItemLayout.height - this.recentCloseButtonLayout.height) / 2,
        new Paint());
  }

  private void drawRecentIndicator(Canvas paramCanvas) {
    paramCanvas.drawBitmap(
        Bitmap.createScaledBitmap(
            BitmapFactory.decodeResource(getResources(), 2130837759),
            this.recentIndicatorLayout.width,
            this.recentIndicatorLayout.height,
            false),
        this.recentIndicatorLayout.leftMargin,
        (this.recentItemLayout.height - this.recentIndicatorLayout.height) / 2,
        new Paint());
  }

  private void drawRecentItem(Canvas paramCanvas) {
    drawRecentBg(paramCanvas);
    drawRecentIndicator(paramCanvas);
    drawRecentTitle(paramCanvas);
    drawRecentCloseButton(paramCanvas);
    drawRecentLine(paramCanvas);
  }

  private void drawRecentLine(Canvas paramCanvas) {
    SkinManager.getInstance()
        .drawHorizontalLine(
            paramCanvas,
            this.recentLineLayout.leftMargin,
            this.recentItemLayout.width,
            this.recentItemLayout.height - this.recentLineLayout.height,
            this.recentLineLayout.height);
  }

  private void drawRecentTitle(Canvas paramCanvas) {
    Object localObject2 = "继续收听  “";
    Object localObject1 = localObject2;
    if (this.mNode != null) {
      localObject1 = localObject2;
      if (this.mNode.nodeName != null) {
        localObject1 = localObject2;
        if (this.mNode.nodeName.equalsIgnoreCase("playhistory"))
          localObject1 =
              "继续收听  “" + ((ProgramNode) ((PlayHistoryNode) this.mNode).playNode).title + "”";
      }
    }
    localObject2 = SkinManager.getInstance().getSubTextPaint();
    localObject1 =
        TextUtils.ellipsize(
                (CharSequence) localObject1,
                (TextPaint) localObject2,
                this.recentTitleLayout.width,
                TextUtils.TruncateAt.END)
            .toString();
    Rect localRect = new Rect();
    ((TextPaint) localObject2)
        .getTextBounds((String) localObject1, 0, ((String) localObject1).length(), localRect);
    float f = this.recentTitleLayout.leftMargin;
    int i = this.recentTitleLayout.topMargin;
    int j = localRect.top;
    paramCanvas.drawText(
        (String) localObject1,
        f,
        (this.recentItemLayout.height - localRect.height()) / 2 + (i - j),
        (Paint) localObject2);
  }

  private void drawReminder(Canvas paramCanvas, float paramFloat1, float paramFloat2) {
    paramCanvas.drawCircle(
        this.remindLayout.width / 2 + paramFloat1,
        paramFloat2,
        this.remindLayout.width / 2,
        this.mHighlightPaint);
  }

  private void drawStateInfo(Canvas paramCanvas, int paramInt) {
    if (this.mNode.nodeName.equalsIgnoreCase("program")) {
      drawUpdateTime(
          paramCanvas,
          drawStateLabel(paramCanvas, paramInt),
          drawDurationTime(paramCanvas, paramInt),
          paramInt);
      drawTriangular(paramCanvas);
    }
  }

  private float drawStateLabel(Canvas paramCanvas, int paramInt) {
    int i;
    String str;
    if (this.mNode.nodeName.equalsIgnoreCase("program")) {
      i = ((ProgramNode) this.mNode).getCurrPlayStatus();
      switch (i) {
        default:
          str = "";
        case 1:
        case 2:
        case 3:
      }
    }
    while (true)
      if ((str == null) || (str.equalsIgnoreCase(""))) {
        return this.itemLayout.leftMargin;
        i = 3;
        break;
        str = "直播";
        this.mStatePaint.setColor(SkinManager.getTextColorHighlight2());
        continue;
        if (InfoManager.getInstance().root().mPersonalCenterNode.reserveNode.isExisted(this.mNode))
          ;
        for (str = "已预约"; ; str = "预约") {
          this.mStatePaint.setColor(SkinManager.getTextColorHighlight2());
          break;
        }
        return this.itemLayout.leftMargin;
      }
    this.mStatePaint.getTextBounds(str, 0, str.length(), this.textBound);
    paramCanvas.drawText(
        str,
        this.itemLayout.leftMargin + this.otherInfoLayout.leftMargin,
        this.otherInfoLayout.topMargin
            + paramInt
            + (this.otherInfoLayout.height - this.textBound.height()),
        this.mStatePaint);
    return this.itemLayout.leftMargin + this.otherInfoLayout.leftMargin + this.textBound.width();
  }

  private int drawTitle(Canvas paramCanvas) {
    if (this.mIsLiving) drawLivingLabel(paramCanvas);
    if (this.mRemind)
      drawReminder(
          paramCanvas,
          this.itemLayout.leftMargin + this.remindLayout.leftMargin,
          this.programLayout.topMargin + this.programLayout.height / 2);
    int i = paramCanvas.save();
    paramCanvas.translate(this.programLayout.leftMargin, this.programLayout.topMargin);
    this.mTitleLayout.draw(paramCanvas);
    paramCanvas.restoreToCount(i);
    return this.programLayout.topMargin + this.mTitleHeight;
  }

  private void drawTriangular(Canvas paramCanvas) {
    paramCanvas.drawBitmap(
        BitmapResourceCache.getInstance()
            .getResourceCacheByParent(getResources(), this.hash, 2130838038),
        null,
        this.mTriangularRect,
        this.mPaint);
  }

  private void drawUpdateTime(
      Canvas paramCanvas, float paramFloat1, float paramFloat2, int paramInt) {
    String str;
    if (this.mNode.nodeName.equalsIgnoreCase("program"))
      if (((ProgramNode) this.mNode).channelType == 1)
        str = getUpdateTimeString((ProgramNode) this.mNode);
    while (true)
      if (str == null) {
        return;
        if (((ProgramNode) this.mNode).getCurrPlayStatus() == 3)
          str = TimeUtil.msToDate5(((ProgramNode) this.mNode).getAbsoluteStartTime() * 1000L);
      } else {
        str =
            TextUtils.ellipsize(
                    str, this.mUpdateTimePaint, paramFloat2 - paramFloat1, TextUtils.TruncateAt.END)
                .toString();
        this.mUpdateTimePaint.getTextBounds(str, 0, str.length(), this.textBound);
        paramCanvas.drawText(
            str,
            this.otherInfoLayout.leftMargin + paramFloat1,
            this.otherInfoLayout.topMargin
                + paramInt
                + (this.otherInfoLayout.height - this.textBound.height()),
            this.mUpdateTimePaint);
        return;
        str = null;
      }
  }

  private void generateRect() {
    this.mTriangularRect.set(
        this.itemLayout.leftMargin
            + this.itemLayout.width
            - this.triangularLayout.leftMargin
            - this.triangularLayout.width,
        this.mItemHeight - this.triangularLayout.topMargin - this.triangularLayout.height,
        this.itemLayout.leftMargin + this.itemLayout.width - this.triangularLayout.leftMargin,
        this.mItemHeight - this.triangularLayout.topMargin);
    int i = (this.mItemHeight - this.livingLayout.height) / 2;
    this.mLivingRect.set(
        this.livingLayout.leftMargin,
        i,
        this.livingLayout.leftMargin + this.livingLayout.width,
        this.livingLayout.height + i);
  }

  private String getDurationTime(int paramInt) {
    int i = paramInt / 60;
    String str = "" + i + ":";
    paramInt %= 60;
    if (paramInt < 10) return str + "0" + paramInt;
    return str + paramInt;
  }

  private int getSelectedIndex() {
    if ((this.mNode != null)
        && (this.mNode.nodeName != null)
        && (this.mNode.nodeName.equalsIgnoreCase("playhistory"))
        && (this.mLastMotionX
            > this.recentItemLayout.width
                - this.recentCloseButtonLayout.leftMargin
                - this.recentCloseButtonLayout.width * 2)
        && (this.mLastMotionY > 0.0F)
        && (this.mLastMotionY < this.recentItemLayout.height)) return 2;
    if ((this.mLastMotionX
            > this.itemLayout.width
                - this.triangularLayout.leftMargin
                - this.triangularLayout.width * 2)
        && (this.mLastMotionY
            > this.mItemHeight
                - this.triangularLayout.topMargin
                - this.triangularLayout.height * 2)) return 1;
    return 0;
  }

  private int getThisHeight() {
    int i;
    if (this.mNode == null) {
      i = this.itemLayout.height;
      return i;
    }
    this.mIsLiving = isPlaying();
    this.mDownloadState =
        InfoManager.getInstance().root().mDownLoadInfoNode.hasDownLoad(this.mNode);
    String str = "";
    if (this.mNode.nodeName.equalsIgnoreCase("program")) {
      if (this.mRemind) str = "    " + ((ProgramNode) this.mNode).title;
    } else
      label102:
      if (!this.mIsLiving) break label238;
    label238:
    for (TextPaint localTextPaint = SkinManager.getInstance().getmHighlightTextPaint2();
        ;
        localTextPaint = SkinManager.getInstance().getNormalTextPaint()) {
      this.mTitleLayout =
          new StaticLayout(
              str,
              localTextPaint,
              this.itemLayout.width - this.programLayout.leftMargin,
              Layout.Alignment.ALIGN_NORMAL,
              1.2F,
              0.5F,
              false);
      this.mTitleHeight = this.mTitleLayout.getHeight();
      int j =
          this.programLayout.topMargin
              + this.mTitleHeight
              + this.otherInfoLayout.topMargin
              + this.otherInfoLayout.height;
      i = j;
      if (!this.mHasChannelName) break;
      return j + (this.channelnameLayout.height + this.channelnameLayout.topMargin);
      str = ((ProgramNode) this.mNode).title;
      break label102;
    }
  }

  private String getTitle() {
    if (this.mNode == null) return "";
    if (this.mNode.nodeName.equalsIgnoreCase("program")) return ((ProgramNode) this.mNode).title;
    if (this.mNode.nodeName.equalsIgnoreCase("channel")) return ((ChannelNode) this.mNode).title;
    return "";
  }

  private String getUpdateTimeString(ProgramNode paramProgramNode) {
    long l = paramProgramNode.getUpdateTime();
    if (this.mSameDay) {
      l = System.currentTimeMillis() - l;
      if (l <= 600000L) return "刚刚更新";
      int i = (int) (l / 1000L / 3600L);
      if (i > 0) return String.format(Locale.CHINA, "%d小时前", new Object[] {Integer.valueOf(i)});
      i = (int) (l / 1000L / 60L % 60L);
      if (i > 0) return String.format(Locale.CHINA, "%d分钟前", new Object[] {Integer.valueOf(i)});
      return "刚刚更新";
    }
    return TimeUtil.msToDate5(l);
  }

  private boolean isPlaying() {
    if (this.mNode == null) return false;
    Node localNode = InfoManager.getInstance().root().getCurrentPlayingNode();
    if (localNode == null) return false;
    if (!this.mNode.nodeName.equalsIgnoreCase(localNode.nodeName)) return false;
    return (this.mNode.nodeName.equalsIgnoreCase("program"))
        && (((ProgramNode) this.mNode).id == ((ProgramNode) localNode).id);
  }

  private boolean isSameDay() {
    if (this.mNode == null) return false;
    if ((this.mNode.nodeName.equalsIgnoreCase("program"))
        && (((ProgramNode) this.mNode).channelType == 1)) {
      long l = ((ProgramNode) this.mNode).getUpdateTime();
      Calendar localCalendar = Calendar.getInstance();
      int i = localCalendar.get(1);
      int j = localCalendar.get(6);
      localCalendar.setTimeInMillis(l);
      int k = localCalendar.get(1);
      int m = localCalendar.get(6);
      if ((i == k) && (j == m)) return true;
    }
    return false;
  }

  protected void onDraw(Canvas paramCanvas) {
    if (this.mNode == null) return;
    paramCanvas.setDrawFilter(this.filter);
    paramCanvas.save();
    if (this.mNode.nodeName.equalsIgnoreCase("playhistory")) drawRecentItem(paramCanvas);
    while (true) {
      paramCanvas.restore();
      return;
      drawNormalItem(paramCanvas);
    }
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.itemLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.lineLayout.scaleToBounds(this.itemLayout);
    this.programLayout.scaleToBounds(this.itemLayout);
    this.channelnameLayout.scaleToBounds(this.itemLayout);
    this.otherInfoLayout.scaleToBounds(this.itemLayout);
    this.triangularLayout.scaleToBounds(this.itemLayout);
    this.livingLayout.scaleToBounds(this.itemLayout);
    this.remindLayout.scaleToBounds(this.itemLayout);
    this.mChannelNamePaint.setTextSize(SkinManager.getInstance().getSubTextSize());
    this.mStatePaint.setTextSize(SkinManager.getInstance().getTeenyTinyTextSize());
    this.mDownloadStatePaint.setTextSize(SkinManager.getInstance().getTeenyTinyTextSize());
    this.mUpdateTimePaint.setTextSize(SkinManager.getInstance().getTeenyTinyTextSize());
    this.mTimePaint.setTextSize(SkinManager.getInstance().getTeenyTinyTextSize());
    this.mItemHeight = getThisHeight();
    generateRect();
    this.recentItemLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.recentIndicatorLayout.scaleToBounds(this.recentItemLayout);
    this.recentTitleLayout.scaleToBounds(this.recentItemLayout);
    this.recentCloseButtonLayout.scaleToBounds(this.recentItemLayout);
    this.recentLineLayout.scaleToBounds(this.recentItemLayout);
    if ((this.mNode != null) && (this.mNode.nodeName.equalsIgnoreCase("playhistory"))) {
      setMeasuredDimension(this.recentItemLayout.width, this.recentItemLayout.height);
      return;
    }
    setMeasuredDimension(this.itemLayout.width, this.mItemHeight);
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent) {
    if ((!this.mInTouchMode) && (paramMotionEvent.getAction() != 0)) ;
    do {
      do {
        do {
          return true;
          switch (paramMotionEvent.getAction()) {
            default:
              return true;
            case 0:
              this.mLastMotionX = paramMotionEvent.getX();
              this.mLastMotionY = paramMotionEvent.getY();
              this.mInTouchMode = true;
              this.mSelectedIndex = getSelectedIndex();
              invalidate();
              return true;
            case 2:
              this.mLastMotionX = paramMotionEvent.getX();
              this.mLastMotionY = paramMotionEvent.getY();
            case 3:
            case 1:
          }
        } while (getSelectedIndex() == this.mSelectedIndex);
        this.mSelectedIndex = -1;
        this.mInTouchMode = false;
      } while (!isItemPressed());
      invalidate();
      return true;
      this.mSelectedIndex = -1;
    } while (!isItemPressed());
    invalidate();
    return true;
    doClickEvent();
    return true;
  }

  public void setBelongToPodcasterInfo(boolean paramBoolean) {
    this.mBelongToPodcasterInfo = paramBoolean;
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("content")) {
      if (!(paramObject instanceof Node)) break label43;
      this.mNode = ((Node) paramObject);
      this.mSameDay = isSameDay();
      this.mHasChannelName = false;
    }
    label43:
    while (!(paramObject instanceof HashMap)) {
      requestLayout();
      return;
    }
    paramString = (HashMap) paramObject;
    this.mNode = ((Node) paramString.get("node"));
    if (((this.mNode instanceof ProgramNode))
        && (!TextUtils.isEmpty(((ProgramNode) this.mNode).getChannelName()))) ;
    for (this.mHasChannelName = true; ; this.mHasChannelName = false) {
      this.mSameDay = isSameDay();
      this.mRemind = ((Boolean) paramString.get("remind")).booleanValue();
      break;
    }
  }
}
Exemplo n.º 4
0
public class AccurateSeekView extends QtView implements ViewElement.OnElementClickListener {
  private static final String HOURFORMAT = "%02d:%02d:%02d";
  private final ViewLayout actionLayout =
      this.standardLayout.createChildLT(276, 140, 222, 40, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout iconLayout =
      this.actionLayout.createChildLT(56, 58, 41, 41, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout lineLayout =
      this.actionLayout.createChildLT(1, 100, 138, 20, ViewLayout.SCALE_FLAG_SLTCW);
  private ButtonViewElement mActionBg;
  private ButtonViewElement mBackwardElement;
  private ButtonViewElement mForwardElement;
  private TextViewElement mLeftTimeElement;
  private int mLeftTimeOffset = 0;
  private LineElement mLineElement;
  private TextViewElement mRightTimeElement;
  private ButtonViewElement mTimeBg;
  private final ViewLayout roundLayout =
      this.standardLayout.createChildLT(8, 8, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);
  private final ViewLayout timeLayout =
      this.standardLayout.createChildLT(440, 100, 140, 0, ViewLayout.SCALE_FLAG_SLTCW);

  public AccurateSeekView(Context paramContext) {
    super(paramContext);
    int i = hashCode();
    setBackgroundColor(-1728053248);
    this.mTimeBg = new ButtonViewElement(paramContext);
    this.mTimeBg.setBackgroundColor(-1728053248, -1728053248);
    this.mTimeBg.setRoundCorner(true);
    addElement(this.mTimeBg);
    this.mLeftTimeElement = new TextViewElement(paramContext);
    this.mLeftTimeElement.setColor(SkinManager.getTextColorHighlight());
    this.mLeftTimeElement.setAlignment(Layout.Alignment.ALIGN_OPPOSITE);
    this.mLeftTimeElement.setMaxLineLimit(1);
    addElement(this.mLeftTimeElement);
    this.mRightTimeElement = new TextViewElement(paramContext);
    this.mRightTimeElement.setColor(-1);
    this.mRightTimeElement.setMaxLineLimit(1);
    addElement(this.mRightTimeElement);
    this.mActionBg = new ButtonViewElement(paramContext);
    this.mActionBg.setRoundCorner(true);
    this.mActionBg.setBackgroundColor(-1, -1);
    addElement(this.mActionBg);
    this.mBackwardElement = new ButtonViewElement(paramContext);
    this.mBackwardElement.setBackground(2130837756, 2130837755);
    addElement(this.mBackwardElement, i);
    this.mBackwardElement.expandHotPot(ScreenType.getCustomExtraBound());
    this.mBackwardElement.setOnElementClickListener(this);
    this.mForwardElement = new ButtonViewElement(paramContext);
    this.mForwardElement.setBackground(2130837770, 2130837769);
    addElement(this.mForwardElement, i);
    this.mForwardElement.expandHotPot(ScreenType.getCustomExtraBound());
    this.mForwardElement.setOnElementClickListener(this);
    this.mLineElement = new LineElement(paramContext);
    this.mLineElement.setOrientation(0);
    this.mLineElement.setColor(SkinManager.getDividerColor());
    addElement(this.mLineElement);
  }

  private String durationToStr(int paramInt) {
    int i = paramInt / 3600;
    int j = paramInt / 60 % 60;
    int k = paramInt % 60;
    if (i < 0) return "";
    Locale localLocale = Locale.US;
    Object[] arrayOfObject = new Object[3];
    arrayOfObject[0] = Integer.valueOf(i);
    arrayOfObject[1] = Integer.valueOf(j);
    arrayOfObject[2] = Integer.valueOf(k);
    return String.format(localLocale, "%02d:%02d:%02d", arrayOfObject);
  }

  public void close(boolean paramBoolean) {
    BitmapResourceCache.getInstance().clearResourceCacheOfOne(this, 0);
    super.close(paramBoolean);
  }

  public void onElementClick(ViewElement paramViewElement) {
    dispatchActionEvent("extendDismissLength", null);
    if (paramViewElement == this.mBackwardElement)
      PlayProcessSyncUtil.getInstance().backwardThirtySeconds();
    while (paramViewElement != this.mForwardElement) return;
    PlayProcessSyncUtil.getInstance().forwardThirtySeconds();
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.standardLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.timeLayout.scaleToBounds(this.standardLayout);
    this.actionLayout.scaleToBounds(this.standardLayout);
    this.iconLayout.scaleToBounds(this.actionLayout);
    this.roundLayout.scaleToBounds(this.standardLayout);
    this.lineLayout.scaleToBounds(this.actionLayout);
    this.mActionBg.measure(
        this.actionLayout.leftMargin,
        this.standardLayout.height - this.actionLayout.getBottom(),
        this.actionLayout.getRight(),
        this.standardLayout.height - this.actionLayout.topMargin);
    int i = this.actionLayout.leftMargin;
    int j = this.mActionBg.getTopMargin();
    this.mBackwardElement.measure(
        i + this.iconLayout.leftMargin,
        j + this.iconLayout.topMargin,
        i + this.iconLayout.getRight(),
        j + this.iconLayout.getBottom());
    this.mLineElement.measure(
        i + this.lineLayout.leftMargin,
        j + this.lineLayout.topMargin,
        i + this.lineLayout.getRight(),
        j + this.lineLayout.getBottom());
    int k = this.standardLayout.width / 2;
    this.mForwardElement.measure(
        k + this.iconLayout.leftMargin,
        j + this.iconLayout.topMargin,
        k + this.iconLayout.getRight(),
        j + this.iconLayout.getBottom());
    int m = (this.standardLayout.height - this.timeLayout.height) / 2;
    this.mTimeBg.measure(
        this.timeLayout.leftMargin, m, this.timeLayout.getRight(), m + this.timeLayout.height);
    this.mLeftTimeElement.measure(
        this.timeLayout.leftMargin,
        m,
        this.standardLayout.width / 2 - this.roundLayout.width,
        m + this.timeLayout.height);
    this.mRightTimeElement.measure(
        this.standardLayout.width / 2, m, this.timeLayout.getRight(), m + this.timeLayout.height);
    this.mLeftTimeElement.setTextSize(SkinManager.getInstance().getLargeTextSize());
    this.mRightTimeElement.setTextSize(SkinManager.getInstance().getLargeTextSize());
    this.mTimeBg.setRoundCornerRadius(this.roundLayout.width);
    this.mActionBg.setRoundCornerRadius(this.roundLayout.width);
    super.onMeasure(paramInt1, paramInt2);
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("progresschanged")) {
      int k = ((Integer) paramObject).intValue();
      this.mLeftTimeElement.setText(durationToStr(k + this.mLeftTimeOffset));
    }
    do {
      return;
      if (paramString.equalsIgnoreCase("leftTimeOffset")) {
        this.mLeftTimeOffset = ((Integer) paramObject).intValue();
        return;
      }
      if (paramString.equalsIgnoreCase("rightTime")) {
        int j = ((Integer) paramObject).intValue();
        this.mRightTimeElement.setText("/" + durationToStr(j));
        return;
      }
    } while (!paramString.equalsIgnoreCase("progress"));
    int i = ((Integer) paramObject).intValue();
    this.mLeftTimeElement.setText(durationToStr(i + this.mLeftTimeOffset));
  }
}
Exemplo n.º 5
0
public class SearchItemShowView extends QtView {
  private final ViewLayout descLayout =
      this.itemLayout.createChildLT(480, 50, 208, 52, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout itemLayout =
      ViewLayout.createViewLayoutWithBoundsLT(
          720, 170, 720, 1200, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout lineLayout =
      this.itemLayout.createChildLT(640, 1, 40, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private ButtonViewElement mBg;
  private TextViewElement mInfo;
  private LineElement mLineElement;
  private TextViewElement mName;
  private SearchItemNode mNode;
  private NetImageViewElement mPic;
  private RatingElement mRatingElement;
  private final ViewLayout nameLayout =
      this.itemLayout.createChildLT(480, 50, 208, 12, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout picLayout =
      this.itemLayout.createChildLT(136, 136, 40, 17, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout ratingLayout =
      this.itemLayout.createChildLT(137, 30, 208, 118, ViewLayout.SCALE_FLAG_SLTCW);

  public SearchItemShowView(Context paramContext, int paramInt) {
    super(paramContext);
    this.mBg = new ButtonViewElement(paramContext);
    this.mBg.setBackgroundColor(
        SkinManager.getItemHighlightMaskColor(), SkinManager.getCardColor());
    addElement(this.mBg);
    this.mBg.setOnElementClickListener(
        new ViewElement.OnElementClickListener() {
          public void onElementClick(ViewElement paramAnonymousViewElement) {
            if (InfoManager.getInstance().root().mSearchNode.getVoiceSearch()) {
              InfoManager.getInstance().root().mSearchNode.setVoiceSearch(false);
              QTMSGManage.getInstance()
                  .sendStatistcsMessage("VoiceRecognition", "voice_search_click");
            }
            InputMethodUtil.hideSoftInput(SearchItemShowView.this);
            ControllerManager.getInstance()
                .redirectToViewBySearchNode(SearchItemShowView.this.mNode);
          }
        });
    this.mPic = new NetImageViewElement(paramContext);
    this.mPic.setDefaultImageRes(2130837930);
    this.mPic.setBoundColor(SkinManager.getDividerColor());
    addElement(this.mPic, paramInt);
    this.mName = new TextViewElement(paramContext);
    this.mName.setMaxLineLimit(1);
    this.mName.setColor(SkinManager.getTextColorNormal());
    addElement(this.mName);
    this.mInfo = new TextViewElement(paramContext);
    this.mInfo.setMaxLineLimit(1);
    this.mInfo.setColor(SkinManager.getTextColorSubInfo());
    addElement(this.mInfo);
    this.mRatingElement = new RatingElement(paramContext);
    addElement(this.mRatingElement, paramInt);
    this.mLineElement = new LineElement(paramContext);
    this.mLineElement.setColor(SkinManager.getDividerColor());
    this.mLineElement.setOrientation(1);
    addElement(this.mLineElement);
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.itemLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.ratingLayout.scaleToBounds(this.itemLayout);
    this.picLayout.scaleToBounds(this.itemLayout);
    this.nameLayout.scaleToBounds(this.itemLayout);
    this.descLayout.scaleToBounds(this.itemLayout);
    this.lineLayout.scaleToBounds(this.itemLayout);
    this.mBg.measure(this.itemLayout);
    this.mPic.measure(this.picLayout);
    this.mPic.setBoundLineWidth(this.lineLayout.height);
    this.mName.measure(this.nameLayout);
    this.mInfo.measure(this.descLayout);
    this.mRatingElement.measure(this.ratingLayout);
    this.mLineElement.measure(
        this.lineLayout.leftMargin,
        this.itemLayout.height - this.lineLayout.height,
        this.lineLayout.getRight(),
        this.itemLayout.height);
    this.mName.setTextSize(SkinManager.getInstance().getNormalTextSize());
    this.mInfo.setTextSize(SkinManager.getInstance().getMiddleTextSize());
    setMeasuredDimension(this.itemLayout.width, this.itemLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("content")) {
      this.mNode = ((SearchItemNode) paramObject);
      this.mPic.setImageUrl(this.mNode.cover);
      this.mName.setText(this.mNode.name);
      this.mRatingElement.setRating(this.mNode.star);
      this.mInfo.setText(this.mNode.desc);
    }
    while (!paramString.equalsIgnoreCase("nbl")) return;
    boolean bool = ((Boolean) paramObject).booleanValue();
    paramString = this.mLineElement;
    if (bool) ;
    for (int i = 0; ; i = 4) {
      paramString.setVisible(i);
      return;
    }
  }
}
Exemplo n.º 6
0
public class ChatInviteView extends QtListItemView {
  private final int EMPTY = 20;
  private final int[] PLATFORM_ICONS = {
    2130837973, 2130837968, 2130837970, 2130837969, 2130837971, 2130837972
  };
  private final String[] PLATFORM_NAMES = {"微信", "朋友圈", "QQ空间", "QQ好友", "新浪微博", "腾讯微博"};
  private final String TITLE = "邀请好友一起收听";
  private final ViewLayout iconLayout =
      this.itemLayout.createChildLT(120, 120, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout itemLayout =
      this.standardLayout.createChildLT(180, 200, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private Rect mIconRect = new Rect();
  private boolean mInTouchMode = false;
  private float mLastMotionX = 0.0F;
  private float mLastMotionY = 0.0F;
  private final Paint mNamePaint = new Paint();
  private final Paint mPaint = new Paint();
  private int mSelectIndex = -1;
  private Rect mTextBound = new Rect();
  private final Paint mTitlePaint = new Paint();
  private final ViewLayout nameLayout =
      this.itemLayout.createChildLT(180, 45, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);
  private final ViewLayout titleLayout =
      this.standardLayout.createChildLT(720, 80, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);

  public ChatInviteView(Context paramContext) {
    super(paramContext);
    setItemSelectedEnable();
    this.mNamePaint.setColor(SkinManager.getTextColorNormal());
    this.mTitlePaint.setColor(SkinManager.getTextColorNormal());
    this.mTitlePaint.setTextSize(SkinManager.getInstance().getSubTextSize());
  }

  private void drawBg(Canvas paramCanvas) {
    int i = paramCanvas.save();
    paramCanvas.clipRect(
        0, getTopMargin(), this.standardLayout.width, getTopMargin() + getThisHeight());
    paramCanvas.drawColor(-1);
    paramCanvas.restoreToCount(i);
  }

  private void drawHighlight(Canvas paramCanvas, int paramInt1, int paramInt2) {
    int i = paramCanvas.save();
    paramCanvas.clipRect(
        paramInt1,
        paramInt2,
        paramInt1 + this.itemLayout.width,
        paramInt2 + this.itemLayout.height);
    paramCanvas.drawColor(SkinManager.getItemHighlightMaskColor());
    paramCanvas.restoreToCount(i);
  }

  private void drawItem(Canvas paramCanvas, int paramInt1, int paramInt2, int paramInt3) {
    this.mIconRect.offset(paramInt1, paramInt2);
    paramCanvas.drawBitmap(
        BitmapResourceCache.getInstance()
            .getResourceCache(getResources(), this, this.PLATFORM_ICONS[paramInt3]),
        null,
        this.mIconRect,
        this.mPaint);
    String str = this.PLATFORM_NAMES[paramInt3];
    this.mNamePaint.getTextBounds(str, 0, str.length(), this.mTextBound);
    paramCanvas.drawText(
        str,
        paramInt1 + (this.itemLayout.width - this.mTextBound.width()) / 2,
        this.mIconRect.bottom
            + (this.nameLayout.height - this.mTextBound.top - this.mTextBound.bottom) / 2,
        this.mNamePaint);
    this.mIconRect.offset(-paramInt1, -paramInt2);
  }

  private void drawItems(Canvas paramCanvas) {
    int i = 0;
    if (i < 6) {
      int j = this.itemLayout.width * (i % 4);
      int k = getTopMargin() + this.titleLayout.height;
      int m = this.itemLayout.height;
      if (i < 4) ;
      for (int n = 0; ; n = 1) {
        int i1 = k + n * m;
        if ((isItemPressed()) && (this.mSelectIndex == i)) drawHighlight(paramCanvas, j, i1);
        drawItem(paramCanvas, j, i1, i);
        i++;
        break;
      }
    }
  }

  private void drawTitle(Canvas paramCanvas) {
    this.mTitlePaint.getTextBounds("邀请好友一起收听", 0, "邀请好友一起收听".length(), this.mTextBound);
    paramCanvas.drawText(
        "邀请好友一起收听",
        (this.standardLayout.width - this.mTextBound.width()) / 2,
        getTopMargin()
            + (this.titleLayout.height - this.mTextBound.top - this.mTextBound.bottom) / 2,
        this.mTitlePaint);
  }

  private int getSelectIndex() {
    if (this.mLastMotionY < getTopMargin()) ;
    int k;
    do {
      int i;
      int j;
      do {
        return -1;
        if ((this.mLastMotionY > getTopMargin())
            && (this.mLastMotionY < getTopMargin() + this.titleLayout.height)) return 20;
        i = (int) Math.floor(this.mLastMotionX / this.itemLayout.width);
        j =
            (int)
                Math.floor(
                    (this.mLastMotionY - getTopMargin() - this.titleLayout.height)
                        / this.itemLayout.height);
      } while ((i < 0) || (j < 0));
      k = i + j * 4;
    } while (k > this.PLATFORM_NAMES.length);
    return k;
  }

  private int getThisHeight() {
    int i = this.PLATFORM_NAMES.length;
    int j = i / 4;
    if (i % 4 == 0) ;
    for (int k = 0; ; k = 1) return (k + j) * this.itemLayout.height + this.titleLayout.height;
  }

  private int getTopMargin() {
    return 0;
  }

  public void close(boolean paramBoolean) {
    BitmapResourceCache.getInstance().clearResourceCacheOfOne(this, 0);
    super.close(paramBoolean);
  }

  protected void onDraw(Canvas paramCanvas) {
    paramCanvas.setDrawFilter(SkinManager.getInstance().getDrawFilter());
    paramCanvas.save();
    drawBg(paramCanvas);
    drawTitle(paramCanvas);
    drawItems(paramCanvas);
    paramCanvas.restore();
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.standardLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.itemLayout.scaleToBounds(this.standardLayout);
    this.iconLayout.scaleToBounds(this.itemLayout);
    this.nameLayout.scaleToBounds(this.itemLayout);
    this.titleLayout.scaleToBounds(this.standardLayout);
    this.mNamePaint.setTextSize(SkinManager.getInstance().getSubTextSize());
    int i = (this.itemLayout.height - this.iconLayout.height - this.nameLayout.height) / 2;
    this.mIconRect.set(
        (this.itemLayout.width - this.iconLayout.width) / 2,
        i,
        (this.itemLayout.width + this.iconLayout.width) / 2,
        i + this.iconLayout.height);
    setMeasuredDimension(this.standardLayout.width, getThisHeight());
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent) {
    if ((!this.mInTouchMode) && (paramMotionEvent.getAction() != 0)) ;
    do {
      do {
        int i;
        do {
          return true;
          switch (paramMotionEvent.getAction()) {
            default:
              return true;
            case 0:
              this.mLastMotionX = paramMotionEvent.getX();
              this.mLastMotionY = paramMotionEvent.getY();
              this.mSelectIndex = getSelectIndex();
              if (this.mSelectIndex < 0) {
                this.mInTouchMode = false;
                dispatchActionEvent("cancelPop", null);
                return true;
              }
              this.mInTouchMode = true;
              invalidate();
              return true;
            case 2:
              this.mLastMotionX = paramMotionEvent.getX();
              this.mLastMotionY = paramMotionEvent.getY();
              i = getSelectIndex();
            case 3:
            case 1:
          }
        } while ((this.mSelectIndex <= -1) || (i == this.mSelectIndex));
        this.mInTouchMode = false;
        this.mSelectIndex = -1;
      } while (!isItemPressed());
      invalidate();
      return true;
      this.mInTouchMode = false;
      this.mSelectIndex = -1;
    } while (!isItemPressed());
    invalidate();
    return true;
    if ((this.mSelectIndex > -1) && (this.mSelectIndex < this.PLATFORM_NAMES.length)) {
      MobclickAgent.onEvent(getContext(), "ChatroomInvite", this.PLATFORM_NAMES[this.mSelectIndex]);
      dispatchActionEvent("shareToPlatform", Integer.valueOf(this.mSelectIndex));
      ShareUtil.inviteByPlatform(
          getContext(),
          InfoManager.getInstance().root().getCurrentPlayingNode(),
          this.mSelectIndex);
    }
    this.mInTouchMode = false;
    invalidate();
    return true;
  }
}
Exemplo n.º 7
0
public class ImChatMainView extends ViewGroupViewImpl
  implements IEventHandler, RootNode.IInfoUpdateEventListener, BaseUserInfoPool.OnBaseUserinfoPutListener
{
  public static final String ADD_HISTORY = "addhistory";
  public static final String ADD_MESSAGE = "addmessage";
  public static final String ADD_MESSAGES = "addMessages";
  private static final String[] CONTENTS = { "虽然这里有上千个主播,百万的节目,一天二十四小时不断更新,但我还是觉得@%s 的节目最有趣,献朵小花支持你!你又支持谁?下载链接:http://qingting.fm/app/download_xiaoyuan", "分享一个@蜻蜓FM 的群组%s,边听节目边聊天真的好欢乐~蜻蜓FM,倾听世界的声音。下载链接:http://qingting.fm/app/download_zazhi", "报告大家!发现一个新功能,只要使用@蜻蜓FM 收听【%s】就可以在群组里和%s全国各地的听众聊天啦!赶紧来【%s】群里和大家一起贫吧!下载请戳:http://qingting.fm/app/download_xiaoyuan2014", "用了@蜻蜓FM 才知道原来声音的世界也那么精彩~小说,音乐,娱乐八卦甚至还有全国的校园电台,一天二十四小时听不完的节目!和全国听友边听边聊还能和电台主播们实时互动,新时代的电台就是这么拽!下载链接:http://qingting.fm/app/download_quange" };
  private static final int NORMAL = 0;
  private static final int SHOWINGEXPRESSION = 1;
  private static final int SHOWINGINVITE = 2;
  private static final int SHOWINGMORE = 3;
  private final long TIME_INTERVAL = 1800L;
  private final ViewLayout bottomLayout = this.standardLayout.createChildLT(720, 106, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout chatMemberLayout = this.standardLayout.createChildLT(720, 380, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout checkinLayout = this.standardLayout.createChildLT(156, 74, 564, 130, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout headerLayout = this.standardLayout.createChildLT(720, 256, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private boolean isInputShowing = false;
  private ChatActionsView mActionsView;
  private ImChatAdapter mAdapter;
  private HashSet<String> mAdmins = new HashSet();
  private Calendar mCalendar;
  private Button mCheckinButton;
  private List<ChatItem> mDatas = new ArrayList();
  private int mDay;
  private ExpressionView mExpressionView;
  private IChatAdapterIViewFactory mFactory;
  private ImChatHeadView mHeadView;
  private ImChatInputView mInputView;
  private ImChatInviteView mInviteView;
  private UserActionView mJoinView;
  private long mLastTimestamp = 0L;
  private LinearLayout mListContainer;
  private PullToRefreshListView mListView;
  private boolean mLoading = false;
  private IMMessage mMessage;
  private long mOldestMsgSeq = 0L;
  private long mOldestTimeStamp = 0L;
  private boolean mTalkingBlocked = false;
  private GroupInfo mTalkingGroupInfo;
  private String mTalkingId;
  private UserInfo mTalkingUserInfo;
  private int mViewState = 0;
  private int normalLayoutHeight = 0;
  private int specialLayoutHeight = -1;
  private final ViewLayout standardLayout = ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);

  public ImChatMainView(Context paramContext)
  {
    super(paramContext);
    setBackgroundColor(-1118482);
    this.mFactory = new IChatAdapterIViewFactory()
    {
      public IView createView(int paramAnonymousInt)
      {
        switch (paramAnonymousInt)
        {
        default:
          return null;
        case 16:
          return new ImChatItemLeftView(ImChatMainView.this.getContext(), this.val$hash, true);
        case 0:
          return new ImChatItemRightView(ImChatMainView.this.getContext(), this.val$hash);
        case 32:
        }
        return new ChatroomTimestampView(ImChatMainView.this.getContext());
      }
    };
    this.mAdapter = new ImChatAdapter(this.mDatas, this.mFactory);
    this.mListContainer = ((LinearLayout)LayoutInflater.from(paramContext).inflate(2130903040, null));
    this.mListView = ((PullToRefreshListView)this.mListContainer.findViewById(2131230731));
    this.mListView.setVerticalScrollBarEnabled(false);
    this.mListView.setVerticalFadingEdgeEnabled(false);
    this.mListView.setSelector(17170445);
    addView(this.mListContainer);
    this.mListView.setAdapter(this.mAdapter);
    this.mListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener()
    {
      public void onRefresh(PullToRefreshBase<ListView> paramAnonymousPullToRefreshBase)
      {
        String str = DateUtils.formatDateTime(ImChatMainView.this.getContext(), System.currentTimeMillis(), 524305);
        paramAnonymousPullToRefreshBase.getLoadingLayoutProxy().setLastUpdatedLabel(str);
        new ImChatMainView.GetDataTask(ImChatMainView.this, null).execute(new Void[0]);
      }
    });
    this.mHeadView = new ImChatHeadView(paramContext);
    addView(this.mHeadView);
    this.mHeadView.setEventHandler(this);
    this.mInputView = new ImChatInputView(paramContext);
    addView(this.mInputView);
    this.mInputView.setEventHandler(this);
    this.mActionsView = new ChatActionsView(paramContext);
    this.mActionsView.setEventHandler(this);
    addView(this.mActionsView);
    this.mExpressionView = new ExpressionView(paramContext);
    this.mExpressionView.setEventHandler(this);
    addView(this.mExpressionView);
    this.mInviteView = new ImChatInviteView(paramContext);
    this.mInviteView.setEventHandler(this);
    addView(this.mInviteView);
    this.mCheckinButton = new Button(paramContext);
    this.mCheckinButton.setBackgroundResource(2130837574);
    this.mCheckinButton.setText("签到");
    addView(this.mCheckinButton);
    this.mCheckinButton.setTextColor(-1);
    this.mCheckinButton.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        ImChatMainView.this.checkIn();
      }
    });
    this.mJoinView = new UserActionView(paramContext);
    this.mJoinView.update("setData", "加入群聊");
    addView(this.mJoinView);
    this.mJoinView.setEventHandler(this);
    this.mJoinView.setVisibility(8);
    resetBaseTime();
    BaseUserInfoPool.addListener(this);
  }

  private void actualCheckin()
  {
    if (this.mTalkingGroupInfo == null)
      return;
    if (!IMContacts.getInstance().hasWatchedGroup(this.mTalkingId))
      InfoManager.getInstance().getUserProfile().followGroup(this.mTalkingId);
    String str1 = "";
    List localList = this.mTalkingGroupInfo.lstAdmins;
    int i;
    Object localObject;
    UserInfo localUserInfo;
    String str6;
    String str4;
    if ((localList != null) && (localList.size() > 0))
    {
      i = 0;
      localObject = str1;
      if (i < localList.size())
      {
        localUserInfo = (UserInfo)localList.get(i);
        if ((localUserInfo instanceof AdminInfo))
        {
          str6 = ((AdminInfo)localUserInfo).weiboName;
          if ((str6 != null) && (str6.length() != 0))
            break label290;
          str4 = localUserInfo.snsInfo.sns_name;
        }
      }
    }
    while (true)
    {
      String str5 = (String)localObject + "@" + str4 + " ";
      i++;
      localObject = str5;
      break;
      str4 = localUserInfo.snsInfo.sns_name;
      continue;
      str1 = (String)localObject + "还有";
      Locale localLocale = Locale.CHINESE;
      String str2 = CONTENTS[2];
      Object[] arrayOfObject = new Object[3];
      arrayOfObject[0] = this.mTalkingGroupInfo.groupName;
      arrayOfObject[1] = str1;
      arrayOfObject[2] = this.mTalkingGroupInfo.groupName;
      String str3 = String.format(localLocale, str2, arrayOfObject);
      sendMessage("签个到,大家好呀~~", 1);
      QTMSGManage.getInstance().sendStatistcsMessage("im_checkin");
      ShareUtil.shareToPlatform(str3, 8, 9);
      return;
      label290: str4 = str6;
    }
  }

  private void actualFlowerToUser(UserInfo paramUserInfo)
  {
    if (!IMContacts.getInstance().hasWatchedGroup(this.mTalkingId))
      InfoManager.getInstance().getUserProfile().followGroup(this.mTalkingId);
    if ((paramUserInfo instanceof AdminInfo))
    {
      str1 = ((AdminInfo)paramUserInfo).weiboName;
      if ((str1 != null) && (str1.length() != 0));
    }
    for (String str1 = paramUserInfo.snsInfo.sns_name; ; str1 = paramUserInfo.snsInfo.sns_name)
    {
      String str2 = String.format(Locale.CHINESE, CONTENTS[0], new Object[] { str1 });
      QTMSGManage.getInstance().sendStatistcsMessage("im_flower");
      ShareUtil.shareToPlatform(str2, 10, 11);
      return;
    }
  }

  private void actualSendMessage(String paramString, int paramInt)
  {
    int i = 4;
    if (this.mLoading)
    {
      this.mDatas.clear();
      this.mLoading = false;
    }
    String str = InfoManager.getInstance().getUserProfile().getUserKey();
    if (ChatMode.isGroup())
    {
      if ((IMAgent.getInstance().isCheckin(paramInt)) && (this.mTalkingGroupInfo != null) && (!IMAgent.getInstance().hasCheckIn(this.mTalkingGroupInfo.groupId)))
        paramString = IMAgent.getInstance().getCheckinText();
      IMAgent.getInstance().sendGroupMsg(paramString, this.mTalkingGroupInfo, paramInt);
      IMMessage localIMMessage2 = new IMMessage();
      localIMMessage2.mMessage = paramString;
      localIMMessage2.chatType = 1;
      localIMMessage2.publish = (System.currentTimeMillis() / 1000L);
      long l2 = localIMMessage2.publish;
      if (l2 - this.mLastTimestamp >= 1800L)
      {
        this.mDatas.add(new ChatItem(32, getTimestampBySecond(l2)));
        this.mLastTimestamp = l2;
      }
      List localList2 = this.mDatas;
      if (isAdmin(str));
      while (true)
      {
        localList2.add(new ChatItem(i, localIMMessage2));
        IMContacts.getInstance().addRecentContacts(this.mTalkingGroupInfo);
        this.mAdapter.notifyDataSetChanged();
        return;
        i = 1;
      }
    }
    if (this.mTalkingBlocked)
    {
      Toast.makeText(getContext(), "该账号已经被举报,无法接收消息", 1).show();
      return;
    }
    IMAgent.getInstance().sendUserMsg(paramString, this.mTalkingUserInfo, paramInt);
    IMMessage localIMMessage1 = new IMMessage();
    localIMMessage1.mMessage = paramString;
    localIMMessage1.chatType = 0;
    localIMMessage1.publish = (System.currentTimeMillis() / 1000L);
    long l1 = localIMMessage1.publish;
    if (l1 - this.mLastTimestamp >= 1800L)
    {
      this.mDatas.add(new ChatItem(32, getTimestampBySecond(l1)));
      this.mLastTimestamp = l1;
    }
    List localList1 = this.mDatas;
    if (isAdmin(str));
    while (true)
    {
      localList1.add(new ChatItem(i, localIMMessage1));
      IMContacts.getInstance().addRecentContacts(this.mTalkingUserInfo);
      break;
      i = 1;
    }
  }

  private final void actualShareGroup()
  {
    if (this.mTalkingGroupInfo == null)
      return;
    Locale localLocale = Locale.CHINESE;
    String str1 = CONTENTS[1];
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = this.mTalkingGroupInfo.groupName;
    String str2 = String.format(localLocale, str1, arrayOfObject);
    QTMSGManage.getInstance().sendStatistcsMessage("im_share");
    ShareUtil.shareToPlatform(str2, 1, 2);
  }

  private void addHistoryMessages(List<IMMessage> paramList)
  {
    String str = InfoManager.getInstance().getUserProfile().getUserKey();
    int i;
    int j;
    int k;
    long l1;
    int m;
    label41: IMMessage localIMMessage;
    boolean bool2;
    int n;
    label152: long l2;
    if (this.mDatas.size() == 0)
    {
      i = 1;
      j = paramList.size();
      k = 0;
      l1 = 0L;
      m = 0;
      if (m >= j)
        break label275;
      localIMMessage = (IMMessage)paramList.get(m);
      if (m == 0)
      {
        this.mOldestMsgSeq = localIMMessage.msgSeq;
        long l3 = localIMMessage.publish;
        if ((i == 0) && (l3 > this.mOldestTimeStamp - 1800L))
          this.mDatas.remove(0);
        this.mOldestTimeStamp = l3;
      }
      boolean bool1 = TextUtils.equals(str, localIMMessage.mFromID);
      bool2 = isAdmin(localIMMessage.mFromID);
      if (!bool1)
        break label256;
      if (!bool2)
        break label250;
      n = 4;
      l2 = localIMMessage.publish;
      if (l2 - l1 < 1800L)
        break label337;
      this.mDatas.add(m + k, new ChatItem(32, getTimestampBySecond(l2)));
    }
    for (int i1 = k + 1; ; i1 = k)
    {
      this.mDatas.add(m + i1, new ChatItem(n, localIMMessage));
      m++;
      k = i1;
      l1 = l2;
      break label41;
      i = 0;
      break;
      label250: n = 1;
      break label152;
      label256: if (bool2)
      {
        n = 20;
        break label152;
      }
      n = 17;
      break label152;
      label275: this.mAdapter.notifyDataSetChanged();
      this.mListView.onRefreshComplete();
      if (i != 0)
      {
        if (this.mLastTimestamp < l1)
          this.mLastTimestamp = l1;
        this.mListView.setSelection(this.mAdapter.getCount());
        return;
      }
      this.mListView.setSelection(j + k);
      return;
      label337: l2 = l1;
    }
  }

  private void changeChatMode()
  {
    switch (ChatMode.getCurrentMode())
    {
    default:
    case 0:
    case 1:
    }
    while (true)
    {
      this.mInputView.update("changeMode", null);
      return;
      this.mCheckinButton.setVisibility(8);
      this.mJoinView.setVisibility(8);
      continue;
      this.mCheckinButton.setVisibility(0);
      this.mJoinView.setVisibility(8);
    }
  }

  private void checkIn()
  {
    if (!CloudCenter.getInstance().isLogin())
    {
      CloudCenter.OnLoginEventListerner local7 = new CloudCenter.OnLoginEventListerner()
      {
        public void onLoginFailed(int paramAnonymousInt)
        {
        }

        public void onLoginSuccessed(int paramAnonymousInt)
        {
          ImChatMainView.this.actualCheckin();
        }
      };
      EventDispacthManager.getInstance().dispatchAction("showLogin", local7);
      return;
    }
    actualCheckin();
  }

  private void flowerToUser(final UserInfo paramUserInfo)
  {
    if (!CloudCenter.getInstance().isLogin())
    {
      CloudCenter.OnLoginEventListerner local8 = new CloudCenter.OnLoginEventListerner()
      {
        public void onLoginFailed(int paramAnonymousInt)
        {
        }

        public void onLoginSuccessed(int paramAnonymousInt)
        {
          ImChatMainView.this.actualFlowerToUser(paramUserInfo);
          ImChatMainView.this.mJoinView.setVisibility(8);
        }
      };
      EventDispacthManager.getInstance().dispatchAction("showLogin", local8);
      return;
    }
    actualFlowerToUser(paramUserInfo);
  }

  private int getActionsOffset()
  {
    if (this.mViewState == 3)
      return this.mActionsView.getMeasuredHeight();
    return 0;
  }

  private int getExpressionOffset()
  {
    if (this.mViewState == 1)
      return this.mExpressionView.getMeasuredHeight();
    return 0;
  }

  private int getInputOffset()
  {
    if (this.isInputShowing)
      return 0;
    switch (this.mViewState)
    {
    default:
      return 0;
    case 1:
      return this.mExpressionView.getMeasuredHeight();
    case 3:
      return this.mActionsView.getMeasuredHeight();
    case 2:
    }
    return this.mInviteView.getMeasuredHeight();
  }

  private int getInviteOffset()
  {
    if (this.mViewState == 2)
      return this.mInviteView.getMeasuredHeight();
    return 0;
  }

  private String getTimeInDay(int paramInt1, int paramInt2)
  {
    String str;
    if (paramInt1 < 6)
      str = "凌晨";
    while (true)
    {
      Locale localLocale = Locale.CHINESE;
      Object[] arrayOfObject = new Object[3];
      arrayOfObject[0] = str;
      arrayOfObject[1] = Integer.valueOf(paramInt1);
      arrayOfObject[2] = Integer.valueOf(paramInt2);
      return String.format(localLocale, "%s%02d:%02d", arrayOfObject);
      if (paramInt1 < 12)
        str = "早上";
      else if (paramInt1 < 13)
        str = "中午";
      else if (paramInt1 < 18)
        str = "下午";
      else
        str = "晚上";
    }
  }

  private String getTimestampBySecond(long paramLong)
  {
    int i = 11;
    this.mCalendar.setTimeInMillis(1000L * paramLong);
    int j = this.mCalendar.get(6);
    int k = this.mCalendar.get(i);
    int m = this.mCalendar.get(12);
    if (j == this.mDay)
      return getTimeInDay(k, m);
    if (j == -1 + this.mDay)
      return "昨天 " + getTimeInDay(k, m);
    int n = this.mCalendar.get(2);
    int i1 = this.mCalendar.get(5);
    if (i1 == 12);
    while (true)
    {
      Locale localLocale = Locale.CHINESE;
      Object[] arrayOfObject = new Object[3];
      arrayOfObject[0] = Integer.valueOf(n + 1);
      arrayOfObject[1] = Integer.valueOf(i);
      arrayOfObject[2] = getTimeInDay(k, m);
      return String.format(localLocale, "%d月%d日 %s", arrayOfObject);
      i = i1;
    }
  }

  private void invalidateAvatar(String paramString)
  {
    int i = this.mListView.getListChildCnt();
    for (int j = 0; j < i; j++)
    {
      View localView = this.mListView.getListChildAt(j);
      if ((localView != null) && ((localView instanceof IView)))
        ((IView)localView).update("invalidateAvatar", paramString);
    }
  }

  private void invite(int paramInt)
  {
    QTMSGManage.getInstance().sendStatistcsMessage("im_invite", String.valueOf(paramInt));
    ShareUtil.inviteByPlatformIm(getContext(), paramInt, CONTENTS[3]);
  }

  private boolean isAdmin(String paramString)
  {
    return this.mAdmins.contains(paramString);
  }

  private void layoutViews(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    int i = this.mHeadView.getMeasuredHeight();
    int j = ScreenType.getNaviHeight() / 2;
    int k = this.standardLayout.height;
    int m = this.mInputView.getMeasuredHeight();
    if (this.isInputShowing)
      try
      {
        this.mListContainer.layout(0, i, this.standardLayout.width, k - m);
        this.mHeadView.layout(0, 0, this.standardLayout.width, i);
        this.mInputView.layout(0, k - m, this.standardLayout.width, k);
        this.mJoinView.layout(0, k - m, this.standardLayout.width, k);
        this.mExpressionView.layout(0, k, this.standardLayout.width, k + this.chatMemberLayout.height);
        this.mActionsView.layout(0, k, this.standardLayout.width, k + this.mActionsView.getMeasuredHeight());
        this.mInviteView.layout(0, k, this.standardLayout.width, k + this.mInviteView.getMeasuredHeight());
        this.mCheckinButton.layout(this.checkinLayout.leftMargin, i + j, this.checkinLayout.getRight(), i + j + this.checkinLayout.height);
        return;
      }
      catch (IllegalStateException localIllegalStateException2)
      {
        while (true)
          localIllegalStateException2.printStackTrace();
      }
    int n = getInputOffset();
    try
    {
      this.mListContainer.layout(0, i, this.standardLayout.width, k - m - n);
      this.mHeadView.layout(0, 0, this.standardLayout.width, i);
      this.mInputView.layout(0, k - m - n, this.standardLayout.width, k - n);
      this.mJoinView.layout(0, k - m - n, this.standardLayout.width, k - n);
      int i1 = getExpressionOffset();
      this.mExpressionView.layout(0, k - i1, this.standardLayout.width, k + this.mExpressionView.getMeasuredHeight() - i1);
      int i2 = getActionsOffset();
      this.mActionsView.layout(0, k - i2, this.standardLayout.width, k + this.mActionsView.getMeasuredHeight() - i2);
      int i3 = getInviteOffset();
      this.mInviteView.layout(0, k - i3, this.standardLayout.width, k + this.mInviteView.getMeasuredHeight() - i3);
      this.mCheckinButton.layout(this.checkinLayout.leftMargin, i + j, this.checkinLayout.getRight(), i + j + this.checkinLayout.height);
      return;
    }
    catch (IllegalStateException localIllegalStateException1)
    {
      while (true)
        localIllegalStateException1.printStackTrace();
    }
  }

  private void loadMoreHistory()
  {
    dispatchActionEvent("loadMore", Long.valueOf(this.mOldestMsgSeq));
  }

  private void resetBaseTime()
  {
    if (this.mCalendar == null)
      this.mCalendar = Calendar.getInstance();
    this.mCalendar.setTimeInMillis(System.currentTimeMillis());
    this.mDay = this.mCalendar.get(6);
  }

  private void sendMessage(String paramString, int paramInt)
  {
    if ((ChatMode.isGroup()) && (!IMContacts.getInstance().hasWatchedGroup(this.mTalkingId)))
      InfoManager.getInstance().getUserProfile().followGroup(this.mTalkingId);
    actualSendMessage(paramString, paramInt);
  }

  private void shareGroup()
  {
    if (!CloudCenter.getInstance().isLogin())
    {
      CloudCenter.OnLoginEventListerner local6 = new CloudCenter.OnLoginEventListerner()
      {
        public void onLoginFailed(int paramAnonymousInt)
        {
        }

        public void onLoginSuccessed(int paramAnonymousInt)
        {
          ImChatMainView.this.actualShareGroup();
        }
      };
      EventDispacthManager.getInstance().dispatchAction("showLogin", local6);
      return;
    }
    actualShareGroup();
  }

  public void close(boolean paramBoolean)
  {
    this.mInputView.close(paramBoolean);
    this.mHeadView.close(paramBoolean);
    this.mActionsView.close(paramBoolean);
    this.mInviteView.close(paramBoolean);
    BitmapResourceCache.getInstance().clearResourceCacheOfOne(this, 0);
    BaseUserInfoPool.removeListener(this);
    super.close(paramBoolean);
  }

  public boolean dispatchKeyEvent(KeyEvent paramKeyEvent)
  {
    if ((!this.isInputShowing) && (this.mViewState == 1))
    {
      if ((paramKeyEvent.getKeyCode() == 4) && (paramKeyEvent.getAction() == 1))
      {
        this.mViewState = 0;
        requestLayout();
        return true;
      }
    }
    else if ((!this.isInputShowing) && (this.mViewState == 2) && (paramKeyEvent.getKeyCode() == 4) && (paramKeyEvent.getAction() == 1))
    {
      this.mViewState = 0;
      requestLayout();
      return true;
    }
    return super.dispatchKeyEvent(paramKeyEvent);
  }

  public Object getValue(String paramString, Object paramObject)
  {
    if (paramString.equalsIgnoreCase("keyboardState"))
      return Boolean.valueOf(this.isInputShowing);
    return super.getValue(paramString, paramObject);
  }

  public void onBaseInfoPut(String paramString, BaseUserInfoPool.AvatarAndGender paramAvatarAndGender)
  {
    if (paramString == null)
      return;
    invalidateAvatar(paramString);
  }

  public void onEvent(Object paramObject1, String paramString, Object paramObject2)
  {
    if (paramString.equalsIgnoreCase("sendDiscuss"))
      sendMessage((String)paramObject2, 0);
    ChatActionsView.ChatActionType localChatActionType;
    do
    {
      return;
      if (paramString.equalsIgnoreCase("expression"))
      {
        if (this.isInputShowing)
        {
          this.mViewState = 1;
          this.mInputView.update("closeKeyboard", null);
          return;
        }
        if (this.mViewState == 1)
        {
          this.mViewState = 0;
          requestLayout();
          return;
        }
        if (!CloudCenter.getInstance().isLogin())
        {
          CloudCenter.OnLoginEventListerner local4 = new CloudCenter.OnLoginEventListerner()
          {
            public void onLoginFailed(int paramAnonymousInt)
            {
            }

            public void onLoginSuccessed(int paramAnonymousInt)
            {
              QTMSGManage.getInstance().sendStatistcsMessage("chat_functionclick", "expression");
              ImChatMainView.access$302(ImChatMainView.this, 1);
              ImChatMainView.this.mInputView.update("closeKeyboard", null);
              ImChatMainView.this.requestLayout();
            }
          };
          EventDispacthManager.getInstance().dispatchAction("showLogin", local4);
          return;
        }
        QTMSGManage.getInstance().sendStatistcsMessage("chat_functionclick", "expression");
        this.mViewState = 1;
        this.mInputView.update("closeKeyboard", null);
        requestLayout();
        return;
      }
      if (paramString.equalsIgnoreCase("expand"))
      {
        if (this.isInputShowing)
        {
          this.mViewState = 3;
          this.mInputView.update("closeKeyboard", null);
          return;
        }
        if (this.mViewState == 3)
        {
          this.mViewState = 0;
          requestLayout();
          return;
        }
        this.mViewState = 3;
        requestLayout();
        return;
      }
      if (paramString.equalsIgnoreCase("inviteFriends"))
      {
        if (this.isInputShowing)
        {
          this.mViewState = 2;
          this.mInputView.update("closeKeyboard", null);
          return;
        }
        if (this.mViewState != 2)
        {
          this.mViewState = 2;
          requestLayout();
          return;
        }
        this.mViewState = 0;
        requestLayout();
        return;
      }
      if (paramString.equalsIgnoreCase("selectExpression"))
      {
        this.mInputView.update("addExpression", paramObject2);
        return;
      }
      if (paramString.equalsIgnoreCase("deleteExpression"))
      {
        this.mInputView.update(paramString, paramObject2);
        return;
      }
      if (paramString.equalsIgnoreCase("scrollToFirstIndexAtMe"))
      {
        dispatchActionEvent(paramString, paramObject2);
        return;
      }
      if (paramString.equalsIgnoreCase("useraction"))
      {
        if (!CloudCenter.getInstance().isLogin())
        {
          CloudCenter.OnLoginEventListerner local5 = new CloudCenter.OnLoginEventListerner()
          {
            public void onLoginFailed(int paramAnonymousInt)
            {
            }

            public void onLoginSuccessed(int paramAnonymousInt)
            {
              InfoManager.getInstance().getUserProfile().followGroup(ImChatMainView.this.mTalkingId);
              ImChatMainView.this.mJoinView.setVisibility(8);
            }
          };
          EventDispacthManager.getInstance().dispatchAction("showLogin", local5);
          return;
        }
        InfoManager.getInstance().getUserProfile().followGroup(this.mTalkingId);
        this.mJoinView.setVisibility(8);
        return;
      }
      if (paramString.equalsIgnoreCase("flowerToAdmin"))
      {
        flowerToUser((UserInfo)paramObject2);
        return;
      }
      if (!paramString.equalsIgnoreCase("chatActionType"))
        break;
      localChatActionType = (ChatActionsView.ChatActionType)paramObject2;
      if (localChatActionType == ChatActionsView.ChatActionType.SHARE)
      {
        shareGroup();
        return;
      }
      if (localChatActionType == ChatActionsView.ChatActionType.ASKNAME)
      {
        sendMessage("现在播的什么歌?", 0);
        return;
      }
    }
    while ((localChatActionType == ChatActionsView.ChatActionType.ANSWERNAME) || (localChatActionType != ChatActionsView.ChatActionType.COLLECTION));
    return;
    if (paramString.equalsIgnoreCase("shareToPlatform"))
    {
      invite(((Integer)paramObject2).intValue());
      return;
    }
    dispatchActionEvent(paramString, paramObject2);
  }

  public void onInfoUpdated(int paramInt)
  {
    if (paramInt == 3)
      if (this.mMessage != null)
      {
        UserProfile localUserProfile = UserProfileManager.getInstance().getUserProfile(this.mTalkingId);
        if (localUserProfile != null)
          this.mTalkingUserInfo = localUserProfile.getUserInfo();
      }
    GroupInfo localGroupInfo;
    do
    {
      do
        return;
      while ((paramInt != 6) || (!ChatMode.isGroup()) || ((this.mAdmins != null) && (this.mAdmins.size() != 0)));
      localGroupInfo = IMAgent.getInstance().getGroupInfo(this.mTalkingId);
    }
    while (localGroupInfo == null);
    if ((localGroupInfo.lstAdmins != null) && (localGroupInfo.lstAdmins.size() > 0))
      for (int i = 0; i < localGroupInfo.lstAdmins.size(); i++)
        this.mAdmins.add(((UserInfo)localGroupInfo.lstAdmins.get(i)).userKey);
    this.mHeadView.update("setData", localGroupInfo);
    this.mTalkingUserInfo = null;
    this.mTalkingGroupInfo = localGroupInfo;
    this.mTalkingBlocked = false;
    this.mMessage = null;
  }

  public boolean onInterceptTouchEvent(MotionEvent paramMotionEvent)
  {
    if (paramMotionEvent.getAction() == 0)
    {
      float f = paramMotionEvent.getY();
      if (this.isInputShowing)
      {
        if ((f > this.mHeadView.getMeasuredHeight()) && (f < this.standardLayout.height - this.mInputView.getMeasuredHeight()))
        {
          this.mViewState = 0;
          this.mInputView.update("closeKeyboard", null);
          return true;
        }
      }
      else if ((this.mViewState != 0) && (f > this.mHeadView.getMeasuredHeight()) && (f < this.standardLayout.height - getInputOffset() - this.mInputView.getMeasuredHeight()))
      {
        this.mViewState = 0;
        requestLayout();
        return true;
      }
    }
    return super.onInterceptTouchEvent(paramMotionEvent);
  }

  protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    layoutViews(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
    this.mListView.setTranscriptMode(1);
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    int i = View.MeasureSpec.getSize(paramInt1);
    int j = View.MeasureSpec.getSize(paramInt2);
    this.standardLayout.scaleToBounds(i, j);
    this.bottomLayout.scaleToBounds(this.standardLayout);
    this.checkinLayout.scaleToBounds(this.standardLayout);
    this.headerLayout.scaleToBounds(this.standardLayout);
    this.headerLayout.measureView(this.mHeadView);
    this.bottomLayout.measureView(this.mInputView);
    this.bottomLayout.measureView(this.mJoinView);
    int k = this.standardLayout.height;
    if (k > this.normalLayoutHeight)
    {
      this.specialLayoutHeight = k;
      if (this.normalLayoutHeight == 0)
        this.normalLayoutHeight = k;
    }
    if (k < this.normalLayoutHeight);
    for (this.isInputShowing = true; ; this.isInputShowing = false)
    {
      this.chatMemberLayout.scaleToBounds(this.standardLayout);
      this.chatMemberLayout.measureView(this.mExpressionView);
      this.chatMemberLayout.measureView(this.mActionsView);
      this.chatMemberLayout.measureView(this.mInviteView);
      int m = getInputOffset();
      this.mListContainer.measure(this.standardLayout.getWidthMeasureSpec(), View.MeasureSpec.makeMeasureSpec(k - this.mHeadView.getMeasuredHeight() - this.mInputView.getMeasuredHeight() - m, 1073741824));
      this.checkinLayout.measureView(this.mCheckinButton);
      this.mCheckinButton.setPadding((int)(0.3F * this.checkinLayout.width), 0, 0, 0);
      this.mCheckinButton.setTextSize(0, SkinManager.getInstance().getSubTextSize());
      setMeasuredDimension(this.standardLayout.width, k);
      return;
    }
  }

  protected void onSizeChanged(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this.mListView.setTranscriptMode(2);
    super.onSizeChanged(paramInt1, paramInt2, paramInt3, paramInt4);
  }

  public void setActivate(boolean paramBoolean)
  {
    if (paramBoolean)
      super.setActivate(paramBoolean);
  }

  public void update(String paramString, Object paramObject)
  {
    GroupInfo localGroupInfo2;
    GroupInfo localGroupInfo3;
    if (paramString.equalsIgnoreCase("setData"))
    {
      this.mAdmins.clear();
      if ((paramObject instanceof GroupInfo))
      {
        localGroupInfo2 = (GroupInfo)paramObject;
        this.mTalkingId = localGroupInfo2.groupId;
        ChatMode.setMode(1);
        int m;
        if ((localGroupInfo2.lstAdmins != null) && (localGroupInfo2.lstAdmins.size() > 0))
          m = 0;
        while (m < localGroupInfo2.lstAdmins.size())
        {
          this.mAdmins.add(((UserInfo)localGroupInfo2.lstAdmins.get(m)).userKey);
          m++;
          continue;
          localGroupInfo3 = IMAgent.getInstance().getGroupInfo(this.mTalkingId);
          if (localGroupInfo3 != null)
            break label266;
          IMAgent.getInstance().loadGroupInfo(this.mTalkingId, this);
        }
        this.mTalkingUserInfo = null;
        this.mTalkingGroupInfo = localGroupInfo2;
        this.mTalkingBlocked = false;
        this.mMessage = null;
        QTMSGManage.getInstance().sendStatistcsMessage("groupChat", "enter");
        String str4 = QTLogger.getInstance().buildEnterIMLog(7);
        if (str4 != null)
          LogModule.getInstance().send("IMUI", str4);
        this.mHeadView.update("setData", localGroupInfo2);
        label213: this.mDatas.clear();
        this.mLastTimestamp = 0L;
        this.mLoading = true;
        this.mDatas.add(new ChatItem(32, "正在加载聊天消息"));
        this.mAdapter.notifyDataSetChanged();
        changeChatMode();
      }
    }
    label266: 
    do
    {
      return;
      localGroupInfo2.update(localGroupInfo3);
      if ((localGroupInfo2.lstAdmins == null) || (localGroupInfo2.lstAdmins.size() <= 0))
        break;
      for (int k = 0; k < localGroupInfo2.lstAdmins.size(); k++)
        this.mAdmins.add(((UserInfo)localGroupInfo2.lstAdmins.get(k)).userKey);
      break;
      if ((paramObject instanceof UserInfo))
      {
        UserInfo localUserInfo = (UserInfo)paramObject;
        this.mTalkingId = localUserInfo.userKey;
        ChatMode.setMode(0);
        this.mTalkingUserInfo = localUserInfo;
        this.mTalkingGroupInfo = null;
        this.mTalkingBlocked = localUserInfo.isBlocked;
        this.mMessage = null;
        QTMSGManage.getInstance().sendStatistcsMessage("userChat", "enter");
        String str3 = QTLogger.getInstance().buildEnterIMLog(8);
        if (str3 != null)
          LogModule.getInstance().send("IMUI", str3);
        this.mHeadView.update("setData", localUserInfo);
        break label213;
      }
      if ((paramObject instanceof IMMessage))
      {
        IMMessage localIMMessage2 = (IMMessage)paramObject;
        this.mTalkingId = localIMMessage2.mFromID;
        ChatMode.setMode(0);
        UserProfile localUserProfile = UserProfileManager.getInstance().getUserProfile(this.mTalkingId);
        if (localUserProfile == null)
          UserProfileManager.getInstance().loadUserInfo(this.mTalkingId, this);
        while (true)
        {
          this.mTalkingGroupInfo = null;
          this.mMessage = localIMMessage2;
          QTMSGManage.getInstance().sendStatistcsMessage("userChat", "enter");
          String str2 = QTLogger.getInstance().buildEnterIMLog(8);
          if (str2 != null)
            LogModule.getInstance().send("IMUI", str2);
          this.mHeadView.update("setData", localIMMessage2);
          break;
          this.mTalkingUserInfo = localUserProfile.getUserInfo();
        }
      }
      if (!(paramObject instanceof String))
        break label213;
      this.mTalkingId = ((String)paramObject);
      ChatMode.setMode(1);
      GroupInfo localGroupInfo1 = IMAgent.getInstance().getGroupInfo(this.mTalkingId);
      if (localGroupInfo1 == null)
        IMAgent.getInstance().loadGroupInfo(this.mTalkingId, this);
      while (true)
      {
        this.mTalkingUserInfo = null;
        this.mTalkingGroupInfo = localGroupInfo1;
        this.mTalkingBlocked = false;
        this.mMessage = null;
        QTMSGManage.getInstance().sendStatistcsMessage("groupChat", "enter");
        String str1 = QTLogger.getInstance().buildEnterIMLog(7);
        if (str1 != null)
          LogModule.getInstance().send("IMUI", str1);
        this.mHeadView.update("setData", localGroupInfo1);
        break;
        if ((localGroupInfo1.lstAdmins != null) && (localGroupInfo1.lstAdmins.size() > 0))
          for (int j = 0; j < localGroupInfo1.lstAdmins.size(); j++)
            this.mAdmins.add(((UserInfo)localGroupInfo1.lstAdmins.get(j)).userKey);
      }
      if (paramString.equalsIgnoreCase("addmessage"))
      {
        if (this.mLoading)
        {
          this.mDatas.clear();
          this.mLoading = false;
        }
        IMMessage localIMMessage1 = (IMMessage)paramObject;
        long l = localIMMessage1.publish;
        if (l - this.mLastTimestamp >= 1800L)
        {
          this.mDatas.add(new ChatItem(32, getTimestampBySecond(l)));
          this.mLastTimestamp = l;
        }
        List localList = this.mDatas;
        if (isAdmin(localIMMessage1.mFromID));
        for (int i = 20; ; i = 17)
        {
          localList.add(new ChatItem(i, localIMMessage1));
          this.mAdapter.notifyDataSetChanged();
          return;
        }
      }
      if (paramString.equalsIgnoreCase("addhistory"))
      {
        if (paramObject == null)
        {
          if (this.mLoading)
          {
            this.mDatas.clear();
            this.mLoading = false;
            this.mOldestMsgSeq = 0L;
            this.mOldestTimeStamp = 0L;
            this.mAdapter.notifyDataSetChanged();
          }
          this.mAdapter.notifyDataSetChanged();
          this.mListView.onRefreshComplete();
          return;
        }
        if (this.mLoading)
        {
          this.mDatas.clear();
          this.mLoading = false;
        }
        addHistoryMessages((List)paramObject);
        return;
      }
      if (paramString.equalsIgnoreCase("closeKeyboard"))
      {
        this.mInputView.update(paramString, paramObject);
        return;
      }
      if (paramString.equalsIgnoreCase("needAccount"))
      {
        onEvent(this, paramString, paramObject);
        return;
      }
    }
    while (!paramString.equalsIgnoreCase("atTa"));
    if (this.mJoinView.getVisibility() == 0)
    {
      Toast.makeText(getContext(), "请先加入群聊", 0).show();
      return;
    }
    this.mJoinView.setVisibility(8);
    this.mInputView.update(paramString, paramObject);
  }

  private class GetDataTask extends AsyncTask<Void, Void, String[]>
  {
    private GetDataTask()
    {
    }

    protected String[] doInBackground(Void[] paramArrayOfVoid)
    {
      try
      {
        Thread.sleep(300L);
        label6: return null;
      }
      catch (InterruptedException localInterruptedException)
      {
        break label6;
      }
    }

    protected void onPostExecute(String[] paramArrayOfString)
    {
      ImChatMainView.this.loadMoreHistory();
      super.onPostExecute(paramArrayOfString);
    }
  }
}
Exemplo n.º 8
0
public class GroupMembersView extends QtView {
  private static final String GROUPTYPE = "群组成员";
  private static final int MAXMEMBER = 4;
  private final ViewLayout arrowLayout =
      this.itemLayout.createChildLT(36, 36, 660, 42, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout itemLayout =
      ViewLayout.createViewLayoutWithBoundsLT(
          720, 120, 720, 120, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout lineLayout =
      this.itemLayout.createChildLT(720, 1, 180, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private ImageViewElement mArrowElement;
  private ButtonViewElement mBg;
  private int mHash = hashCode();
  private List<UserInfo> mInfos;
  private RoundAvatarElement[] mMembersElements;
  private boolean mNeedMatchParentLine = false;
  private boolean mNeedMeasure = true;
  private TextViewElement mNumberElement;
  private TextViewElement mTypeElement;
  private final ViewLayout memberLayout =
      this.itemLayout.createChildLT(90, 90, 20, 15, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout numberLayout =
      this.itemLayout.createChildLT(160, 45, 0, 65, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout typeLayout =
      this.itemLayout.createChildLT(160, 45, 0, 17, ViewLayout.SCALE_FLAG_SLTCW);

  public GroupMembersView(Context paramContext) {
    super(paramContext);
    this.mBg = new ButtonViewElement(paramContext);
    this.mBg.setBackgroundColor(SkinManager.getItemHighlightMaskColor(), 0);
    addElement(this.mBg);
    this.mBg.setOnElementClickListener(
        new ViewElement.OnElementClickListener() {
          public void onElementClick(ViewElement paramAnonymousViewElement) {
            if (GroupMembersView.this.mInfos == null) return;
            ControllerManager.getInstance()
                .openImGroupMemberListController(GroupMembersView.this.mInfos);
          }
        });
    this.mTypeElement = new TextViewElement(paramContext);
    this.mTypeElement.setMaxLineLimit(1);
    this.mTypeElement.setText("群组成员", false);
    this.mTypeElement.setAlignment(Layout.Alignment.ALIGN_CENTER);
    this.mTypeElement.setColor(SkinManager.getTextColorNormal());
    addElement(this.mTypeElement);
    this.mNumberElement = new TextViewElement(paramContext);
    this.mNumberElement.setAlignment(Layout.Alignment.ALIGN_CENTER);
    this.mNumberElement.setMaxLineLimit(1);
    this.mNumberElement.setColor(SkinManager.getTextColorSubInfo());
    addElement(this.mNumberElement);
    this.mMembersElements = new RoundAvatarElement[4];
    this.mArrowElement = new ImageViewElement(paramContext);
    this.mArrowElement.setImageRes(2130837694);
    addElement(this.mArrowElement, this.mHash);
  }

  private void drawLine(Canvas paramCanvas) {
    SkinManager localSkinManager = SkinManager.getInstance();
    if (this.mNeedMatchParentLine) ;
    for (int i = 0; ; i = this.lineLayout.leftMargin) {
      localSkinManager.drawHorizontalLine(
          paramCanvas,
          i,
          this.itemLayout.width,
          getMeasuredHeight() - this.lineLayout.height,
          this.lineLayout.height);
      return;
    }
  }

  private void measureAvatars() {
    int i = this.lineLayout.leftMargin;
    for (int j = 0; j < this.mMembersElements.length; j++) {
      RoundAvatarElement localRoundAvatarElement = this.mMembersElements[j];
      if (localRoundAvatarElement != null) {
        localRoundAvatarElement.measure(
            i + this.memberLayout.leftMargin,
            this.memberLayout.topMargin,
            i + this.memberLayout.getRight(),
            this.memberLayout.getBottom());
        i += this.memberLayout.getRight();
      }
    }
  }

  public void close(boolean paramBoolean) {
    BitmapResourceCache.getInstance().clearResourceCacheOfOne(this, 0);
    super.close(paramBoolean);
  }

  protected void onDraw(Canvas paramCanvas) {
    super.onDraw(paramCanvas);
    drawLine(paramCanvas);
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.itemLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.typeLayout.scaleToBounds(this.itemLayout);
    this.memberLayout.scaleToBounds(this.itemLayout);
    this.lineLayout.scaleToBounds(this.itemLayout);
    this.numberLayout.scaleToBounds(this.itemLayout);
    this.arrowLayout.scaleToBounds(this.itemLayout);
    measureAvatars();
    this.mBg.measure(this.itemLayout);
    this.mArrowElement.measure(this.arrowLayout);
    this.mTypeElement.measure(this.typeLayout);
    this.mTypeElement.setTextSize(SkinManager.getInstance().getMiddleTextSize());
    this.mNumberElement.measure(this.numberLayout);
    this.mNumberElement.setTextSize(SkinManager.getInstance().getSubTextSize());
    this.mNeedMeasure = true;
    setMeasuredDimension(this.itemLayout.width, this.itemLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("setData")) {
      this.mInfos = ((List) paramObject);
      if (this.mInfos == null) break label274;
    }
    label274:
    for (int i = this.mInfos.size(); ; i = 0) {
      int j = Math.min(i, 4);
      int k = 0;
      if (k < j) {
        if (this.mMembersElements[k] == null) {
          RoundAvatarElement localRoundAvatarElement1 = new RoundAvatarElement(getContext());
          localRoundAvatarElement1.setDefaultImageRes(2130837698);
          localRoundAvatarElement1.setImageUrl(((UserInfo) this.mInfos.get(k)).snsInfo.sns_avatar);
          this.mMembersElements[k] = localRoundAvatarElement1;
          addElement(localRoundAvatarElement1, this.mHash);
        }
        while (true) {
          k++;
          break;
          RoundAvatarElement localRoundAvatarElement2 = this.mMembersElements[k];
          localRoundAvatarElement2.setImageUrl(((UserInfo) this.mInfos.get(k)).snsInfo.sns_avatar);
          localRoundAvatarElement2.setVisible(0);
        }
      }
      if (j < 4)
        for (int m = j; m < 4; m++)
          if (this.mMembersElements[m] != null) this.mMembersElements[m].setVisible(4);
      if (this.mNeedMeasure) measureAvatars();
      do {
        do {
          return;
          if (!paramString.equalsIgnoreCase("setCnt")) break;
        } while (paramObject == null);
        this.mNumberElement.setText(String.valueOf(paramObject));
        return;
      } while (!paramString.equalsIgnoreCase("needfillline"));
      this.mNeedMatchParentLine = true;
      return;
    }
  }
}
Exemplo n.º 9
0
public class ExpressionView extends ViewGroupViewImpl implements IEventHandler {
  private final int MAX_EXPRESSION_CNT = 17;
  private int PICAMOUNT = getPageCnt();
  private int currentIndex = 0;
  private final ViewLayout dotsLayout =
      this.standardLayout.createChildLT(12, 12, 15, 40, ViewLayout.SCALE_FLAG_SLTCW);
  private Paint greyDotPaint = new Paint();
  private final ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 400, 720, 400, 0, 0, ViewLayout.FILL);
  private List<ExpressionGridView> subViews = new ArrayList();
  private ViewPager viewPager;
  private Paint whiteDotPaint = new Paint();

  public ExpressionView(Context paramContext) {
    super(paramContext);
    setBackgroundColor(-1);
    this.viewPager = new ViewPager(paramContext);
    this.viewPager.setAdapter(new MyAdapter(null));
    this.viewPager.setOnPageChangeListener(new MyPageChangeListener(null));
    addView(this.viewPager);
    this.greyDotPaint.setColor(-2004318072);
    this.greyDotPaint.setStyle(Paint.Style.FILL);
    this.whiteDotPaint.setColor(-14540254);
    this.whiteDotPaint.setStyle(Paint.Style.FILL);
    buildViews();
  }

  private void buildViews() {
    int i = 0;
    int j = ExpressionUtil.getInstance().getExpressionCnt();
    int k = j / 17;
    if (j % 17 > 0) ;
    for (int m = 1; ; m = 0) {
      int n = k + m;
      while (i < n) {
        int i1 = i * 17;
        int i2 = 17 * (i + 1);
        if (i2 > j) i2 = j;
        List localList = ExpressionUtil.getInstance().getExpressionSubList(i1, i2);
        ExpressionGridView localExpressionGridView = new ExpressionGridView(getContext());
        localExpressionGridView.setEventHandler(this);
        localExpressionGridView.update("setData", localList);
        this.subViews.add(localExpressionGridView);
        i++;
      }
    }
  }

  private void drawDots(Canvas paramCanvas) {
    int i =
        (this.standardLayout.width
                - this.PICAMOUNT * this.dotsLayout.width
                - (-1 + this.PICAMOUNT) * this.dotsLayout.width)
            / 2;
    int j = 0;
    if (j < this.PICAMOUNT) {
      RectF localRectF =
          new RectF(
              i,
              this.standardLayout.height - this.dotsLayout.topMargin,
              i + this.dotsLayout.width,
              this.standardLayout.height - this.dotsLayout.topMargin + this.dotsLayout.height);
      if (j == this.currentIndex) ;
      for (Paint localPaint = this.whiteDotPaint; ; localPaint = this.greyDotPaint) {
        paramCanvas.drawOval(localRectF, localPaint);
        i += this.dotsLayout.leftMargin + this.dotsLayout.width;
        j++;
        break;
      }
    }
  }

  private int getPageCnt() {
    int i = ExpressionUtil.getInstance().getExpressionCnt();
    int j = i / 17;
    if (i % 17 > 0) ;
    for (int k = 1; ; k = 0) return k + j;
  }

  protected void dispatchDraw(Canvas paramCanvas) {
    super.dispatchDraw(paramCanvas);
    paramCanvas.save();
    drawDots(paramCanvas);
    paramCanvas.restore();
  }

  public void onEvent(Object paramObject1, String paramString, Object paramObject2) {
    if (paramString.equalsIgnoreCase("selectExpression"))
      dispatchActionEvent(paramString, paramObject2);
    while (!paramString.equalsIgnoreCase("deleteExpression")) return;
    dispatchActionEvent(paramString, paramObject2);
  }

  protected void onLayout(
      boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    this.viewPager.layout(0, 0, this.standardLayout.width, this.standardLayout.height);
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    int i = View.MeasureSpec.getSize(paramInt1);
    int j = View.MeasureSpec.getSize(paramInt2);
    this.standardLayout.scaleToBounds(i, j);
    this.dotsLayout.scaleToBounds(this.standardLayout);
    this.standardLayout.measureView(this.viewPager);
    setMeasuredDimension(i, this.standardLayout.height);
  }

  public void update(String paramString, Object paramObject) {}

  private class MyAdapter extends PagerAdapter {
    private MyAdapter() {}

    public void destroyItem(View paramView, int paramInt, Object paramObject) {
      ((ViewPager) paramView).removeView((View) paramObject);
    }

    public void finishUpdate(View paramView) {}

    public int getCount() {
      return ExpressionView.this.PICAMOUNT;
    }

    public Object instantiateItem(View paramView, int paramInt) {
      int i = paramInt % ExpressionView.this.PICAMOUNT;
      if (i < 0) ;
      for (int j = i + ExpressionView.this.PICAMOUNT; ; j = i) {
        ((ViewPager) paramView).addView((View) ExpressionView.this.subViews.get(j));
        return ExpressionView.this.subViews.get(j);
      }
    }

    public boolean isViewFromObject(View paramView, Object paramObject) {
      return paramView == paramObject;
    }

    public void restoreState(Parcelable paramParcelable, ClassLoader paramClassLoader) {}

    public Parcelable saveState() {
      return null;
    }

    public void startUpdate(View paramView) {}
  }

  private class MyPageChangeListener implements ViewPager.OnPageChangeListener {
    private MyPageChangeListener() {}

    public void onPageScrollStateChanged(int paramInt) {}

    public void onPageScrolled(int paramInt1, float paramFloat, int paramInt2) {}

    public void onPageSelected(int paramInt) {
      ExpressionView.access$402(ExpressionView.this, paramInt % ExpressionView.this.PICAMOUNT);
      ExpressionView.this.invalidate();
    }
  }
}
Exemplo n.º 10
0
public class GroupWebView extends ViewGroupViewImpl
{
  public static final String AndroidUA = "Android-QingtingFM Mozilla/5.0 (Linux; U; Android 4.4.0; zh-cn; MB200 Build/GRJ22;) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1";
  private String URL = "http://qingting.fm";
  private boolean hasRemoved = false;
  private Context mContext;
  private LoadingView mLoadingView;
  private MiniPlayerView mMiniView;
  private final ViewLayout miniLayout = this.standardLayout.createChildLT(720, 110, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private boolean needMiniPlayer = false;
  private ViewLayout standardLayout = ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);
  private MyWebView webView = null;
  private qtWebViewClient webViewClient = new qtWebViewClient(null);
  private final ViewLayout webviewLayout = ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL | ViewLayout.SLTR | ViewLayout.SC | ViewLayout.CW | ViewLayout.SVH);

  public GroupWebView(Context paramContext, String paramString, boolean paramBoolean1, boolean paramBoolean2)
  {
    super(paramContext);
    this.mContext = paramContext;
    this.needMiniPlayer = paramBoolean2;
    this.URL = paramString;
    if (paramBoolean1)
      buildUrl();
    init();
    this.mLoadingView = new LoadingView(paramContext);
    addView(this.mLoadingView);
    if (this.needMiniPlayer)
    {
      this.mMiniView = new MiniPlayerView(paramContext);
      addView(this.mMiniView);
    }
  }

  private void log(String paramString)
  {
  }

  private void removeLoading()
  {
    if (!this.hasRemoved)
    {
      removeView(this.mLoadingView);
      this.hasRemoved = true;
    }
  }

  protected String buildUrl()
  {
    if (this.URL == null)
      return "";
    this.URL += "&phonetype=android";
    String str1 = AppInfo.getCurrentInternalVersion(this.mContext);
    if (str1 != null)
      this.URL = (this.URL + "&versioncode=" + str1);
    String str2 = InfoManager.getInstance().getDeviceId();
    if (str2 == null)
      str2 = "UnknownUser";
    this.URL = (this.URL + "&deviceId=" + str2);
    return this.URL;
  }

  public boolean canBack()
  {
    if (this.webView != null)
    {
      String str = WebViewPlayer.getInstance().getBackPolicy();
      if ((str != null) && (!str.equalsIgnoreCase("")))
        return true;
    }
    return false;
  }

  public void destroy()
  {
  }

  public boolean dispatchKeyEvent(KeyEvent paramKeyEvent)
  {
    if (paramKeyEvent == null)
      return false;
    if ((paramKeyEvent.getKeyCode() == 4) && (paramKeyEvent.getAction() == 1) && (canBack()))
    {
      goBack();
      return true;
    }
    return super.dispatchKeyEvent(paramKeyEvent);
  }

  public String getUrl()
  {
    return this.URL;
  }

  public void goBack()
  {
    if (this.webView != null)
    {
      String str = WebViewPlayer.getInstance().getBackPolicy();
      if ((str != null) && (!str.equalsIgnoreCase("")))
      {
        this.webView.loadUrl(str);
        WebViewPlayer.getInstance().setbackPolicy(null);
      }
    }
    else
    {
      return;
    }
    this.webView.goBack();
  }

  @TargetApi(18)
  protected void init()
  {
    try
    {
      this.webView = new MyWebView(this.mContext);
      WebSettings localWebSettings = this.webView.getSettings();
      if (localWebSettings != null)
      {
        localWebSettings.setJavaScriptEnabled(true);
        localWebSettings.setUserAgentString("Android-QingtingFM Mozilla/5.0 (Linux; U; Android 4.4.0; zh-cn; MB200 Build/GRJ22;) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
        localWebSettings.setSupportZoom(true);
        localWebSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
        localWebSettings.setCacheMode(2);
        localWebSettings.setJavaScriptCanOpenWindowsAutomatically(true);
      }
      WebViewPlayer.getInstance().setbackPolicy(null);
      this.webView.addJavascriptInterface(WebViewPlayer.getInstance(), "QTJsPlayer");
      this.webView.addJavascriptInterface(WebViewFunc.getInstance(), "QTJsReserve");
      this.webView.setWebChromeClient(new WebChromeClient()
      {
        public boolean onJsAlert(WebView paramAnonymousWebView, String paramAnonymousString1, String paramAnonymousString2, JsResult paramAnonymousJsResult)
        {
          AlertDialog.Builder localBuilder = new AlertDialog.Builder(paramAnonymousWebView.getContext());
          localBuilder.setTitle("蜻蜓提示").setMessage(paramAnonymousString2).setPositiveButton("确定", null);
          localBuilder.setCancelable(false);
          localBuilder.create().show();
          paramAnonymousJsResult.confirm();
          return true;
        }

        public void onProgressChanged(WebView paramAnonymousWebView, int paramAnonymousInt)
        {
          if (paramAnonymousInt > 70)
            GroupWebView.this.removeLoading();
        }

        public void onReceivedTitle(WebView paramAnonymousWebView, String paramAnonymousString)
        {
        }
      });
      this.webView.setHorizontalScrollBarEnabled(false);
      this.webView.setVerticalScrollBarEnabled(false);
      this.webView.setWebViewClient(this.webViewClient);
      this.webView.loadUrl(getUrl());
      this.webView.setDownloadListener(new DownloadListener()
      {
        public void onDownloadStart(String paramAnonymousString1, String paramAnonymousString2, String paramAnonymousString3, String paramAnonymousString4, long paramAnonymousLong)
        {
          Intent localIntent = new Intent("android.intent.action.VIEW", Uri.parse(paramAnonymousString1));
          GroupWebView.this.getContext().startActivity(localIntent);
        }
      });
      WebViewPlayer.getInstance().setWebview(this.webView);
      WebViewFunc.getInstance().setWebview(this.webView);
      LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -1);
      addView(this.webView, localLayoutParams);
      return;
    }
    catch (Exception localException)
    {
    }
  }

  protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    (paramInt3 - paramInt1);
    (paramInt4 - paramInt2);
    if (this.needMiniPlayer)
      this.mMiniView.layout(0, this.standardLayout.height - this.miniLayout.height, this.standardLayout.width, this.standardLayout.height);
    for (int i = this.miniLayout.height; ; i = 0)
    {
      this.webView.layout(this.webviewLayout.getLeft(), this.webviewLayout.getTop(), this.webviewLayout.getRight(), this.webviewLayout.getBottom() - i);
      this.mLoadingView.layout(0, 0, this.standardLayout.width, this.standardLayout.height);
      return;
    }
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    int i = View.MeasureSpec.getSize(paramInt1);
    int j = View.MeasureSpec.getSize(paramInt2);
    this.standardLayout.scaleToBounds(i, j);
    this.webviewLayout.scaleToBounds(this.standardLayout);
    boolean bool = this.needMiniPlayer;
    int k = 0;
    if (bool)
    {
      this.miniLayout.scaleToBounds(this.standardLayout);
      this.miniLayout.measureView(this.mMiniView);
      k = this.miniLayout.height;
    }
    this.webView.measure(this.webviewLayout.getWidthMeasureSpec(), this.webviewLayout.getHeightMeasureSpec() - k);
    this.mLoadingView.measure(this.standardLayout.getWidthMeasureSpec(), View.MeasureSpec.makeMeasureSpec(this.standardLayout.height - k, 1073741824));
    setMeasuredDimension(this.standardLayout.width, this.standardLayout.height);
  }

  protected void onViewWillClose()
  {
  }

  public void release()
  {
    if (this.webView != null)
    {
      this.webView.removeAllViews();
      this.webView.destroy();
      this.webView = null;
    }
  }

  public void update(String paramString, Object paramObject)
  {
  }

  public class ADWebAppInterface
  {
    Context mContext;

    ADWebAppInterface()
    {
    }

    public void onClickAppDownload()
    {
      UMengLogger.sendmessage(GroupWebView.this.getContext(), "adPageDownload", AdvertisementManage.getInstance().currentADKey);
    }

    public void onClickDraw()
    {
      UMengLogger.sendmessage(GroupWebView.this.getContext(), "adPageRequestCoupon", AdvertisementManage.getInstance().currentADKey);
    }

    public void onClickEmailSend()
    {
      Toast.makeText(GroupWebView.this.getContext(), "正在发送邮件", 1).show();
      UMengLogger.sendmessage(GroupWebView.this.getContext(), "adPageSendEmail", AdvertisementManage.getInstance().currentADKey);
    }

    public void onPageLoaded()
    {
      UMengLogger.sendmessage(GroupWebView.this.getContext(), "adPageDisplay", AdvertisementManage.getInstance().currentADKey);
    }
  }

  private class MyWebView extends WebView
  {
    public MyWebView(Context arg2)
    {
      super();
    }

    public boolean onTouchEvent(MotionEvent paramMotionEvent)
    {
      Log.e("groupwebview", "" + WebViewPlayer.getInstance().mPreventParentTouch);
      boolean bool = super.onTouchEvent(paramMotionEvent);
      if (WebViewPlayer.getInstance().mPreventParentTouch)
        switch (paramMotionEvent.getAction())
        {
        default:
        case 2:
        case 1:
        case 3:
        }
      while (true)
      {
        return bool;
        requestDisallowInterceptTouchEvent(true);
        return true;
        requestDisallowInterceptTouchEvent(false);
        WebViewPlayer.getInstance().mPreventParentTouch = false;
      }
    }
  }

  private class qtWebViewClient extends WebViewClient
  {
    private qtWebViewClient()
    {
    }

    public void onPageFinished(WebView paramWebView, String paramString)
    {
    }

    public void onReceivedError(WebView paramWebView, int paramInt, String paramString1, String paramString2)
    {
      if (paramString2 != null)
      {
        String str = GroupWebView.this.getUrl();
        if ((str != null) && (str.equalsIgnoreCase(paramString2)))
          paramWebView.loadUrl("http://wx.qingting.fm");
      }
    }

    public boolean shouldOverrideUrlLoading(WebView paramWebView, String paramString)
    {
      if (paramString.startsWith("tel:"))
      {
        Intent localIntent1 = new Intent("android.intent.action.DIAL", Uri.parse(paramString));
        GroupWebView.this.getContext().startActivity(localIntent1);
        return true;
      }
      if (((paramString != null) && ((paramString.startsWith("rtsp")) || (paramString.startsWith("mms")) || (paramString.endsWith(".mp3")) || (paramString.endsWith(".apk")))) || (paramString.contains("active.coupon.360buy.com")))
      {
        Intent localIntent2 = new Intent("android.intent.action.VIEW", Uri.parse(paramString));
        paramWebView.getContext().startActivity(localIntent2);
        return true;
      }
      return false;
    }
  }
}
public class OnlineMembersListView extends ViewGroupViewImpl implements IEventHandler {
  private CustomizedAdapter adapter;
  private IAdapterIViewFactory factory;
  private OnlineBubbleView mBubbleView;
  private ListView mListView;
  private final ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);

  public OnlineMembersListView(Context paramContext) {
    super(paramContext);
    setBackgroundColor(SkinManager.getBackgroundColor());
    this.factory =
        new IAdapterIViewFactory() {
          public IView createView(int paramAnonymousInt) {
            return new MembersItemViewNew(OnlineMembersListView.this.getContext(), this.val$hash);
          }
        };
    this.adapter = new CustomizedAdapter(new ArrayList(), this.factory);
    this.adapter.setEventHandler(this);
    this.mListView = new ListView(paramContext);
    this.mListView.setVerticalFadingEdgeEnabled(false);
    this.mListView.setCacheColorHint(0);
    this.mListView.setDivider(null);
    this.mListView.setHeaderDividersEnabled(false);
    this.mListView.setSelector(17170445);
    this.mListView.setAdapter(this.adapter);
    addView(this.mListView);
    this.mBubbleView = new OnlineBubbleView(paramContext);
    addView(this.mBubbleView);
    this.mBubbleView.setVisibility(4);
    this.mBubbleView.setEventHandler(this);
  }

  private void initData(List<UserInfo> paramList) {
    this.adapter.setData(ListUtils.convertToObjectList(paramList));
  }

  public void close(boolean paramBoolean) {
    BitmapResourceCache.getInstance().clearResourceCacheOfOne(this, 0);
    super.close(paramBoolean);
  }

  public boolean dispatchKeyEvent(KeyEvent paramKeyEvent) {
    if ((paramKeyEvent.getAction() == 1) && (this.mBubbleView.getVisibility() == 0)) {
      this.mBubbleView.setVisibility(4);
      return true;
    }
    return super.dispatchKeyEvent(paramKeyEvent);
  }

  public void onEvent(Object paramObject1, String paramString, Object paramObject2) {
    if (paramString.equalsIgnoreCase("itemCallback")) {
      ItemParam localItemParam = (ItemParam) paramObject2;
      Point localPoint = (Point) localItemParam.param;
      int i = localItemParam.position;
      if (this.adapter.getData() != null) {
        UserInfo localUserInfo = (UserInfo) this.adapter.getData().get(i);
        this.mBubbleView.setChatParam(localUserInfo, localPoint);
        this.mBubbleView.setVisibility(0);
      }
    }
    do {
      return;
      if (paramString.equalsIgnoreCase("select")) {
        dispatchActionEvent(paramString, paramObject2);
        return;
      }
      if (paramString.equalsIgnoreCase("cancelPop")) {
        this.mBubbleView.setVisibility(4);
        return;
      }
      if (paramString.equalsIgnoreCase("talkWithIt")) {
        dispatchActionEvent(paramString, paramObject2);
        this.mBubbleView.setVisibility(4);
        return;
      }
    } while (!paramString.equalsIgnoreCase("lookItsInfo"));
    dispatchActionEvent(paramString, paramObject2);
    this.mBubbleView.setVisibility(4);
  }

  protected void onLayout(
      boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    this.standardLayout.layoutView(this.mListView);
    this.standardLayout.layoutView(this.mBubbleView);
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.standardLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.standardLayout.measureView(this.mListView);
    this.standardLayout.measureView(this.mBubbleView);
    setMeasuredDimension(this.standardLayout.width, this.standardLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("setData")) initData((List) paramObject);
  }
}
Exemplo n.º 12
0
public class TraChannelView extends ViewGroupViewImpl
  implements InfoManager.ISubscribeEventListener
{
  private CustomizedAdapter adapter;
  private IAdapterIViewFactory factory;
  private ListView mListView;
  private LoadingView mLoadingView;
  private MiniPlayerView mMiniView;
  private final ViewLayout standardLayout = ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);

  public TraChannelView(Context paramContext)
  {
    super(paramContext);
    setBackgroundColor(SkinManager.getBackgroundColor());
    this.factory = new IAdapterIViewFactory()
    {
      public IView createView(int paramAnonymousInt)
      {
        return new TraChannelItemView(TraChannelView.this.getContext(), this.val$hash);
      }
    };
    this.adapter = new CustomizedAdapter(new ArrayList(), this.factory);
    this.mListView = new ListView(paramContext);
    this.mListView.setVerticalScrollBarEnabled(false);
    this.mListView.setVerticalFadingEdgeEnabled(false);
    this.mListView.setCacheColorHint(0);
    this.mListView.setDivider(null);
    MiniPlayerPlaceHolder.wrapListView(paramContext, this.mListView);
    this.mLoadingView = new LoadingView(paramContext);
    addView(this.mLoadingView);
    this.mListView.setEmptyView(this.mLoadingView);
    this.mListView.setAdapter(this.adapter);
    addView(this.mListView);
    this.mMiniView = new MiniPlayerView(paramContext);
    addView(this.mMiniView);
  }

  private void invalidateCurrentPlayingProgram()
  {
    int j = this.mListView.getChildCount();
    int i = 0;
    while (i < j)
    {
      View localView = this.mListView.getChildAt(i);
      if ((localView != null) && ((localView instanceof IView)))
        ((IView)localView).update("ip", null);
      i += 1;
    }
  }

  private void loadPlayingProgram(List<Node> paramList)
  {
    if (paramList == null)
      return;
    Object localObject = "";
    Iterator localIterator = paramList.iterator();
    paramList = (List<Node>)localObject;
    label17: int i;
    if (localIterator.hasNext())
    {
      localObject = (Node)localIterator.next();
      if (((Node)localObject).nodeName.equalsIgnoreCase("channel"))
        i = ((ChannelNode)localObject).channelId;
    }
    while (true)
    {
      label57: if (!InfoManager.getInstance().root().mPlayingProgramInfo.isExist(i))
        if (paramList.equalsIgnoreCase(""))
          paramList = paramList + i;
      while (true)
      {
        break label17;
        if (!((Node)localObject).nodeName.equalsIgnoreCase("radiochannel"))
          break label179;
        i = ((RadioChannelNode)localObject).channelId;
        break label57;
        paramList = paramList + "," + i;
        continue;
        if (paramList.equalsIgnoreCase(""))
          break;
        InfoManager.getInstance().loadCurrentPlayingPrograms(paramList, this);
        return;
      }
      label179: i = 0;
    }
  }

  public void close(boolean paramBoolean)
  {
    this.mMiniView.destroy();
    BitmapResourceCache.getInstance().clearResourceCacheOfOne(this, 0);
    InfoManager.getInstance().unRegisterSubscribeEventListener(this, new String[] { "RCPPL" });
    super.close(paramBoolean);
  }

  protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this.mListView.layout(0, 0, this.standardLayout.width, this.standardLayout.height);
    this.mLoadingView.layout(0, 0, this.standardLayout.width, this.standardLayout.height);
    this.mMiniView.layout(0, this.standardLayout.height - this.mMiniView.getMeasuredHeight(), this.standardLayout.width, this.standardLayout.height);
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    paramInt1 = View.MeasureSpec.getSize(paramInt1);
    paramInt2 = View.MeasureSpec.getSize(paramInt2);
    this.standardLayout.scaleToBounds(paramInt1, paramInt2);
    this.standardLayout.measureView(this.mMiniView);
    this.mListView.measure(this.standardLayout.getWidthMeasureSpec(), View.MeasureSpec.makeMeasureSpec(this.standardLayout.height, 1073741824));
    this.mLoadingView.measure(this.standardLayout.getWidthMeasureSpec(), View.MeasureSpec.makeMeasureSpec(this.standardLayout.height, 1073741824));
    setMeasuredDimension(paramInt1, paramInt2);
  }

  public void onNotification(String paramString)
  {
    if (paramString.equalsIgnoreCase("RCPPL"))
      invalidateCurrentPlayingProgram();
  }

  public void onRecvDataException(String paramString, InfoManager.DataExceptionStatus paramDataExceptionStatus)
  {
  }

  public void update(String paramString, Object paramObject)
  {
    if (paramString.equalsIgnoreCase("setData"))
    {
      paramString = (List)paramObject;
      this.adapter.setData(ListUtils.convertToObjectList(paramString));
      loadPlayingProgram(paramString);
    }
    while (!paramString.equalsIgnoreCase("refresh"))
      return;
    this.adapter.notifyDataSetChanged();
  }
}
Exemplo n.º 13
0
public class SchedulePopItemView extends QtListItemView
{
  private final ViewLayout arrowLayout = this.itemLayout.createChildLT(36, 36, 650, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout channelLayout = this.itemLayout.createChildLT(720, 45, 30, 20, ViewLayout.SCALE_FLAG_SLTCW);
  private DrawFilter filter;
  private int hash = -2;
  private Paint iconPaint = new Paint();
  private final ViewLayout infoLayout = this.itemLayout.createChildLT(720, 45, 30, 10, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout itemLayout = ViewLayout.createViewLayoutWithBoundsLT(720, 136, 720, 800, 0, 0, ViewLayout.LT | ViewLayout.SLT | ViewLayout.CW);
  private final ViewLayout lineLayout = this.itemLayout.createChildLT(670, 1, 30, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private Paint livePaint = new Paint();
  private final ViewLayout livingLayout = this.itemLayout.createChildLT(20, 26, 10, 29, ViewLayout.SCALE_FLAG_SLTCW);
  private Rect mArrowRect = new Rect();
  private Rect mLivingRect = new Rect();
  private Node mNode;
  private Rect textBound = new Rect();

  public SchedulePopItemView(Context paramContext, int paramInt)
  {
    super(paramContext);
    this.hash = paramInt;
    this.livePaint.setColor(SkinManager.getLiveColor());
    setOnClickListener(this);
    setItemSelectedEnable();
    this.filter = SkinManager.getInstance().getDrawFilter();
  }

  private void drawArrow(Canvas paramCanvas)
  {
    paramCanvas.drawBitmap(BitmapResourceCache.getInstance().getResourceCacheByParent(getResources(), this.hash, 2130837697), null, this.mArrowRect, this.iconPaint);
  }

  private void drawBg(Canvas paramCanvas)
  {
    if (isItemPressed())
      paramCanvas.drawColor(SkinManager.getItemHighlightMaskColor());
  }

  private void drawLine(Canvas paramCanvas)
  {
    SkinManager.getInstance().drawHorizontalLine(paramCanvas, this.lineLayout.leftMargin, this.lineLayout.getRight(), this.itemLayout.height - this.lineLayout.height, this.lineLayout.height);
  }

  private void drawLivingLabel(Canvas paramCanvas)
  {
    paramCanvas.drawBitmap(BitmapResourceCache.getInstance().getResourceCache(getResources(), this, 2130837925), null, this.mLivingRect, this.iconPaint);
  }

  private void drawSubInfo(Canvas paramCanvas)
  {
    Object localObject2 = null;
    int i;
    Object localObject1;
    if (this.mNode.nodeName.equalsIgnoreCase("program"))
    {
      i = ((ProgramNode)this.mNode).getCurrPlayStatus();
      if (i == 1)
      {
        this.livePaint.setColor(SkinManager.getLiveColor());
        localObject2 = "直播";
        localObject1 = ((ProgramNode)this.mNode).startTime;
        localObject1 = (String)localObject1 + "-";
        localObject1 = (String)localObject1 + ((ProgramNode)this.mNode).endTime;
        i = 0;
      }
    }
    while (true)
    {
      Object localObject3 = SkinManager.getInstance().getSubTextPaint();
      if ((localObject2 != null) && (localObject1 != null))
      {
        this.livePaint.getTextBounds((String)localObject2, 0, ((String)localObject2).length(), this.textBound);
        f1 = this.infoLayout.getLeft();
        f2 = this.channelLayout.topMargin + this.channelLayout.height + this.infoLayout.topMargin + (this.infoLayout.height - this.textBound.top - this.textBound.bottom) / 2;
        paramCanvas.drawText((String)localObject2, f1, f2, this.livePaint);
        f3 = this.textBound.width();
        float f4 = this.infoLayout.getLeft() / 2;
        ((TextPaint)localObject3).getTextBounds((String)localObject1, 0, ((String)localObject1).length(), this.textBound);
        paramCanvas.drawText((String)localObject1, f1 + f3 + f4, f2, (Paint)localObject3);
      }
      do
      {
        return;
        if (i == 2)
        {
          if (InfoManager.getInstance().root().mPersonalCenterNode.reserveNode.isExisted(this.mNode));
          for (localObject1 = "己预约"; ; localObject1 = "预约")
          {
            this.livePaint.setColor(SkinManager.getTextColorHighlight());
            localObject2 = ((ProgramNode)this.mNode).startTime;
            localObject2 = (String)localObject2 + "-";
            localObject3 = (String)localObject2 + ((ProgramNode)this.mNode).endTime;
            localObject2 = localObject1;
            localObject1 = localObject3;
            i = 0;
            break;
          }
        }
        if (((ProgramNode)this.mNode).channelType == 0)
        {
          localObject1 = ((ProgramNode)this.mNode).startTime;
          localObject1 = (String)localObject1 + "-";
          localObject1 = (String)localObject1 + ((ProgramNode)this.mNode).endTime;
          i = 1;
          break;
        }
        localObject1 = getDurationTime(((ProgramNode)this.mNode).getDuration());
        i = 0;
        break;
        if (i == 0)
          break label728;
        ((TextPaint)localObject3).getTextBounds("回听:", 0, "回听:".length(), this.textBound);
        f1 = this.infoLayout.getLeft();
        paramCanvas.drawText("回听:", f1, this.channelLayout.topMargin + this.channelLayout.height + this.infoLayout.topMargin + (this.infoLayout.height - this.textBound.top - this.textBound.bottom) / 2, (Paint)localObject3);
      }
      while ((localObject1 == null) || (((String)localObject1).equalsIgnoreCase("")));
      float f2 = this.textBound.width();
      float f3 = this.infoLayout.getLeft() / 2;
      ((TextPaint)localObject3).getTextBounds((String)localObject1, 0, ((String)localObject1).length(), this.textBound);
      paramCanvas.drawText((String)localObject1, f2 + f1 + f3, this.channelLayout.topMargin + this.channelLayout.height + this.infoLayout.topMargin + (this.infoLayout.height - this.textBound.top - this.textBound.bottom) / 2, (Paint)localObject3);
      return;
      label728: ((TextPaint)localObject3).getTextBounds("时长:", 0, "时长:".length(), this.textBound);
      float f1 = this.infoLayout.getLeft();
      paramCanvas.drawText("时长:", f1, this.channelLayout.topMargin + this.channelLayout.height + this.infoLayout.topMargin + (this.infoLayout.height - this.textBound.top - this.textBound.bottom) / 2, (Paint)localObject3);
      f2 = this.textBound.width();
      f3 = this.infoLayout.getLeft() / 2;
      ((TextPaint)localObject3).getTextBounds((String)localObject1, 0, ((String)localObject1).length(), this.textBound);
      paramCanvas.drawText((String)localObject1, f2 + f1 + f3, this.channelLayout.topMargin + this.channelLayout.height + this.infoLayout.topMargin + (this.infoLayout.height - this.textBound.top - this.textBound.bottom) / 2, (Paint)localObject3);
      return;
      i = 0;
      localObject1 = null;
    }
  }

  private void drawTitle(Canvas paramCanvas)
  {
    boolean bool = isPlaying();
    if (bool)
      drawLivingLabel(paramCanvas);
    TextPaint localTextPaint = SkinManager.getInstance().getNormalTextPaint();
    String str = getTitle();
    int j = this.mArrowRect.left;
    int i;
    float f1;
    label123: float f2;
    if (bool)
    {
      i = this.mLivingRect.right + this.channelLayout.leftMargin;
      str = TextUtils.ellipsize(str, localTextPaint, j - i, TextUtils.TruncateAt.END).toString();
      localTextPaint.getTextBounds(str, 0, str.length(), this.textBound);
      if (!bool)
        break label202;
      f1 = this.mLivingRect.right + this.livingLayout.leftMargin;
      f2 = this.channelLayout.topMargin + (this.channelLayout.height - this.textBound.top - this.textBound.bottom) / 2;
      if ((!bool) && (!isItemPressed()))
        break label214;
      paramCanvas.drawText(str, f1, f2, SkinManager.getInstance().getHighlightTextPaint());
    }
    while (true)
    {
      drawSubInfo(paramCanvas);
      return;
      i = this.channelLayout.leftMargin;
      break;
      label202: f1 = this.channelLayout.leftMargin;
      break label123;
      label214: paramCanvas.drawText(str, f1, f2, localTextPaint);
    }
  }

  private void generateRect()
  {
    int i = this.arrowLayout.leftMargin;
    int j = (this.itemLayout.height - this.arrowLayout.height) / 2;
    this.mArrowRect.set(i, j, this.arrowLayout.width + i, this.arrowLayout.height + j);
    this.mLivingRect.set(this.channelLayout.leftMargin, this.livingLayout.topMargin, this.channelLayout.leftMargin + this.livingLayout.width, this.livingLayout.getBottom());
  }

  private String getDurationTime(int paramInt)
  {
    int i = paramInt / 3600;
    int j = paramInt / 60 % 60;
    paramInt %= 60;
    if (i == 0)
    {
      if (paramInt == 0)
        return String.format(Locale.CHINA, "%d分", new Object[] { Integer.valueOf(j) });
      if (j == 0)
        return String.format(Locale.CHINA, "%d秒", new Object[] { Integer.valueOf(paramInt) });
      return String.format(Locale.CHINA, "%d分%d秒", new Object[] { Integer.valueOf(j), Integer.valueOf(paramInt) });
    }
    return String.format(Locale.CHINA, "%d小时%d分", new Object[] { Integer.valueOf(i), Integer.valueOf(j) });
  }

  private String getTitle()
  {
    if (this.mNode.nodeName.equalsIgnoreCase("program"))
      return ((ProgramNode)this.mNode).title;
    return "";
  }

  private boolean isPlaying()
  {
    if (this.mNode == null)
      return false;
    Node localNode = InfoManager.getInstance().root().getCurrentPlayingNode();
    if (localNode == null)
      return false;
    if (!this.mNode.nodeName.equalsIgnoreCase(localNode.nodeName))
      return false;
    return (this.mNode.nodeName.equalsIgnoreCase("program")) && (((ProgramNode)this.mNode).id == ((ProgramNode)localNode).id);
  }

  protected void onDraw(Canvas paramCanvas)
  {
    if (this.mNode == null)
      return;
    paramCanvas.save();
    paramCanvas.setDrawFilter(this.filter);
    drawBg(paramCanvas);
    drawLine(paramCanvas);
    drawTitle(paramCanvas);
    drawArrow(paramCanvas);
    paramCanvas.restore();
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    paramInt1 = View.MeasureSpec.getSize(paramInt1);
    paramInt2 = View.MeasureSpec.getSize(paramInt2);
    this.itemLayout.scaleToBounds(paramInt1, paramInt2);
    this.channelLayout.scaleToBounds(this.itemLayout);
    this.infoLayout.scaleToBounds(this.itemLayout);
    this.lineLayout.scaleToBounds(this.itemLayout);
    this.arrowLayout.scaleToBounds(this.itemLayout);
    this.livingLayout.scaleToBounds(this.itemLayout);
    this.livePaint.setTextSize(this.channelLayout.height * 0.5F);
    generateRect();
    setMeasuredDimension(this.itemLayout.width, this.itemLayout.height);
  }

  protected void onQtItemClick(View paramView)
  {
    if (this.mNode == null)
      return;
    if ((this.mNode.nodeName.equalsIgnoreCase("program")) && (((ProgramNode)this.mNode).getCurrPlayStatus() == 2))
    {
      if (InfoManager.getInstance().root().mPersonalCenterNode.reserveNode.isExisted(this.mNode))
        InfoManager.getInstance().root().mPersonalCenterNode.reserveNode.cancelReserve(((ProgramNode)this.mNode).id);
      while (true)
      {
        invalidate();
        return;
        InfoManager.getInstance().root().mPersonalCenterNode.reserveNode.addReserveNode((ProgramNode)this.mNode);
      }
    }
    int j;
    int i;
    if (InfoManager.getInstance().root().currentPlayMode() == RootNode.PlayMode.FMPLAY)
    {
      Toast.makeText(getContext(), "亲,无法使用系统收音机回听节目,只能播放当前直播节目", 1).show();
      j = 0;
      if (this.mNode.nodeName.equalsIgnoreCase("program"))
      {
        i = j;
        if (this.mNode.parent != null)
        {
          i = j;
          if (this.mNode.parent.nodeName.equalsIgnoreCase("radiochannel"))
            i = Integer.valueOf(((RadioChannelNode)this.mNode.parent).freq).intValue();
        }
        if (i != 0)
          FMManager.getInstance().tune(i);
        PlayerAgent.getInstance().dispatchPlayStateInFM(4096);
        InfoManager.getInstance().root().tuneFM(true);
      }
    }
    while (true)
    {
      invalidate();
      return;
      i = j;
      if (!this.mNode.nodeName.equalsIgnoreCase("radiochannel"))
        break;
      i = Integer.valueOf(((RadioChannelNode)this.mNode).freq).intValue();
      break;
      dispatchActionEvent("refresh", this.mNode);
      PlayerAgent.getInstance().play(this.mNode);
    }
  }

  public void update(String paramString, Object paramObject)
  {
    if (paramString.equalsIgnoreCase("content"))
    {
      this.mNode = ((Node)paramObject);
      invalidate();
    }
  }
}
public class DiscoverItemRecommendTagView extends QtView
    implements ViewElement.OnElementClickListener {
  public static final int DISCOVERY_MORE_COLLECTION = -100;
  private final ViewLayout arrowLayout =
      this.itemLayout.createChildLT(17, 30, 683, 23, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout itemLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 56, 720, 56, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout labelLayout =
      this.itemLayout.createChildLT(5, 32, 18, 22, ViewLayout.SCALE_FLAG_SLTCW);
  private ImageViewElement mArrow;
  private ImageViewElement mLabel;
  private TextViewElement mMore;
  private RecommendItemNode mNode;
  private TextViewElement mTag;
  private final ViewLayout moreLayout =
      this.itemLayout.createChildLT(150, 40, 523, 18, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout tagLayout =
      this.itemLayout.createChildLT(540, 40, 38, 18, ViewLayout.SCALE_FLAG_SLTCW);

  public DiscoverItemRecommendTagView(Context paramContext, int paramInt) {
    super(paramContext);
    setBackgroundColor(SkinManager.getCardColor());
    this.mLabel = new ImageViewElement(paramContext);
    this.mLabel.setImageRes(2130837717);
    addElement(this.mLabel);
    this.mTag = new TextViewElement(paramContext);
    this.mTag.setColor(SkinManager.getTextColorNormal());
    this.mTag.setMaxLineLimit(1);
    this.mTag.setVerticalAlignment(TextViewElement.VerticalAlignment.CENTER);
    addElement(this.mTag);
    this.mTag.expandHotPot(ScreenType.getCustomExtraBound());
    this.mMore = new TextViewElement(paramContext);
    this.mMore.setColor(SkinManager.getTextColorHighlight());
    this.mMore.setMaxLineLimit(1);
    this.mMore.setText("更多", false);
    this.mMore.setAlignment(Layout.Alignment.ALIGN_OPPOSITE);
    addElement(this.mMore);
    this.mMore.setOnElementClickListener(this);
    this.mArrow = new ImageViewElement(paramContext);
    this.mArrow.setImageRes(2130837695);
    addElement(this.mArrow, paramInt);
    this.mArrow.setOnElementClickListener(this);
  }

  public void onElementClick(ViewElement paramViewElement) {
    PlayerAgent.getInstance().addPlaySource(33);
    if (this.mNode.sectionId == -100) {
      ControllerManager.getInstance().redirectToMyCollectionView();
      MobclickAgent.onEvent(InfoManager.getInstance().getContext(), "frontCollectionMore");
      TCAgent.onEvent(InfoManager.getInstance().getContext(), "frontCollectionMore");
      return;
    }
    ControllerManager.getInstance().openDiscoverCategoryController(this.mNode.sectionId);
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.itemLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.tagLayout.scaleToBounds(this.itemLayout);
    this.moreLayout.scaleToBounds(this.itemLayout);
    this.arrowLayout.scaleToBounds(this.itemLayout);
    this.labelLayout.scaleToBounds(this.itemLayout);
    this.mArrow.measure(this.arrowLayout);
    this.mLabel.measure(
        this.labelLayout.leftMargin,
        this.labelLayout.topMargin,
        this.labelLayout.getRight(),
        this.labelLayout.getBottom());
    this.mTag.measure(this.tagLayout);
    this.mTag.setTextSize(SkinManager.getInstance().getNormalTextSize());
    this.mMore.measure(this.moreLayout);
    this.mMore.setTextSize(SkinManager.getInstance().getSubTextSize());
    setMeasuredDimension(this.itemLayout.width, this.itemLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("content")) {
      this.mNode = ((RecommendItemNode) paramObject);
      this.mTag.setText(this.mNode.belongName, false);
      invalidate();
    }
  }
}
Exemplo n.º 15
0
public class DanmakuPlayListView extends ViewGroupViewImpl
    implements InfoManager.ISubscribeEventListener {
  private final ViewLayout headLayout =
      this.standardLayout.createChildLT(720, 98, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private DanmakuScheduleHeadView mHeadView;
  private DanmakuVirtualPlaylistView mListView;
  private HashSet<Integer> mLoadedPosition = new HashSet();
  private int mLoadedTotal = 0;
  private final ViewLayout standardLayout =
      ViewLayout.createViewLayoutWithBoundsLT(720, 1200, 720, 1200, 0, 0, ViewLayout.FILL);

  public DanmakuPlayListView(Context paramContext) {
    super(paramContext);
    this.mHeadView = new DanmakuScheduleHeadView(paramContext);
    addView(this.mHeadView);
    this.mListView = new DanmakuVirtualPlaylistView(paramContext);
    this.mListView.setOnLoadMoreListener(
        new LoadMoreListView.onLoadMoreListener() {
          public void onLoadMore(int paramAnonymousInt) {
            DanmakuPlayListView.this.loadMore(paramAnonymousInt);
          }
        });
    addView(this.mListView);
  }

  private void loadMore(int paramInt) {
    if (this.mLoadedPosition.contains(Integer.valueOf(paramInt))) return;
    this.mLoadedTotal = paramInt;
    this.mLoadedPosition.add(Integer.valueOf(paramInt));
    InfoManager.getInstance()
        .loadProgramsScheduleNode(
            InfoManager.getInstance().root().getCurrentPlayingChannelNode(), this);
  }

  private void setProgramList() {
    ChannelNode localChannelNode = InfoManager.getInstance().root().getCurrentPlayingChannelNode();
    if (localChannelNode != null) {
      List localList = localChannelNode.getAllLstProgramNode();
      if ((localList != null) && (localList.size() > this.mLoadedTotal)) {
        this.mListView.update("addmore", localList);
        this.mListView.cancelLoadState();
      }
    }
  }

  protected void onLayout(
      boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    this.headLayout.layoutView(this.mHeadView);
    this.mListView.layout(
        0, this.headLayout.height, this.standardLayout.width, this.standardLayout.height);
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.standardLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.headLayout.scaleToBounds(this.standardLayout);
    this.mListView.measure(
        this.standardLayout.getWidthMeasureSpec(),
        View.MeasureSpec.makeMeasureSpec(
            this.standardLayout.height - this.headLayout.height, 1073741824));
    this.headLayout.measureView(this.mHeadView);
    setMeasuredDimension(this.standardLayout.width, this.standardLayout.height);
  }

  public void onNotification(String paramString) {
    if (paramString.equalsIgnoreCase("RPS")) setProgramList();
  }

  public void onRecvDataException(
      String paramString, InfoManager.DataExceptionStatus paramDataExceptionStatus) {}

  public void update(String paramString, Object paramObject) {
    if (paramString.equalsIgnoreCase("setData")) this.mListView.update(paramString, paramObject);
  }
}
public class VirtualPlaylistItemView extends QtView {
  private static final String MODEL_HOUR_MINUTE = "时长:%d时%d分";
  private static final String MODEL_MINITE = "时长:%d分";
  private static final String MODEL_MINITE_SECOND = "时长:%d分%d秒";
  private static final String MODEL_SECOND = "时长:%d秒";
  private final ViewLayout arrowLayout =
      this.itemLayout.createChildLT(36, 36, 650, 50, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout infoLayout =
      this.itemLayout.createChildLT(600, 45, 30, 75, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout itemLayout =
      ViewLayout.createViewLayoutWithBoundsLT(
          720, 136, 720, 800, 0, 0, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout lineLayout =
      this.itemLayout.createChildLT(690, 1, 30, 135, ViewLayout.SCALE_FLAG_SLTCW);
  private final ViewLayout livingLayout =
      this.itemLayout.createChildLT(50, 26, 30, 29, ViewLayout.SCALE_FLAG_SLTCW);
  private ImageViewElement mArrowElement;
  private ButtonViewElement mBgElement;
  private TextViewElement mInfoElement;
  private boolean mIsPlaying = false;
  private LineElement mLineElement;
  private TextViewElement mNameElement;
  private ProgramNode mNode;
  private ImageViewElement mStateElement;
  private final ViewLayout nameLayout =
      this.itemLayout.createChildLT(600, 45, 30, 20, ViewLayout.SCALE_FLAG_SLTCW);

  public VirtualPlaylistItemView(Context paramContext, int paramInt) {
    super(paramContext);
    this.mBgElement = new ButtonViewElement(paramContext);
    this.mBgElement.setBackgroundColor(SkinManager.getItemHighlightMaskColor(), 0);
    addElement(this.mBgElement);
    this.mBgElement.setOnElementClickListener(
        new ViewElement.OnElementClickListener() {
          public void onElementClick(ViewElement paramAnonymousViewElement) {
            VirtualPlaylistItemView.this.handleClick();
          }
        });
    this.mNameElement = new TextViewElement(paramContext);
    this.mNameElement.setMaxLineLimit(1);
    this.mNameElement.setColor(-1);
    addElement(this.mNameElement);
    this.mInfoElement = new TextViewElement(paramContext);
    this.mInfoElement.setMaxLineLimit(1);
    this.mInfoElement.setColor(SkinManager.getNewPlaySubColor());
    addElement(this.mInfoElement);
    this.mStateElement = new ImageViewElement(paramContext);
    this.mStateElement.setImageRes(2130837921);
    addElement(this.mStateElement, paramInt);
    this.mLineElement = new LineElement(paramContext);
    this.mLineElement.setColor(872415231);
    this.mLineElement.setOrientation(1);
    addElement(this.mLineElement);
    this.mArrowElement = new ImageViewElement(paramContext);
    this.mArrowElement.setImageRes(2130837694);
    addElement(this.mArrowElement, paramInt);
  }

  private String getDurationTime(int paramInt) {
    int i = paramInt / 3600;
    int j = paramInt / 60 % 60;
    int k = paramInt % 60;
    if (i == 0) {
      if (k == 0) {
        Locale localLocale4 = Locale.CHINA;
        Object[] arrayOfObject4 = new Object[1];
        arrayOfObject4[0] = Integer.valueOf(j);
        return String.format(localLocale4, "时长:%d分", arrayOfObject4);
      }
      if (j == 0) {
        Locale localLocale3 = Locale.CHINA;
        Object[] arrayOfObject3 = new Object[1];
        arrayOfObject3[0] = Integer.valueOf(k);
        return String.format(localLocale3, "时长:%d秒", arrayOfObject3);
      }
      Locale localLocale2 = Locale.CHINA;
      Object[] arrayOfObject2 = new Object[2];
      arrayOfObject2[0] = Integer.valueOf(j);
      arrayOfObject2[1] = Integer.valueOf(k);
      return String.format(localLocale2, "时长:%d分%d秒", arrayOfObject2);
    }
    Locale localLocale1 = Locale.CHINA;
    Object[] arrayOfObject1 = new Object[2];
    arrayOfObject1[0] = Integer.valueOf(i);
    arrayOfObject1[1] = Integer.valueOf(j);
    return String.format(localLocale1, "时长:%d时%d分", arrayOfObject1);
  }

  private void handleClick() {
    if (this.mNode == null) return;
    PlayerAgent.getInstance().play(this.mNode);
    ControllerManager.getInstance().popLastController();
  }

  private boolean isPlaying(ProgramNode paramProgramNode) {
    if (paramProgramNode == null) return false;
    Node localNode = InfoManager.getInstance().root().getCurrentPlayingNode();
    if (localNode == null) return false;
    if (!this.mNode.nodeName.equalsIgnoreCase(localNode.nodeName)) return false;
    return this.mNode.uniqueId == ((ProgramNode) localNode).uniqueId;
  }

  protected void onDraw(Canvas paramCanvas) {
    TextViewElement localTextViewElement = this.mNameElement;
    if (this.mIsPlaying) ;
    for (int i = this.livingLayout.width; ; i = 0) {
      localTextViewElement.setTranslationX(i);
      super.onDraw(paramCanvas);
      return;
    }
  }

  protected void onMeasure(int paramInt1, int paramInt2) {
    this.itemLayout.scaleToBounds(
        View.MeasureSpec.getSize(paramInt1), View.MeasureSpec.getSize(paramInt2));
    this.nameLayout.scaleToBounds(this.itemLayout);
    this.infoLayout.scaleToBounds(this.itemLayout);
    this.arrowLayout.scaleToBounds(this.itemLayout);
    this.lineLayout.scaleToBounds(this.itemLayout);
    this.livingLayout.scaleToBounds(this.itemLayout);
    this.mNameElement.measure(this.nameLayout);
    this.mInfoElement.measure(this.infoLayout);
    this.mArrowElement.measure(this.arrowLayout);
    this.mBgElement.measure(this.itemLayout);
    this.mStateElement.measure(this.livingLayout);
    this.mLineElement.measure(this.lineLayout);
    this.mNameElement.setTextSize(SkinManager.getInstance().getNormalTextSize());
    this.mInfoElement.setTextSize(SkinManager.getInstance().getSubTextSize());
    setMeasuredDimension(this.itemLayout.width, this.itemLayout.height);
  }

  public void update(String paramString, Object paramObject) {
    ImageViewElement localImageViewElement;
    if (paramString.equalsIgnoreCase("content")) {
      this.mNode = ((ProgramNode) paramObject);
      this.mIsPlaying = isPlaying(this.mNode);
      localImageViewElement = this.mStateElement;
      if (!this.mIsPlaying) break label86;
    }
    label86:
    for (int i = 0; ; i = 4) {
      localImageViewElement.setVisible(i);
      this.mNameElement.setText(this.mNode.title, false);
      this.mInfoElement.setText(getDurationTime(this.mNode.getDuration()));
      return;
    }
  }
}