n.java 5.52 KB
package com.instabug.library.util;

import android.app.Activity;
import android.app.Dialog;
import android.graphics.Bitmap;
import android.net.Uri;
import android.opengl.GLSurfaceView;
import android.support.annotation.NonNull;
import android.view.View;
import com.google.android.gms.maps.GoogleMap;
import com.instabug.library.internal.d.a.a;
import com.instabug.library.internal.layer.CapturableView;
import com.instabug.library.internal.layer.c;
import com.instabug.library.internal.layer.c.a;
import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;

public class n
{
  private static n a;
  private List<c> b = new LinkedList();
  
  public static n a()
  {
    if (a == null) {
      a = new n();
    }
    return a;
  }
  
  private void a(Activity paramActivity, WeakReference<Dialog> paramWeakReference, GLSurfaceView paramGLSurfaceView, final b paramb)
  {
    final com.instabug.library.internal.d.a locala = new com.instabug.library.internal.d.a(paramActivity);
    com.instabug.library.internal.a.b localb = new com.instabug.library.internal.module.a().a().a(paramActivity);
    if (paramWeakReference == null) {}
    for (paramWeakReference = null;; paramWeakReference = (Dialog)paramWeakReference.get())
    {
      paramActivity = new m(paramActivity, paramWeakReference, paramGLSurfaceView, this.b, localb);
      paramActivity.a(new m.a()
      {
        public final void a(Bitmap paramAnonymousBitmap)
        {
          InstabugSDKLogger.d(this, "Screenshot captured. Saving to file..");
          locala.a(paramAnonymousBitmap, new a.a()
          {
            public final void a(Bitmap paramAnonymous2Bitmap, Uri paramAnonymous2Uri)
            {
              n.2.this.b.a(paramAnonymous2Uri);
            }
            
            public final void a(String paramAnonymous2String)
            {
              n.2.this.b.a(paramAnonymous2String);
            }
          });
        }
        
        public final void a(String paramAnonymousString, Exception paramAnonymousException)
        {
          if (paramAnonymousException != null) {
            InstabugSDKLogger.e(this, "Screenshot capture failed: " + paramAnonymousString, paramAnonymousException);
          }
          for (;;)
          {
            paramb.a(paramAnonymousString);
            return;
            InstabugSDKLogger.e(this, "Screenshot capture failed: " + paramAnonymousString);
          }
        }
      });
      paramActivity.b();
      return;
    }
  }
  
  private void a(Object paramObject)
  {
    int i = 0;
    for (;;)
    {
      if (i < this.b.size())
      {
        if ((((c)this.b.get(i)).b() != null) && (((c)this.b.get(i)).b() == paramObject)) {
          this.b.remove(i);
        }
      }
      else {
        return;
      }
      i += 1;
    }
  }
  
  public void a(final Activity paramActivity, WeakReference<Dialog> paramWeakReference, GLSurfaceView paramGLSurfaceView, final c paramc)
  {
    InstabugSDKLogger.d(this, "Starting Instabug process");
    b();
    if ((paramActivity != null) && (!paramActivity.isFinishing()))
    {
      j.b(paramActivity);
      paramc = new b()
      {
        public final void a(Uri paramAnonymousUri)
        {
          InstabugSDKLogger.d(this, "Screenshot capturing completed");
          paramc.a(paramAnonymousUri);
        }
        
        public final void a(String paramAnonymousString)
        {
          j.a(paramActivity);
          InstabugSDKLogger.e(this, "Screenshot capturing failed: " + paramAnonymousString);
        }
      };
      if (this.b.isEmpty())
      {
        InstabugSDKLogger.d(this, "ScreenshotProcessor: Starting Screenshot Capture");
        a(paramActivity, paramWeakReference, paramGLSurfaceView, paramc);
      }
    }
    else
    {
      return;
    }
    InstabugSDKLogger.d(this, "Invoking advanced screenshot capturing");
    paramActivity = new a(paramActivity, paramWeakReference, paramGLSurfaceView, paramc);
    ((c)this.b.get(0)).a(paramActivity);
  }
  
  public void a(View paramView, GoogleMap paramGoogleMap)
  {
    a(paramView);
    paramView = new com.instabug.library.internal.layer.b(paramView, paramGoogleMap);
    this.b.add(paramView);
  }
  
  public void a(@NonNull CapturableView paramCapturableView)
  {
    a(paramCapturableView);
    paramCapturableView = new com.instabug.library.internal.layer.a(paramCapturableView);
    this.b.add(paramCapturableView);
  }
  
  public void b()
  {
    int i = 0;
    while (i < this.b.size()) {
      if (!((c)this.b.get(i)).a()) {
        this.b.remove(i);
      } else {
        i += 1;
      }
    }
  }
  
  final class a
    implements c.a
  {
    int a = 1;
    Activity b;
    WeakReference<Dialog> c;
    GLSurfaceView d;
    n.b e;
    
    public a(WeakReference<Dialog> paramWeakReference, GLSurfaceView paramGLSurfaceView, n.b paramb)
    {
      this.b = paramWeakReference;
      this.c = paramGLSurfaceView;
      this.d = paramb;
      n.b localb;
      this.e = localb;
    }
    
    public final void a()
    {
      if (n.a(n.this).size() >= this.a)
      {
        n.a(n.this, this.b, this.c, this.d, this.e);
        return;
      }
      this.a += 1;
      ((c)n.a(n.this).get(this.a)).a(this);
    }
  }
  
  public static abstract interface b
  {
    public abstract void a(Uri paramUri);
    
    public abstract void a(String paramString);
  }
  
  public static abstract interface c
  {
    public abstract void a(Uri paramUri);
  }
}


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