ViewTranslationCallback

public interface ViewTranslationCallback

android.view.translation.ViewTranslationCallback


Callback for handling the translated information show or hide in the View.

Summary

Public methods

abstract boolean onClearTranslation(View view)

Called when the translation state is no longer needed and can be cleared.

abstract boolean onHideTranslation(View view)

Called when the original content should be shown instead of the translated text.

abstract boolean onShowTranslation(View view)

Called when the translated text is ready to show or should be re-shown.

Public methods

onClearTranslation

public abstract boolean onClearTranslation (View view)

Called when the translation state is no longer needed and can be cleared.

Parameters
view View: This value cannot be null.

Returns
boolean true if the View handles clearing the translation.

onHideTranslation

public abstract boolean onHideTranslation (View view)

Called when the original content should be shown instead of the translated text. This method will not be called before View#onViewTranslationResponse or View#onViewTranslationResponse.

Parameters
view View: This value cannot be null.

Returns
boolean true if the View handles hiding the translation.

onShowTranslation

public abstract boolean onShowTranslation (View view)

Called when the translated text is ready to show or should be re-shown.

The translated content can be obtained from View#getViewTranslationResponse. This method will not be called before View#onViewTranslationResponse or View#onVirtualViewTranslationResponses. See View#onViewTranslationResponse for how to get the translated information.

Parameters
view View: This value cannot be null.

Returns
boolean true if the View handles showing the translation.