PlaceSearchFragment

public final class PlaceSearchFragment extends Fragment


A fragment displays a list of places generated from either a text search or a nearby search request.

Summary

Nested types

public enum PlaceSearchFragment.Content extends Enum

Enumeration of all content types supported by PlaceSearchFragment.

Public fields

static final @NonNull List<@NonNull PlaceSearchFragment.Content>

List containing all Content supported by the widget.

static final @NonNull List<@NonNull PlaceSearchFragment.Content>

A list containing standard Content for the widget.

Public constructors

Public methods

final void

Configures the fragment from a SearchByTextRequest.

final void

Configures the fragment from a SearchNearbyRequest.

final @NonNull AttributionPosition

The position of the Google Maps attribution.

final @NonNull MediaSize

The size of the media in the vertical fragment view.

final boolean

Whether content is truncated to fit into a single line.

final boolean

Whether the place search results are selectable.

static final @NonNull PlaceSearchFragment
newInstance(
    @NonNull List<@NonNull PlaceSearchFragment.Content> content,
    @NonNull Orientation orientation,
    @StyleRes int theme
)

Creates a new instance of the PlaceSearchFragment.

final void

Registers the listener to receive callbacks when the places result is loaded or an error occurs, or when a place is selected if the fragment is configured to be selectable.

final void

The position of the Google Maps attribution.

final void

The size of the media in the vertical fragment view.

final void
setPreferTruncation(boolean preferTruncation)

Whether content is truncated to fit into a single line.

final void
setSelectable(boolean selectable)

Whether the place search results are selectable.

final void

Unregisters the listener to not receive callbacks when the places result is loaded or an error occurs, or when a place is selected if the fragment is configured to be selectable.

Inherited fields

From androidx.fragment.app.Fragment
final @Nullable String
@RestrictTo(value = [RestrictTo.Scope.LIBRARY])
mPreviousWho

Inherited methods

From androidx.fragment.app.Fragment
void
dump(
    @NonNull String p0,
    @Nullable FileDescriptor p1,
    @NonNull PrintWriter p2,
    @Nullable String[] p3
)
final boolean
final @Nullable FragmentActivity
boolean
boolean
final @Nullable Bundle
final @NonNull FragmentManager
@Nullable Context
@NonNull CreationExtras
@NonNull ViewModelProvider.Factory
@Nullable Object
@Nullable Object
final @Nullable FragmentManager

This method is deprecated. Deprecated in Java

final @Nullable Object
final int
final @NonNull LayoutInflater
@NonNull LayoutInflater
@RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP_PREFIX])
getLayoutInflater(@Nullable Bundle p0)

This method is deprecated. Deprecated in Java

@NonNull Lifecycle
@NonNull LoaderManager

This method is deprecated. Deprecated in Java

final @Nullable Fragment
final @NonNull FragmentManager
@Nullable Object
final @NonNull Resources
final boolean

This method is deprecated. Deprecated in Java

@Nullable Object
final @NonNull SavedStateRegistry
@Nullable Object
@Nullable Object
final @NonNull String
final @NonNull String
final @Nullable String
final @Nullable Fragment

This method is deprecated. Deprecated in Java

final int

This method is deprecated. Deprecated in Java

final @NonNull CharSequence
getText(@StringRes int p0)
boolean

This method is deprecated. Deprecated in Java

@Nullable View
@NonNull LifecycleOwner
@NonNull LiveData<@NonNull LifecycleOwner>
@NonNull ViewModelStore
final boolean
@RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP_PREFIX])
hasOptionsMenu()
final int
final boolean
final boolean
final boolean
final boolean
final boolean
@RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP_PREFIX])
isMenuVisible()
final boolean
final boolean
final boolean
final boolean
void

This method is deprecated. Deprecated in Java

void
onActivityResult(int p0, int p1, @Nullable Intent p2)

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
void

This method is deprecated. Deprecated in Java

void
boolean
@Nullable Animation
@MainThread
onCreateAnimation(int p0, boolean p1, int p2)
@Nullable Animator
@MainThread
onCreateAnimator(int p0, boolean p1, int p2)
void
void

This method is deprecated. Deprecated in Java

void
void

This method is deprecated. Deprecated in Java

void
void
@NonNull LayoutInflater
void
void

This method is deprecated. Deprecated in Java

void
void
void
boolean

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
void
void

This method is deprecated. Deprecated in Java

void
void
onRequestPermissionsResult(int p0, @NonNull String[] p1, @NonNull int[] p2)

This method is deprecated. Deprecated in Java

