1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-26 04:52:29 +01:00

Make the drawer layout adapt to any status bar size

This improves the drawer specifically for phones that have a notch.
This commit is contained in:
Mauricio Colli 2020-04-02 11:05:19 -03:00
parent da2b059802
commit 45194061b3
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
3 changed files with 20 additions and 18 deletions

View File

@ -1,24 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.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:layout_width="wrap_content"
android:layout_height="@dimen/drawer_header_height"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
android:nextFocusDown="@+id/drawer_header_action_button">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/background_header"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/drawer_header_padding_top"
android:fitsSystemWindows="true"
android:gravity="bottom"
android:minHeight="@dimen/drawer_header_content_min_height"
android:orientation="vertical"
android:paddingTop="@dimen/drawer_header_padding_top">
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
@ -53,7 +59,8 @@
android:textStyle="bold"
app:autoSizeMaxTextSize="@dimen/drawer_header_newpipe_title_max_text_size"
app:autoSizeMinTextSize="@dimen/drawer_header_newpipe_title_min_text_size"
app:autoSizeTextType="uniform" />
app:autoSizeTextType="uniform"
tools:ignore="UnusedAttribute" />
</LinearLayout>
<LinearLayout
@ -68,7 +75,7 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="32dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
@ -108,7 +115,8 @@
<Button
android:id="@+id/drawer_header_action_button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
android:background="?selectableItemBackground"
android:focusable="true" />
</FrameLayout>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Menu Drawer Dimensions -->
<dimen name="drawer_header_height">150dp</dimen>
<dimen name="drawer_header_padding_top">36dp</dimen>
</resources>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Menu Drawer Dimensions -->
<dimen name="drawer_header_height">130dp</dimen>
<dimen name="drawer_header_content_min_height">120dp</dimen>
<dimen name="drawer_header_padding_top">16dp</dimen>
<dimen name="drawer_header_newpipe_icon_size">48dp</dimen>
<dimen name="drawer_header_newpipe_icon_title_space">12dp</dimen>