package com.tealium.library;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.drawable.PaintDrawable;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.ScaleAnimation;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import java.lang.ref.WeakReference;
import java.util.List;

@SuppressLint({"ViewConstructor"})
final class G extends RelativeLayout
  implements View.OnClickListener, View.OnTouchListener, ViewTreeObserver.OnGlobalLayoutListener, m, t
{
  private final R a;
  private final List<ab> b;
  private final List<ab> c;
  private final Point d;
  private final Point e;
  private final Point f;
  private final int g;
  private final int h;
  private final int i;
  private final int j;
  private final V k;
  private WeakReference<View> l;
  private B m;
  private I n;
  private I o;
  private D p;
  private L q;
  private O r;
  private e s;
  private int t = 0;
  private float u;
  private float v;

  G(List<ab> paramList1, List<ab> paramList2, H paramH, V paramV)
  {
    super(paramH.getContext());
    this.k = paramV;
    this.h = S.a(this, 256.0F);
    this.i = S.a(this, 256.0F);
    this.j = S.a(this, 3.0F);
    this.g = S.a(this, 50.0F);
    this.a = new R(paramH);
    this.c = paramList1;
    this.b = paramList2;
    this.d = new Point();
    this.e = new Point();
    this.f = new Point();
    setLayoutParams(new FrameLayout.LayoutParams(0, 0));
    setPadding(0, 0, 0, 0);
    getViewTreeObserver().addOnGlobalLayoutListener(this);
  }

  private void a(int paramInt1, int paramInt2)
  {
    this.f.set(paramInt1, paramInt2);
    FrameLayout.LayoutParams localLayoutParams = (FrameLayout.LayoutParams)getLayoutParams();
    localLayoutParams.leftMargin = paramInt1;
    localLayoutParams.topMargin = paramInt2;
    setLayoutParams(localLayoutParams);
  }

  private void a(boolean paramBoolean)
  {
    if (this.s == e.a)
      return;
    this.s = e.a;
    this.n = null;
    this.o = null;
    this.p = null;
    this.q = null;
    this.r = null;
    this.m = null;
    final d locald = new d(getContext(), this.g);
    if (paramBoolean)
    {
      float f1 = this.e.x / this.g;
      float f2 = this.e.y / this.g;
      removeAllViews();
      b(this.g, this.g);
      ScaleAnimation localScaleAnimation = new ScaleAnimation(f1, 1.0F, f2, 1.0F, 1, 0.0F, 1, 0.0F);
      localScaleAnimation.setDuration(500L);
      localScaleAnimation.setAnimationListener(new Animation.AnimationListener()
      {
        public final void onAnimationEnd(Animation paramAnonymousAnimation)
        {
          G.this.addView(locald);
        }

        public final void onAnimationRepeat(Animation paramAnonymousAnimation)
        {
        }

        public final void onAnimationStart(Animation paramAnonymousAnimation)
        {
        }
      });
      startAnimation(localScaleAnimation);
      return;
    }
    removeAllViews();
    addView(locald);
    b(this.g, this.g);
  }

  private void b(int paramInt1, int paramInt2)
  {
    if (this.s == e.b)
    {
      Point localPoint = this.e;
      if (paramInt1 < this.h)
        paramInt1 = this.h;
      if (paramInt2 < this.i)
        paramInt2 = this.i;
      localPoint.set(paramInt1, paramInt2);
    }
    while (true)
    {
      FrameLayout.LayoutParams localLayoutParams = (FrameLayout.LayoutParams)getLayoutParams();
      localLayoutParams.width = this.e.x;
      localLayoutParams.height = this.e.y;
      setLayoutParams(localLayoutParams);
      return;
      this.e.set(paramInt1, paramInt2);
    }
  }

  private void b(g paramg)
  {
    if (paramg == null);
    do
    {
      do
        return;
      while (g.b(paramg) != e.b);
      b(g.c(paramg).x, g.c(paramg).y);
    }
    while (g.d(paramg) == null);
    switch (6.a[g.d(paramg).ordinal()])
    {
    default:
      return;
    case 1:
      onClick(this.n);
      return;
    case 2:
      onClick(this.o);
      return;
    case 3:
      onClick(this.p);
      return;
    case 4:
      onClick(this.q);
      return;
    case 5:
    }
    onClick(this.r);
  }

  private void c(g paramg)
  {
    if (this.s == e.b)
      return;
    if (this.s == e.a);
    for (int i1 = 1; ; i1 = 0)
    {
      this.s = e.b;
      removeAllViews();
      Context localContext = getContext();
      S.a locala = new S.a();
      PaintDrawable localPaintDrawable = new PaintDrawable(Color.rgb(64, 64, 64));
      localPaintDrawable.setCornerRadius(10.0F);
      S.a(this, localPaintDrawable);
      a locala1 = new a(localContext, locala.a());
      locala1.setOnClickListener(this);
      b localb = new b(localContext, locala.a());
      localb.setOnClickListener(this);
      f localf = new f(localContext, locala.a());
      this.n = I.a(localContext, locala.a(), locala1.getId());
      this.n.setOnClickListener(this);
      this.o = I.b(localContext, locala.a(), this.n.getId());
      this.o.setOnClickListener(this);
      this.p = new D(localContext, locala.a(), this.o.getId());
      this.p.setOnClickListener(this);
      this.q = L.a(localContext, locala.a(), this.p.getId(), this.c, this.b);
      this.q.setOnClickListener(this);
      this.r = new O(localContext, locala.a(), this.q.getId(), this.k);
      this.r.setOnClickListener(this);
      View localView1 = new View(localContext);
      int i2 = S.a(localView1, 37.0F);
      int i3 = S.a(localView1, 5.0F);
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(i2, i2);
      localLayoutParams.setMargins(i3, i3, i3, i3);
      localLayoutParams.addRule(12);
      localLayoutParams.addRule(11);
      localView1.setLayoutParams(localLayoutParams);
      localView1.setOnTouchListener(this);
      this.m = new B(localContext, this.n.getId(), localf.getId());
      addView(locala1);
      addView(localb);
      addView(new c(localContext, locala1.getId(), localb.getId()));
      addView(localf);
      addView(this.n);
      addView(this.o);
      addView(this.p);
      addView(this.q);
      addView(this.r);
      addView(this.m);
      addView(localView1);
      if (paramg == null)
        break;
      b(paramg);
      return;
    }
    b(this.h, this.i);
    View localView2;
    if (this.l == null)
    {
      localView2 = null;
      label533: if (localView2 != null)
        break label616;
    }
    label616: for (Object localObject = this.n; ; localObject = this.p.a(localView2))
    {
      onClick((View)localObject);
      if (i1 == 0)
        break;
      float f1 = this.g / this.h;
      ScaleAnimation localScaleAnimation = new ScaleAnimation(f1, 1.0F, f1, 1.0F, 1, 0.0F, 1, 0.0F);
      localScaleAnimation.setDuration(500L);
      startAnimation(localScaleAnimation);
      return;
      localView2 = (View)this.l.get();
      break label533;
    }
  }

  final g a()
  {
    g localg = new g(this, (byte)0);
    if (this.s == e.b)
      this.m.a(null);
    this.a.b();
    return localg;
  }

  public final void a(final View paramView)
  {
    if (!ad.a())
      d.a().post(new Runnable()
      {
        public final void run()
        {
          G.this.a(paramView);
        }
      });
    do
    {
      return;
      this.l = new WeakReference(paramView);
      if (this.s == e.a)
      {
        c(null);
        return;
      }
    }
    while (this.s != e.b);
    onClick(this.p.a(paramView));
  }

  final void a(final g paramg)
  {
    if (paramg == null);
    label79: 
    do
    {
      return;
      final View localView = ad.c(this);
      if (localView != null)
      {
        if (localView.getWidth() <= 0)
          break label79;
        a((int)(localView.getWidth() * g.a(paramg).x), (int)(localView.getHeight() * g.a(paramg).y));
      }
      while ((g.b(paramg) == e.b) && (this.s != e.b))
      {
        c(paramg);
        return;
        localView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
        {
          public final void onGlobalLayout()
          {
            G.a(G.this, (int)(localView.getWidth() * G.g.a(paramg).x), (int)(localView.getHeight() * G.g.a(paramg).y));
            S.a(localView.getViewTreeObserver(), this);
          }
        });
      }
      if ((g.b(paramg) == e.a) && (this.s != e.a))
      {
        a(false);
        return;
      }
    }
    while (g.b(paramg) != e.b);
    b(paramg);
  }

  public final void b()
  {
    if (!ad.a())
      d.a().post(new Runnable()
      {
        public final void run()
        {
          G.this.b();
        }
      });
    while (this.m == null)
      return;
    this.m.b();
  }

  final R c()
  {
    return this.a;
  }

  final void d()
  {
    if (getParent() == null)
      return;
    if (this.s == null)
      a(false);
    View localView = (View)getParent();
    a((int)(localView.getWidth() / 2.0F - this.e.x / 2.0F), (int)(localView.getHeight() / 2.0F - this.e.y / 2.0F));
  }

  public final void onClick(View paramView)
  {
    if ((paramView instanceof b))
      a(true);
    do
    {
      return;
      if ((paramView instanceof a))
      {
        this.a.b();
        ScaleAnimation localScaleAnimation = new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F, 1, 0.0F, 1, 0.0F);
        localScaleAnimation.setDuration(500L);
        localScaleAnimation.setAnimationListener(new Animation.AnimationListener()
        {
          public final void onAnimationEnd(Animation paramAnonymousAnimation)
          {
            ViewGroup localViewGroup = (ViewGroup)G.this.getParent();
            if (localViewGroup != null)
              localViewGroup.removeView(G.this);
          }

          public final void onAnimationRepeat(Animation paramAnonymousAnimation)
          {
          }

          public final void onAnimationStart(Animation paramAnonymousAnimation)
          {
          }
        });
        startAnimation(localScaleAnimation);
        return;
      }
    }
    while (!(paramView instanceof L));
    this.m.a((L)paramView);
  }

  public final void onGlobalLayout()
  {
    ViewGroup localViewGroup = (ViewGroup)getParent();
    int i1;
    int i2;
    if ((localViewGroup != null) && (this.t != localViewGroup.getWidth()))
    {
      this.t = localViewGroup.getWidth();
      i1 = this.t - getWidth();
      i2 = localViewGroup.getHeight() - getHeight();
      if (this.f.x >= 0)
        break label134;
      this.f.x = 0;
      if (this.f.y >= 0)
        break label156;
      this.f.y = 0;
    }
    while (true)
    {
      FrameLayout.LayoutParams localLayoutParams = (FrameLayout.LayoutParams)getLayoutParams();
      localLayoutParams.leftMargin = this.f.x;
      localLayoutParams.topMargin = this.f.y;
      localLayoutParams.gravity = 51;
      setLayoutParams(localLayoutParams);
      return;
      label134: if (this.f.x <= i1)
        break;
      this.f.x = i1;
      break;
      label156: if (this.f.y > i2)
        this.f.y = i2;
    }
  }

  @SuppressLint({"ClickableViewAccessibility"})
  public final boolean onTouch(View paramView, MotionEvent paramMotionEvent)
  {
    switch (paramMotionEvent.getActionMasked())
    {
    case 1:
    default:
      return true;
    case 0:
      this.u = paramMotionEvent.getRawX();
      this.v = paramMotionEvent.getRawY();
    case 2:
    }
    float f1 = this.e.x + paramMotionEvent.getRawX() - this.u;
    float f2 = this.e.y + paramMotionEvent.getRawY() - this.v;
    int i1;
    if (f1 < this.h)
    {
      i1 = this.h;
      label105: if (f2 >= this.i)
        break label156;
    }
    label156: for (int i2 = this.i; ; i2 = (int)f2)
    {
      b(i1, i2);
      this.u = paramMotionEvent.getRawX();
      this.v = paramMotionEvent.getRawY();
      break;
      i1 = (int)f1;
      break label105;
    }
  }

  @SuppressLint({"ClickableViewAccessibility"})
  public final boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    super.onTouchEvent(paramMotionEvent);
    switch (paramMotionEvent.getActionMasked())
    {
    default:
    case 0:
    case 2:
    case 1:
    }
    while (true)
    {
      return true;
      this.d.set((int)paramMotionEvent.getRawX(), (int)paramMotionEvent.getRawY());
      this.u = paramMotionEvent.getRawX();
      this.v = paramMotionEvent.getRawY();
      continue;
      int i1 = (int)(paramMotionEvent.getRawX() - this.u);
      int i2 = (int)(paramMotionEvent.getRawY() - this.v);
      if ((i1 != 0) || (i2 != 0))
      {
        Point localPoint1 = this.f;
        localPoint1.x = (i1 + localPoint1.x);
        Point localPoint2 = this.f;
        localPoint2.y = (i2 + localPoint2.y);
        this.u = paramMotionEvent.getRawX();
        this.v = paramMotionEvent.getRawY();
        a(this.f.x, this.f.y);
        continue;
        if ((this.s == e.a) && (Math.abs(this.d.x - this.u) < this.j) && (Math.abs(this.d.y - this.v) < this.j))
          c(null);
      }
    }
  }

  static final class a extends G.h
  {
    a(Context paramContext, int paramInt)
    {
      super(paramInt);
      setText("X");
      RelativeLayout.LayoutParams localLayoutParams = (RelativeLayout.LayoutParams)getLayoutParams();
      localLayoutParams.addRule(9);
      localLayoutParams.addRule(10);
    }
  }

  static final class b extends G.h
  {
    b(Context paramContext, int paramInt)
    {
      super(paramInt);
      setText("_");
      RelativeLayout.LayoutParams localLayoutParams = (RelativeLayout.LayoutParams)getLayoutParams();
      localLayoutParams.addRule(11);
      localLayoutParams.addRule(10);
    }
  }

  static final class c extends TextView
  {
    c(Context paramContext, int paramInt1, int paramInt2)
    {
      super();
      setText("Tealium Mobile Companion");
      setTextSize(13.0F);
      setGravity(19);
      setTextColor(Color.rgb(204, 204, 204));
      setSingleLine();
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
      setLayoutParams(localLayoutParams);
      localLayoutParams.addRule(10);
      localLayoutParams.addRule(1, paramInt1);
      localLayoutParams.addRule(0, paramInt2);
      localLayoutParams.addRule(8, paramInt1);
    }

    c(Context paramContext, int paramInt, String paramString)
    {
      super();
      setText(paramString);
      setId(paramInt);
      setTypeface(null, 1);
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
      localLayoutParams.addRule(10);
      localLayoutParams.addRule(9);
      setLayoutParams(localLayoutParams);
    }

    c(Context paramContext, int paramInt1, String paramString, int paramInt2)
    {
      super();
      setText(paramString);
      setId(paramInt1);
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
      int i = S.a(this, 10.0F);
      localLayoutParams.leftMargin = i;
      localLayoutParams.rightMargin = i;
      localLayoutParams.addRule(3, paramInt2);
      localLayoutParams.addRule(9);
      localLayoutParams.addRule(11);
      setLayoutParams(localLayoutParams);
    }
  }

  static final class d extends ImageView
  {
    public d(Context paramContext, int paramInt)
    {
      super();
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(paramInt, paramInt);
      localLayoutParams.addRule(12);
      localLayoutParams.addRule(11);
      localLayoutParams.addRule(10);
      localLayoutParams.addRule(9);
      setImageDrawable(S.a("img/launcher.png", "launcher"));
      setPadding(0, 0, 0, 0);
      setScaleType(ImageView.ScaleType.FIT_CENTER);
      setBackgroundColor(0);
      setLayoutParams(localLayoutParams);
    }
  }

  static enum e
  {
    static
    {
      e[] arrayOfe = new e[2];
      arrayOfe[0] = a;
      arrayOfe[1] = b;
    }
  }

  static final class f extends View
    implements ViewTreeObserver.OnGlobalLayoutListener
  {
    private Paint a = new Paint();
    private Path b;

    f(Context paramContext, int paramInt)
    {
      super();
      this.a.setStyle(Paint.Style.FILL);
      this.a.setColor(-1);
      this.b = new Path();
      getViewTreeObserver().addOnGlobalLayoutListener(this);
      setId(paramInt);
      int i = S.a(this, 10.0F);
      int j = S.a(this, 5.0F);
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(i, i);
      localLayoutParams.setMargins(j, j, j, j);
      setLayoutParams(localLayoutParams);
      localLayoutParams.addRule(11);
      localLayoutParams.addRule(12);
    }

    protected final void onDraw(Canvas paramCanvas)
    {
      super.onDraw(paramCanvas);
      paramCanvas.drawPath(this.b, this.a);
    }

    public final void onGlobalLayout()
    {
      S.a(getViewTreeObserver(), this);
      this.b.moveTo(0.0F, getHeight());
      this.b.lineTo(getWidth(), 0.0F);
      this.b.lineTo(getWidth(), getHeight());
      this.b.lineTo(0.0F, getHeight());
    }
  }

  static final class g
  {
    private final Point a;
    private final PointF b;
    private final G.e c;
    private final L.a d;

    private g(G paramG)
    {
      this.a = new Point(G.a(paramG));
      View localView = (View)paramG.getParent();
      if ((localView == null) || (localView.getWidth() == 0) || (localView.getHeight() == 0));
      for (this.b = new PointF(0.0F, 0.0F); ; this.b = new PointF(G.b(paramG).x / localView.getWidth(), G.b(paramG).y / localView.getHeight()))
      {
        this.c = G.c(paramG);
        if (G.c(paramG) != G.e.a)
          break;
        this.d = null;
        return;
      }
      this.d = G.d(paramG).a();
    }

    public final String toString()
    {
      return "State: {\r\n\tsize : (" + this.a.x + ", " + this.a.y + "),\r\n\t loc : (" + (int)(100.0F * this.b.x) + "%, " + (int)(100.0F * this.b.y) + "%),\r\n\tmode : " + this.c + '\r' + "\n\t tab : " + this.d + '\r' + "\n}";
    }
  }

  static abstract class h extends TextView
  {
    h(Context paramContext, int paramInt)
    {
      super();
      setBackgroundColor(0);
      setMinWidth(S.a(this, 25.0F));
      setMinHeight(S.a(this, 25.0F));
      setGravity(17);
      setTextSize(18.0F);
      setTextColor(Color.rgb(128, 128, 128));
      setPadding(0, 0, 0, 0);
      setTypeface(null, 1);
      int i = S.a(this, 37.0F);
      setLayoutParams(new RelativeLayout.LayoutParams(i, i));
      setId(paramInt);
    }
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.tealium.library.G
 * JD-Core Version:    0.6.2
 */