AdvancedPlaceDetailsCompactFragment

public final class AdvancedPlaceDetailsCompactFragment extends Fragment implements PlaceActionController


A compact fragment that displays information about a place.

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

Summary

Nested types

Enumeration of all content types supported by AdvancedPlaceDetailsCompactFragment.

Public fields

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

List containing all Content supported by the widget.

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

A list containing standard Content for the widget.

Public constructors

Public methods

final void

Applies media search options to the fragment.

final boolean

Whether to enable lightbox.

final boolean

Whether content is truncated to fit into a single line.

final void

Loads details of the place with the specified coordinates and displays it on the widget.

final void

Loads details of the place with the specified place ID and displays it on the widget.

final void

Loads details of the place with the specified place resource name and displays it on the widget.

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

Returns a new instance of AdvancedPlaceDetailsCompactFragment.

final void
setEnableLightbox(boolean enableLightbox)

Whether to enable lightbox.

final void

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

void

Sets the PlaceActionProvider to be used to update action buttons.

final void

Sets a listener to be invoked when a place is loaded into the widget or when the widget fails to load.

final void
setPreferTruncation(boolean preferTruncation)

Whether content is truncated to fit into a single line.

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

AdvancedPlaceDetailsCompactFragment

public AdvancedPlaceDetailsCompactFragment()

Public methods

applySearchMediaOptions

@MainThread
public final void applySearchMediaOptions(SearchMediaOptions options)

Applies media search options to the fragment. If a place is currently loaded, the media search will be performed immediately and the media will be updated.

Parameters
SearchMediaOptions options

the SearchMediaOptions to apply, or null to clear.

getEnableLightbox

public final boolean getEnableLightbox()

Whether to enable lightbox.

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

loadWithCoordinates

public final void loadWithCoordinates(@NonNull LatLng coordinates)

Loads details of the place with the specified coordinates and displays it on the widget.

Parameters
@NonNull LatLng coordinates

The coordinates of the place to load.

loadWithPlaceId

public final void loadWithPlaceId(@NonNull String placeId)

Loads details of the place with the specified place ID and displays it on the widget.

Parameters
@NonNull String placeId

The ID of the place to load.

loadWithResourceName

public final void loadWithResourceName(@NonNull String resourceName)

Loads details of the place with the specified place resource name and displays it on the widget.

Parameters
@NonNull String resourceName

The resource name of the place to load.

newInstance

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

Returns a new instance of AdvancedPlaceDetailsCompactFragment.

After creating a new instance of AdvancedPlaceDetailsCompactFragment, you may call loadWithPlaceId or loadWithResourceName to load the place details.

Parameters
@NonNull List<@NonNull AdvancedPlaceDetailsCompactFragment.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 that inherits from R.style.PlacesMaterialTheme and overrides theme attributes to customize the widget appearance.

setEnableLightbox

public final void setEnableLightbox(boolean enableLightbox)

Whether to enable lightbox.

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.

setPlaceActionProvider

@MainThread
public void setPlaceActionProvider(PlaceActionProvider placeActionProvider)

Sets the PlaceActionProvider to be used to update action buttons.

Parameters
PlaceActionProvider placeActionProvider

The provider to be used to update action buttons.

setPlaceLoadListener

public final void setPlaceLoadListener(@NonNull PlaceLoadListener listener)

Sets a listener to be invoked when a place is loaded into the widget or when the widget fails to load.

Parameters
@NonNull PlaceLoadListener listener

The listener to be invoked when a place is loaded into the widget or when the widget fails to load.

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