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
|
||||
webServer.start()
|
||||
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
|
||||
|
@ -126,7 +127,7 @@ abstract class AbsCastActivity : AbsSlidingMusicPanelActivity() {
|
|||
progress: Long = MusicPlayerRemote.songProgressMillis.toLong(),
|
||||
) {
|
||||
mCastSession?.let {
|
||||
if (!MusicPlayerRemote.playingQueue.isNullOrEmpty()) {
|
||||
if (MusicPlayerRemote.playingQueue.isNotEmpty()) {
|
||||
CastHelper.castQueue(
|
||||
it,
|
||||
MusicPlayerRemote.playingQueue,
|
||||
|
|
|
@ -39,7 +39,7 @@ object CastHelper {
|
|||
val remoteMediaClient = castSession.remoteMediaClient
|
||||
remoteMediaClient?.queueLoad(
|
||||
songs.toMediaInfoList(),
|
||||
position,
|
||||
if (position != -1) position else 0,
|
||||
MediaStatus.REPEAT_MODE_REPEAT_OFF,
|
||||
progress,
|
||||
JSONObject()
|
||||
|
|
|
@ -1,31 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="0dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/container_current"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/cast_mini_controller_icon_height">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/cast_mini_controller_height">
|
||||
|
||||
<View
|
||||
android:id="@+id/center"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_view"
|
||||
android:layout_width="@dimen/cast_mini_controller_icon_width"
|
||||
android:layout_height="@dimen/cast_mini_controller_icon_height"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_audio_art" />
|
||||
<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
|
||||
android:id="@+id/icon_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_audio_art" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/button_0"
|
||||
|
@ -33,9 +42,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
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_toLeftOf="@+id/button_1" />
|
||||
android:layout_toStartOf="@+id/button_1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/button_1"
|
||||
|
@ -43,52 +50,40 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
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_toLeftOf="@+id/button_2" />
|
||||
android:layout_toStartOf="@+id/button_2" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/button_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp" />
|
||||
android:layout_marginEnd="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/center"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="-3dp"
|
||||
android:layout_toStartOf="@+id/button_0"
|
||||
android:layout_toLeftOf="@+id/button_0"
|
||||
android:layout_toEndOf="@+id/icon_view"
|
||||
android:layout_toRightOf="@+id/icon_view"
|
||||
android:layout_toEndOf="@+id/icon_container"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/castTitleTextAppearance" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/center"
|
||||
android:layout_alignStart="@+id/title_view"
|
||||
android:layout_alignLeft="@+id/title_view"
|
||||
android:layout_alignEnd="@+id/title_view"
|
||||
android:layout_alignRight="@+id/title_view"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_toStartOf="@+id/button_0"
|
||||
android:layout_toLeftOf="@+id/button_0"
|
||||
android:layout_toEndOf="@+id/icon_view"
|
||||
android:layout_toRightOf="@+id/icon_view"
|
||||
android:layout_toEndOf="@+id/icon_container"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?attr/castSubtitleTextAppearance" />
|
||||
|
@ -97,7 +92,7 @@
|
|||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layoutDirection="ltr"
|
||||
|
|
|
@ -72,4 +72,6 @@
|
|||
<dimen name="padding_album_cover">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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue