-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
374 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.skyd.rays.ext | ||
|
||
import androidx.compose.material3.windowsizeclass.WindowSizeClass | ||
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass | ||
|
||
val WindowSizeClass.isCompact: Boolean | ||
get() = widthSizeClass == WindowWidthSizeClass.Compact | ||
|
||
val WindowSizeClass.isMedium: Boolean | ||
get() = widthSizeClass == WindowWidthSizeClass.Medium | ||
|
||
val WindowSizeClass.Expanded: Boolean | ||
get() = widthSizeClass == WindowWidthSizeClass.Expanded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/src/main/java/com/skyd/rays/ui/component/shape/CloverShape.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.skyd.rays.ui.component.shape | ||
|
||
import android.graphics.Matrix | ||
import androidx.compose.ui.geometry.Size | ||
import androidx.compose.ui.graphics.Outline | ||
import androidx.compose.ui.graphics.Path | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.graphics.asAndroidPath | ||
import androidx.compose.ui.graphics.asComposePath | ||
import androidx.compose.ui.unit.Density | ||
import androidx.compose.ui.unit.LayoutDirection | ||
|
||
val CloverShape: Shape = object : Shape { | ||
override fun createOutline( | ||
size: Size, | ||
layoutDirection: LayoutDirection, | ||
density: Density | ||
): Outline { | ||
val baseWidth = 200f | ||
val baseHeight = 200f | ||
|
||
val path = Path().apply { | ||
moveTo(12f, 100f) | ||
cubicTo(12f, 76f, 0f, 77.6142f, 0f, 50f) | ||
cubicTo(0f, 22.3858f, 22.3858f, 0f, 50f, 0f) | ||
cubicTo(77.6142f, 0f, 76f, 12f, 100f, 12f) | ||
cubicTo(124f, 12f, 122.3858f, 0f, 150f, 0f) | ||
cubicTo(177.6142f, 0f, 200f, 22.3858f, 200f, 50f) | ||
cubicTo(200f, 77.6142f, 188f, 76f, 188f, 100f) | ||
cubicTo(188f, 124f, 200f, 122.3858f, 200f, 150f) | ||
cubicTo(200f, 177.6142f, 177.6142f, 200f, 150f, 200f) | ||
cubicTo(122.3858f, 200f, 124f, 188f, 100f, 188f) | ||
cubicTo(76f, 188f, 77.6142f, 200f, 50f, 200f) | ||
cubicTo(22.3858f, 200f, 0f, 177.6142f, 0f, 150f) | ||
cubicTo(0f, 122.3858f, 12f, 124f, 12f, 100f) | ||
close() | ||
} | ||
|
||
return Outline.Generic( | ||
path | ||
.asAndroidPath() | ||
.apply { | ||
transform(Matrix().apply { | ||
setScale(size.width / baseWidth, size.height / baseHeight) | ||
}) | ||
} | ||
.asComposePath() | ||
) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/com/skyd/rays/ui/component/shape/SquircleShape.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.skyd.rays.ui.component.shape | ||
|
||
import android.graphics.Matrix | ||
import androidx.compose.ui.geometry.Size | ||
import androidx.compose.ui.graphics.Outline | ||
import androidx.compose.ui.graphics.Path | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.graphics.asAndroidPath | ||
import androidx.compose.ui.graphics.asComposePath | ||
import androidx.compose.ui.unit.Density | ||
import androidx.compose.ui.unit.LayoutDirection | ||
|
||
val SquircleShape: Shape = object : Shape { | ||
override fun createOutline( | ||
size: Size, | ||
layoutDirection: LayoutDirection, | ||
density: Density | ||
): Outline { | ||
val baseWidth = 1000f | ||
val baseHeight = 1000f | ||
|
||
val path = Path().apply { | ||
moveTo(0f, 500f) | ||
cubicTo(0f, 88.25f, 88.25f, 0f, 500f, 0f) | ||
cubicTo(911.75f, 0f, 1000f, 88.25f, 1000f, 500f) | ||
cubicTo(1000f, 911.75f, 911.75f, 1000f, 500f, 1000f) | ||
cubicTo(88.25f, 1000f, 0f, 911.75f, 0f, 500f) | ||
close() | ||
} | ||
|
||
return Outline.Generic( | ||
path | ||
.asAndroidPath() | ||
.apply { | ||
transform(Matrix().apply { | ||
setScale(size.width / baseWidth, size.height / baseHeight) | ||
}) | ||
} | ||
.asComposePath() | ||
) | ||
} | ||
} |
Oops, something went wrong.