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

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

        <variable
            name="leftAreaMove"
            type="android.databinding.ObservableBoolean"/>

        <variable
            name="rightAreaMove"
            type="android.databinding.ObservableBoolean"/>

        <variable
            name="brightnessAndVolumeProgress"
            type="android.databinding.ObservableInt"/>
    </data>

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

        <LinearLayout
            android:id="@+id/operationVolumeBrightness"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:background="@drawable/player_volumn_bg"
            android:orientation="vertical"
            android:padding="0dip"
            android:visibility="@{(leftAreaMove.get() || rightAreaMove.get()) ? View.VISIBLE : View.GONE}">

            <ImageView
                android:id="@+id/operationImage"
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="12dp"
                android:contentDescription="@null"
                android:src="@{leftAreaMove.get() ? @drawable/player_volume : @drawable/player_brightness}"/>

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="10dp">

                <ImageView
                    android:id="@+id/operationFull"
                    android:layout_width="93dp"
                    android:layout_height="2dp"
                    android:layout_gravity="left"
                    android:contentDescription="@null"
                    android:src="#33ffffff" />

                <ImageView
                    android:id="@+id/operationPercent"
                    android:layout_width="@{brightnessAndVolumeProgress.get(),default=@dimen/volumeWidthDefault}"
                    android:layout_height="2dp"
                    android:layout_gravity="left"
                    android:contentDescription="@null"
                    android:scaleType="matrix"
                    android:src="#ff6633"/>
            </FrameLayout>
        </LinearLayout>

    </RelativeLayout>


</layout>