zza.java 6.35 KB
package com.google.android.gms.dynamic;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.internal.zzh;
import java.util.Iterator;
import java.util.LinkedList;

public abstract class zza<T extends LifecycleDelegate>
{
  private T a;
  private Bundle b;
  private LinkedList<a> c;
  private final zze<T> d = new zze()
  {
    public final void zza(T paramAnonymousT)
    {
      zza.a(zza.this, paramAnonymousT);
      paramAnonymousT = zza.a(zza.this).iterator();
      while (paramAnonymousT.hasNext()) {
        ((zza.a)paramAnonymousT.next()).b();
      }
      zza.a(zza.this).clear();
      zza.c(zza.this);
    }
  };
  
  private void a(int paramInt)
  {
    while ((!this.c.isEmpty()) && (((a)this.c.getLast()).a() >= paramInt)) {
      this.c.removeLast();
    }
  }
  
  private void a(Bundle paramBundle, a parama)
  {
    if (this.a != null)
    {
      parama.b();
      return;
    }
    if (this.c == null) {
      this.c = new LinkedList();
    }
    this.c.add(parama);
    if (paramBundle != null)
    {
      if (this.b != null) {
        break label72;
      }
      this.b = ((Bundle)paramBundle.clone());
    }
    for (;;)
    {
      zza(this.d);
      return;
      label72:
      this.b.putAll(paramBundle);
    }
  }
  
  public static void zzb(final FrameLayout paramFrameLayout)
  {
    Object localObject = GoogleApiAvailability.getInstance();
    Context localContext = paramFrameLayout.getContext();
    int i = ((GoogleApiAvailability)localObject).isGooglePlayServicesAvailable(localContext);
    String str2 = zzh.zzi(localContext, i);
    String str1 = zzh.zzk(localContext, i);
    LinearLayout localLinearLayout = new LinearLayout(paramFrameLayout.getContext());
    localLinearLayout.setOrientation(1);
    localLinearLayout.setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
    paramFrameLayout.addView(localLinearLayout);
    paramFrameLayout = new TextView(paramFrameLayout.getContext());
    paramFrameLayout.setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
    paramFrameLayout.setText(str2);
    localLinearLayout.addView(paramFrameLayout);
    paramFrameLayout = ((GoogleApiAvailability)localObject).zzb(localContext, i, null);
    if (paramFrameLayout != null)
    {
      localObject = new Button(localContext);
      ((Button)localObject).setId(16908313);
      ((Button)localObject).setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
      ((Button)localObject).setText(str1);
      localLinearLayout.addView((View)localObject);
      ((Button)localObject).setOnClickListener(new View.OnClickListener()
      {
        public final void onClick(View paramAnonymousView)
        {
          try
          {
            zza.this.startActivity(paramFrameLayout);
            return;
          }
          catch (ActivityNotFoundException paramAnonymousView)
          {
            Log.e("DeferredLifecycleHelper", "Failed to start resolution intent", paramAnonymousView);
          }
        }
      });
    }
  }
  
  public void onCreate(final Bundle paramBundle)
  {
    a(paramBundle, new a()
    {
      public final int a()
      {
        return 1;
      }
      
      public final void b()
      {
        zza.b(zza.this).onCreate(paramBundle);
      }
    });
  }
  
  public View onCreateView(final LayoutInflater paramLayoutInflater, final ViewGroup paramViewGroup, final Bundle paramBundle)
  {
    final FrameLayout localFrameLayout = new FrameLayout(paramLayoutInflater.getContext());
    a(paramBundle, new a()
    {
      public final int a()
      {
        return 2;
      }
      
      public final void b()
      {
        localFrameLayout.removeAllViews();
        localFrameLayout.addView(zza.b(zza.this).onCreateView(paramLayoutInflater, paramViewGroup, paramBundle));
      }
    });
    if (this.a == null) {
      zza(localFrameLayout);
    }
    return localFrameLayout;
  }
  
  public void onDestroy()
  {
    if (this.a != null)
    {
      this.a.onDestroy();
      return;
    }
    a(1);
  }
  
  public void onDestroyView()
  {
    if (this.a != null)
    {
      this.a.onDestroyView();
      return;
    }
    a(2);
  }
  
  public void onInflate(final Activity paramActivity, final Bundle paramBundle1, final Bundle paramBundle2)
  {
    a(paramBundle2, new a()
    {
      public final int a()
      {
        return 0;
      }
      
      public final void b()
      {
        zza.b(zza.this).onInflate(paramActivity, paramBundle1, paramBundle2);
      }
    });
  }
  
  public void onLowMemory()
  {
    if (this.a != null) {
      this.a.onLowMemory();
    }
  }
  
  public void onPause()
  {
    if (this.a != null)
    {
      this.a.onPause();
      return;
    }
    a(5);
  }
  
  public void onResume()
  {
    a(null, new a()
    {
      public final int a()
      {
        return 5;
      }
      
      public final void b()
      {
        zza.b(zza.this).onResume();
      }
    });
  }
  
  public void onSaveInstanceState(Bundle paramBundle)
  {
    if (this.a != null) {
      this.a.onSaveInstanceState(paramBundle);
    }
    while (this.b == null) {
      return;
    }
    paramBundle.putAll(this.b);
  }
  
  public void onStart()
  {
    a(null, new a()
    {
      public final int a()
      {
        return 4;
      }
      
      public final void b()
      {
        zza.b(zza.this).onStart();
      }
    });
  }
  
  public void onStop()
  {
    if (this.a != null)
    {
      this.a.onStop();
      return;
    }
    a(4);
  }
  
  public T zzBN()
  {
    return this.a;
  }
  
  protected void zza(FrameLayout paramFrameLayout)
  {
    zzb(paramFrameLayout);
  }
  
  protected abstract void zza(zze<T> paramzze);
  
  static abstract interface a
  {
    public abstract int a();
    
    public abstract void b();
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/google/android/gms/dynamic/zza.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */