-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-20286] iOS/Android: Expose Ti.UI.View.getViewById method #8677
Changes from 5 commits
d419876
c222f84
6f6c530
4f48c70
5df4ff7
833b89a
74dc629
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -737,7 +737,32 @@ public void removeAllChildren() | |
} | ||
} | ||
} | ||
|
||
/** | ||
* Returns the view by the given ID. | ||
* @module.api | ||
*/ | ||
@Kroll.method | ||
public TiViewProxy getViewById(String arg) | ||
{ | ||
if (children != null) { | ||
for (TiViewProxy child : children) { | ||
if (child.children != null && child.children.size() > 0) { | ||
TiViewProxy parentChild = child.getViewById(arg); | ||
if (parentChild != null) { | ||
return parentChild; | ||
} | ||
} | ||
|
||
if (child.getProperty(TiC.PROPERTY_ID) && child.getProperty(TiC.PROPERTY_ID).equals(arg)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Builds failing, if (child.hasProperty(TiC.PROPERTY_ID) && child.getProperty(TiC.PROPERTY_ID).equals(id)) { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but you can only perform an if (child.hasProperty(TiC.PROPERTY_ID) && child.getProperty(TiC.PROPERTY_ID).equals(id)) {
// OR
if (child.getProperty(TiC.PROPERTY_ID) != null && child.getProperty(TiC.PROPERTY_ID).equals(id)) { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But that's how it was before all that. You can edit it on Github, so we can ensure it doesn't cause problems again. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, I think you might have missed my change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha, changed it. But the original implementation was like the second suggestion above already (except the string-casting), that's why I wondered. Sorry for the confusion, let's finish this 🙂 |
||
return child; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
public void handleRemove(TiViewProxy child) | ||
{ | ||
if (children != null) { | ||
|
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.
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.
Does this work on Android?
id
is a type on iOS. Will change it here, but primarily followed other method argument lists.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.
Updated.