mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-12 07:30:06 +03:00
Add little dropdown icon to server selector header to show interactivity.
This commit is contained in:
parent
bfe24e5dfd
commit
fd22c0f8b5
@ -338,11 +338,18 @@ class NavigationActivity : AppCompatActivity() {
|
||||
|
||||
selectServerButton =
|
||||
navigationView?.getHeaderView(0)?.findViewById(R.id.header_select_server)
|
||||
selectServerButton?.setOnClickListener {
|
||||
val dropDownButton: ImageView? =
|
||||
navigationView?.getHeaderView(0)?.findViewById(R.id.edit_server_button)
|
||||
|
||||
val onClick: (View) -> Unit = {
|
||||
if (drawerLayout?.isDrawerVisible(GravityCompat.START) == true)
|
||||
this.drawerLayout?.closeDrawer(GravityCompat.START)
|
||||
navController.navigate(R.id.serverSelectorFragment)
|
||||
}
|
||||
|
||||
selectServerButton?.setOnClickListener(onClick)
|
||||
dropDownButton?.setOnClickListener(onClick)
|
||||
|
||||
headerBackgroundImage =
|
||||
navigationView?.getHeaderView(0)?.findViewById(R.id.img_header_bg)
|
||||
}
|
||||
@ -352,10 +359,10 @@ class NavigationActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private val closeNavigationDrawerOnBack = object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
drawerLayout?.closeDrawer(GravityCompat.START)
|
||||
}
|
||||
override fun handleOnBackPressed() {
|
||||
drawerLayout?.closeDrawer(GravityCompat.START)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
val retValue = super.onCreateOptionsMenu(menu)
|
||||
|
5
ultrasonic/src/main/res/drawable/arrow_drop_down.xml
Normal file
5
ultrasonic/src/main/res/drawable/arrow_drop_down.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:autoMirrored="true" android:height="24dp"
|
||||
android:tint="#000000" android:viewportHeight="24"
|
||||
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M7,10l5,5 5,-5z"/>
|
||||
</vector>
|
@ -42,6 +42,7 @@
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
a:id="@+id/nav_view"
|
||||
a:layout_width="wrap_content"
|
||||
a:maxWidth="300dp"
|
||||
a:layout_height="match_parent"
|
||||
a:layout_gravity="start"
|
||||
a:fitsSystemWindows="true"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:a="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
a:id="@+id/view_container"
|
||||
@ -13,19 +12,18 @@
|
||||
a:id="@+id/img_header_bg"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_height="0dp"
|
||||
a:importantForAccessibility="no"
|
||||
a:scaleType="fitXY"
|
||||
a:src="@drawable/ic_header_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
a:importantForAccessibility="no" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
a:id="@+id/header_select_server"
|
||||
style="@style/Widget.Material3.Button.TextButton.Icon"
|
||||
a:layout_width="match_parent"
|
||||
a:layout_width="0dp"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_marginStart="3dp"
|
||||
a:layout_marginTop="24dp"
|
||||
a:layout_marginTop="48dp"
|
||||
a:background="@drawable/default_ripple"
|
||||
a:gravity="center_vertical"
|
||||
a:paddingHorizontal="22dp"
|
||||
@ -39,9 +37,27 @@
|
||||
app:iconPadding="12dp"
|
||||
app:iconSize="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/edit_server_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:iconTint="@color/selected_menu_dark"
|
||||
tools:textColor="@color/selected_menu_dark" />
|
||||
|
||||
<ImageView
|
||||
a:id="@+id/edit_server_button"
|
||||
style="@style/Widget.Material3.Button.TextButton.Icon"
|
||||
a:layout_width="wrap_content"
|
||||
a:layout_height="0dp"
|
||||
a:layout_marginTop="6dp"
|
||||
a:layout_marginBottom="6dp"
|
||||
a:contentDescription="@string/server_menu.edit"
|
||||
a:maxHeight="32dp"
|
||||
a:src="@drawable/arrow_drop_down"
|
||||
a:text="@null"
|
||||
app:layout_constraintBottom_toBottomOf="@id/header_select_server"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/header_select_server"
|
||||
app:layout_constraintTop_toTopOf="@id/header_select_server"
|
||||
app:tint="@color/selected_menu_dark" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
x
Reference in New Issue
Block a user