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-7673] "replaceAt", "insertAt", and "getAt" view-like UI components #5109
Conversation
@@ -556,6 +566,106 @@ public void add(TiViewProxy child) | |||
//TODO zOrder | |||
} | |||
|
|||
@SuppressWarnings("unchecked") | |||
@Kroll.method | |||
public void replaceAt(Object params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you know that the input is going to be of type HashMap<String,Object> why not use KrollDict directly instead of adding SuppressWarnings markers?
There is no actual need for the getAt method since we expose the chilren property. You should only implement replaceAt and insertAt |
This would also be a good time to refactor the iOS code to not use two arrays (chilren and pendingAdds) and instead use a single array like iOS. |
Documentation missing. This ticket is also marked as TiAPI. So please create parity tickets for BB and MW |
Code Reviewed. Please address comments |
… timob-7673 Conflicts: iphone/Classes/TiViewProxy.m
public void insertAt(TiUIView child, int position) | ||
{ | ||
add(child, position); | ||
if(children.contains(child)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if block is not required. Instead refactor the add method to insert child at correct index
Code looks ok. One minor fix. Will continue with FR once addressed. |
Conflicts: android/titanium/src/java/org/appcelerator/titanium/proxy/TiViewProxy.java
@@ -224,60 +245,21 @@ -(void)remove:(id)arg | |||
ENSURE_UI_THREAD_1_ARG(arg); | |||
|
|||
pthread_rwlock_wrlock(&childrenLock); | |||
if ([children containsObject:arg]) | |||
{ | |||
NSMutableArray* childrenCopy = [children mutableCopy]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This array got leaked since it is never released. Either use [self children]
outside the locks or release this object at end of method
Code reviewed. 2 memory leaks. Otherwise ok. Starting functional. |
FR Passed. Ran test case and KS. Will merge once memory leaks are addressed. |
[TIMOB-7673] "replaceAt", "insertAt", and "getAt" view-like UI components
[TIMOB-7673] "replaceAt", "insertAt", and "getAt" view-like UI components
Details in Jira ticket
Sample code on comment