导航菜单

页面标题

页面副标题

Perplexity v2.48.1 - AutocompleteActivity.java 源代码

正在查看: Perplexity v2.48.1 应用的 AutocompleteActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.google.android.libraries.places.widget;

import J3.l;
import J3.m;
import J3.n;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.RecentlyNonNull;
import androidx.fragment.app.l0;
import com.google.android.gms.common.api.Status;
import com.google.android.libraries.places.R;
import com.google.android.libraries.places.api.Places;
import com.google.android.libraries.places.api.model.Place;
import com.google.android.libraries.places.api.net.PlacesStatusCodes;
import com.google.android.libraries.places.internal.zzls;
import com.google.android.libraries.places.internal.zzlv;
import com.google.android.libraries.places.internal.zzmj;
import com.google.android.libraries.places.internal.zznm;
import com.google.android.libraries.places.internal.zznn;
import com.google.android.libraries.places.widget.internal.autocomplete.ui.AutocompleteImplFragment;
import com.google.android.libraries.places.widget.listener.PlaceSelectionListener;
import com.google.android.libraries.places.widget.model.AutocompleteActivityMode;
import g3.p;

public class AutocompleteActivity extends n implements PlaceSelectionListener {
    public static final int RESULT_ERROR = 2;
    private int zza;
    private int zzb;
    private boolean zzc;

    public AutocompleteActivity() {
        super(R.layout.places_autocomplete_activity);
        getSavedStateRegistry().c("androidx:appcompat", new l(this));
        addOnContextAvailableListener(new m(this, 0));
        this.zzc = false;
    }

    private final void zzc(int i, Place place, Status status) {
        try {
            Intent intent = new Intent();
            if (place != null) {
                intent.putExtra("places/selected_place", place);
            }
            intent.putExtra("places/status", status);
            setResult(i, intent);
            finish();
        } catch (Error e) {
            e = e;
            zzlv.zzb(e);
            throw e;
        } catch (RuntimeException e2) {
            e = e2;
            zzlv.zzb(e);
            throw e;
        }
    }

    @SuppressLint({"MissingSuperCall"})
    public void onCreate(Bundle bundle) {
        try {
            p.D("Places must be initialized.", Places.isInitialized());
            p.D("Cannot find caller. startActivityForResult should be used.", getCallingActivity() != null);
            zzmj zzmjVar = (zzmj) getIntent().getParcelableExtra("places/AutocompleteOptions");
            zzmjVar.getClass();
            AutocompleteActivityMode autocompleteActivityMode = AutocompleteActivityMode.FULLSCREEN;
            int ordinal = zzmjVar.zzb().ordinal();
            if (ordinal == 0) {
                this.zza = R.layout.places_autocomplete_impl_fragment_fullscreen;
                this.zzb = R.style.PlacesAutocompleteFullscreen;
            } else if (ordinal == 1) {
                this.zza = R.layout.places_autocomplete_impl_fragment_overlay;
                this.zzb = R.style.PlacesAutocompleteOverlay;
            }
            l0 supportFragmentManager = getSupportFragmentManager();
            int i = this.zza;
            zznn zza = zznm.zza();
            zza.zzc(this);
            zza.zzb(zzls.AUTOCOMPLETE_WIDGET);
            supportFragmentManager.A = new com.google.android.libraries.places.widget.internal.autocomplete.ui.zzc(i, zza.zza(), zzmjVar);
            setTheme(this.zzb);
            super/*androidx.fragment.app.P*/.onCreate(bundle);
            final AutocompleteImplFragment autocompleteImplFragment = (AutocompleteImplFragment) getSupportFragmentManager().C(R.id.places_autocomplete_content);
            if (autocompleteImplFragment == null) {
                throw new IllegalStateException();
            }
            autocompleteImplFragment.zza(this);
            final View findViewById = findViewById(android.R.id.content);
            findViewById.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public final boolean onTouch(View view, MotionEvent motionEvent) {
                    return AutocompleteActivity.this.zza(autocompleteImplFragment, findViewById, view, motionEvent);
                }
            });
            findViewById.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    AutocompleteActivity.this.zzb(view);
                }
            });
            if (zzmjVar.zzc().isEmpty()) {
                zzc(2, null, new Status(PlacesStatusCodes.INVALID_REQUEST, "Place Fields must not be empty.", null, null));
            }
        } catch (Error e) {
            e = e;
            zzlv.zzb(e);
            throw e;
        } catch (RuntimeException e2) {
            e = e2;
            zzlv.zzb(e);
            throw e;
        }
    }

    @Override
    public void onError(@RecentlyNonNull Status status) {
        zzc(status.w == 16 ? 0 : 2, null, status);
    }

    @Override
    public void onPlaceSelected(@RecentlyNonNull Place place) {
        zzc(-1, place, Status.X);
    }

    public final boolean zza(AutocompleteImplFragment autocompleteImplFragment, View view, View view2, MotionEvent motionEvent) {
        this.zzc = false;
        if (autocompleteImplFragment.getView() == null || motionEvent.getY() <= r1.getBottom()) {
            return false;
        }
        this.zzc = true;
        view.performClick();
        return true;
    }

    public final void zzb(View view) {
        if (this.zzc) {
            zzc(0, null, new Status(16, null, null, null));
        }
    }
}