chinwag-android/app/src/main/res/layout/material_drawer_header.xml
Konrad Pozniak 2cf1e366b8
convert MainActivity to Kotlin and upgrade MaterialDrawer to version 8 (#1748)
* convert MainActivity to Kotlin

* migrate to MaterialDrawer 8

* fix drawer styles

* revert removing BezelImageView and material_drawer_header override

* fix tests

* add lost comment back to material_drawer_header.xml

* add tools:parentTag to material_drawer_header.xml

* use when instead of if in MainActivity

* fix statusbar color over the drawer

* cleanup drawer item creation

* tint secondary drawer items as well

* remove unnecessary ids

* fix header text color in the light theme

* improve header text contrast
2020-04-15 18:57:53 +02:00

201 lines
10 KiB
XML

<!-- this replaces the default material_drawer_header.xml from the MaterialDrawer library to enable rounded avatars -->
<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"
android:id="@+id/material_drawer_account_header"
android:layout_width="match_parent"
android:layout_height="@dimen/material_drawer_account_header_height"
android:clickable="true"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/material_drawer_account_header_background"
android:layout_width="match_parent"
android:layout_height="@dimen/material_drawer_account_header_height"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/material_drawer_statusbar_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="0dp" />
<com.keylesspalace.tusky.view.BezelImageView
android:id="@+id/material_drawer_account_header_current"
style="@style/BezelImageView"
android:layout_width="@dimen/material_drawer_account_header_selected"
android:layout_height="@dimen/material_drawer_account_header_selected"
android:layout_marginStart="@dimen/material_drawer_vertical_padding"
android:layout_marginTop="@dimen/material_drawer_account_header_horizontal_top"
android:clickable="true"
android:elevation="2dp"
android:focusable="true"
android:scaleType="fitCenter"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/material_drawer_statusbar_guideline"
app:materialDrawerMaskDrawable="@drawable/materialdrawer_shape_large" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/material_drawer_account_header_current_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="4dp"
android:fontFamily="sans-serif"
android:gravity="center"
android:lines="1"
android:minWidth="20dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:singleLine="true"
android:textSize="@dimen/material_drawer_item_badge_text"
app:layout_constraintBottom_toBottomOf="@id/material_drawer_account_header_current"
app:layout_constraintStart_toStartOf="@id/material_drawer_account_header_current"
tools:text="99" />
<com.keylesspalace.tusky.view.BezelImageView
android:id="@+id/material_drawer_account_header_small_first"
style="@style/BezelImageView"
android:layout_width="@dimen/material_drawer_account_header_secondary"
android:layout_height="@dimen/material_drawer_account_header_secondary"
android:layout_marginTop="@dimen/material_drawer_account_header_horizontal_top"
android:layout_marginEnd="@dimen/material_drawer_vertical_padding"
android:clickable="true"
android:elevation="2dp"
android:focusable="true"
android:scaleType="fitCenter"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="@id/material_drawer_account_header_small_second"
app:layout_constraintTop_toBottomOf="@+id/material_drawer_statusbar_guideline" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/material_drawer_account_header_small_first_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="4dp"
android:fontFamily="sans-serif"
android:gravity="center"
android:lines="1"
android:minWidth="20dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:singleLine="true"
android:textSize="@dimen/material_drawer_item_badge_small_text"
app:layout_constraintBottom_toBottomOf="@id/material_drawer_account_header_small_first"
app:layout_constraintStart_toStartOf="@id/material_drawer_account_header_small_first"
tools:text="99" />
<com.keylesspalace.tusky.view.BezelImageView
android:id="@+id/material_drawer_account_header_small_second"
style="@style/BezelImageView"
android:layout_width="@dimen/material_drawer_account_header_secondary"
android:layout_height="@dimen/material_drawer_account_header_secondary"
android:layout_marginTop="@dimen/material_drawer_account_header_horizontal_top"
android:layout_marginEnd="@dimen/material_drawer_vertical_padding"
android:clickable="true"
android:elevation="2dp"
android:focusable="true"
android:scaleType="fitCenter"
android:visibility="visible"
app:layout_constraintEnd_toStartOf="@id/material_drawer_account_header_small_third"
app:layout_constraintTop_toBottomOf="@+id/material_drawer_statusbar_guideline" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/material_drawer_account_header_small_second_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="4dp"
android:fontFamily="sans-serif"
android:gravity="center"
android:lines="1"
android:minWidth="20dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:singleLine="true"
android:textSize="@dimen/material_drawer_item_badge_small_text"
app:layout_constraintBottom_toBottomOf="@id/material_drawer_account_header_small_second"
app:layout_constraintStart_toStartOf="@id/material_drawer_account_header_small_second"
tools:text="99" />
<com.keylesspalace.tusky.view.BezelImageView
android:id="@+id/material_drawer_account_header_small_third"
style="@style/BezelImageView"
android:layout_width="@dimen/material_drawer_account_header_secondary"
android:layout_height="@dimen/material_drawer_account_header_secondary"
android:layout_marginTop="@dimen/material_drawer_account_header_horizontal_top"
android:layout_marginEnd="@dimen/material_drawer_vertical_padding"
android:clickable="true"
android:elevation="2dp"
android:focusable="true"
android:scaleType="fitCenter"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/material_drawer_statusbar_guideline" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/material_drawer_account_header_small_third_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="4dp"
android:fontFamily="sans-serif"
android:gravity="center"
android:lines="1"
android:minWidth="20dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:singleLine="true"
android:textSize="@dimen/material_drawer_item_badge_small_text"
app:layout_constraintBottom_toBottomOf="@id/material_drawer_account_header_small_third"
app:layout_constraintStart_toStartOf="@id/material_drawer_account_header_small_third"
tools:text="99" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/material_drawer_text_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_end="@dimen/material_drawer_account_header_dropdown_guideline" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/material_drawer_account_header_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/material_drawer_vertical_padding"
android:fontFamily="sans-serif-medium"
android:lines="1"
android:maxLines="1"
android:textSize="@dimen/material_drawer_account_header_title"
app:layout_constraintBottom_toTopOf="@id/material_drawer_account_header_email"
app:layout_constraintEnd_toStartOf="@id/material_drawer_account_header_text_switcher"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/material_drawer_text_guideline"
app:layout_constraintVertical_chainStyle="packed" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/material_drawer_account_header_email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/material_drawer_vertical_padding"
android:layout_marginBottom="@dimen/material_drawer_padding"
android:fontFamily="sans-serif"
android:lines="1"
android:maxLines="1"
android:textSize="@dimen/material_drawer_account_header_subtext"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/material_drawer_account_header_text_switcher"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/material_drawer_account_header_name" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/material_drawer_account_header_text_switcher"
android:layout_width="@dimen/material_drawer_account_header_dropdown"
android:layout_height="@dimen/material_drawer_account_header_dropdown"
android:layout_marginEnd="@dimen/material_drawer_vertical_padding"
android:layout_marginBottom="@dimen/material_drawer_account_header_dropdown_margin_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</merge>