Tweaked selected color, added circle to offline icon
This commit is contained in:
parent
cef1153f89
commit
eb2e6ada0a
|
@ -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) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
a:scaleType="fitXY"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
a:importantForAccessibility="no" />
|
||||
|
||||
<ImageView
|
||||
a:id="@+id/img_profile"
|
||||
|
@ -29,7 +29,7 @@
|
|||
tools:tint="@color/selected_menu_dark"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
a:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
a:id="@+id/name"
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@drawable/ic_menu_server_dark" />
|
||||
tools:src="@drawable/ic_menu_server_dark"
|
||||
a:importantForAccessibility="no" />
|
||||
|
||||
<TextView
|
||||
a:id="@+id/server_name"
|
||||
|
@ -55,7 +56,7 @@
|
|||
a:layout_centerVertical="true"
|
||||
a:layout_gravity="end"
|
||||
a:layout_marginEnd="15dp"
|
||||
|
||||
a:contentDescription="@string/server_editor.advanced"
|
||||
a:focusable="false"
|
||||
a:src="?attr/more_vert"
|
||||
tools:src="@drawable/ic_more_vert_dark"
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
<ListView
|
||||
a:id="@+id/server_list"
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="fill_parent" />
|
||||
a:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
a:id="@+id/server_add_fab"
|
||||
a:layout_width="wrap_content"
|
||||
a:layout_height="wrap_content"
|
||||
a:layout_alignRight="@id/server_list"
|
||||
a:layout_alignEnd="@id/server_list"
|
||||
a:layout_alignBottom="@id/server_list"
|
||||
a:layout_margin="16dp"
|
||||
a:clickable="true"
|
||||
a:focusable="true"
|
||||
a:src="@drawable/ic_add_white" />
|
||||
a:src="@drawable/ic_add_white"
|
||||
a:contentDescription="@string/server_editor.new_label" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -3,20 +3,20 @@
|
|||
<color name="dividerColor">#555555</color>
|
||||
<color name="appwidget_text">#FFFFFF</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
<color name="cyan">#ff0099cc</color>
|
||||
<color name="navigation_header_light">#ff6200EE</color>
|
||||
<color name="navigation_header_dark">#ffBB86FC</color>
|
||||
<color name="cyan">#0099cc</color>
|
||||
<color name="navigation_header_light">#6200EE</color>
|
||||
<color name="navigation_header_dark">#BB86FC</color>
|
||||
<color name="ics_opaque">#8033b5e5</color>
|
||||
<color name="md__transparent">#00000000</color>
|
||||
<color name="translucent">#80000000</color>
|
||||
<color name="background_color_dark">#ff000000</color>
|
||||
<color name="background_color_grey">#ff333333</color>
|
||||
<color name="background_color_light">#ffffffff</color>
|
||||
<color name="background_color_dark">#000000</color>
|
||||
<color name="background_color_grey">#333333</color>
|
||||
<color name="background_color_light">#ffffff</color>
|
||||
<color name="selected_color_dark">#424242</color>
|
||||
<color name="selected_color_light">#B1B1B1</color>
|
||||
<color name="selected_menu_dark">#fff3f3f3</color>
|
||||
<color name="selected_menu_light">#ff000000</color>
|
||||
<color name="selected_menu_background_dark">#ff333333</color>
|
||||
<color name="selected_menu_background_black">#ff111111</color>
|
||||
<color name="selected_menu_background_light">#fff3f3f3</color>
|
||||
<color name="selected_color_light">#B6B6B6</color>
|
||||
<color name="selected_menu_dark">#F3F3F3</color>
|
||||
<color name="selected_menu_light">#000000</color>
|
||||
<color name="selected_menu_background_dark">#333333</color>
|
||||
<color name="selected_menu_background_black">#111111</color>
|
||||
<color name="selected_menu_background_light">#f3f3f3</color>
|
||||
</resources>
|
Loading…
Reference in New Issue