ActionBarDrawerToggle.java 9.15 KB
package android.support.v4.app;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.graphics.drawable.InsetDrawable;
import android.os.Build.VERSION;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.DrawerLayout.DrawerListener;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import cb;
import cc;

@Deprecated
public class ActionBarDrawerToggle
  implements DrawerLayout.DrawerListener
{
  private static final a b = new b();
  final Activity a;
  private final Delegate c;
  private final DrawerLayout d;
  private boolean e = true;
  private boolean f;
  private Drawable g;
  private Drawable h;
  private e i;
  private final int j;
  private final int k;
  private final int l;
  private Object m;
  
  static
  {
    int n = Build.VERSION.SDK_INT;
    if (n >= 18)
    {
      b = new d();
      return;
    }
    if (n >= 11)
    {
      b = new c();
      return;
    }
  }
  
  public ActionBarDrawerToggle(Activity paramActivity, DrawerLayout paramDrawerLayout, @DrawableRes int paramInt1, @StringRes int paramInt2, @StringRes int paramInt3) {}
  
  public ActionBarDrawerToggle(Activity paramActivity, DrawerLayout paramDrawerLayout, boolean paramBoolean, @DrawableRes int paramInt1, @StringRes int paramInt2, @StringRes int paramInt3)
  {
    this.a = paramActivity;
    if ((paramActivity instanceof DelegateProvider))
    {
      this.c = ((DelegateProvider)paramActivity).getDrawerToggleDelegate();
      this.d = paramDrawerLayout;
      this.j = paramInt1;
      this.k = paramInt2;
      this.l = paramInt3;
      this.g = a();
      this.h = ContextCompat.getDrawable(paramActivity, paramInt1);
      this.i = new e(this.h);
      paramActivity = this.i;
      if (!paramBoolean) {
        break label123;
      }
    }
    label123:
    for (float f1 = 0.33333334F;; f1 = 0.0F)
    {
      paramActivity.b = f1;
      paramActivity.invalidateSelf();
      return;
      this.c = null;
      break;
    }
  }
  
  private Drawable a()
  {
    if (this.c != null) {
      return this.c.getThemeUpIndicator();
    }
    return b.a(this.a);
  }
  
  private void a(int paramInt)
  {
    if (this.c != null)
    {
      this.c.setActionBarDescription(paramInt);
      return;
    }
    this.m = b.a(this.m, this.a, paramInt);
  }
  
  private void a(Drawable paramDrawable, int paramInt)
  {
    if (this.c != null)
    {
      this.c.setActionBarUpIndicator(paramDrawable, paramInt);
      return;
    }
    this.m = b.a(this.m, this.a, paramDrawable, paramInt);
  }
  
  public boolean isDrawerIndicatorEnabled()
  {
    return this.e;
  }
  
  public void onConfigurationChanged(Configuration paramConfiguration)
  {
    if (!this.f) {
      this.g = a();
    }
    this.h = ContextCompat.getDrawable(this.a, this.j);
    syncState();
  }
  
  public void onDrawerClosed(View paramView)
  {
    this.i.a(0.0F);
    if (this.e) {
      a(this.k);
    }
  }
  
  public void onDrawerOpened(View paramView)
  {
    this.i.a(1.0F);
    if (this.e) {
      a(this.l);
    }
  }
  
  public void onDrawerSlide(View paramView, float paramFloat)
  {
    float f1 = this.i.a;
    if (paramFloat > 0.5F) {}
    for (paramFloat = Math.max(f1, Math.max(0.0F, paramFloat - 0.5F) * 2.0F);; paramFloat = Math.min(f1, paramFloat * 2.0F))
    {
      this.i.a(paramFloat);
      return;
    }
  }
  
  public void onDrawerStateChanged(int paramInt) {}
  
  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    if ((paramMenuItem != null) && (paramMenuItem.getItemId() == 16908332) && (this.e))
    {
      if (this.d.isDrawerVisible(8388611)) {
        this.d.closeDrawer(8388611);
      }
      for (;;)
      {
        return true;
        this.d.openDrawer(8388611);
      }
    }
    return false;
  }
  
  public void setDrawerIndicatorEnabled(boolean paramBoolean)
  {
    int n;
    if (paramBoolean != this.e)
    {
      if (!paramBoolean) {
        break label54;
      }
      e locale = this.i;
      if (!this.d.isDrawerOpen(8388611)) {
        break label46;
      }
      n = this.l;
      a(locale, n);
    }
    for (;;)
    {
      this.e = paramBoolean;
      return;
      label46:
      n = this.k;
      break;
      label54:
      a(this.g, 0);
    }
  }
  
  public void setHomeAsUpIndicator(int paramInt)
  {
    Drawable localDrawable = null;
    if (paramInt != 0) {
      localDrawable = ContextCompat.getDrawable(this.a, paramInt);
    }
    setHomeAsUpIndicator(localDrawable);
  }
  
  public void setHomeAsUpIndicator(Drawable paramDrawable)
  {
    if (paramDrawable == null) {
      this.g = a();
    }
    for (this.f = false;; this.f = true)
    {
      if (!this.e) {
        a(this.g, 0);
      }
      return;
      this.g = paramDrawable;
    }
  }
  
  public void syncState()
  {
    e locale;
    if (this.d.isDrawerOpen(8388611))
    {
      this.i.a(1.0F);
      if (this.e)
      {
        locale = this.i;
        if (!this.d.isDrawerOpen(8388611)) {
          break label67;
        }
      }
    }
    label67:
    for (int n = this.l;; n = this.k)
    {
      a(locale, n);
      return;
      this.i.a(0.0F);
      break;
    }
  }
  
  public static abstract interface Delegate
  {
    @Nullable
    public abstract Drawable getThemeUpIndicator();
    
    public abstract void setActionBarDescription(@StringRes int paramInt);
    
    public abstract void setActionBarUpIndicator(Drawable paramDrawable, @StringRes int paramInt);
  }
  
  public static abstract interface DelegateProvider
  {
    @Nullable
    public abstract ActionBarDrawerToggle.Delegate getDrawerToggleDelegate();
  }
  
  static abstract interface a
  {
    public abstract Drawable a(Activity paramActivity);
    
    public abstract Object a(Object paramObject, Activity paramActivity, int paramInt);
    
    public abstract Object a(Object paramObject, Activity paramActivity, Drawable paramDrawable, int paramInt);
  }
  
  static final class b
    implements ActionBarDrawerToggle.a
  {
    public final Drawable a(Activity paramActivity)
    {
      return null;
    }
    
    public final Object a(Object paramObject, Activity paramActivity, int paramInt)
    {
      return paramObject;
    }
    
    public final Object a(Object paramObject, Activity paramActivity, Drawable paramDrawable, int paramInt)
    {
      return paramObject;
    }
  }
  
  @TargetApi(11)
  @RequiresApi(11)
  static final class c
    implements ActionBarDrawerToggle.a
  {
    public final Drawable a(Activity paramActivity)
    {
      return cb.a(paramActivity);
    }
    
    public final Object a(Object paramObject, Activity paramActivity, int paramInt)
    {
      return cb.a(paramObject, paramActivity, paramInt);
    }
    
    public final Object a(Object paramObject, Activity paramActivity, Drawable paramDrawable, int paramInt)
    {
      return cb.a(paramObject, paramActivity, paramDrawable, paramInt);
    }
  }
  
  @TargetApi(18)
  @RequiresApi(18)
  static final class d
    implements ActionBarDrawerToggle.a
  {
    public final Drawable a(Activity paramActivity)
    {
      return cc.a(paramActivity);
    }
    
    public final Object a(Object paramObject, Activity paramActivity, int paramInt)
    {
      return cc.a(paramObject, paramActivity, paramInt);
    }
    
    public final Object a(Object paramObject, Activity paramActivity, Drawable paramDrawable, int paramInt)
    {
      return cc.a(paramObject, paramActivity, paramDrawable, paramInt);
    }
  }
  
  final class e
    extends InsetDrawable
    implements Drawable.Callback
  {
    float a;
    float b;
    private final boolean d;
    private final Rect e;
    
    e(Drawable paramDrawable)
    {
      super(0);
      if (Build.VERSION.SDK_INT > 18) {
        bool = true;
      }
      this.d = bool;
      this.e = new Rect();
    }
    
    public final void a(float paramFloat)
    {
      this.a = paramFloat;
      invalidateSelf();
    }
    
    public final void draw(Canvas paramCanvas)
    {
      int j = 1;
      copyBounds(this.e);
      paramCanvas.save();
      if (ViewCompat.getLayoutDirection(ActionBarDrawerToggle.this.a.getWindow().getDecorView()) == 1) {}
      for (int i = 1;; i = 0)
      {
        if (i != 0) {
          j = -1;
        }
        int k = this.e.width();
        float f1 = -this.b;
        float f2 = k;
        float f3 = this.a;
        paramCanvas.translate(j * (f1 * f2 * f3), 0.0F);
        if ((i != 0) && (!this.d))
        {
          paramCanvas.translate(k, 0.0F);
          paramCanvas.scale(-1.0F, 1.0F);
        }
        super.draw(paramCanvas);
        paramCanvas.restore();
        return;
      }
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/app/ActionBarDrawerToggle.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */