package com.metaio.cloud.plugin.view;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.IntEvaluator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build.VERSION;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.TextView;

public class CollapsibleTextView extends TextView
{
  private int expandedHeight = -2;
  private boolean isAnimating = false;
  private boolean isCollapsationEnabled = true;
  private boolean isCollapsed = false;

  public CollapsibleTextView(Context paramContext)
  {
    super(paramContext);
  }

  public CollapsibleTextView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
  }

  public CollapsibleTextView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
  }

  @TargetApi(11)
  private void expand()
  {
    if (!this.isCollapsationEnabled)
      return;
    if (Build.VERSION.SDK_INT >= 11)
    {
      HeightEvaluator localHeightEvaluator = new HeightEvaluator(this);
      Object[] arrayOfObject = new Object[2];
      arrayOfObject[0] = Integer.valueOf(getHeight());
      arrayOfObject[1] = Integer.valueOf(this.expandedHeight);
      ValueAnimator localValueAnimator = ValueAnimator.ofObject(localHeightEvaluator, arrayOfObject);
      localValueAnimator.setDuration(250L);
      localValueAnimator.setInterpolator(new OvershootInterpolator());
      localValueAnimator.addListener(new Animator.AnimatorListener()
      {
        public void onAnimationCancel(Animator paramAnonymousAnimator)
        {
        }

        public void onAnimationEnd(Animator paramAnonymousAnimator)
        {
          CollapsibleTextView.this.setEllipsize(null);
          CollapsibleTextView.access$002(CollapsibleTextView.this, false);
          CollapsibleTextView.access$102(CollapsibleTextView.this, false);
          CollapsibleTextView.this.postInvalidate();
        }

        public void onAnimationRepeat(Animator paramAnonymousAnimator)
        {
        }

        public void onAnimationStart(Animator paramAnonymousAnimator)
        {
          CollapsibleTextView.access$002(CollapsibleTextView.this, true);
        }
      });
      if (!this.isAnimating)
        localValueAnimator.start();
    }
    while (true)
    {
      setEllipsize(null);
      return;
      ViewGroup.LayoutParams localLayoutParams = getLayoutParams();
      localLayoutParams.height = this.expandedHeight;
      setLayoutParams(localLayoutParams);
    }
  }

  @TargetApi(11)
  public void collapse()
  {
    if (!this.isCollapsationEnabled)
      return;
    collapse((int)TypedValue.applyDimension(1, 50.0F, getResources().getDisplayMetrics()));
  }

  @TargetApi(11)
  public void collapse(int paramInt)
  {
    if (paramInt >= this.expandedHeight);
    ValueAnimator localValueAnimator;
    do
    {
      return;
      if (Build.VERSION.SDK_INT < 11)
        break;
      HeightEvaluator localHeightEvaluator = new HeightEvaluator(this);
      Object[] arrayOfObject = new Object[2];
      arrayOfObject[0] = Integer.valueOf(getHeight());
      arrayOfObject[1] = Integer.valueOf(paramInt);
      localValueAnimator = ValueAnimator.ofObject(localHeightEvaluator, arrayOfObject);
      localValueAnimator.setDuration(250L);
      localValueAnimator.setInterpolator(new DecelerateInterpolator());
      localValueAnimator.addListener(new Animator.AnimatorListener()
      {
        public void onAnimationCancel(Animator paramAnonymousAnimator)
        {
        }

        public void onAnimationEnd(Animator paramAnonymousAnimator)
        {
          CollapsibleTextView.this.setEllipsize(TextUtils.TruncateAt.END);
          CollapsibleTextView.access$102(CollapsibleTextView.this, true);
          CollapsibleTextView.access$002(CollapsibleTextView.this, false);
          CollapsibleTextView.this.postInvalidate();
        }

        public void onAnimationRepeat(Animator paramAnonymousAnimator)
        {
        }

        public void onAnimationStart(Animator paramAnonymousAnimator)
        {
          CollapsibleTextView.access$002(CollapsibleTextView.this, true);
        }
      });
    }
    while (this.isAnimating);
    localValueAnimator.start();
    return;
    ViewGroup.LayoutParams localLayoutParams = getLayoutParams();
    localLayoutParams.height = paramInt;
    setLayoutParams(localLayoutParams);
  }

  public boolean isCollapsationEnabled()
  {
    return this.isCollapsationEnabled;
  }

  protected void onMeasure(int paramInt1, int paramInt2)
  {
    super.onMeasure(paramInt1, paramInt2);
    if (this.expandedHeight < 0)
      this.expandedHeight = getMeasuredHeight();
  }

  public void setCollapsationEnabled(boolean paramBoolean)
  {
    this.isCollapsationEnabled = paramBoolean;
  }

  public void toggle()
  {
    if (this.isCollapsed)
    {
      expand();
      return;
    }
    collapse();
  }

  @TargetApi(11)
  private class HeightEvaluator extends IntEvaluator
  {
    private final View v;

    public HeightEvaluator(View arg2)
    {
      Object localObject;
      this.v = localObject;
    }

    public Integer evaluate(float paramFloat, Integer paramInteger1, Integer paramInteger2)
    {
      int i = (int)(paramInteger1.intValue() + paramFloat * (paramInteger2.intValue() - paramInteger1.intValue()));
      ViewGroup.LayoutParams localLayoutParams = this.v.getLayoutParams();
      localLayoutParams.height = i;
      this.v.setLayoutParams(localLayoutParams);
      return Integer.valueOf(i);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.metaio.cloud.plugin.view.CollapsibleTextView
 * JD-Core Version:    0.6.2
 */