void
void
void
void
void
final void
final @NonNull ActivityResultLauncher<@NonNull I>
@MainThread
<I extends Object, O extends Object> registerForActivityResult(
    @NonNull ActivityResultContract<@NonNull I, @NonNull O> contract,
    @NonNull ActivityResultCallback<@NonNull O> callback
)
final @NonNull ActivityResultLauncher<@NonNull I>
@MainThread
<I extends Object, O extends Object> registerForActivityResult(
    @NonNull ActivityResultContract<@NonNull I, @NonNull O> contract,
    @NonNull ActivityResultRegistry registry,
    @NonNull ActivityResultCallback<@NonNull O> callback
)
void
final void
requestPermissions(@NonNull String[] p0, int p1)

This method is deprecated. Deprecated in Java

final @NonNull FragmentActivity
final @NonNull Bundle
final @NonNull Context
final @NonNull FragmentManager

This method is deprecated. Deprecated in Java

final @NonNull Object
final @NonNull Fragment
final @NonNull View
void
void
void
void
void
void
void
void
setHasOptionsMenu(boolean p0)

This method is deprecated. Deprecated in Java

void
void
setMenuVisibility(boolean p0)
void
void
setRetainInstance(boolean p0)

This method is deprecated. Deprecated in Java

void
void
void
void

This method is deprecated. Deprecated in Java

void
setUserVisibleHint(boolean p0)

This method is deprecated. Deprecated in Java

boolean
void
void
void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
startIntentSenderForResult(
    @NonNull IntentSender p0,
    int p1,
    @Nullable Intent p2,
    int p3,
    int p4,
    int p5,
    @Nullable Bundle p6
)

This method is deprecated. Deprecated in Java

void
@NonNull String
void

Public fields

ALL_CONTENT

public static final @NonNull List<@NonNull PlaceSearchFragment.ContentALL_CONTENT

List containing all Content supported by the widget. This can be passed into the widget's newInstance function to show all content on the widget.

STANDARD_CONTENT

public static final @NonNull List<@NonNull PlaceSearchFragment.ContentSTANDARD_CONTENT

A list containing standard Content for the widget. This can be passed into the widget's newInstance function to show standard content on the widget.

Public constructors

PlaceSearchFragment

public PlaceSearchFragment()

Public methods

configureFromSearchByTextRequest

public final void configureFromSearchByTextRequest(@NonNull SearchByTextRequest request)

Configures the fragment from a SearchByTextRequest.

configureFromSearchNearbyRequest

public final void configureFromSearchNearbyRequest(@NonNull SearchNearbyRequest request)

Configures the fragment from a SearchNearbyRequest. SearchNearbyRequest.getPlaceFields is

getAttributionPosition

public final @NonNull AttributionPosition getAttributionPosition()

The position of the Google Maps attribution.

getMediaSize

public final @NonNull MediaSize getMediaSize()

The size of the media in the vertical fragment view.

getPreferTruncation

public final boolean getPreferTruncation()

Whether content is truncated to fit into a single line. Not all content may be truncatable to fit into a single line (like ratings).

getSelectable

public final boolean getSelectable()

Whether the place search results are selectable.

newInstance

public static final @NonNull PlaceSearchFragment newInstance(
    @NonNull List<@NonNull PlaceSearchFragment.Content> content,
    @NonNull Orientation orientation,
    @StyleRes int theme
)

Creates a new instance of the PlaceSearchFragment.

Parameters
@NonNull List<@NonNull PlaceSearchFragment.Content> content

a list of Content values to be shown on the widget.

@NonNull Orientation orientation

the Orientation to show the widget in.

@StyleRes int theme

a theme inherits from R.style.PlacesMaterialTheme and overrides theme attributes to customize the widget appearance.

registerListener

public final void registerListener(@NonNull PlaceSearchFragmentListener listener)

Registers the listener to receive callbacks when the places result is loaded or an error occurs, or when a place is selected if the fragment is configured to be selectable.

setAttributionPosition

public final void setAttributionPosition(@NonNull AttributionPosition attributionPosition)

The position of the Google Maps attribution.

setMediaSize

public final void setMediaSize(@NonNull MediaSize mediaSize)

The size of the media in the vertical fragment view.

setPreferTruncation

public final void setPreferTruncation(boolean preferTruncation)

Whether content is truncated to fit into a single line. Not all content may be truncatable to fit into a single line (like ratings).

setSelectable

public final void setSelectable(boolean selectable)

Whether the place search results are selectable.

unregisterListener

public final void unregisterListener()

Unregisters the listener to not receive callbacks when the places result is loaded or an error occurs, or when a place is selected if the fragment is configured to be selectable.