BatchingListUpdateCallback.java 2.12 KB
package android.support.v7.util;

public class BatchingListUpdateCallback
  implements ListUpdateCallback
{
  final ListUpdateCallback a;
  int b = 0;
  int c = -1;
  int d = -1;
  Object e = null;
  
  public BatchingListUpdateCallback(ListUpdateCallback paramListUpdateCallback)
  {
    this.a = paramListUpdateCallback;
  }
  
  public void dispatchLastEvent()
  {
    if (this.b == 0) {
      return;
    }
    switch (this.b)
    {
    }
    for (;;)
    {
      this.e = null;
      this.b = 0;
      return;
      this.a.onInserted(this.c, this.d);
      continue;
      this.a.onRemoved(this.c, this.d);
      continue;
      this.a.onChanged(this.c, this.d, this.e);
    }
  }
  
  public void onChanged(int paramInt1, int paramInt2, Object paramObject)
  {
    if ((this.b == 3) && (paramInt1 <= this.c + this.d) && (paramInt1 + paramInt2 >= this.c) && (this.e == paramObject))
    {
      int i = this.c;
      int j = this.d;
      this.c = Math.min(paramInt1, this.c);
      this.d = (Math.max(i + j, paramInt1 + paramInt2) - this.c);
      return;
    }
    dispatchLastEvent();
    this.c = paramInt1;
    this.d = paramInt2;
    this.e = paramObject;
    this.b = 3;
  }
  
  public void onInserted(int paramInt1, int paramInt2)
  {
    if ((this.b == 1) && (paramInt1 >= this.c) && (paramInt1 <= this.c + this.d))
    {
      this.d += paramInt2;
      this.c = Math.min(paramInt1, this.c);
      return;
    }
    dispatchLastEvent();
    this.c = paramInt1;
    this.d = paramInt2;
    this.b = 1;
  }
  
  public void onMoved(int paramInt1, int paramInt2)
  {
    dispatchLastEvent();
    this.a.onMoved(paramInt1, paramInt2);
  }
  
  public void onRemoved(int paramInt1, int paramInt2)
  {
    if ((this.b == 2) && (this.c >= paramInt1) && (this.c <= paramInt1 + paramInt2))
    {
      this.d += paramInt2;
      this.c = paramInt1;
      return;
    }
    dispatchLastEvent();
    this.c = paramInt1;
    this.d = paramInt2;
    this.b = 2;
  }
}


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