Updated looks of navigation header

This commit is contained in:
Nite 2021-10-28 07:28:31 +02:00
parent eb2e6ada0a
commit 9782e18b6e
No known key found for this signature in database
GPG Key ID: 1D1AD59B1C6386C1
4 changed files with 41 additions and 55 deletions

View File

@ -73,8 +73,6 @@ class NavigationActivity : AppCompatActivity() {
private var host: NavHostFragment? = null
private var selectServerButton: MaterialButton? = null
private var headerBackgroundImage: ImageView? = null
private var ultrasonicLogoImage: ImageView? = null
private var ultrasonicNameText: TextView? = null
private lateinit var appBarConfiguration: AppBarConfiguration
private lateinit var nowPlayingEventListener: NowPlayingEventListener
@ -222,10 +220,7 @@ class NavigationActivity : AppCompatActivity() {
ContextCompat.getDrawable(this, R.drawable.ic_menu_select_server_dark)
selectServerButton?.iconTint = ColorStateList.valueOf(foregroundColor)
ultrasonicLogoImage?.imageTintList = ColorStateList.valueOf(foregroundColor)
selectServerButton?.setTextColor(foregroundColor)
ultrasonicNameText?.setTextColor(foregroundColor)
headerBackgroundImage?.setBackgroundColor(backgroundColor)
}
@ -289,10 +284,6 @@ class NavigationActivity : AppCompatActivity() {
}
headerBackgroundImage =
navigationView?.getHeaderView(0)?.findViewById(R.id.img_header_bg)
ultrasonicLogoImage =
navigationView?.getHeaderView(0)?.findViewById(R.id.img_profile)
ultrasonicNameText =
navigationView?.getHeaderView(0)?.findViewById(R.id.name)
}
private fun setupActionBar(navController: NavController, appBarConfig: AppBarConfiguration) {

View File

@ -12,7 +12,7 @@ import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils
import org.moire.ultrasonic.R
private const val LUMINANCE_LIMIT = 0.25
private const val LUMINANCE_LIMIT = 0.4
/**
* Contains functions for computing server display colors

View File

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="256dp"
android:height="128dp"
android:viewportWidth="67.733"
android:viewportHeight="33.867">
<path
android:fillColor="#FF000000"
android:pathData="m28.575,0h39.158v33.867h-67.733z"
android:strokeAlpha="0.26667"
android:strokeWidth="3.7213"
android:fillAlpha="0.1"/>
<path
android:fillColor="#FF000000"
android:pathData="m39.158,33.87h-39.158v-33.867h67.733z"
android:strokeAlpha="0.26667"
android:strokeWidth="3.7213"
android:fillAlpha="0.1"/>
<path
android:fillColor="#FF000000"
android:pathData="m19.579,33.87h-19.579v-33.867h33.867z"
android:strokeAlpha="0.26667"
android:strokeWidth="2.6313"
android:fillAlpha="0.15"/>
<path
android:fillColor="#FF000000"
android:pathData="m48.154,0h19.579v33.867h-33.867z"
android:strokeAlpha="0.26667"
android:strokeWidth="2.6313"
android:fillAlpha="0.05"/>
</vector>

View File

@ -14,67 +14,32 @@
a:layout_width="match_parent"
a:layout_height="0dp"
a:scaleType="fitXY"
a:src="@drawable/ic_header_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
a:importantForAccessibility="no" />
<ImageView
a:id="@+id/img_profile"
a:layout_width="52dp"
a:layout_height="52dp"
a:layout_marginStart="16dp"
a:layout_marginLeft="16dp"
a:layout_marginTop="32dp"
a:src="@drawable/ic_stat_ultrasonic"
tools:tint="@color/selected_menu_dark"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
a:importantForAccessibility="no" />
<TextView
a:id="@+id/name"
a:layout_width="wrap_content"
a:layout_height="wrap_content"
a:gravity="center_vertical"
a:paddingStart="16dp"
a:paddingLeft="16dp"
a:text="@string/common.appname"
a:textAppearance="@style/TextAppearance.AppCompat.Title"
a:textColor="?attr/colorOnPrimary"
tools:textColor="@color/selected_menu_dark"
app:layout_constraintBottom_toBottomOf="@+id/img_profile"
app:layout_constraintStart_toEndOf="@+id/img_profile"
app:layout_constraintTop_toTopOf="@+id/img_profile" />
<Button
a:id="@+id/header_select_server"
style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
a:layout_width="match_parent"
a:layout_height="wrap_content"
a:layout_marginTop="24dp"
a:background="@drawable/default_ripple"
a:gravity="center_vertical"
a:textAppearance="@style/MenuDrawer.Widget"
a:textSize="14sp"
app:icon="@drawable/ic_menu_select_server_dark"
app:iconPadding="16dp"
a:paddingHorizontal="22dp"
a:paddingTop="14dp"
a:paddingBottom="14dp"
a:text="@string/main.offline"
a:textAppearance="@style/MenuDrawer.Widget"
a:textColor="?attr/colorOnPrimary"
a:background="@drawable/default_ripple"
tools:iconTint="@color/selected_menu_dark"
tools:textColor="@color/selected_menu_dark"
a:textSize="14sp"
app:icon="@drawable/ic_menu_select_server_dark"
app:iconPadding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/img_profile" />
<ImageView
a:id="@+id/img_shadow"
a:layout_width="match_parent"
a:layout_height="6dp"
a:layout_marginTop="-6dp"
a:scaleType="fitXY"
a:src="@drawable/drop_shadow"
app:layout_constraintTop_toBottomOf="@+id/header_select_server" />
app:layout_constraintTop_toTopOf="parent"
tools:iconTint="@color/selected_menu_dark"
tools:textColor="@color/selected_menu_dark" />
</androidx.constraintlayout.widget.ConstraintLayout>