Improve error message and correct reference to proper layout

PiperOrigin-RevId: 326944292
This commit is contained in:
insun 2020-08-17 03:13:05 +01:00 committed by kim-vde
parent 49bf83a169
commit 333ccedf80
6 changed files with 91 additions and 9 deletions

View file

@ -192,10 +192,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
* <h3>Overriding the layout file</h3>
*
* To customize the layout of StyledPlayerView throughout your app, or just for certain
* configurations, you can define {@code exo_player_view.xml} layout files in your application
* {@code res/layout*} directories. These layouts will override the one provided by the ExoPlayer
* library, and will be inflated for use by StyledPlayerView. The view identifies and binds its
* children by looking for the following ids:
* configurations, you can define {@code exo_styled_player_view.xml} layout files in your
* application {@code res/layout*} directories. These layouts will override the one provided by the
* ExoPlayer library, and will be inflated for use by StyledPlayerView. The view identifies and
* binds its children by looking for the following ids:
*
* <ul>
* <li><b>{@code exo_content_frame}</b> - A frame whose aspect ratio is resized based on the video
@ -365,7 +365,7 @@ public class StyledPlayerView extends FrameLayout implements AdsLoader.AdViewPro
boolean shutterColorSet = false;
int shutterColor = 0;
int playerLayoutId = R.layout.exo_player_view;
int playerLayoutId = R.layout.exo_styled_player_view;
boolean useArtwork = true;
int defaultArtworkId = 0;
boolean useController = true;

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/exo_styled_error_message_background"/>
<corners android:radius="16dp"/>
</shape>

View file

@ -26,7 +26,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/exo_widget_center_view_background" />
android:background="@color/exo_black_opacity_30" />
<include
android:id="@+id/exo_embedded_transport_controls"

View file

@ -13,6 +13,62 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<merge>
<include layout="@layout/exo_player_view"/>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout android:id="@id/exo_content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<!-- Video surface will be inserted as the first child of the content frame. -->
<View android:id="@id/exo_shutter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"/>
<ImageView android:id="@id/exo_artwork"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"/>
<com.google.android.exoplayer2.ui.SubtitleView android:id="@id/exo_subtitles"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ProgressBar android:id="@id/exo_buffering"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:layout_gravity="center"/>
<TextView android:id="@id/exo_error_message"
android:layout_width="wrap_content"
android:layout_height="@dimen/exo_error_message_height"
android:layout_gravity="center"
android:layout_marginBottom="@dimen/exo_error_message_margin_bottom"
android:gravity="center"
android:textColor="@color/exo_white"
android:textSize="@dimen/exo_error_message_text_size"
android:background="@drawable/exo_rounded_rectangle"
android:paddingLeft="@dimen/exo_error_message_text_padding_horizontal"
android:paddingRight="@dimen/exo_error_message_text_padding_horizontal"
android:paddingTop="@dimen/exo_error_message_text_padding_vertical"
android:paddingBottom="@dimen/exo_error_message_text_padding_vertical"/>
</com.google.android.exoplayer2.ui.AspectRatioFrameLayout>
<FrameLayout android:id="@id/exo_ad_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<FrameLayout android:id="@id/exo_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View android:id="@id/exo_controller_placeholder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</merge>

View file

@ -20,6 +20,7 @@
<color name="exo_white">#ffffff</color>
<color name="exo_white_opacity_70">#B3ffffff</color>
<color name="exo_black_opacity_70">#B3000000</color>
<color name="exo_widget_center_view_background">#90000000</color>
<color name="exo_black_opacity_30">#4D000000</color>
<color name="exo_styled_error_message_background">#80808080</color>
<color name="exo_bottom_bar_background">#b0000000</color>
</resources>

View file

@ -42,4 +42,10 @@
<dimen name="exo_time_view_padding">10dp</dimen>
<dimen name="exo_time_view_width">170sp</dimen>
<dimen name="exo_error_message_height">32dp</dimen>
<dimen name="exo_error_message_margin_bottom">64dp</dimen>
<dimen name="exo_error_message_text_size">14sp</dimen>
<dimen name="exo_error_message_text_padding_horizontal">12dp</dimen>
<dimen name="exo_error_message_text_padding_vertical">4dp</dimen>
</resources>