diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/ServerRowAdapter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/ServerRowAdapter.kt index eff72fd0..85190acb 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/ServerRowAdapter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/ServerRowAdapter.kt @@ -2,6 +2,7 @@ package org.moire.ultrasonic.fragment import android.content.Context import android.graphics.Color +import android.graphics.drawable.Drawable import android.os.Build import android.view.LayoutInflater import android.view.Menu @@ -68,8 +69,10 @@ internal class ServerRowAdapter( /** * Creates the Row representation of a Server Setting */ + @Suppress("LongMethod") override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View? { var index = position + // Skip "Offline" in manage mode if (manageMode) index++ @@ -92,20 +95,29 @@ internal class ServerRowAdapter( if (setting == null) serverMenu?.visibility = View.INVISIBLE } - // Provide icons for the row + val icon: Drawable? + val background: Drawable? + + // Configure icons for the row if (index == 0) { serverMenu?.visibility = View.INVISIBLE - image?.setImageDrawable(Util.getDrawableFromAttribute(context, R.attr.screen_on_off)) - image?.background = ContextCompat.getDrawable(context, R.color.transparent) + icon = Util.getDrawableFromAttribute(context, R.attr.screen_on_off) + background = ContextCompat.getDrawable(context, R.drawable.circle) } else { - val icon = ContextCompat.getDrawable(context, R.drawable.ic_menu_server_dark) - icon?.setTint(ServerColor.getForegroundColor(context, setting?.color)) - image?.setImageDrawable(icon) - val background = ContextCompat.getDrawable(context, R.drawable.circle) - background?.setTint(ServerColor.getBackgroundColor(context, setting?.color)) - image?.background = background + icon = ContextCompat.getDrawable(context, R.drawable.ic_menu_server_dark) + background = ContextCompat.getDrawable(context, R.drawable.circle) } + // Set colors + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + icon?.setTint(ServerColor.getForegroundColor(context, setting?.color)) + background?.setTint(ServerColor.getBackgroundColor(context, setting?.color)) + } + + // Set the final drawables + image?.setImageDrawable(icon) + image?.background = background + // Highlight the Active Server's row by changing its background if (index == activeServerProvider.getActiveServer().index) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { diff --git a/ultrasonic/src/main/res/layout/navigation_header.xml b/ultrasonic/src/main/res/layout/navigation_header.xml index c5f9c9fd..37401c11 100644 --- a/ultrasonic/src/main/res/layout/navigation_header.xml +++ b/ultrasonic/src/main/res/layout/navigation_header.xml @@ -16,7 +16,7 @@ a:scaleType="fitXY" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent" - tools:ignore="ContentDescription" /> + a:importantForAccessibility="no" /> + a:importantForAccessibility="no" /> + tools:src="@drawable/ic_menu_server_dark" + a:importantForAccessibility="no" /> + a:layout_height="fill_parent"/> + a:src="@drawable/ic_add_white" + a:contentDescription="@string/server_editor.new_label" /> \ No newline at end of file diff --git a/ultrasonic/src/main/res/values/colors.xml b/ultrasonic/src/main/res/values/colors.xml index 85caa5af..9d5bf7c3 100644 --- a/ultrasonic/src/main/res/values/colors.xml +++ b/ultrasonic/src/main/res/values/colors.xml @@ -3,20 +3,20 @@ #555555 #FFFFFF #00000000 - #ff0099cc - #ff6200EE - #ffBB86FC + #0099cc + #6200EE + #BB86FC #8033b5e5 #00000000 #80000000 - #ff000000 - #ff333333 - #ffffffff + #000000 + #333333 + #ffffff #424242 - #B1B1B1 - #fff3f3f3 - #ff000000 - #ff333333 - #ff111111 - #fff3f3f3 + #B6B6B6 + #F3F3F3 + #000000 + #333333 + #111111 + #f3f3f3 \ No newline at end of file