AdvancedPlaceListFragment

public final class AdvancedPlaceListFragment extends Fragment implements PlaceActionController


A fragment that displays a list of places.

This advanced fragment supports configuring custom action buttons and media search.

Summary

Nested types

Enumeration of all content types supported by AdvancedPlaceListFragment.

Public fields

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

List containing all Content supported by the widget.

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

A list containing standard Content for the widget.

Public constructors

Public methods

final void

Applies media search options to the fragment.

final void

Loads a list of places identified by their coordinates.

final void

Loads a list of places identified by their Place IDs.

final void

Loads a list of places identified by their Resource Names.

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 list results are selectable.

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

Creates a new instance of the AdvancedPlaceListFragment.

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

Sets a listener to be invoked when internal photos are loaded or fail to load.

final void

The size of the media in the vertical fragment view.

void

Sets the PlaceActionProvider to be used by the widget.

final void
setPreferTruncation(boolean preferTruncation)

Whether content is truncated to fit into a single line.

final void
setSelectable(boolean selectable)

Whether the place list 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 methods

From androidx.fragment.app.Fragment
void
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

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
getString(@StringRes int p0, @NonNull Object... p1)
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
final int
final boolean
final boolean
final boolean
final boolean
final boolean
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

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
@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
@Nullable Context
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
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 AdvancedPlaceListFragment.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 AdvancedPlaceListFragment.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

AdvancedPlaceListFragment

public AdvancedPlaceListFragment()

Public methods

applySearchMediaOptions

@MainThread
public final void applySearchMediaOptions(SearchMediaOptions options)

Applies media search options to the fragment.

Parameters
SearchMediaOptions options

the SearchMediaOptions to apply.

configureFromCoordinates

public final void configureFromCoordinates(@NonNull List<@NonNull LatLng> coordinates)

Loads a list of places identified by their coordinates.

configureFromPlaceIds

public final void configureFromPlaceIds(@NonNull List<@NonNull String> placeIds)

Loads a list of places identified by their Place IDs.

configureFromResourceNames

public final void configureFromResourceNames(@NonNull List<@NonNull String> resourceNames)

Loads a list of places identified by their Resource Names.

getAttributionPosition

public final @NonNull AttributionPosition getAttributionPosition()

The position of the Google Maps attribution. This is necessary because a developer can set attributionPosition immediately after the fragment is created, but before onViewCreated is called (where the controller is initialized).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

getMediaSize

public final @NonNull MediaSize getMediaSize()

The size of the media in the vertical fragment view. This is necessary because a developer can set mediaSize immediately after the fragment is created, but before onViewCreated is called (where the controller is initialized).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

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).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

getSelectable

public final boolean getSelectable()

Whether the place list results are selectable. This is necessary because a developer can set selectable immediately after the fragment is created, but before onViewCreated is called (where the controller is initialized).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

newInstance

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

Creates a new instance of the AdvancedPlaceListFragment.

Parameters
@NonNull List<@NonNull AdvancedPlaceListFragment.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 PlaceListFragmentListener 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. Caller is responsible to re-register the listener on configuration changes.

setAttributionPosition

public final void setAttributionPosition(@NonNull AttributionPosition attributionPosition)

The position of the Google Maps attribution. This is necessary because a developer can set attributionPosition immediately after the fragment is created, but before onViewCreated is called (where the controller is initialized).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

setMediaResultListener

public final void setMediaResultListener(@NonNull MediaResultListener listener)

Sets a listener to be invoked when internal photos are loaded or fail to load. Caller is responsible to re-set the listener on configuration changes.

Parameters
@NonNull MediaResultListener listener

the MediaResultListener to be invoked.

setMediaSize

public final void setMediaSize(@NonNull MediaSize mediaSize)

The size of the media in the vertical fragment view. This is necessary because a developer can set mediaSize immediately after the fragment is created, but before onViewCreated is called (where the controller is initialized).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

setPlaceActionProvider

@MainThread
public void setPlaceActionProvider(PlaceActionProvider placeActionProvider)

Sets the PlaceActionProvider to be used by the widget.

The provider is responsible for providing the actions to be displayed and notifying the widget of any changes.

Parameters
PlaceActionProvider placeActionProvider

The provider to set.

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).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

setSelectable

public final void setSelectable(boolean selectable)

Whether the place list results are selectable. This is necessary because a developer can set selectable immediately after the fragment is created, but before onViewCreated is called (where the controller is initialized).

Once the controller is created, it is the source of truth. This copy is also updated to handle config changes.

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.