layout_player_ugc_info.xml 7.21 KB
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <import type="android.databinding.ObservableInt"/>
        <import type="android.databinding.ObservableField"/>
        <import type="com.cnlive.gundam.video.view.PlayerInfoView"/>
        <import type="android.view.View"/>

        <variable
            name="showType"
            type="ObservableInt"/>

        <variable
            name="statusMsg"
            type="ObservableField&lt;String>"/>

        <variable
            name="playerInfoView"
            type="PlayerInfoView"/>

        <variable
            name="errorMsg"
            type="ObservableField&lt;String>" />

    </data>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout
            android:id="@+id/loadingLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_LOADING ? View.VISIBLE : View.GONE}"
            tools:visibility="gone"
            android:background="#000000">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:gravity="center"
                android:orientation="vertical">

                <ProgressBar
                    android:id="@+id/loading"
                    android:layout_width="50dp"
                    android:layout_height="50dp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/loading"
                    android:textColor="@android:color/white"
                    tools:text="@string/player_loading" />

            </LinearLayout>

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/bufferingLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_BUFFERING ? View.VISIBLE : View.GONE}"
            tools:visibility="visible">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:gravity="center"
                android:orientation="vertical">

                <ProgressBar
                    android:layout_width="50dp"
                    android:layout_height="50dp" />

            </LinearLayout>

        </RelativeLayout>

        <LinearLayout
            android:id="@+id/errorLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000000"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_ERROR ? View.VISIBLE : View.GONE}"
            tools:visibility="gone"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{errorMsg.get()}"
                android:textColor="@android:color/white"
                android:layout_marginBottom="20dp"/>

            <TextView
                android:id="@+id/retry"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/player_btn_bg"
                android:gravity="center"
                android:text="@string/player_retry"
                android:onClick="@{playerInfoView.onClick}"
                android:textColor="@android:color/white" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/mobileNetLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000000"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_MOBILE_NET ? View.VISIBLE : View.GONE}"
            tools:visibility="gone"
            android:gravity="center"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/player_mobile_net"
                android:textColor="@android:color/white"
                android:layout_marginBottom="20dp"/>

            <TextView
                android:id="@+id/playByMobileNet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/player_btn_bg"
                android:gravity="center"
                android:text="@string/player_continue_play"
                android:onClick="@{playerInfoView.onClick}"
                android:textColor="@android:color/white" />

        </LinearLayout>

        <RelativeLayout
            android:id="@+id/endLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_END ? View.VISIBLE : View.GONE}"
            tools:visibility="gone"
            android:background="#000000">

            <TextView
                android:id="@+id/replay"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/player_replay"
                android:gravity="center"
                android:background="@drawable/player_btn_bg"
                android:textColor="@android:color/white"
                android:layout_centerInParent="true"
                android:onClick="@{playerInfoView.onClick}"/>

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/ugcLiveStatusLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_UGC_LIVE_STATUS ? View.VISIBLE : View.GONE}"
            tools:visibility="gone"
            android:background="@color/play_status_bg">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{statusMsg.get()}"
                android:gravity="center"
                android:background="@drawable/player_btn_bg"
                android:textColor="@android:color/white"
                android:layout_centerInParent="true"/>

        </RelativeLayout>

        <ImageView
            android:id="@+id/back"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/player_back"
            android:layout_marginLeft="10dp"
            android:onClick="@{playerInfoView.onClick}"
            android:visibility="@{(showType.get() == PlayerInfoView.SHOW_BUFFERING || showType.get() == PlayerInfoView.SHOW_NULL) ? View.GONE : View.VISIBLE}"/>

    </RelativeLayout>

</layout>