Better Cast layout
This commit is contained in:
parent
af63d0f28c
commit
3c26c39a5a
4 changed files with 36 additions and 38 deletions
|
@ -60,7 +60,8 @@ abstract class AbsCastActivity : AbsSlidingMusicPanelActivity() {
|
||||||
mCastSession = castSession
|
mCastSession = castSession
|
||||||
webServer.start()
|
webServer.start()
|
||||||
mCastSession?.remoteMediaClient?.let {
|
mCastSession?.remoteMediaClient?.let {
|
||||||
loadCastQueue(it.mediaQueue.indexOfItemWithId(it.currentItem?.itemId ?: 0), it.approximateStreamPosition)
|
loadCastQueue(it.mediaQueue.indexOfItemWithId(it.currentItem?.itemId ?: 0),
|
||||||
|
it.approximateStreamPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
MusicPlayerRemote.isCasting = true
|
MusicPlayerRemote.isCasting = true
|
||||||
|
@ -126,7 +127,7 @@ abstract class AbsCastActivity : AbsSlidingMusicPanelActivity() {
|
||||||
progress: Long = MusicPlayerRemote.songProgressMillis.toLong(),
|
progress: Long = MusicPlayerRemote.songProgressMillis.toLong(),
|
||||||
) {
|
) {
|
||||||
mCastSession?.let {
|
mCastSession?.let {
|
||||||
if (!MusicPlayerRemote.playingQueue.isNullOrEmpty()) {
|
if (MusicPlayerRemote.playingQueue.isNotEmpty()) {
|
||||||
CastHelper.castQueue(
|
CastHelper.castQueue(
|
||||||
it,
|
it,
|
||||||
MusicPlayerRemote.playingQueue,
|
MusicPlayerRemote.playingQueue,
|
||||||
|
|
|
@ -39,7 +39,7 @@ object CastHelper {
|
||||||
val remoteMediaClient = castSession.remoteMediaClient
|
val remoteMediaClient = castSession.remoteMediaClient
|
||||||
remoteMediaClient?.queueLoad(
|
remoteMediaClient?.queueLoad(
|
||||||
songs.toMediaInfoList(),
|
songs.toMediaInfoList(),
|
||||||
position,
|
if (position != -1) position else 0,
|
||||||
MediaStatus.REPEAT_MODE_REPEAT_OFF,
|
MediaStatus.REPEAT_MODE_REPEAT_OFF,
|
||||||
progress,
|
progress,
|
||||||
JSONObject()
|
JSONObject()
|
||||||
|
|
|
@ -1,31 +1,40 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/container_all"
|
android:id="@+id/container_all"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="0dp">
|
android:paddingTop="0dp">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/container_current"
|
android:id="@+id/container_current"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/cast_mini_controller_icon_height">
|
android:layout_height="@dimen/cast_mini_controller_height">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/center"
|
android:id="@+id/center"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
|
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/icon_container"
|
||||||
|
android:layout_width="@dimen/cast_mini_controller_image_size"
|
||||||
|
android:layout_height="@dimen/cast_mini_controller_image_size"
|
||||||
|
android:layout_margin="8dp"
|
||||||
|
app:cardCornerRadius="10dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon_view"
|
android:id="@+id/icon_view"
|
||||||
android:layout_width="@dimen/cast_mini_controller_icon_width"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/cast_mini_controller_icon_height"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:src="@drawable/default_audio_art" />
|
android:src="@drawable/default_audio_art" />
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/button_0"
|
android:id="@+id/button_0"
|
||||||
|
@ -33,9 +42,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginEnd="@dimen/cast_mini_controller_control_button_margin"
|
android:layout_marginEnd="@dimen/cast_mini_controller_control_button_margin"
|
||||||
android:layout_marginRight="@dimen/cast_mini_controller_control_button_margin"
|
android:layout_toStartOf="@+id/button_1" />
|
||||||
android:layout_toStartOf="@+id/button_1"
|
|
||||||
android:layout_toLeftOf="@+id/button_1" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/button_1"
|
android:id="@+id/button_1"
|
||||||
|
@ -43,52 +50,40 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginEnd="@dimen/cast_mini_controller_control_button_margin"
|
android:layout_marginEnd="@dimen/cast_mini_controller_control_button_margin"
|
||||||
android:layout_marginRight="@dimen/cast_mini_controller_control_button_margin"
|
android:layout_toStartOf="@+id/button_2" />
|
||||||
android:layout_toStartOf="@+id/button_2"
|
|
||||||
android:layout_toLeftOf="@+id/button_2" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/button_2"
|
android:id="@+id/button_2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp" />
|
||||||
android:layout_marginRight="8dp" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title_view"
|
android:id="@+id/title_view"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_above="@+id/center"
|
android:layout_above="@+id/center"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginLeft="15dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_marginBottom="-3dp"
|
android:layout_marginBottom="-3dp"
|
||||||
android:layout_toStartOf="@+id/button_0"
|
android:layout_toStartOf="@+id/button_0"
|
||||||
android:layout_toLeftOf="@+id/button_0"
|
android:layout_toEndOf="@+id/icon_container"
|
||||||
android:layout_toEndOf="@+id/icon_view"
|
|
||||||
android:layout_toRightOf="@+id/icon_view"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAppearance="?attr/castTitleTextAppearance" />
|
android:textAppearance="?attr/castTitleTextAppearance" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subtitle_view"
|
android:id="@+id/subtitle_view"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/center"
|
android:layout_below="@+id/center"
|
||||||
android:layout_alignStart="@+id/title_view"
|
android:layout_alignStart="@+id/title_view"
|
||||||
android:layout_alignLeft="@+id/title_view"
|
|
||||||
android:layout_alignEnd="@+id/title_view"
|
android:layout_alignEnd="@+id/title_view"
|
||||||
android:layout_alignRight="@+id/title_view"
|
|
||||||
android:layout_marginTop="3dp"
|
android:layout_marginTop="3dp"
|
||||||
android:layout_toStartOf="@+id/button_0"
|
android:layout_toStartOf="@+id/button_0"
|
||||||
android:layout_toLeftOf="@+id/button_0"
|
android:layout_toEndOf="@+id/icon_container"
|
||||||
android:layout_toEndOf="@+id/icon_view"
|
|
||||||
android:layout_toRightOf="@+id/icon_view"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAppearance="?attr/castSubtitleTextAppearance" />
|
android:textAppearance="?attr/castSubtitleTextAppearance" />
|
||||||
|
@ -97,7 +92,7 @@
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="5dp"
|
android:layout_height="5dp"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layoutDirection="ltr"
|
android:layoutDirection="ltr"
|
||||||
|
|
|
@ -72,4 +72,6 @@
|
||||||
<dimen name="padding_album_cover">16dp</dimen>
|
<dimen name="padding_album_cover">16dp</dimen>
|
||||||
|
|
||||||
<dimen name="seekbar_padding">16dp</dimen>
|
<dimen name="seekbar_padding">16dp</dimen>
|
||||||
|
<dimen name="cast_mini_controller_height">64dp</dimen>
|
||||||
|
<dimen name="cast_mini_controller_image_size">48dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue