Nav drawer android design support library and more
This commit is contained in:
parent
865f72e5bb
commit
b233b3b718
25 changed files with 303 additions and 405 deletions
|
|
@ -1,4 +1,5 @@
|
|||
<android.support.v4.widget.DrawerLayout
|
||||
android:fitsSystemWindows="true"
|
||||
android:id="@+id/drawer_layout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
|
|
@ -24,11 +25,6 @@
|
|||
android:orientation="vertical"
|
||||
tools:ignore="UnusedAttribute">
|
||||
|
||||
<View
|
||||
android:id="@+id/status_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/status_bar_padding" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
|
@ -79,21 +75,12 @@
|
|||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/nav_drawer_frame"
|
||||
android:layout_width="1dp"
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:clickable="true">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_drawer"
|
||||
android:name="com.kabouzeid.gramophone.ui.fragments.NavigationDrawerFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:tag="NAV_DRAWER"
|
||||
tools:layout="@layout/fragment_navigation_drawer" />
|
||||
|
||||
</FrameLayout>
|
||||
android:fitsSystemWindows="true"
|
||||
app:menu="@menu/menu_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/navigation_drawer_background_color"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/navigation_drawer_image_height"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true">
|
||||
|
||||
<ImageView
|
||||
android:transitionName="@string/transition_album_cover"
|
||||
android:id="@+id/album_art"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/navigation_drawer_image_height"
|
||||
android:layout_alignParentTop="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_album_art"
|
||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/shadow_up" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_artist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:singleLine="true"
|
||||
android:text="@string/nothing_playing"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/header_clickable"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:soundEffectsEnabled="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/navigation_drawer_list"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:clipToPadding="false" />
|
||||
|
||||
</LinearLayout>
|
||||
60
app/src/main/res/layout/navigation_drawer_header.xml
Normal file
60
app/src/main/res/layout/navigation_drawer_header.xml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<FrameLayout
|
||||
android:id="@+id/header"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/navigation_drawer_header_height"
|
||||
android:clickable="true"
|
||||
android:foreground="?rect_selector">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/album_art"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_album_art"
|
||||
android:transitionName="@string/transition_album_cover"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/shadow_up" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_artist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:singleLine="true"
|
||||
android:text="@string/nothing_playing"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
36
app/src/main/res/menu/menu_drawer.xml
Normal file
36
app/src/main/res/menu/menu_drawer.xml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/nav_songs"
|
||||
android:icon="@drawable/ic_audiotrack_white_24dp"
|
||||
android:title="@string/songs" />
|
||||
<item
|
||||
android:id="@+id/nav_albums"
|
||||
android:icon="@drawable/ic_album_white_24dp"
|
||||
android:title="@string/albums" />
|
||||
<item
|
||||
android:id="@+id/nav_artists"
|
||||
android:icon="@drawable/ic_person_white_24dp"
|
||||
android:title="@string/artists" />
|
||||
<item
|
||||
android:id="@+id/nav_playlists"
|
||||
android:icon="@drawable/ic_queue_music_white_24dp"
|
||||
android:title="@string/playlists" />
|
||||
</group>
|
||||
|
||||
<item android:title="@string/other">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/ic_settings_white_24dp"
|
||||
android:title="@string/action_settings" />
|
||||
<item
|
||||
android:id="@+id/nav_about"
|
||||
android:icon="@drawable/ic_help_white_24dp"
|
||||
android:title="@string/action_about" />
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
</menu>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="navigation_drawer_image_height">189dp</dimen>
|
||||
<dimen name="navigation_drawer_header_height">189dp</dimen>
|
||||
<dimen name="navigation_drawer_width">304dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="status_bar_padding">25dp</dimen>
|
||||
<dimen name="navigation_drawer_image_height">165dp</dimen>
|
||||
<dimen name="navigation_drawer_header_height">165dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="status_bar_padding">25dp</dimen>
|
||||
<dimen name="navigation_drawer_image_height">165dp</dimen>
|
||||
<dimen name="navigation_drawer_header_height">165dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
<item name="rect_selector">@drawable/rect_ripple_selector_dark</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MaterialMusic.Light" parent="Theme.MaterialMusic.Base.Light">
|
||||
|
|
@ -12,6 +13,7 @@
|
|||
<item name="rect_selector">@drawable/rect_ripple_selector</item>
|
||||
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.MaterialMusic.Notification" parent="@android:style/TextAppearance.Material.Notification" />
|
||||
|
|
@ -19,6 +21,7 @@
|
|||
<style name="Theme.MaterialMusic.Notification.Title" parent="@android:style/TextAppearance.Material.Notification.Title" />
|
||||
|
||||
<style name="PlayPauseFab" parent="PlayPauseFabParent">
|
||||
<item name="borderWidth">0dp</item>
|
||||
<item name="android:transitionName">@string/transition_fab</item>
|
||||
</style>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
||||
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
||||
<dimen name="navigation_drawer_image_height">140dp</dimen>
|
||||
<dimen name="navigation_drawer_header_height">140dp</dimen>
|
||||
<dimen name="nav_drawer_width_limit">320dp</dimen>
|
||||
<dimen name="nav_drawer_margin">56dp</dimen>
|
||||
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@
|
|||
<string name="failed_download_albumart">Unable to download the art for this album.</string>
|
||||
<string name="search_hint">Search your library…</string>
|
||||
<string name="rescanning_media">Rescanning media…</string>
|
||||
<string name="other">Other</string>
|
||||
|
||||
<string-array name="update_album_cover_options">
|
||||
<item>Download from Last.fm</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue