Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timob-12176: fix list view issues #3972

Merged
merged 8 commits into from Mar 20, 2013
Merged

Conversation

hieupham007
Copy link
Contributor

Fixes include:
-showVerticalIndicator should work properly when toggle on/off
-correct sectionIndex, itemIndex values
-events won't bubble past listItem (iOS parity)
-allow defaultItemTemplate to change
-implement updateItemAt. This behaves same as replaceItemsAt. This implementation is for parity with iOS.
-replaceItemsAt no longer append when trying to replace an item with index = items.size()
-'items' is now a property in section, with read/write capabilities.
-fix layout glitches for built-in template
-'wordWrap' property in label is now true by default.

Update:
-itemclick event should now fire appropriately when a child view is clicked
-added icon for disclosure image
-fixed deleteItemsAt bug in KS Listview test

@pingwang2011
Copy link
Contributor

The replaceSectionAt() method also has different behavior with iOS.

case MSG_UPDATE_ITEM_AT: {
AsyncResult result = (AsyncResult) msg.obj;
KrollDict data = (KrollDict) result.getArg();
int index = data.getInt("index");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use TiC constant.

@pingwang2011
Copy link
Contributor

Text is still not wrapped. BTW, Ti.UI.Label dose not enable wordWrap by default now. But from the doc, wordWrap should be true by default.

@pingwang2011
Copy link
Contributor

replaceItemsAt() still has different behavior with iOS.

@pingwang2011
Copy link
Contributor

Here is the results of the first pass of the KS->List View test https://docs.google.com/spreadsheet/ccc?key=0Ai_iBzK2t1G0dElUQzJ0UW1mSHpsSEFpMkJmVW5DTVE&usp=sharing
The wordWrap issue for labels is a regression. Please fix that first.
The List View test is in this PR appcelerator-developer-relations/KitchenSink#92

@pingwang2011
Copy link
Contributor

BTW, please merge with master since rhino has been already removed.

if (source != null && !source.equals(this) && listProxy != null) {
TiViewProxy listViewProxy = listProxy.get();
if (listViewProxy != null) {
listViewProxy.fireEvent(TiC.EVENT_ITEM_CLICK, eventData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The itemclick event should be fired from native android ListView through OnItemClickListener. We don't need to manually fire this event from every child item. If the OnItemClickListener does not work as expect, this means we miss something important in the native android part. This missing does not only affect the itemclick event but also affects all the background selected color / highlight color which should be handled by the native android ListView. We have to fix this from the root; otherwise, our listview won't work correctly.

@pingwang2011
Copy link
Contributor

When clicking on the row (not a child view), the app crashes. The crash log is
E/AndroidRuntime(12722): FATAL EXCEPTION: main
E/AndroidRuntime(12722): java.util.ConcurrentModificationException
E/AndroidRuntime(12722): at java.util.HashMap$HashIterator.nextEntry(HashMap.java:792)
E/AndroidRuntime(12722): at java.util.HashMap$EntryIterator.next(HashMap.java:829)
E/AndroidRuntime(12722): at java.util.HashMap$EntryIterator.next(HashMap.java:827)
E/AndroidRuntime(12722): at java.util.HashMap.constructorPutAll(HashMap.java:205)
E/AndroidRuntime(12722): at java.util.HashMap.(HashMap.java:196)
E/AndroidRuntime(12722): at org.appcelerator.kroll.KrollDict.(KrollDict.java:79)
E/AndroidRuntime(12722): at ti.modules.titanium.ui.widget.listview.ListItemProxy.fireItemClick(ListItemProxy.java:56)
E/AndroidRuntime(12722): at ti.modules.titanium.ui.widget.listview.ListItemProxy.access$0(ListItemProxy.java:54)
E/AndroidRuntime(12722): at ti.modules.titanium.ui.widget.listview.ListItemProxy$1.run(ListItemProxy.java:48)
E/AndroidRuntime(12722): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime(12722): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(12722): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(12722): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(12722): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12722): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(12722): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(12722): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(12722): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 202): Force finishing activity com.android/.TestprojectActivity

@pingwang2011
Copy link
Contributor

The itemclick event does not work if clicking on the row itself (not on a label or an image).

@pingwang2011
Copy link
Contributor

Code reviewed and functionally tested. Here is the result of KS->List View test https://docs.google.com/spreadsheet/ccc?key=0Ai_iBzK2t1G0dElUQzJ0UW1mSHpsSEFpMkJmVW5DTVE&usp=sharing
Accepted

pingwang2011 added a commit that referenced this pull request Mar 20, 2013
timob-12176: fix list view issues
@pingwang2011 pingwang2011 merged commit 6a42dd6 into tidev:master Mar 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants