DragStartHelper.java 2.61 KB
package android.support.v13.view;

import android.annotation.TargetApi;
import android.graphics.Point;
import android.support.annotation.RequiresApi;
import android.support.v4.view.MotionEventCompat;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;

@TargetApi(13)
@RequiresApi(13)
public class DragStartHelper
{
  private final View a;
  private final OnDragStartListener b;
  private int c;
  private int d;
  private boolean e;
  private final View.OnLongClickListener f = new View.OnLongClickListener()
  {
    public final boolean onLongClick(View paramAnonymousView)
    {
      return DragStartHelper.this.onLongClick(paramAnonymousView);
    }
  };
  private final View.OnTouchListener g = new View.OnTouchListener()
  {
    public final boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent)
    {
      return DragStartHelper.this.onTouch(paramAnonymousView, paramAnonymousMotionEvent);
    }
  };
  
  public DragStartHelper(View paramView, OnDragStartListener paramOnDragStartListener)
  {
    this.a = paramView;
    this.b = paramOnDragStartListener;
  }
  
  public void attach()
  {
    this.a.setOnLongClickListener(this.f);
    this.a.setOnTouchListener(this.g);
  }
  
  public void detach()
  {
    this.a.setOnLongClickListener(null);
    this.a.setOnTouchListener(null);
  }
  
  public void getTouchPosition(Point paramPoint)
  {
    paramPoint.set(this.c, this.d);
  }
  
  public boolean onLongClick(View paramView)
  {
    return this.b.onDragStart(paramView, this);
  }
  
  public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
  {
    int i = (int)paramMotionEvent.getX();
    int j = (int)paramMotionEvent.getY();
    switch (paramMotionEvent.getAction())
    {
    default: 
    case 0: 
    case 2: 
      do
      {
        return false;
        this.c = i;
        this.d = j;
        return false;
      } while ((!MotionEventCompat.isFromSource(paramMotionEvent, 8194)) || ((MotionEventCompat.getButtonState(paramMotionEvent) & 0x1) == 0) || (this.e) || ((this.c == i) && (this.d == j)));
      this.c = i;
      this.d = j;
      this.e = this.b.onDragStart(paramView, this);
      return this.e;
    }
    this.e = false;
    return false;
  }
  
  public static abstract interface OnDragStartListener
  {
    public abstract boolean onDragStart(View paramView, DragStartHelper paramDragStartHelper);
  }
}


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