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?
Related
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.
I need help finding an approach to build a certain kind of menu for an app.
Let's say I have a menu activity and 2 other activities. My menu activity consists of 2 options.
I want to drag the "buttons" (not sure if button is the correct name in this case) sideways and while dragging, the other activity's screen starts appearing from the side.
The thing is, depending on which button I'm dragging, different screens should appear, and I couldn't find anything similar to read about.
Does anybody recommend some topic to read that could help?
How can I manage the activities in this case?
I implemented a SlidingDrawer in my app and everything works fine so far.
Then I made an invisible handle, just like the one in the Android main window.
Now I want, that it is possible to grab the handle (and make it visible) just by moving the finger over the handle. I mean the same behaviour like the one in the Android main window.
But i donĀ“t know how to mange that.
(At the moment it only works when you tap at the handle, and not if you tap somewhere else and move the finger above the handle)
Sounds like a bad idea. There will be no way to distinquish between the system's drawer and your app's drawer.
You want to detect a swipe motion that starts on the top bezel.
You want to use MotionEvent's getEdgeFlags() to detect whether a swipe gesture starts on the bezel.
I'm implementing a not-so-standard navigational menu that is accessible from every screen in my app. That is to say, from every screen in my app, I can pop up a menu that will let me choose an entirely different area of the app to navigate directly to.
I have several screens that I call edit screens. They are screens where the user had chosen an item from a list of items and are able to then edit the data for that item. I do not wish for these screens to remain on the Activity stack if the user then uses the menu to navigate to some other area of the app.
This is easy enough. I can simply call "finish()" before navigating away. However, there are a couple places where it is possible to access a nested edit screen. Meaning the edit screen the user is currently on is a child of a parent edit screen. I want both off the Activity stack.
Can anyone think of a slick way to do this? The only way I can think of is to always use startActivityForResult and pass back some identifier that tells the screen to kill itself the next time it resumes.
The Android app Thrutu puts a drawer on top of the in call screen which has several functions and only takes up a fraction of the screen. The call control buttons below still are fully functional. Even a transparent activity would not allow this behaviour. Any idea on how to implement this?
The trick to making the underlying buttons work is to implement the UI using a Service rather than an Activity, make the Window you add (using WindowManager.addView) one of the higher-priority types (e.g. TYPE_PHONE), then use FLAG_NOT_TOUCH_MODAL.
I think you need android.permission.SYSTEM_ALERT_WINDOW.
Take a look at How to display a fullscreen TYPE_SYSTEM_ALERT window? and in particular Creating a system overlay where the home buttons still work?