Fix album page toolbar color

This commit is contained in:
Karim Abou Zeid 2018-04-28 13:38:21 +02:00
commit 21d7b3d5df
2 changed files with 179 additions and 186 deletions

View file

@ -202,6 +202,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
setTaskDescriptionColor(color); setTaskDescriptionColor(color);
toolbar.setBackgroundColor(color); toolbar.setBackgroundColor(color);
setSupportActionBar(toolbar); // needed to auto readjust the toolbar content color
setStatusbarColor(color); setStatusbarColor(color);
int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color)); int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
@ -263,7 +264,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_album_detail, menu); getMenuInflater().inflate(R.menu.menu_album_detail, menu);
return true; return super.onCreateOptionsMenu(menu);
} }
private void loadWiki() { private void loadWiki() {

View file

@ -1,226 +1,218 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/shadow_statusbar_toolbar" /> <include layout="@layout/status_bar" />
<LinearLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:elevation="@dimen/toolbar_elevation"
tools:ignore="UnusedAttribute">
<include layout="@layout/status_bar" /> <android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:background="@android:color/transparent" />
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="0dp"
android:scrollbars="none" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="@dimen/toolbar_elevation" android:orientation="vertical">
tools:ignore="UnusedAttribute">
<android.support.v7.widget.Toolbar <LinearLayout
android:id="@+id/toolbar" android:id="@+id/header"
style="@style/Toolbar"
android:background="@android:color/transparent" />
<ViewStub
android:id="@+id/cab_stub"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" /> android:layout_height="@dimen/detail_header_height"
android:background="?attr/defaultFooterColor"
android:elevation="@dimen/toolbar_elevation"
android:orientation="horizontal"
tools:ignore="UnusedAttribute">
</FrameLayout> <!--placeholder image view, the actual image view can't go here or the shared element transition won't work right-->
<View
<FrameLayout android:layout_width="144dp"
android:layout_width="match_parent" android:layout_height="144dp"
android:layout_height="match_parent"> android:layout_margin="16dp" />
<com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="0dp"
android:scrollbars="none" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/detail_header_height" android:layout_height="match_parent"
android:background="?attr/defaultFooterColor" android:layout_marginBottom="16dp"
android:elevation="@dimen/toolbar_elevation" android:layout_marginTop="16dp"
android:orientation="horizontal" android:orientation="vertical">
tools:ignore="UnusedAttribute">
<!--placeholder image view, the actual image view can't go here or the shared element transition won't work right-->
<View
android:layout_width="144dp"
android:layout_height="144dp"
android:layout_margin="16dp" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_weight="2"
android:layout_marginTop="16dp" android:gravity="center_vertical"
android:orientation="vertical"> android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
<LinearLayout <ImageView
android:layout_width="match_parent" android:id="@+id/artist_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_person_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<TextView
android:id="@+id/artist_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2" android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
<ImageView </LinearLayout>
android:id="@+id/artist_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_person_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<TextView <LinearLayout
android:id="@+id/artist_text" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" /> android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
</LinearLayout> <ImageView
android:id="@+id/duration_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_access_time_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/duration_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
<ImageView </LinearLayout>
android:id="@+id/duration_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_access_time_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<TextView <LinearLayout
android:id="@+id/duration_text" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
</LinearLayout> <ImageView
android:id="@+id/song_count_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_music_note_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/song_count_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
<ImageView </LinearLayout>
android:id="@+id/song_count_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_music_note_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<TextView <LinearLayout
android:id="@+id/song_count_text" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
</LinearLayout> <ImageView
android:id="@+id/album_year_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_event_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/album_year_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingLeft="0dp"
android:paddingRight="16dp"
android:paddingStart="0dp">
<ImageView
android:id="@+id/album_year_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginStart="0dp"
app:srcCompat="@drawable/ic_event_white_24dp"
tools:ignore="ContentDescription,UnusedAttribute" />
<TextView
android:id="@+id/album_year_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<View </LinearLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" />
</FrameLayout>
<ImageView
android:id="@+id/image"
android:layout_width="144dp"
android:layout_height="144dp"
android:layout_margin="16dp"
android:scaleType="centerCrop"
android:src="@drawable/default_album_art"
android:transitionName="@string/transition_album_art"
tools:ignore="ContentDescription,UnusedAttribute" />
<View <View
android:id="@+id/header_overlay"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/detail_header_height" android:layout_height="match_parent"
android:elevation="@dimen/toolbar_elevation" android:background="@android:color/transparent" />
tools:ignore="UnusedAttribute" />
</FrameLayout> </FrameLayout>
</LinearLayout> <ImageView
android:id="@+id/image"
android:layout_width="144dp"
android:layout_height="144dp"
android:layout_margin="16dp"
android:scaleType="centerCrop"
android:src="@drawable/default_album_art"
android:transitionName="@string/transition_album_art"
tools:ignore="ContentDescription,UnusedAttribute" />
</FrameLayout> <View
android:id="@+id/header_overlay"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_header_height"
android:elevation="@dimen/toolbar_elevation"
tools:ignore="UnusedAttribute" />
</FrameLayout>
</LinearLayout>