Bottom Navigation with Activity - android

I have an application where it is required to persist the bottom navigation across multiple screen. Now naturally bottom navigation works well with fragments but the problem is that my other fragments also have other screens to call which is usually delegated back to the handling activity.
With said, when i tried implementing the bottom navigation with fragments the activity becomes a God Activity where it handles all fragments.
So my solution was to start an activity instead. But the problem with this approach is that every start of the activity the activity transition makes it obvious an activity is being started. I tried setting off the activity transition to avoid this but now Im left with a very static page which just suddenly changes. I still want my views to animate smoothly between screen changes.
Can someone give me an advice here. Heres what I would want to achieve in summary:
1) make it seem the bottom navigation was not changed/moved (and hopefull still have the shifting animation if possible)
2) animate smoothly between screen changes
3) also still have the capability of having shared element transition if possible.
Please help me here. Thank you so much in advance.

Related

Wear OS swipe-to-dismiss

I'm developing an app for Wear OS.
It has 2 screens, both extending from AppCompatActivity, both havingandroid.support.wear.widget.BoxInsetLayout as the root of their layouts.
From the first one i can navigate to the second one and in the second screen use left-right swipe to navigate back without problems, i didn't need to do anything for this to work.
For the first screen the same left-right swipe is not doing anything, and i can't understand why, as the documentation says:
An activity automatically supports swipe-to-dismiss. Swiping an activity from left to right results in dismissal of the activity, and the app navigates down the back stack.
Witch makes sense after seeing the default behaviour of my 2nd screen.
I've tried to put a SwipeDismissFrameLayout as the root element of that screen, that make the swipe work, but, instead of showing the watch face that is below, it's showing a gray screen and it's also not finishing the activity (unless i explicitly do it implementing the callback)
From what i can understand in the docs this should be working without having to do anything, but for some reason it's not...
Both activities have the same style and same layout root element.
Is there something i'm missing to make this work?

Adding a shared floating action button to two existing activities

I'm working on an app that is already in production, it has multiple activities. The designers now want to add a Floating Action Button which is anchored to the bottom-right of two of our activities (possibly more in future). The FAB needs to remain at the same spot when the two activities transition between each other.
I know I can use shared element transition to achieve this, but the problem is we are using overridePendingTransition() to add a sliding animation when transitioning between the two activities, and that sliding animation gets broken when I use shared element transition as it gets overridden by the scene transition animation.
Has anyone had to do something similar?
To summarise, here are my requirements:
two activitie transition between each other using a sliding animation
a floating action button is in both activities, in the same location
the FAB needs to remain stationary at all times, including during the transition between the two activities
the FAB can but doesn't need to respond to onClick events during transition (this is an acceptable limitation)
I don't care how dirty the implementation is, but I would strongly prefer not to refactor into a single activity because both activities are quite complex as they are
Happy to provide any additional details if it helps. Thanks.
Actually, I don't have similar case to you. I am working on multiple fragments rather than activities.
What you can do is create a base activity which implement the fab button and extend that base activity in the other two activities.
For the respective work of fab button in each activity, you can do that with the help of string in savedInstanceState i.e from Bundle.
Hope it helps!!

MvvmCross-AndroidSupport fragment back navigation is slow

I’m using the MvxCachingFragmentCompatActivity with a single fragment for every screen. During normal navigation the next view/fragment loads within an acceptable time-frame. When I use back navigation to a previous screen it takes much much longer.
While closing a fragment (when navigation back) I’m not doing anything, and still it takes over 2 or 3 seconds. I expected back navigation to be faster than normal navigation because views and viewmodels are already cached. The only thing it needs to do is invoke OnCreate again on the old view, while sometimes my OnCreate is almost empty and even then the delay is also noticeable.
Anyone got the same behaviour with fragments in mvvmcross 4, or has anyone tips how to approach this?

Navigation Drawer switching Activities

I am having this problem when working with Navigation Drawer and Activities instead of Fragments. Everything runs smooth, but when i initialize the Drawer (DrawerHome) I hit an screen which is not neither of my Activities. When I set default to be any of the Activities, the executions runs into loop and never stops. I am just wondering if it is possible to achieve this or I must go and user Fragments and only one Activity.
Thank you in advance for your time and effort.
Really appreciate.

ANDROID: Possible to load an Activity into a SlidingDrawer view?

I'm searching all over but cannot seem to find a answer to this.
I have my main HomeActivity view which contains a SlidingDrawer in the main.xml layout. The sliding drawer works fine. What I'd like to do though is that when the SlidingDrawer is opened, I want to launch a new activity in the sliding drawer view, and when the drawer closes it drops a result.
So in theory I'm looking at launching an activity with the startActivityForResult method and when the SlidingDrawer closes, processing the result? Is this at all possible or am I out to lunch?
I have recently given this some thought and although actually having the activity itself display inside the SlidingDrawer contents is impossible, theoretically you could simulate this buy copying the layout you are going to, and putting that as the contents, then as soon as the sliding drawer is done, go to the new activity. I haven't tried this myself but it might actually look nice. It won't be perfect but I think it could work.
Another way is to merge both those activities into one and use the sliding drawer to show the other layout.
Anybody have any better ideas I'd love to hear them also!

Categories

Resources