mirror of
https://github.com/androidx/media.git
synced 2025-05-15 03:29:53 +08:00
Make SubtitleWebView 'invisible' to touch events
Without this, tapping the main video playback doesn't bring up the controls. PiperOrigin-RevId: 291943063
This commit is contained in:
parent
e92ea31fcd
commit
658e0e17b8
@ -22,6 +22,7 @@ import static com.google.android.exoplayer2.ui.SubtitleView.DEFAULT_TEXT_SIZE_FR
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -65,7 +66,22 @@ import java.util.List;
|
||||
style = CaptionStyleCompat.DEFAULT;
|
||||
bottomPaddingFraction = DEFAULT_BOTTOM_PADDING_FRACTION;
|
||||
|
||||
webView = new WebView(context, attrs);
|
||||
webView =
|
||||
new WebView(context, attrs) {
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
super.onTouchEvent(event);
|
||||
// Return false so that touch events are allowed down into @id/exo_content_frame below.
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performClick() {
|
||||
super.performClick();
|
||||
// Return false so that clicks are allowed down into @id/exo_content_frame below.
|
||||
return false;
|
||||
}
|
||||
};
|
||||
webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
addView(webView);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user