[TIMOB-24582] Android: Navigation parity for a cross-platform Ti.UI.NavigationWindow
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Done |
Resolution Date | 2019-01-11T02:17:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.0.0 |
Components | Android |
Labels | NavigationWindow, android, parity |
Reporter | Hans Knöchel |
Assignee | Gary Mathews |
Created | 2017-04-16T18:32:58.000+0000 |
Updated | 2019-01-11T02:17:32.000+0000 |
Description
On iOS, we have the
Ti.UI.iOS.NavigationWindow
to handle a stack of windows that can be opened and closed. Unfortunately, on Android and Windows, we have to do that manually and it required the (Alloy) developer to either write custom (per platform) logic or use plugins like [xp.ui](https://github.com/FokkeZB/UTiL/blob/master/app/lib/xp.ui.js).
Proposed API-changes:
* iOS: Deprecate Ti.UI.iOS.NavigationWindow
in favor of Ti.UI.NavigationWindow
* Android / Windows: Support NavigationWindow, add the native [back button](https://developer.android.com/training/implementing-navigation/temporal.html)
* Android / Windows: Expose the openWindow
, closeWindow
and popToRootWindow
if possible
* Adjust Alloy to make the <NavigationWindow>
tag available for all platforms
Attachments
File | Date | Size |
---|---|---|
nav-bar-example.png | 2018-09-18T18:22:10.000+0000 | 17661 |
Untitled-2.png | 2018-09-18T18:21:33.000+0000 | 17661 |
Cloned to TIMOB-25537 for Windows so we can track the ticket independently.
Pushed mocha testbed for
Ti.UI.NavigationWindow
that is meant to be cross-platform. https://github.com/appcelerator/titanium-mobile-mocha-suite/pull/31. Just implemented few basic navigation tests and we can start from there.Just my two cents on this topic since my mic seemed to be broken during our recent discussion. We should also think of this as a common abstraction of the Android ActionBar and the iOS NavigationWindow (and whatever it is called on Windows^^). So apart from handling the window stack and navigation, this should also include setting bar items. Ideally it would rely on
leftNavButtons
andrightNavButtons
on iOS andTi.Android.Menu
on Android exposed as a unified API. I have something like this in mind for configuring the ActionBar/UINavigationBar:or programmatically configurable via a
navigationBar
property onTi.UI.Window
for example. This would result in: !nav-bar-example.png|thumbnail! For the general navigation functionality in our apps we could build upon [titanium-navigator](https://github.com/appcelerator/titanium-navigator), which exposes a set of APIs for navigation through an app. It's currently tailored to handle components from Angular and Vue. Behind the scenes it inspects the root view of that component and handles navigation accordingly so it should be easy to make it work for Alloy or Classic apps too. Some pseudo code demonstrating the usage:Internally
titanium-navigator
has a set of rules so it knows how to handle navigation. See [AbstractNavigator](https://github.com/appcelerator/titanium-navigator/blob/master/src/navigators/AbstractNavigator.ts) and [NavigationManager.open()](https://github.com/appcelerator/titanium-navigator/blob/master/src/NavigationManager.ts#L145) to get a rough idea how it works.master: https://github.com/appcelerator/titanium_mobile/pull/10375
FR passed. Waiting for CR To Merge.
Already FR'd before merge