Lint: change to lowercase for composable functions with a return type
Bug: 253979024 Test: manual - build gallery Change-Id: I0926f83040037f1c28c323e9ecafbf8781bae5b1
This commit is contained in:
@@ -23,7 +23,7 @@ import com.android.settingslib.spa.framework.common.LogEvent
|
||||
import com.android.settingslib.spa.framework.common.SpaEnvironmentFactory
|
||||
|
||||
@Composable
|
||||
fun LogEntryEvent(): (event: LogEvent) -> Unit {
|
||||
fun logEntryEvent(): (event: LogEvent) -> Unit {
|
||||
val entryId = LocalEntryDataProvider.current.entryId ?: return {}
|
||||
return {
|
||||
SpaEnvironmentFactory.instance.logger.event(entryId, it, category = LogCategory.VIEW)
|
||||
@@ -31,9 +31,9 @@ fun LogEntryEvent(): (event: LogEvent) -> Unit {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun WrapOnClickWithLog(onClick: (() -> Unit)?): (() -> Unit)? {
|
||||
fun wrapOnClickWithLog(onClick: (() -> Unit)?): (() -> Unit)? {
|
||||
if (onClick == null) return null
|
||||
val logEvent = LogEntryEvent()
|
||||
val logEvent = logEntryEvent()
|
||||
return {
|
||||
logEvent(LogEvent.ENTRY_CLICK)
|
||||
onClick()
|
||||
@@ -41,9 +41,9 @@ fun WrapOnClickWithLog(onClick: (() -> Unit)?): (() -> Unit)? {
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun WrapOnSwitchWithLog(onSwitch: ((checked: Boolean) -> Unit)?): ((checked: Boolean) -> Unit)? {
|
||||
fun wrapOnSwitchWithLog(onSwitch: ((checked: Boolean) -> Unit)?): ((checked: Boolean) -> Unit)? {
|
||||
if (onSwitch == null) return null
|
||||
val logEvent = LogEntryEvent()
|
||||
val logEvent = logEntryEvent()
|
||||
return {
|
||||
val event = if (it) LogEvent.ENTRY_SWITCH_ON else LogEvent.ENTRY_SWITCH_OFF
|
||||
logEvent(event)
|
||||
|
||||
@@ -26,9 +26,9 @@ import com.android.settingslib.spa.framework.common.EntryMacro
|
||||
import com.android.settingslib.spa.framework.common.EntrySearchData
|
||||
import com.android.settingslib.spa.framework.compose.navigator
|
||||
import com.android.settingslib.spa.framework.compose.stateOf
|
||||
import com.android.settingslib.spa.framework.util.WrapOnClickWithLog
|
||||
import com.android.settingslib.spa.widget.util.EntryHighlight
|
||||
import com.android.settingslib.spa.framework.util.wrapOnClickWithLog
|
||||
import com.android.settingslib.spa.widget.ui.createSettingsIcon
|
||||
import com.android.settingslib.spa.widget.util.EntryHighlight
|
||||
|
||||
data class SimplePreferenceMacro(
|
||||
val title: String,
|
||||
@@ -107,7 +107,7 @@ fun Preference(
|
||||
model: PreferenceModel,
|
||||
singleLineSummary: Boolean = false,
|
||||
) {
|
||||
val onClickWithLog = WrapOnClickWithLog(model.onClick)
|
||||
val onClickWithLog = wrapOnClickWithLog(model.onClick)
|
||||
val modifier = remember(model.enabled.value) {
|
||||
if (onClickWithLog != null) {
|
||||
Modifier.clickable(
|
||||
|
||||
@@ -31,9 +31,9 @@ import com.android.settingslib.spa.framework.compose.stateOf
|
||||
import com.android.settingslib.spa.framework.compose.toState
|
||||
import com.android.settingslib.spa.framework.theme.SettingsDimension
|
||||
import com.android.settingslib.spa.framework.theme.SettingsTheme
|
||||
import com.android.settingslib.spa.framework.util.WrapOnSwitchWithLog
|
||||
import com.android.settingslib.spa.widget.util.EntryHighlight
|
||||
import com.android.settingslib.spa.framework.util.wrapOnSwitchWithLog
|
||||
import com.android.settingslib.spa.widget.ui.SettingsSwitch
|
||||
import com.android.settingslib.spa.widget.util.EntryHighlight
|
||||
|
||||
/**
|
||||
* The widget model for [SwitchPreference] widget.
|
||||
@@ -104,7 +104,7 @@ internal fun InternalSwitchPreference(
|
||||
) {
|
||||
val checkedValue = checked.value
|
||||
val indication = LocalIndication.current
|
||||
val onChangeWithLog = WrapOnSwitchWithLog(onCheckedChange)
|
||||
val onChangeWithLog = wrapOnSwitchWithLog(onCheckedChange)
|
||||
val modifier = remember(checkedValue, changeable.value) {
|
||||
if (checkedValue != null && onChangeWithLog != null) {
|
||||
Modifier.toggleable(
|
||||
|
||||
@@ -20,7 +20,7 @@ import androidx.compose.material3.Checkbox
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import com.android.settingslib.spa.framework.util.WrapOnSwitchWithLog
|
||||
import com.android.settingslib.spa.framework.util.wrapOnSwitchWithLog
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@@ -35,7 +35,7 @@ fun SettingsSwitch(
|
||||
if (checkedValue != null) {
|
||||
Checkbox(
|
||||
checked = checkedValue,
|
||||
onCheckedChange = WrapOnSwitchWithLog(onCheckedChange),
|
||||
onCheckedChange = wrapOnSwitchWithLog(onCheckedChange),
|
||||
enabled = changeable.value,
|
||||
)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user