-
Notifications
You must be signed in to change notification settings - Fork 20
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
15 changed files
with
147 additions
and
74 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
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/pluu/webtoon/ui/CreateSerializableType.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,12 @@ | ||
package com.pluu.webtoon.ui | ||
|
||
import androidx.navigation.NavType | ||
|
||
class SerializableType<T : java.io.Serializable>( | ||
type: Class<T>, | ||
private val parser: (String) -> T | ||
) : NavType.SerializableType<T>(type) { | ||
override fun parseValue(value: String): T { | ||
return parser(value) | ||
} | ||
} |
34 changes: 0 additions & 34 deletions
34
app/src/main/java/com/pluu/webtoon/utils/NavHostController.kt
This file was deleted.
Oops, something went wrong.
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
5 changes: 5 additions & 0 deletions
5
features/ui-common/src/main/java/com/pluu/webtoon/ui/compose/Color.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,5 @@ | ||
package com.pluu.webtoon.ui.compose | ||
|
||
import androidx.compose.ui.graphics.Color | ||
|
||
fun Color.toLong() = value.toLong() |
22 changes: 16 additions & 6 deletions
22
features/ui-common/src/main/java/com/pluu/webtoon/ui/model/PalletColor.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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
package com.pluu.webtoon.ui.model | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import com.pluu.webtoon.model.utils.parseNavigationValue | ||
import com.pluu.webtoon.model.utils.toNavigationValue | ||
import java.io.Serializable | ||
|
||
@kotlinx.serialization.Serializable | ||
data class PalletColor( | ||
val darkVibrantColor: Color, | ||
val darkMutedColor: Color, | ||
val lightVibrantColor: Color, | ||
val lightMutedColor: Color, | ||
) : Serializable | ||
val darkVibrantColor: Long, | ||
val darkMutedColor: Long, | ||
val lightVibrantColor: Long, | ||
val lightMutedColor: Long, | ||
) : Serializable { | ||
companion object { | ||
fun toNavigationValue(value: PalletColor): String = | ||
value.toNavigationValue() | ||
|
||
fun parseNavigationValue(value: String): PalletColor = | ||
value.parseNavigationValue() | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
plugins { | ||
id("pluu.java.library") | ||
kotlin("plugin.serialization") | ||
} | ||
|
||
dependencies { | ||
implementation(libs.kotlin.serialization) | ||
} |
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
11 changes: 11 additions & 0 deletions
11
model/src/main/java/com/pluu/webtoon/model/utils/Navigation.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,11 @@ | ||
package com.pluu.webtoon.model.utils | ||
|
||
import kotlinx.serialization.encodeToString | ||
import kotlinx.serialization.json.Json | ||
import java.net.URLEncoder | ||
|
||
inline fun <reified T> T.toNavigationValue(): String = | ||
URLEncoder.encode(Json.encodeToString(this), "UTF-8") | ||
|
||
inline fun <reified T> String.parseNavigationValue(): T = | ||
Json.decodeFromString(this) |
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
Oops, something went wrong.