InstabugActivityDelegate.java 4.67 KB
package com.instabug.library;

import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build.VERSION;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.GestureDetectorCompat;
import android.view.MotionEvent;
import com.instabug.library.interaction.InstabugSwipeDelegate;
import com.instabug.library.interaction.InstabugSwipeDelegate.GestureConfig;
import com.instabug.library.interaction.InstabugSwipeDelegate.GestureListener;
import com.instabug.library.interaction.InstabugSwipeDelegate.a;
import com.instabug.library.util.TouchEventDispatcher;
import rz;

public class InstabugActivityDelegate
  implements InstabugSwipeDelegate.a
{
  private final Activity mActivity;
  private GestureDetectorCompat mDetector;
  private InstabugSwipeDelegate mSwipeDelegate;
  private TouchEventDispatcher mTouchEventDispatcher;
  
  public InstabugActivityDelegate(Activity paramActivity)
  {
    this.mActivity = paramActivity;
    this.mTouchEventDispatcher = new TouchEventDispatcher(Instabug.iG().a());
    if (Build.VERSION.SDK_INT >= 11) {
      this.mActivity.getFragmentManager().addOnBackStackChangedListener(new a((byte)0));
    }
    if ((this.mActivity instanceof FragmentActivity)) {
      ((FragmentActivity)this.mActivity).getSupportFragmentManager().addOnBackStackChangedListener(new b((byte)0));
    }
  }
  
  public void dispatchTouchEvent(MotionEvent paramMotionEvent)
  {
    if (this.mSwipeDelegate != null) {
      this.mSwipeDelegate.onTouchEvent(paramMotionEvent);
    }
    if (InstabugFeaturesManager.getInstance().getFeatureState(Feature.TRACK_USER_STEPS) == Feature.State.ENABLED) {
      this.mTouchEventDispatcher.dispatchTouchEvent(this.mActivity, paramMotionEvent);
    }
  }
  
  public void onDestroy()
  {
    Instabug.notifyActivityDestroyed(this.mActivity);
  }
  
  public void onInstabugGestureEvent(MotionEvent paramMotionEvent)
  {
    this.mDetector.onTouchEvent(paramMotionEvent);
  }
  
  public void onPause()
  {
    this.mSwipeDelegate = null;
    this.mDetector = null;
    if (Build.VERSION.SDK_INT < 14) {
      Instabug.notifyActivityPaused(this.mActivity);
    }
  }
  
  public void onResume()
  {
    Instabug.access$300(Instabug.iG().a);
    Activity localActivity;
    InstabugSwipeDelegate localInstabugSwipeDelegate;
    if (rz.j().i() == IBGInvocationEvent.IBGInvocationEventTwoFingersSwipeLeft)
    {
      this.mSwipeDelegate = new InstabugSwipeDelegate(this, InstabugSwipeDelegate.GestureConfig.TwoSwipeLeft);
      localActivity = this.mActivity;
      localInstabugSwipeDelegate = this.mSwipeDelegate;
      localInstabugSwipeDelegate.getClass();
    }
    for (this.mDetector = new GestureDetectorCompat(localActivity, new InstabugSwipeDelegate.GestureListener(localInstabugSwipeDelegate));; this.mDetector = null)
    {
      if (Build.VERSION.SDK_INT < 14) {
        Instabug.notifyActivityResumed(this.mActivity);
      }
      return;
      this.mSwipeDelegate = null;
    }
  }
  
  public void onStart()
  {
    if (Build.VERSION.SDK_INT < 14) {
      Instabug.notifyActivityStarted(this.mActivity);
    }
  }
  
  public void onStop()
  {
    if (Build.VERSION.SDK_INT < 14) {
      Instabug.notifyActivityStopped(this.mActivity);
    }
  }
  
  @TargetApi(11)
  final class a
    implements android.app.FragmentManager.OnBackStackChangedListener
  {
    private a() {}
    
    public final void onBackStackChanged()
    {
      int i = InstabugActivityDelegate.this.mActivity.getFragmentManager().getBackStackEntryCount();
      if (i > 0)
      {
        android.app.FragmentManager.BackStackEntry localBackStackEntry = InstabugActivityDelegate.this.mActivity.getFragmentManager().getBackStackEntryAt(i - 1);
        if (Build.VERSION.SDK_INT >= 14) {
          Instabug.iG().a().a(localBackStackEntry.getName(), 2567);
        }
        return;
      }
      Instabug.iG().a().a("", 2577);
    }
  }
  
  final class b
    implements android.support.v4.app.FragmentManager.OnBackStackChangedListener
  {
    private b() {}
    
    public final void onBackStackChanged()
    {
      int i = ((FragmentActivity)InstabugActivityDelegate.this.mActivity).getSupportFragmentManager().getBackStackEntryCount();
      if (i > 0)
      {
        android.support.v4.app.FragmentManager.BackStackEntry localBackStackEntry = ((FragmentActivity)InstabugActivityDelegate.this.mActivity).getSupportFragmentManager().getBackStackEntryAt(i - 1);
        Instabug.iG().a().a(localBackStackEntry.getName(), 2567);
        return;
      }
      Instabug.iG().a().a("", 2577);
    }
  }
}


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