layout_player_info.xml 6.61 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.ObservableBoolean" />

        <import type="com.cnlive.gundam.video.view.PlayerInfoView" />

        <import type="android.view.View" />

        <import type="android.databinding.ObservableField" />

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

        <variable
            name="isNews"
            type="ObservableBoolean" />

        <variable
            name="isPortrait"
            type="ObservableBoolean" />

        <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">

            <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:background="#000000"
            android:visibility="@{showType.get() == PlayerInfoView.SHOW_END ? View.VISIBLE : View.GONE}"
            tools:visibility="gone">

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

        </RelativeLayout>

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

    </RelativeLayout>

</layout>