This file contains hidden or 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
@Configuration | |
open class ConfigureMessageConverters() : WebMvcConfigurer { | |
override fun extendMessageConverters(converters: MutableList<HttpMessageConverter<*>>) { | |
val converter = KotlinSerializationJsonHttpMessageConverter(JsonParser().json) | |
converters.forEachIndexed { index, httpMessageConverter -> | |
if (httpMessageConverter is KotlinSerializationJsonHttpMessageConverter) { | |
converters[index] = converter | |
return | |
} |
This file contains hidden or 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
val restTemplate = RestTemplate() | |
restTemplate.messageConverters = mutableListOf<HttpMessageConverter<*>>( | |
KotlinSerializationJsonHttpMessageConverter(JsonParser().json) |
This file contains hidden or 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
fun Application.module() { | |
val jsonParser = Json { | |
ignoreUnknownKeys = true | |
isLenient = true | |
} | |
install(ContentNegotiation) { | |
json(jsonParser) | |
} |
This file contains hidden or 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
fun Application.module() { | |
val jsonParser = Json { | |
ignoreUnknownKeys = true | |
isLenient = true | |
} | |
install(ContentNegotiation) { | |
json(jsonParser) | |
} | |
val client = HttpClient(Apache) { |
This file contains hidden or 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
val greetingModule = module(createdAtStart = true) { | |
single<GreetingService> { GreetingServiceImpl(get()) } | |
single<IpAddressService> { IpAddressServiceImpl(get()) } | |
} |
This file contains hidden or 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
fun Route.postGreeting() { | |
val greetingService by inject<GreetingService>() | |
post("/greeting") { | |
val greetingRequest = call.receive<GreetingRequest>() | |
call.respond(greetingService.greeting(greetingRequest)) | |
} | |
} |
This file contains hidden or 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
composable( | |
// Route information | |
route = WearScreen.DETAILS.name + "/{trackNumber}", | |
arguments = listOf(navArgument("trackNumber") { type = NavType.StringType }) | |
) { backStackEntry -> | |
val trackNumber = backStackEntry.arguments?.getString("trackNumber") ?: "" | |
// Retrieve View model | |
val trackDetailsViewModel = viewModel<TrackDetailsViewModel>() |
This file contains hidden or 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
WearAppTheme { | |
Scaffold( | |
timeText = { | |
if (displayTime(currentScreen, scalingLazyListState)) { | |
TimeText() | |
} | |
}, | |
vignette = { | |
Vignette(vignettePosition = VignettePosition.TopAndBottom) | |
}, |
This file contains hidden or 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
sealed class DebugScreen(val route: String, val title: Int, val topLevelDestination: Boolean = false) { | |
object Environment : DebugScreen(DebugNavigationItem.Environment.route, R.string.environment_screen_title, true) | |
} | |
Scaffold( | |
scaffoldState = scaffoldState, | |
topBar = { DebugTopBar(navController, version) }, | |
bottomBar = { DebugBottomNavigationBar(navController) } | |
) { paddingValues -> | |
DebugNavHost(navController = navController, paddingValues, showSnackBar) |
This file contains hidden or 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
@OptIn(ExperimentalAnimationGraphicsApi::class) | |
@Composable | |
fun APTextField( | |
modifier: Modifier = Modifier, | |
value: String? = null, | |
onValueChange: (String) -> Unit, | |
onEndIconClicked: () -> Unit = { }, | |
label: String? = null, | |
mode: APTextFieldType = APTextFieldType.Normal | |
) { |