Skip to content

Instantly share code, notes, and snippets.

Safe & Easy Navigation with Jetpack Compose

Navigation is the key part in application development and Android is no exception. From Activities and Fragments transitions to Navigation Component and now, Navigation Component is available for Jetpack Compose! In this article I would like to give a brief overview of how Jetpack Compose Navigation works, the problems I've faced and my solution for it. Lets get started 🙂

Your First Route

When using original Navigation Component we used XML to describe our navigation. There we could declare the arguments for our destination and transitions between them. In Compose world its, of course, we use functions :)

package com.levinzonr.ezpad.security.auth
import com.levinzonr.ezpad.security.resource.ResourceServerSettings
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Configuration
import org.springframework.security.authentication.AuthenticationManager
import org.springframework.security.crypto.password.PasswordEncoder
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer
package com.levinzonr.ezpad.security.resource
import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpMethod
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer
@SpringBootApplication
class Application {
@Bean
fun provideTokenStore() : TokenStore {
return InMemoryTokenStore()
}
@Bean