[TIMOB-25556] Android: Extend drawerLockMode to set Gravity
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-11-23T21:25:23.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.3.0 |
Components | Android |
Labels | drawerlayout |
Reporter | Michael Gangolf |
Assignee | Gary Mathews |
Created | 2017-11-17T15:15:56.000+0000 |
Updated | 2020-11-23T21:25:23.000+0000 |
Description
*Description*
The current DrawerLayout.drawerLockMode supports only:
* LOCK_MODE_LOCKED_CLOSED
* LOCK_MODE_LOCKED_OPEN
* LOCK_MODE_UNDEFINED
* LOCK_MODE_UNLOCKED
for both views (left/right) at the same time.
Extending it so it will you the second parameter "Gravity":
https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html#setDrawerLockMode(int,%20int)
would allow users to set the lock mode individually for each view.
*Proposal:*
Changing the int parameter to a dictionary of:
* drawerLockMode : Number (see above)
* drawerGravity: Number (LEFT, RIGHT)
*Source code*
[Property at Github](https://github.com/appcelerator/titanium_mobile/blob/111153d8600857e6d2e752cdef60dc217dbc15a9/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIDrawerLayout.java#L411)
would be a place to start
I will try to make a PR with the parameters as described in the propsal
PR: https://github.com/appcelerator/titanium_mobile/pull/9627 *Example*
A question about the documentation parameters. It is still possible to use the set() method the old way with an integer instead of a hashmap like this * Both views / current way:
drawer.setDrawerLockMode(Titanium.UI.Android.DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
* Custom side:How to write this in the documentation?
Hello, Thanks for the ticket and the PR. I will forward this to our engineering team to move forward. Thanks.
[~amukherjee] This missed the 8.1.0 timeframe and is an enhancement, not a bug fix. Given that 8.2.0 is iOS 13, this probably should be changed to fix version 8.3.0.
master: https://github.com/appcelerator/titanium_mobile/pull/10970
Hi. bq. master: https://github.com/appcelerator/titanium_mobile/pull/10970 I think this a bad API, it is neither like other Titanium nor like Android: - Ti-developers know nothing about "gravity", drawers are set with "
leftView
" and "rightView
" properties. - Using a "gravity" property on DrawerLayout itself to setup lock mode can be confusing to Android developers. In the original [Ti.Drawer](https://github.com/manumaticx/Ti.DrawerLayout) module I made similar [API change](https://github.com/manumaticx/Ti.DrawerLayout/commit/deed60f8bedd1628e6bd779db2ded5bf52c5e2e9) over two years ago. Only a couple of new properties.https://github.com/appcelerator/titanium_mobile/pull/11271
FR Passed. The individual drawer lock mode defined using leftDrawerLockMode and rightDrawerLockMode working fine. _Note: The lock mode defined on an individual view (using leftDrawerLockMode or rightDrawerLockMode property) would prevail over the defined general lock mode (using drawerLockMode)._
Waiting on Jenkins build
merged to master for 9.3.0 target
Verified on: Mac OS: 10.15.4 SDK: 9.3.0.v20201123121926 Appc CLI: 8.1.1 JDK: 11.0.6 Node: 12.16.1 Studio: 6.0.0.202005141803 Device: Pixel 3 XL(v11.0) emulator