diff options
author | Joshua Brown <keyboardr@google.com> | 2018-04-27 13:20:02 -0700 |
---|---|---|
committer | Joshua Brown <keyboardr@google.com> | 2018-05-02 11:40:05 -0700 |
commit | 30ff1007ab6729566d053649d3e973ac9fd33627 (patch) | |
tree | 523c2a5effee661a20c9b1b6be3b0b6a8876b86d /res | |
parent | 3b78b872b97b59880ad46c96114bc349570fc333 (diff) | |
download | Media-30ff1007ab6729566d053649d3e973ac9fd33627.tar.gz |
DO NOT MERGE Show/hide playback queue
Flattens layouts so that they can be easily transitioned with ConstraintSets. Extracts metadata logic into MetadataController.
Bug: 78784683
Test: Manual
Change-Id: I55f2de884e278fc38fe23a64a84a48d156959747
Diffstat (limited to 'res')
-rw-r--r-- | res/layout/fragment_metadata.xml | 57 | ||||
-rw-r--r-- | res/layout/fragment_metadata_with_queue.xml | 45 | ||||
-rw-r--r-- | res/layout/fragment_playback.xml | 69 | ||||
-rw-r--r-- | res/layout/fragment_playback_with_queue.xml | 43 | ||||
-rw-r--r-- | res/layout/media_activity.xml | 3 | ||||
-rw-r--r-- | res/layout/metadata_compact.xml | 27 | ||||
-rw-r--r-- | res/layout/metadata_normal.xml | 62 | ||||
-rw-r--r-- | res/layout/playback_controls.xml | 26 | ||||
-rw-r--r-- | res/transition/queue_in.xml | 19 | ||||
-rw-r--r-- | res/transition/queue_out.xml | 19 | ||||
-rw-r--r-- | res/values/attrs.xml | 10 | ||||
-rw-r--r-- | res/values/dimens.xml | 5 |
12 files changed, 286 insertions, 99 deletions
diff --git a/res/layout/fragment_metadata.xml b/res/layout/fragment_metadata.xml new file mode 100644 index 0000000..e22410b --- /dev/null +++ b/res/layout/fragment_metadata.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2018, The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<merge + 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" + tools:showIn="@layout/fragment_playback"> + + <ImageView + android:id="@+id/album_art" + android:layout_width="@dimen/playback_album_art_size_large" + android:layout_height="@dimen/playback_album_art_size_large" + android:layout_marginEnd="@dimen/car_keyline_2" + android:layout_marginStart="@dimen/car_keyline_2" + android:contentDescription="@string/album_art" + android:scaleType="centerCrop" + android:transitionName="@string/album_art" + app:layout_constraintBottom_toTopOf="@id/metadata_subcontainer" + app:layout_constraintEnd_toEndOf="@+id/margin_end" + app:layout_constraintStart_toStartOf="@+id/margin_start" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" + tools:src="@drawable/ic_person"/> + + <include android:id="@+id/metadata_subcontainer" + layout="@layout/metadata_normal" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/car_padding_5" + app:layout_constraintBottom_toTopOf="@+id/playback_controls" + app:layout_constraintEnd_toEndOf="@+id/album_art" + app:layout_constraintStart_toStartOf="@+id/album_art" + app:layout_constraintTop_toBottomOf="@+id/album_art"/> + + <androidx.car.widget.PagedListView + android:id="@+id/queue_list" + android:layout_width="0dp" + android:layout_height="0dp" + android:visibility="gone" + app:dividerEndMargin="@dimen/car_keyline_1" + app:dividerStartMargin="@dimen/car_keyline_1" + app:listDividerColor="@color/car_list_divider_inverse"/> +</merge> diff --git a/res/layout/fragment_metadata_with_queue.xml b/res/layout/fragment_metadata_with_queue.xml new file mode 100644 index 0000000..ba204a2 --- /dev/null +++ b/res/layout/fragment_metadata_with_queue.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge + 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" + tools:showIn="@layout/fragment_playback_with_queue"> + + + <ImageView + android:id="@+id/album_art" + android:layout_width="@dimen/playback_album_art_size_normal" + android:layout_height="@dimen/playback_album_art_size_normal" + android:layout_marginTop="@dimen/car_padding_4" + android:layout_marginStart="@dimen/car_keyline_1" + android:contentDescription="@string/album_art" + android:scaleType="centerCrop" + android:transitionName="@string/album_art" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintStart_toStartOf="@+id/margin_start" + tools:src="@drawable/ic_person"/> + + <include android:id="@+id/metadata_subcontainer" + layout="@layout/metadata_normal" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/car_padding_4" + android:layout_marginEnd="@dimen/car_keyline_1" + app:layout_constraintBottom_toBottomOf="@+id/album_art" + app:layout_constraintEnd_toEndOf="@+id/margin_end" + app:layout_constraintStart_toEndOf="@+id/album_art" + app:layout_constraintTop_toTopOf="@+id/album_art"/> + + <androidx.car.widget.PagedListView + android:id="@+id/queue_list" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_marginTop="@dimen/car_padding_4" + app:dividerEndMargin="@dimen/car_keyline_1" + app:dividerStartMargin="@dimen/car_keyline_1" + app:layout_behavior="@string/appbar_scrolling_view_behavior" + app:layout_constraintBottom_toTopOf="@+id/playback_controls" + app:layout_constraintTop_toBottomOf="@+id/album_art" + app:listDividerColor="@color/car_list_divider_inverse"/> + +</merge> diff --git a/res/layout/fragment_playback.xml b/res/layout/fragment_playback.xml index 52f7ab2..bda3f01 100644 --- a/res/layout/fragment_playback.xml +++ b/res/layout/fragment_playback.xml @@ -18,64 +18,27 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/playback_container" - android:animateLayoutChanges="true" android:layout_width="match_parent" android:layout_height="match_parent"> - <LinearLayout - android:id="@+id/metadata_container" - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="@dimen/car_padding_4" - android:paddingBottom="@dimen/car_padding_4" - android:layout_marginLeft="@dimen/car_margin" - android:layout_marginRight="@dimen/car_margin" - android:gravity="center_vertical" - app:layout_constraintTop_toTopOf="parent"> - - <ImageView - android:id="@+id/album_art" - android:contentDescription="@string/album_art" - android:layout_marginStart="@dimen/car_keyline_1" - android:layout_marginEnd="@dimen/car_keyline_1" - android:layout_width="@dimen/playback_album_art_height" - android:layout_height="@dimen/playback_album_art_width" - android:scaleType="centerCrop" - android:transitionName="@string/album_art"/> - - <com.android.car.media.widgets.MetadataView - android:id="@+id/metadata" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/car_keyline_1" - android:layout_weight="1" - android:focusable="false" - app:style="normal"/> - - </LinearLayout> - - <androidx.car.widget.PagedListView - android:id="@+id/queue_list" - android:layout_width="match_parent" + <android.support.constraint.Guideline + android:id="@+id/margin_start" + android:layout_width="0dp" android:layout_height="0dp" - android:layout_marginBottom="@dimen/car_padding_4" - app:listDividerColor="@color/car_list_divider_inverse" - app:dividerStartMargin="@dimen/car_keyline_1" - app:dividerEndMargin="@dimen/car_keyline_1" - app:layout_behavior="@string/appbar_scrolling_view_behavior" - app:layout_constraintTop_toBottomOf="@+id/metadata_container" - app:layout_constraintBottom_toTopOf="@+id/playback_controls"/> + android:orientation="vertical" + app:layout_constraintGuide_begin="@dimen/car_margin"/> - <com.android.car.media.common.PlaybackControlsActionBar - android:id="@+id/playback_controls" - android:layout_width="match_parent" + <android.support.constraint.Guideline + android:id="@+id/margin_end" + android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/car_margin" - android:layout_marginRight="@dimen/car_margin" - android:layout_marginTop="@dimen/car_padding_1" - android:layout_marginBottom="@dimen/car_padding_1" - app:columns="5" - app:layout_constraintBottom_toBottomOf="parent"/> + android:orientation="vertical" + app:layout_constraintGuide_end="@dimen/car_margin"/> + + <include + layout="@layout/fragment_metadata"/> + + <include + layout="@layout/playback_controls"/> </android.support.constraint.ConstraintLayout> diff --git a/res/layout/fragment_playback_with_queue.xml b/res/layout/fragment_playback_with_queue.xml new file mode 100644 index 0000000..f684603 --- /dev/null +++ b/res/layout/fragment_playback_with_queue.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2018, The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<android.support.constraint.ConstraintLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/playback_container" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <android.support.constraint.Guideline + android:id="@+id/margin_start" + android:layout_width="0dp" + android:layout_height="0dp" + android:orientation="vertical" + app:layout_constraintGuide_begin="@dimen/car_margin"/> + + <android.support.constraint.Guideline + android:id="@+id/margin_end" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintGuide_end="@dimen/car_margin"/> + + <include + layout="@layout/fragment_metadata_with_queue"/> + + <include + layout="@layout/playback_controls"/> + +</android.support.constraint.ConstraintLayout> diff --git a/res/layout/media_activity.xml b/res/layout/media_activity.xml index c9be97d..bf26aa9 100644 --- a/res/layout/media_activity.xml +++ b/res/layout/media_activity.xml @@ -78,8 +78,7 @@ android:id="@+id/metadata" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_weight="0.5" - app:style="compact"/> + android:layout_weight="0.5"/> </LinearLayout> </android.support.constraint.ConstraintLayout> diff --git a/res/layout/metadata_compact.xml b/res/layout/metadata_compact.xml index 3d772a1..1a70254 100644 --- a/res/layout/metadata_compact.xml +++ b/res/layout/metadata_compact.xml @@ -15,36 +15,41 @@ limitations under the License. --> <merge - xmlns:android="http://schemas.android.com/apk/res/android" > + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/car_padding_1" - android:textAppearance="@style/TextAppearance.Car.Body1.Light" - android:maxLines="1" android:ellipsize="end" - android:includeFontPadding="false"/> + android:includeFontPadding="false" + android:maxLines="1" + android:textAppearance="@style/TextAppearance.Car.Body1.Light" + tools:text="Body 1 Header"/> <TextView android:id="@+id/subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/title" android:layout_marginBottom="@dimen/car_padding_1" - android:textAppearance="@style/TextAppearance.Car.Body2.Light" - android:maxLines="1" android:ellipsize="end" - android:includeFontPadding="false"/> + android:includeFontPadding="false" + android:maxLines="1" + android:textAppearance="@style/TextAppearance.Car.Body2.Light" + tools:text="Body 2"/> <SeekBar android:id="@+id/seek_bar" android:layout_width="match_parent" android:layout_height="@dimen/playback_seekbar_height" android:layout_below="@+id/subtitle" - android:paddingStart="0dp" android:paddingEnd="0dp" - android:visibility="invisible" + android:paddingStart="0dp" android:progressDrawable="@drawable/seekbar_background" - android:thumb="@drawable/seekbar_thumb"/> + android:thumb="@drawable/seekbar_thumb" + android:visibility="invisible" + tools:visibility="visible" + tools:progress="70"/> -</merge>
\ No newline at end of file +</merge> diff --git a/res/layout/metadata_normal.xml b/res/layout/metadata_normal.xml index cdb63c4..a98e3e0 100644 --- a/res/layout/metadata_normal.xml +++ b/res/layout/metadata_normal.xml @@ -14,47 +14,67 @@ See the License for the specific language governing permissions and limitations under the License. --> -<merge - xmlns:android="http://schemas.android.com/apk/res/android" > +<android.support.constraint.ConstraintLayout + 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/metadata_subcontainer" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:focusable="false"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/car_padding_1" - android:textAppearance="@style/TextAppearance.Car.Body1.Light" - android:maxLines="@integer/playback_title_text_max_lines" android:ellipsize="end" - android:includeFontPadding="false"/> + android:includeFontPadding="false" + android:maxLines="@integer/playback_title_text_max_lines" + android:textAppearance="@style/TextAppearance.Car.Body1.Light" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="Body 1 Header"/> <TextView android:id="@+id/subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_below="@+id/title" - android:layout_marginBottom="@dimen/car_padding_4" - android:textAppearance="@style/TextAppearance.Car.Body2.Light" - android:maxLines="@integer/playback_subtitle_text_max_lines" + android:layout_marginBottom="@dimen/car_padding_2" + android:layout_marginTop="@dimen/car_padding_1" android:ellipsize="end" - android:includeFontPadding="false"/> + android:includeFontPadding="false" + android:maxLines="@integer/playback_subtitle_text_max_lines" + android:textAppearance="@style/TextAppearance.Car.Body2.Light" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/title" + tools:text="Body 2"/> <TextView android:id="@+id/time" - android:layout_width="wrap_content" + android:layout_width="160dp" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_below="@+id/title" - android:textAppearance="@style/TextAppearance.Car.Body2.Light" - android:maxLines="1" + android:layout_marginTop="@dimen/car_padding_1" android:ellipsize="end" - android:includeFontPadding="false"/> + android:includeFontPadding="false" + android:maxLines="@integer/playback_subtitle_text_max_lines" + android:gravity="end" + android:textAppearance="@style/TextAppearance.Car.Body2.Light" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@+id/title" + tools:text="3:27 / 4:03"/> <SeekBar android:id="@+id/seek_bar" android:layout_width="match_parent" android:layout_height="@dimen/playback_seekbar_height" - android:layout_below="@+id/subtitle" - android:paddingStart="0dp" + android:layout_marginTop="@dimen/car_padding_2" + android:background="@color/car_grey_900" android:paddingEnd="0dp" - android:visibility="invisible" + android:paddingStart="0dp" android:progressDrawable="@drawable/seekbar_background" - android:thumb="@drawable/seekbar_thumb"/> + android:thumb="@drawable/seekbar_thumb" + android:visibility="invisible" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/subtitle" + tools:progress="70" + tools:visibility="visible"/> -</merge>
\ No newline at end of file +</android.support.constraint.ConstraintLayout> diff --git a/res/layout/playback_controls.xml b/res/layout/playback_controls.xml new file mode 100644 index 0000000..cbd41a7 --- /dev/null +++ b/res/layout/playback_controls.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2018, The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<com.android.car.media.common.PlaybackControlsActionBar + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/playback_controls" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginHorizontal="@dimen/car_margin" + android:layout_marginBottom="@dimen/car_padding_1" + app:columns="5" + app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/res/transition/queue_in.xml b/res/transition/queue_in.xml new file mode 100644 index 0000000..9e7f798 --- /dev/null +++ b/res/transition/queue_in.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android" + android:transitionOrdering="sequential"> + <arcMotion/> + <fade android:fadingMode="fade_out"/> + <transitionSet android:transitionOrdering="together"> + <changeBounds> + <targets> + <target android:targetId="@+id/album_art"/> + </targets> + </changeBounds> + <changeBounds android:startDelay="50"> + <targets> + <target android:excludeId="@+id/album_art"/> + </targets> + </changeBounds> + </transitionSet> + <fade android:fadingMode="fade_in"/> +</transitionSet> diff --git a/res/transition/queue_out.xml b/res/transition/queue_out.xml new file mode 100644 index 0000000..f0c1e3e --- /dev/null +++ b/res/transition/queue_out.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android" + android:transitionOrdering="sequential"> + <arcMotion/> + <fade android:fadingMode="fade_out"/> + <transitionSet android:transitionOrdering="together"> + <changeBounds android:startDelay="100"> + <targets> + <target android:targetId="@+id/album_art"/> + </targets> + </changeBounds> + <changeBounds> + <targets> + <target android:excludeId="@+id/album_art"/> + </targets> + </changeBounds> + </transitionSet> + <fade android:fadingMode="fade_in"/> +</transitionSet> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 4048b22..134f7f5 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -15,16 +15,6 @@ limitations under the License. --> <resources> - <declare-styleable name="MetadataView"> - <!-- Style of media item metadata view --> - <attr name="style" format="enum"> - <!-- Compact version (to be included in the bottom bar during browsing --> - <enum name="compact" value="0"/> - <!-- Normal version (to be included in the playback screen --> - <enum name="normal" value="1"/> - </attr> - </declare-styleable> - <declare-styleable name="AppBarView"> <!-- Maximum number of tabs to show on the app bar --> <attr name="max_tabs" format="integer"/> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index a6f025f..65c654d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -44,8 +44,9 @@ <!-- Scale to apply to images before blurring them to create the playback background --> <item name="playback_background_blur_scale" format="float" type="dimen">1</item> <!-- Size of the album art thumbnail --> - <dimen name="playback_album_art_height">156dp</dimen> - <dimen name="playback_album_art_width">156dp</dimen> + <dimen name="playback_album_art_size_normal">156dp</dimen> + <!-- Size of the album art thumbnail when large --> + <dimen name="playback_album_art_size_large">574dp</dimen> <!-- Tab height --> <dimen name="browse_tab_height">76dp</dimen> |