Skip to content

Commit

Permalink
Merge pull request #472 from skydoves/spotless/6.20.0
Browse files Browse the repository at this point in the history
Migrate Spotless to 6.20.0
  • Loading branch information
skydoves committed Aug 26, 2023
2 parents b694888 + 31445ad commit 092340c
Show file tree
Hide file tree
Showing 53 changed files with 325 additions and 235 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@v3.5.1
with:
distribution: adopt
java-version: 11
java-version: 17
- name: spotless
run: ./gradlew spotlessCheck

Expand All @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v3.5.1
with:
distribution: adopt
java-version: 11
java-version: 17
- name: API check
run: ./gradlew apiCheck

Expand All @@ -44,7 +44,7 @@ jobs:
uses: actions/setup-java@v3.5.1
with:
distribution: adopt
java-version: 11
java-version: 17

- name: Cache Gradle and wrapper
uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/baseline-profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17

# Sets gradle up
- name: Setup Gradle
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3.1.0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3.5.1
with:
distribution: adopt
java-version: 11
java-version: 17
- name: Release build
run: ./gradlew assemble --scan
- name: Source jar and dokka
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v3.1.0
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3.5.1
with:
distribution: adopt
java-version: 11
java-version: 17
- name: Release build
run: ./gradlew assemble --scan
- name: Source jar and dokka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object BalloonUtils {
fun getNavigationBalloon(
context: Context,
onBalloonClickListener: OnBalloonClickListener,
lifecycleOwner: LifecycleOwner
lifecycleOwner: LifecycleOwner,
): Balloon {
return Balloon.Builder(context)
.setText("You can access your profile from on now.")
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/kotlin/com/skydoves/balloondemo/ComposeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class ComposeActivity : ComponentActivity() {
setOverlayShape(
BalloonOverlayRoundRect(
R.dimen.editBalloonOverlayRadius,
R.dimen.editBalloonOverlayRadius
)
R.dimen.editBalloonOverlayRadius,
),
)
setDismissWhenClicked(true)
}
Expand All @@ -82,13 +82,13 @@ class ComposeActivity : ComponentActivity() {
Text(
text = "Now you can edit your profile1 profile2 profile3 profile4",
textAlign = TextAlign.Center,
color = Color.White
color = Color.White,
)
}
},
) { balloonWindow ->
Button(
modifier = Modifier.size(160.dp, 60.dp),
onClick = { balloonWindow.showAlignTop() }
onClick = { balloonWindow.showAlignTop() },
) {
Text(text = "showAlignTop")
}
Expand All @@ -103,13 +103,13 @@ class ComposeActivity : ComponentActivity() {
Text(
text = "Now you can edit your profile!",
textAlign = TextAlign.Center,
color = Color.White
color = Color.White,
)
}
},
) { balloonWindow ->
Button(
modifier = Modifier.size(160.dp, 60.dp),
onClick = { balloonWindow.showAlignTop() }
onClick = { balloonWindow.showAlignTop() },
) {
Text(text = "wrap balloon")
}
Expand All @@ -126,27 +126,27 @@ class ComposeActivity : ComponentActivity() {
modifier = Modifier
.size(50.dp)
.align(Alignment.CenterStart)
.background(Color.Blue)
.background(Color.Blue),
)
Box(
modifier = Modifier
.size(50.dp)
.align(Alignment.Center)
.background(Color.Blue)
.background(Color.Blue),
)
Box(
modifier = Modifier
.size(50.dp)
.border(2.dp, Color.Red)
.align(Alignment.CenterEnd)
.background(Color.Blue)
.background(Color.Blue),
)
}
}
},
) { balloonWindow ->
Button(
modifier = Modifier.size(160.dp, 60.dp),
onClick = { balloonWindow.showAlignBottom() }
onClick = { balloonWindow.showAlignBottom() },
) {
Text(text = "alignments")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CustomActivity : AppCompatActivity(), CustomAdapter.CustomViewHolder.Deleg
editBalloon.showAlign(
align = BalloonAlign.BOTTOM,
mainAnchor = circleImageView,
subAnchorList = listOf(it)
subAnchorList = listOf(it),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class EditBalloonFactory : Balloon.Factory() {
.setOverlayShape(
BalloonOverlayRoundRect(
R.dimen.editBalloonOverlayRadius,
R.dimen.editBalloonOverlayRadius
)
R.dimen.editBalloonOverlayRadius,
),
)
.setLifecycleOwner(lifecycle)
.setDismissWhenClicked(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.skydoves.balloondemo.databinding.ItemCustomBinding

class CustomAdapter(
private val delegate: CustomViewHolder.Delegate
private val delegate: CustomViewHolder.Delegate,
) : RecyclerView.Adapter<CustomAdapter.CustomViewHolder>() {

private val customItems = mutableListOf<CustomItem>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ import android.graphics.drawable.Drawable

data class CustomItem(
val icon: Drawable?,
val title: String
val title: String,
)
20 changes: 10 additions & 10 deletions app/src/main/kotlin/com/skydoves/balloondemo/recycler/ItemUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,36 @@ object ItemUtils {
SampleItem(
drawable(context, R.drawable.sample0),
"Vincent",
"It is such a mysterious place, the land of tears."
)
"It is such a mysterious place, the land of tears.",
),
)
samples.add(
SampleItem(
drawable(context, R.drawable.sample1),
"Vermeer",
"Be clearly aware of the stars and infinity on high."
)
"Be clearly aware of the stars and infinity on high.",
),
)
samples.add(
SampleItem(
drawable(context, R.drawable.sample2),
"Mia Vance",
"The most beautiful things in the world cannot be seen or touched."
)
"The most beautiful things in the world cannot be seen or touched.",
),
)
samples.add(
SampleItem(
drawable(context, R.drawable.sample3),
"Monet",
"And now here is my secret, a very simple secret."
)
"And now here is my secret, a very simple secret.",
),
)
samples.add(
SampleItem(
drawable(context, R.drawable.sample4),
"Picasso",
"Everything you can imagine is real."
)
"Everything you can imagine is real.",
),
)
}
return samples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ import android.graphics.drawable.Drawable
data class SampleItem(
val image: Drawable?,
val name: String,
val content: String
val content: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public fun Balloon(
builder: Balloon.Builder,
key: Any? = null,
balloonContent: (@Composable () -> Unit)? = null,
content: @Composable (BalloonWindow) -> Unit
content: @Composable (BalloonWindow) -> Unit,
) {
val context = LocalContext.current
val view = LocalView.current
Expand All @@ -87,12 +87,12 @@ public fun Balloon(
anchorView = anchorView,
isComposableContent = isComposableContent,
builder = builder,
balloonID = id
balloonID = id,
).apply {
if (isComposableContent) {
setContent(compositionContext) {
BalloonLayout(
modifier = Modifier.semantics { balloon() }
modifier = Modifier.semantics { balloon() },
) {
currentContent?.invoke()
}
Expand Down Expand Up @@ -125,16 +125,16 @@ public fun Balloon(
}
val size = IntSize(
width = calculatedWidth,
height = coordinates.size.height
height = coordinates.size.height,
)
balloonComposeView.updateSizeOfBalloonCard(size)
balloonComposeView.balloonLayoutInfo.value = BalloonLayoutInfo(
x = coordinates.positionInWindow().x,
y = coordinates.positionInWindow().y,
width = size.width,
height = size.height
height = size.height,
)
}
},
) {
balloonContent?.invoke()
}
Expand All @@ -146,11 +146,11 @@ public fun Balloon(
width = it.width
height = it.height
}
}
},
) {
AndroidView(
modifier = Modifier.matchParentSize(),
factory = { anchorView }
factory = { anchorView },
)

content.invoke(balloonComposeView)
Expand All @@ -173,11 +173,11 @@ public fun Balloon(
@Composable
private fun BalloonLayout(
modifier: Modifier = Modifier,
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
Layout(
content = content,
modifier = modifier
modifier = modifier,
) { measurables, constraints ->
val contentConstraints = constraints.copy(minWidth = 0, minHeight = 0)
val placeables = measurables.map { it.measure(contentConstraints) }
Expand Down
Loading

0 comments on commit 092340c

Please sign in to comment.