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

    <data>

        <import type="android.databinding.ObservableField"/>
        <import type="android.databinding.ObservableBoolean"/>
        <import type="android.databinding.ObservableLong"/>
        <import type="com.cnlive.gundam.video.utils.PlayerUtils"/>
        <import type="com.cnlive.gundam.video.view.PlayerControllerView"/>
        <import type="android.view.View"/>

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

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

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

        <variable
            name="curProgress"
            type="ObservableLong"/>

        <variable
            name="durProgress"
            type="ObservableLong"/>

        <variable
            name="playerControllerView"
            type="PlayerControllerView"/>

    </data>

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

        <RelativeLayout
            android:id="@+id/topLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#44000000"
            android:visibility="@{showController.get() ? View.VISIBLE : View.GONE}">

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="30dp"
                android:layout_marginLeft="50dp"
                android:gravity="center"
                android:textColor="@android:color/white"
                android:text="@{title.get()}" />

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/bottomLayout"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:background="#44000000"
            android:layout_alignParentBottom="true"
            android:visibility="@{showController.get() ? View.VISIBLE : View.GONE}">

            <ImageView
                android:id="@+id/playBtn"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginRight="5dp"
                android:layout_marginLeft="10dp"
                android:src="@{isPlay ? @drawable/player_play : @drawable/player_pause}"
                android:onClick="@{playerControllerView.onClick}"
                android:layout_centerVertical="true"/>

            <TextView
                android:id="@+id/curTime"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/playBtn"
                android:text="@{PlayerUtils.stringForTime(curProgress.get() / 1000)}"
                android:textColor="@android:color/white"
                android:layout_centerVertical="true"/>

            <SeekBar
                android:id="@+id/progressBar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/curTime"
                android:layout_toLeftOf="@+id/durTime"
                android:progress="@{(int)(curProgress.get() / 1000)}"
                android:max="@{(int)(durProgress.get() / 1000)}"
                android:layout_centerVertical="true"
                android:onSeekBarChangeListener="@{playerControllerView}"/>

            <TextView
                android:id="@+id/durTime"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{PlayerUtils.stringForTime(durProgress.get() / 1000)}"
                android:layout_marginRight="5dp"
                android:layout_toLeftOf="@+id/fullScreen"
                android:textColor="@android:color/white"
                android:layout_centerVertical="true"/>

            <ImageView
                android:id="@+id/fullScreen"
                android:layout_width="25dp"
                android:layout_height="25dp"
                android:src="@drawable/player_full_screen"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:layout_marginRight="10dp"
                android:onClick="@{playerControllerView.onClick}"/>

        </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="@{playerControllerView.onClick}"/>

    </RelativeLayout>

</layout>