Skip to content

Commit

Permalink
Use focusable instead of focusTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Jun 16, 2024
1 parent 9fd8e74 commit 9d2ebc6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fun ItemComposable(
.onFocusChanged { focusState ->
isFocused = focusState.hasFocus
}
.focusTarget()
.focusable()
.dpadClickable {
onClick()
},
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fun ItemComposable(
.onFocusChanged { focusState ->
isFocused = focusState.hasFocus
}
.focusTarget()
.focusable()
.dpadClickable {
onClick()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.rubensousa.dpadrecyclerview.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Box
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
Expand All @@ -32,7 +33,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.SemanticsPropertyKey
Expand Down Expand Up @@ -98,7 +98,7 @@ fun TestComposableFocus(
.onFocusChanged { focusState ->
isFocused = focusState.isFocused
}
.focusTarget()
.focusable()
.background(backgroundColor)
.clickable {
onClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.rubensousa.dpadrecyclerview.sample.ui.screen.drag

import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -36,7 +37,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -73,7 +73,7 @@ fun DragButtonItem(
.onFocusChanged { focusState ->
isFocused = focusState.hasFocus
}
.focusTarget()
.focusable()
.dpadClickable {
if (isDragging) {
onStopDragClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.rubensousa.dpadrecyclerview.sample.ui.screen.drag

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -33,7 +34,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -76,7 +76,7 @@ fun DraggableGridItem(
.onFocusChanged { focusState ->
isFocused = focusState.hasFocus
}
.focusTarget()
.focusable()
.dpadClickable {
onClick()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package com.rubensousa.dpadrecyclerview.sample.ui.screen.drag

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -33,7 +34,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -76,7 +76,7 @@ fun DraggableItem(
.onFocusChanged { focusState ->
isFocused = focusState.hasFocus
}
.focusTarget()
.focusable()
.dpadClickable {
onClick()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth
Expand All @@ -38,7 +39,6 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.scale
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.focusTarget
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.semantics.SemanticsPropertyKey
Expand Down Expand Up @@ -85,7 +85,7 @@ fun ItemComposable(
.onFocusChanged { focusState ->
isFocused = focusState.hasFocus
}
.focusTarget()
.focusable()
.dpadClickable {
onClick()
},
Expand Down

0 comments on commit 9d2ebc6

Please sign in to comment.