Comments (6)
ok, I worked around my issue by creating a snapshot onPause within my fragment. Sorry to spam with unrelated stuff and thanks for your response.
from android-extensions.
Hi @wman1980, thanks for checking out the library. MainActivity
has an example of this using an extension:
navigator.stackTransactionModifier = navigator.materialFadeThroughTransition()
The full implementation is:
fun MultiStackNavigator.materialFadeThroughTransition(): FragmentTransaction.(Int) -> Unit = fade@{ index ->
val rootFragmentManager = current?.activity?.supportFragmentManager ?: return@fade
rootFragmentManager.findFragmentByTag(activeIndex.toString())?.apply {
enterTransition = null
if (exitTransition !is MaterialFadeThrough) exitTransition = MaterialFadeThrough().setDuration(300)
}
rootFragmentManager.findFragmentByTag(index.toString())?.apply {
exitTransition = null
if (enterTransition !is MaterialFadeThrough) enterTransition = MaterialFadeThrough().setDuration(300)
}
}
from android-extensions.
ahh, that is awesome!
I just forgot about the supportFragmentManager and the index.
Thanks a lot!
from android-extensions.
Hi @tunjid,
I have a follow up question.
If I add some Transition.TransitionListener to that code above to listen to start and end events for each transition. Do you have an idea how I could pass these events to my active and target fragment?
Currently the fragment returned by findFragmentByTag is a StackFragment and it does not offer a lot to me because everything is internal ...
I first though I could just add this listener within my active/target fragment, but there the transition is null. So is there actually a way to get these transitions from my active/target fragment?
Thanks
from android-extensions.
@wman1980 MultistackNavigator.current
and MultistackNavigator.previous
should give you you a reference to your Fragment
in your Transtion.Listener
. Do you have a snippet of what you're trying to achieve with the listener?
from android-extensions.
Actually I have a WebView within android and the webview "flickers/blinks" if a transition (MaterialSharedAxis.X) is started. My plan to prevent that was to create a bitmap snapshot and put that snapshot in front of the webview on transition start and remove that snapshot on transition end. But unfortunately I just discovered that onDestroyView of my fragment is called before onTransitionStart e.g. during a returnTransition. Damn android!
from android-extensions.
Related Issues (13)
- Wrong order of selected tabs during back press? HOT 7
- StackNavigator shared element transition between activities HOT 3
- Minimal steps needed to implement speed dial HOT 1
- version 1.2.1 no definition for MultiStackNaviagor HOT 2
- Is this a property delegation in the declaration of the multiStackNavigator? HOT 2
- BackStackType Unlimited/Restricted in version 1.2.1 not working correctly HOT 4
- Example of Instagram-Like Navigation HOT 6
- Bug: bad transformation on list when going back to it HOT 6
- How to integrate Material Search Bar with RecyclerView? HOT 2
- How to add multiple viewholders in recyclerview? HOT 4
- Can't perform this action after onSaveInstanceState HOT 5
- Kotlin-gradle-publin declared twice with different versions HOT 1
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 android-extensions.