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-12734] Android: Added ability to change layout dynamically via "layout" property like iOS. #9323

Merged
merged 1 commit into from Aug 17, 2017

Conversation

jquick-axway
Copy link
Contributor

JIRA: https://jira.appcelerator.org/browse/TIMOB-12734

Test:

  1. Build and run the below code on an Android device.
  2. Tap the "Vertical" button.
  3. Verify that "View 1" is above "View 2".
  4. Tap the "Horizontal" button.
  5. Verify that "View 1" is to the left of "View 2".
  6. Tap the "Composite" button.
  7. Verify that "View 1" and "View 2" are at the center of the screen and "View 2" is on top.
var window = Ti.UI.createWindow();

var mainContainer = Ti.UI.createView({ top: "2%" });
mainContainer.add(Ti.UI.createLabel(
{
	text: "View 1",
	textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
	verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,
	color: "white",
	backgroundColor: "#0000FF",
	borderWidth: "2dp",
	borderColor: "#000088",
	width: "50%",
	height: "50%",
}));
mainContainer.add(Ti.UI.createLabel(
{
	text: "View 2",
	textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
	verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_TOP,
	color: "white",
	backgroundColor: "#00BB00",
	borderWidth: "2dp",
	borderColor: "#004400",
	width: "25%",
	height: "25%",
}));
window.add(mainContainer);

var buttonContainer = Ti.UI.createView(
{
	layout: "horizontal",
	bottom: "1%",
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
});
var verticalButton = Ti.UI.createButton({ title: "Vertical" });
verticalButton.addEventListener("click", function(e) {
	mainContainer.layout = "vertical";
});
buttonContainer.add(verticalButton);
var horizontalButton = Ti.UI.createButton({ title: "Horizontal", left: "5%" });
horizontalButton.addEventListener("click", function(e) {
	mainContainer.layout = "horizontal";
});
buttonContainer.add(horizontalButton);
var compositeButton = Ti.UI.createButton({ title: "Composite", left: "5%" });
compositeButton.addEventListener("click", function(e) {
	mainContainer.layout = "composite";
});
buttonContainer.add(compositeButton);
window.add(buttonContainer);

window.open();

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

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

CR: PASS
👍

@lokeshchdhry lokeshchdhry self-assigned this Aug 16, 2017
@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Aug 17, 2017

FR Passed.

Changing layoutproperty dynamically works as expected.

Studio Ver: 4.9.1.201707200100
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.9
Appc CLI: 6.2.3
Ti CLI Ver: 5.0.14
Alloy Ver: 1.9.13
Node Ver: 6.10.1
Java Ver: 1.8.0_101
Devices: ⇨ google Pixel --- Android 7.1.1
⇨ google Nexus 5 --- Android 6.0.1
Android Emulator: Android 4.4.4

@lokeshchdhry lokeshchdhry merged commit 220d265 into tidev:master Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants