mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Ensure we destroy WebViews when we detach them from SubtitleView
PiperOrigin-RevId: 309389731
This commit is contained in:
parent
79c003f5a8
commit
10db7a9c45
@ -143,6 +143,9 @@ public final class SubtitleView extends FrameLayout implements TextOutput {
|
||||
|
||||
private <T extends View & Output> void setView(T view) {
|
||||
removeView(innerSubtitleView);
|
||||
if (innerSubtitleView instanceof SubtitleWebView) {
|
||||
((SubtitleWebView) innerSubtitleView).destroy();
|
||||
}
|
||||
innerSubtitleView = view;
|
||||
output = view;
|
||||
addView(view);
|
||||
|
@ -174,6 +174,17 @@ import java.util.List;
|
||||
updateWebView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up internal state, including calling {@link WebView#destroy()} on the delegate view.
|
||||
*
|
||||
* <p>This method may only be called after this view has been removed from the view system. No
|
||||
* other methods may be called on this view after destroy.
|
||||
*/
|
||||
public void destroy() {
|
||||
cues.clear();
|
||||
webView.destroy();
|
||||
}
|
||||
|
||||
private void updateWebView() {
|
||||
StringBuilder html = new StringBuilder();
|
||||
html.append(
|
||||
|
Loading…
x
Reference in New Issue
Block a user