![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
com.github.terrakok:cicerone
Advanced tools
Cicerone is a lightweight library that makes the navigation in an Android app easy.
![]() |
![]() |
![]() |
Power navigation | Multibackstack | Result listeners |
Cicerone (means - a guide, one who conducts sightseers) is a lightweight library that makes the navigation in an Android app easy.
It was designed to be used with the MVP/MVVM/MVI patterns but will work great with any architecture.
FragmentFactory
if it neededadd
or replace
strategy for opening next screen (see router.navigateTo
last parameter)Add the dependency in your build.gradle:
dependencies {
//Cicerone
implementation("com.github.terrakok:cicerone:X.X.X")
}
Initialize the library (for example in your Application class):
class App : Application() {
private val cicerone = Cicerone.create()
val router get() = cicerone.router
val navigatorHolder get() = cicerone.getNavigatorHolder()
override fun onCreate() {
super.onCreate()
INSTANCE = this
}
companion object {
internal lateinit var INSTANCE: App
private set
}
}
Presenter calls navigation method of Router.
class SamplePresenter(
private val router: Router
) : Presenter<SampleView>() {
fun onOpenNewScreen() {
router.navigateTo(SomeScreen())
}
fun onBackPressed() {
router.exit()
}
}
Router converts the navigation call to the set of Commands and sends them to CommandBuffer.
CommandBuffer checks whether there are "active" Navigator:
fun executeCommands(commands: Array<out Command>) {
navigator?.applyCommands(commands) ?: pendingCommands.add(commands)
}
Navigator processes the navigation commands. Usually it is an anonymous class inside the Activity. Activity provides Navigator to the CommandBuffer in onResume and removes it in onPause.
Attention: Use onResumeFragments() with FragmentActivity (more info)
private val navigator = AppNavigator(this, R.id.container)
override fun onResumeFragments() {
super.onResumeFragments()
navigatorHolder.setNavigator(navigator)
}
override fun onPause() {
navigatorHolder.removeNavigator()
super.onPause()
}
This commands set will fulfill the needs of the most applications. But if you need something special - just add it!
The library provides predefined navigator for Fragments and Activity. To use, just provide it with the container and FragmentManager.
private val navigator = AppNavigator(this, R.id.container)
Custom navigator can be useful sometimes:
private val navigator = object : AppNavigator(this, R.id.container) {
override fun setupFragmentTransaction(
screen: FragmentScreen,
fragmentTransaction: FragmentTransaction,
currentFragment: Fragment?,
nextFragment: Fragment
) {
//setup your animation
}
override fun applyCommands(commands: Array<out Command>) {
hideKeyboard()
super.applyCommands(commands)
}
}
Describe your screens as you like e.g. create Kotlin object
with all application screens:
object Screens {
fun Main() = FragmentScreen { MainFragment() }
fun AddressSearch() = FragmentScreen { AddressSearchFragment() }
fun Profile(userId: Long) = FragmentScreen("Profile_$userId") { ProfileFragment(userId) }
fun Browser(url: String) = ActivityScreen { Intent(Intent.ACTION_VIEW, Uri.parse(url)) }
}
Additional you can use FragmentFactory
for creating your screens:
fun SomeScreen() = FragmentScreen { factory: FragmentFactory -> ... }
//you have to specify screen parameters via new FragmentScreen creation
fun SelectPhoto(resultKey: String) = FragmentScreen {
SelectPhotoFragment.getNewInstance(resultKey)
}
//listen result
fun onSelectPhotoClicked() {
router.setResultListener(RESULT_KEY) { data ->
view.showPhoto(data as Bitmap)
}
router.navigateTo(SelectPhoto(RESULT_KEY))
}
//send result
fun onPhotoClick(photo: Bitmap) {
router.sendResult(resultKey, photoRes)
router.exit()
}
To see how to add, initialize and use the library and predefined navigators see sample project
(thank you @Javernaut for support new library version and migrate sample project to Kotlin!)
For more complex use case check out the GitFox (Android GitLab client)
Яндекс.Еда — доставка еды/продуктов. Food delivery
Whisk: Recipe Saver, Meal Planner & Grocery List
Мой Beeline (Казахстан)
Mercuryo Bitcoin Cryptowallet
ЧекСкан - кэшбэк за чеки, цены и акции в магазинах
RSS Reader для Вести.Ru
EPAM Connect
Consumer Reports: Product Reviews & Ratings
Zakaz.ru
MIT License
Copyright (c) 2017 Konstantin Tskhovrebov (@terrakok)
and Vasili Chyrvon (@Jeevuz)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
FAQs
Unknown package
We found that com.github.terrakok:cicerone demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.