[TIMOB-27077] Android: Rewrite Ti.UI.TableView to use RecyclerView
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-03-12T18:49:50.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.3.0 |
Components | Android |
Labels | TableView, android |
Reporter | Joshua Quick |
Assignee | Gary Mathews |
Created | 2019-05-13T17:50:20.000+0000 |
Updated | 2021-03-12T18:49:54.000+0000 |
Description
*Summary:*
Titanium's [Ti.UI.TableView](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView) is currently implemented on Android via the Java [ListView](https://developer.android.com/reference/android/widget/ListView) class. We should re-implement Titanium's
TableView
to use Android's [RecyclerView](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html) instead.
*Reason:*
Google's RecyclerView
offers the following features we would like to add for parity with iOS:
* "Swipe Actions" for rows.
* Drag-and-drop rows.
The above can be done via Google's [ItemTouchHelper](https://developer.android.com/reference/android/support/v7/widget/helper/ItemTouchHelper) Java class in combination with their RecyclerView
.
*Note 1:*
In Android Studio's UI designer, Google's ListView
is listed under the "Legacy" widgets tab. Google isn't deprecating ListView
, but they're clearly favoring RecyclerView
over it.
*Note 2:*
In the future, we should rewrite Titanium's Ti.UI.ListView
to use Google's RecyclerView
as well, but it's better to test-the-waters with the much simpler Ti.UI.TableView
first.
Attachments
File | Date | Size |
---|---|---|
testCases.js | 2021-03-12T18:49:43.000+0000 | 46820 |
+ 1000 for this. Draggable cells are the only Android limitation that bothers us right now.
Oh please yes
IMHO this is a must-have for Android. Ti ListView for iOS has editing & sorting features, but the lack of this feature on Android is a big parity gap. There's a good Android native library https://github.com/woxblom/DragListView that could help. Of course, without loosing Collections binding.
We developed this internally (actually based on DragListView). No collection binding (obviously), but it works quite performant and allows drag and drop for cells. It will probably be available in the marketplace later this month.
Do you need testing? I was about to start a module for this, but if you've got some progress on your side, I'll wait for it.
Quick question before more work goes into this: Should really the Ti.UI.TableView use RecyclerView and not the Ti.UI.ListView? The ListView API is already well abstracted and performant, which is a good start for RecyclerView. Also, everyone uses ListView on iOS already as it's significantly more performant than the TableView. I' m excited to see the progress!
100% agree with Hans. We use TableView almost nothing, not for saying absolutely nothing. ListView would be a better candidate to work with.
[~hknoechel] We're starting with TableView as it's easier to transition over to using RecyclerView; from there we will transition ListView over, which is a little more complicated due to templating etc..
master: https://github.com/appcelerator/titanium_mobile/pull/11556