Comments (4)
Hi!
Take a look at the createActivityIntent(String screenKey, Object data)
.
Here you have your data and this is your responsibility to put it into the Intent you are creating.
from cicerone.
Hi again,
I did not quite understand your recommendation, so I ended up doing the following in my code:
private val navigator: Navigator? by lazy {
object : Navigator {
override fun applyCommand(command: Command) {
if (command is Forward) {
forward(command)
}
}
private fun forward(command: Forward) {
val data = (command.transitionData as Map<*, *>).filter { it.value == true }
when (command.screenKey) {
RssFeedActivity.TAG -> startActivity(Intent(this@SportsListActivity, RssFeedActivity::class.java)
.putExtra("data", data as HashMap))
else -> Log.e("Cicerone", "Unknown screen: " + command.screenKey)
}
}
}
}
And in the receiver 'Activity':
override fun onResume() {
super.onResume()
presenter?.onViewCreated(intent.getSerializableExtra("data")?.let { it as HashMap<*, *> })
}
Although it works, I would like to know whether this is the most appropriate way when using 'Cicerone'. Specifically, I do not like this approach since it requires doing a couple of explicit casts (as HashMap<*, *>, for instance), which I believe it is not a good practice.
Could you please drop me your thoughts?! Thanks and regards.
from cicerone.
Hm. I think you should see the sample and predefined navigators.
Regarding the data passing usually we create the Params class in the Presenter to hold all the data passing to the screen. Then create it when do the navigation, and cast the Object data to Params in the navigator. Then pass it from screen (eg. fragment) to the Presenter.
from cicerone.
If you have no more questions i think we can close this issue.
from cicerone.
Related Issues (20)
- No view found for id HOT 1
- error with Creator ActivityScreen HOT 1
- How to use Cicerone in sigleActivity multimodule app? HOT 3
- `AppNavigator#setupFragmentTransaction` public signature compatibility HOT 5
- Question: How to get nextFragment when moving backward?
- Migration to mavenCentral HOT 2
- AppNavigator applyCommandsSync HOT 5
- Override Router implementation
- Where could I find more info when Cicerone falied to apply command? HOT 3
- Error when quickly changing fragments HOT 1
- I get NullPointerException when I try to set SupportAppNavigator in NavigatorHolder
- Crash in AppNavigator
- Crash in version 7.1 HOT 2
- ConcurrentModificationException
- v5 to v6+ migration guide HOT 2
- Crash in version 7.1 HOT 4
- Activity -> Fragment deeplinking
- Spelling and Grammar issues in Readme
- Remove Jetifier
- Few questions about your library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cicerone.