android: move node search to background and fix avatar padding (#574)
android: use background search and fix avatar padding fixes tailscale/corp#24847 fixes tailsacle/corp#24848 Search jobs are moved to the default dispatcher so they do not block the UI thread. The avatar boxing is now used only conditionally on AndroidTV. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>pull/576/head
parent
fda3820582
commit
f35b3f9274
@ -0,0 +1,18 @@
|
|||||||
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
package com.tailscale.ipn.ui.util
|
||||||
|
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
/// Applies different modifiers to the receiver based on a condition.
|
||||||
|
inline fun Modifier.conditional(
|
||||||
|
condition: Boolean,
|
||||||
|
ifTrue: Modifier.() -> Modifier,
|
||||||
|
ifFalse: Modifier.() -> Modifier = { this },
|
||||||
|
): Modifier =
|
||||||
|
if (condition) {
|
||||||
|
then(ifTrue(Modifier))
|
||||||
|
} else {
|
||||||
|
then(ifFalse(Modifier))
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue