a.java 5.22 KB
package com.instabug.library.internal.c;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;

public class a
  implements SensorEventListener
{
  private a a;
  private b[] b = new b['–'];
  private float c = 10.0F;
  private int d = 2;
  private int[][] e = { { 0, 0 }, { 0, 0 }, { 0, 0 } };
  private int[] f = { 0, 0, 0 };
  private int g = 0;
  
  public void a(float paramFloat)
  {
    this.c = (100.0F * paramFloat);
  }
  
  public void a(a parama)
  {
    this.a = parama;
  }
  
  public boolean a(SensorManager paramSensorManager)
  {
    if (paramSensorManager != null) {
      return paramSensorManager.registerListener(this, paramSensorManager.getDefaultSensor(1), 2);
    }
    return false;
  }
  
  public void b(SensorManager paramSensorManager)
  {
    if (paramSensorManager != null) {
      paramSensorManager.unregisterListener(this);
    }
  }
  
  public void onAccuracyChanged(Sensor paramSensor, int paramInt) {}
  
  public void onSensorChanged(SensorEvent paramSensorEvent)
  {
    for (;;)
    {
      try
      {
        if ((this.b[0] != null) && (this.g > 0))
        {
          long l1 = paramSensorEvent.timestamp;
          long l2 = this.b[(this.g - 1)].d;
          if (l1 - l2 <= 500L) {
            return;
          }
        }
        Object localObject2 = this.b[this.g];
        Object localObject1 = localObject2;
        if (localObject2 == null) {
          localObject1 = new b(paramSensorEvent.values[0], paramSensorEvent.values[1], paramSensorEvent.values[2], paramSensorEvent.timestamp);
        }
        ((b)localObject1).a = paramSensorEvent.values[0];
        ((b)localObject1).b = paramSensorEvent.values[1];
        ((b)localObject1).c = paramSensorEvent.values[2];
        ((b)localObject1).d = paramSensorEvent.timestamp;
        this.b[this.g] = localObject1;
        this.g += 1;
        if (this.g == this.b.length) {
          this.g = 0;
        }
        this.e[0][0] = 0;
        this.e[0][1] = 0;
        this.e[1][0] = 0;
        this.e[1][1] = 0;
        this.e[2][0] = 0;
        this.e[2][1] = 0;
        paramSensorEvent = this.b;
        int j = paramSensorEvent.length;
        int i = 0;
        if (i < j)
        {
          localObject1 = paramSensorEvent[i];
          if (localObject1 != null)
          {
            if ((((b)localObject1).a > this.c) && (this.f[0] <= 0))
            {
              this.f[0] = 1;
              localObject2 = this.e[0];
              localObject2[0] += 1;
            }
            if ((((b)localObject1).a < -this.c) && (this.f[0] >= 0))
            {
              this.f[0] = -1;
              localObject2 = this.e[0];
              localObject2[1] += 1;
            }
            if ((((b)localObject1).b > this.c) && (this.f[1] <= 0))
            {
              this.f[1] = 1;
              localObject2 = this.e[1];
              localObject2[0] += 1;
            }
            if ((((b)localObject1).b < -this.c) && (this.f[1] >= 0))
            {
              this.f[1] = -1;
              localObject2 = this.e[1];
              localObject2[1] += 1;
            }
            if ((((b)localObject1).c > this.c) && (this.f[2] <= 0))
            {
              this.f[2] = 1;
              localObject2 = this.e[2];
              localObject2[0] += 1;
            }
            if ((((b)localObject1).c < -this.c) && (this.f[2] >= 0))
            {
              this.f[2] = -1;
              localObject1 = this.e[2];
              localObject1[1] += 1;
            }
          }
        }
        else
        {
          paramSensorEvent = this.e;
          int n = paramSensorEvent.length;
          i = 0;
          j = 0;
          if (i < n)
          {
            localObject1 = paramSensorEvent[i];
            int i1 = localObject1.length;
            int k = 0;
            if (k < i1)
            {
              int m = j;
              if (localObject1[k] >= this.d)
              {
                if (j != 0)
                {
                  if (this.a != null) {
                    this.a.a();
                  }
                  this.b = new b['–'];
                  this.g = 0;
                  m = j;
                }
              }
              else
              {
                k += 1;
                j = m;
                continue;
              }
              m = 1;
              continue;
            }
            i += 1;
            continue;
          }
          continue;
        }
        i += 1;
      }
      finally {}
    }
  }
  
  public static abstract interface a
  {
    public abstract void a();
  }
  
  final class b
  {
    float a;
    float b;
    float c;
    long d;
    
    public b(float paramFloat1, float paramFloat2, float paramFloat3, long paramLong)
    {
      this.a = paramFloat1;
      this.b = paramFloat2;
      this.c = paramFloat3;
      this.d = paramLong;
    }
    
    public final String toString()
    {
      return "SensorBundle{mXAcc=" + this.a + ", mYAcc=" + this.b + ", mZAcc=" + this.c + ", mTimestamp=" + this.d + '}';
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/internal/c/a.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */