Initial version -- added millennium read funcionality
This commit is contained in:
@@ -0,0 +1,170 @@
|
||||
package com.google.android.gms.dynamic;
|
||||
|
||||
import android.R;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
import com.google.android.gms.dynamic.LifecycleDelegate;
|
||||
import com.google.errorprone.annotations.ResultIgnorabilityUnspecified;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/* JADX INFO: compiled from: com.google.android.gms:play-services-base@@18.4.0 */
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public abstract class DeferredLifecycleHelper<T extends LifecycleDelegate> {
|
||||
private LifecycleDelegate zaa;
|
||||
private Bundle zab;
|
||||
private LinkedList zac;
|
||||
private final OnDelegateCreatedListener zad = new zaa(this);
|
||||
|
||||
public static void showGooglePlayUnavailableMessage(FrameLayout frameLayout) {
|
||||
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
|
||||
Context context = frameLayout.getContext();
|
||||
int iIsGooglePlayServicesAvailable = googleApiAvailability.isGooglePlayServicesAvailable(context);
|
||||
String strZac = com.google.android.gms.common.internal.zac.zac(context, iIsGooglePlayServicesAvailable);
|
||||
String strZab = com.google.android.gms.common.internal.zac.zab(context, iIsGooglePlayServicesAvailable);
|
||||
LinearLayout linearLayout = new LinearLayout(frameLayout.getContext());
|
||||
linearLayout.setOrientation(1);
|
||||
linearLayout.setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
|
||||
frameLayout.addView(linearLayout);
|
||||
TextView textView = new TextView(frameLayout.getContext());
|
||||
textView.setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
|
||||
textView.setText(strZac);
|
||||
linearLayout.addView(textView);
|
||||
Intent errorResolutionIntent = googleApiAvailability.getErrorResolutionIntent(context, iIsGooglePlayServicesAvailable, null);
|
||||
if (errorResolutionIntent != null) {
|
||||
Button button = new Button(context);
|
||||
button.setId(R.id.button1);
|
||||
button.setLayoutParams(new FrameLayout.LayoutParams(-2, -2));
|
||||
button.setText(strZab);
|
||||
linearLayout.addView(button);
|
||||
button.setOnClickListener(new zae(context, errorResolutionIntent));
|
||||
}
|
||||
}
|
||||
|
||||
private final void zae(int i) {
|
||||
while (!this.zac.isEmpty() && ((zah) this.zac.getLast()).zaa() >= i) {
|
||||
this.zac.removeLast();
|
||||
}
|
||||
}
|
||||
|
||||
private final void zaf(Bundle bundle, zah zahVar) {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
zahVar.zab(lifecycleDelegate);
|
||||
return;
|
||||
}
|
||||
if (this.zac == null) {
|
||||
this.zac = new LinkedList();
|
||||
}
|
||||
this.zac.add(zahVar);
|
||||
if (bundle != null) {
|
||||
Bundle bundle2 = this.zab;
|
||||
if (bundle2 == null) {
|
||||
this.zab = (Bundle) bundle.clone();
|
||||
} else {
|
||||
bundle2.putAll(bundle);
|
||||
}
|
||||
}
|
||||
createDelegate(this.zad);
|
||||
}
|
||||
|
||||
protected abstract void createDelegate(OnDelegateCreatedListener<T> onDelegateCreatedListener);
|
||||
|
||||
public T getDelegate() {
|
||||
return (T) this.zaa;
|
||||
}
|
||||
|
||||
protected void handleGooglePlayUnavailable(FrameLayout frameLayout) {
|
||||
showGooglePlayUnavailableMessage(frameLayout);
|
||||
}
|
||||
|
||||
public void onCreate(Bundle bundle) {
|
||||
zaf(bundle, new zac(this, bundle));
|
||||
}
|
||||
|
||||
@ResultIgnorabilityUnspecified
|
||||
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
FrameLayout frameLayout = new FrameLayout(layoutInflater.getContext());
|
||||
zaf(bundle, new zad(this, frameLayout, layoutInflater, viewGroup, bundle));
|
||||
if (this.zaa == null) {
|
||||
handleGooglePlayUnavailable(frameLayout);
|
||||
}
|
||||
return frameLayout;
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
lifecycleDelegate.onDestroy();
|
||||
} else {
|
||||
zae(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroyView() {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
lifecycleDelegate.onDestroyView();
|
||||
} else {
|
||||
zae(2);
|
||||
}
|
||||
}
|
||||
|
||||
public void onInflate(Activity activity, Bundle bundle, Bundle bundle2) {
|
||||
zaf(bundle2, new zab(this, activity, bundle, bundle2));
|
||||
}
|
||||
|
||||
public void onLowMemory() {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
lifecycleDelegate.onLowMemory();
|
||||
}
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
lifecycleDelegate.onPause();
|
||||
} else {
|
||||
zae(5);
|
||||
}
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
zaf(null, new zag(this));
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(Bundle bundle) {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
lifecycleDelegate.onSaveInstanceState(bundle);
|
||||
return;
|
||||
}
|
||||
Bundle bundle2 = this.zab;
|
||||
if (bundle2 != null) {
|
||||
bundle.putAll(bundle2);
|
||||
}
|
||||
}
|
||||
|
||||
public void onStart() {
|
||||
zaf(null, new zaf(this));
|
||||
}
|
||||
|
||||
public void onStop() {
|
||||
LifecycleDelegate lifecycleDelegate = this.zaa;
|
||||
if (lifecycleDelegate != null) {
|
||||
lifecycleDelegate.onStop();
|
||||
} else {
|
||||
zae(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user