Skip to content

Add iOS demo sources for advanced topics docs#4074

Merged
shai-almog merged 6 commits into
masterfrom
codex/migrate-code-snippets-from-advanced-theming-and-advanced-top
Oct 25, 2025
Merged

Add iOS demo sources for advanced topics docs#4074
shai-almog merged 6 commits into
masterfrom
codex/migrate-code-snippets-from-advanced-theming-and-advanced-top

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Summary

  • add Objective-C snippet files under the iOS demo module so the advanced topics guide can include compiled sources
  • reference the new iOS demo snippets from Advanced-Topics-Under-The-Hood.asciidoc for native interface, peer component, and Mobihelp examples

Testing

  • mvn -f docs/demos/pom.xml -Pios -pl ios -am -DskipTests package (fails: unable to download UpdateCodenameOne.jar because the network is unreachable)

https://chatgpt.com/codex/tasks/task_e_68fc88e1a99883318e1b7e1a9607a8ac

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 2524 to +2527

[source,java]
----
class CenterLayout extends Layout {
public void layoutContainer(Container parent) {
int components = parent.getComponentCount();
Style parentStyle = parent.getStyle();
int centerPos = parent.getLayoutWidth() / 2 + parentStyle.getMargin(Component.LEFT);
int y = parentStyle.getMargin(Component.TOP);
boolean rtl = parent.isRTL();
for (int iter = 0; iter < components; iter++) {
Component current = parent.getComponentAt(iter);
Dimension d = current.getPreferredSize();
Style currentStyle = current.getStyle();
int marginRight = currentStyle.getMarginRight(rtl);
int marginLeft = currentStyle.getMarginLeft(rtl);
int marginTop = currentStyle.getMarginTop();
int marginBottom = currentStyle.getMarginBottom();
current.setSize(d);
int actualWidth = d.getWidth() + marginLeft + marginRight;
current.setX(centerPos - actualWidth / 2 + marginLeft);
y += marginTop;
current.setY(y);
y += d.getHeight() + marginBottom;
}
}

public Dimension getPreferredSize(Container parent) {
int components = parent.getComponentCount();
Style parentStyle = parent.getStyle();
int height = parentStyle.getMargin(Component.TOP) + parentStyle.getMargin(Component.BOTTOM);
int marginX = parentStyle.getMargin(Component.RIGHT) + parentStyle.getMargin(Component.LEFT);
int width = marginX;
for (int iter = 0; iter < components; iter++) {
Component current = parent.getComponentAt(iter);
Dimension d = current.getPreferredSize();
Style currentStyle = current.getStyle();
width = Math.max(d.getWidth() + marginX + currentStyle.getMargin(Component.RIGHT)
+ currentStyle.getMargin(Component.LEFT), width);
height += currentStyle.getMargin(Component.TOP) + d.getHeight()
+ currentStyle.getMargin(Component.BOTTOM);
}
Dimension size = new Dimension(width, height);
return size;
}
}

Form hi = new Form("Center Layout", new CenterLayout());
for(int iter = 1 ; iter < 10 ; iter++) {
Label l = new Label("Label: " + iter);
l.getUnselectedStyle().setMarginLeft(iter * 3);
l.getUnselectedStyle().setMarginRight(0);
hi.add(l);
}
hi.add(new Label("Really Wide Label Text!!!"));
hi.show();
include::../demos/android/src/main/java/com/codenameone/support/mobihelp/MobihelpNativeImpl.java[tag=mobihelpNativeGetUnreadCountAsync,indent=0]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore center layout snippet in layout manager section

The narrative for "Building Your Own Layout Manager" explains a custom CenterLayout, but the code block now includes MobihelpNativeImpl#getUnreadCountAsync instead. This looks like a copy/paste error from the Mobihelp section and no longer shows any layout code, so readers will see unrelated Android native snippets. The include should point at CenterLayoutDemo.java[tag=centerLayout] rather than the Mobihelp file to keep the documentation consistent with the text.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Oct 25, 2025

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: 18729 alert(s) (2754 errors, 6353 warnings, 9622 suggestions) (exit code 1) (report)
  • Image references: No unused images detected (report)

@shai-almog shai-almog merged commit 17dc505 into master Oct 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant