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

feat(android): add fixedSize to RecyclerViews #13138

Merged
merged 5 commits into from Apr 12, 2022

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Oct 23, 2021

JIRA: https://jira.appcelerator.org/browse/AC-6635

Optional Description:

Since we are optimizing the performance of Androids ListViews/TableViews this might be another one:
Adding fixedSize to the ListView/TableView properties

const defaultTemplate = {
	childTemplates: [{
		type: "Ti.UI.View",
		properties: {
			layout: "horizontal",
			horizontalWrap: false,
			top: "5dp",
			left: "10dp",
			bottom: "5dp",
			right: "10dp",
			width: Ti.UI.FILL,
			height: Ti.UI.SIZE,
		},
		childTemplates: [{
			type: 'Ti.UI.Label',
			bindId: 'label',
		}, {
			type: 'Ti.UI.View',
			properties: {
				layout: "horizontal",
				horizontalWrap: true,
				width: Ti.UI.FILL,
				height: Ti.UI.SIZE,
			},
			childTemplates: [],
		}],
	}],
};
const templateImagePaths = [
	"/assets/images/tab1.png",
	"/assets/images/tab2.png",
];
for (let index = 0; index < 32; index++) {
	defaultTemplate.childTemplates[0].childTemplates[1].childTemplates.push({
		type: "Ti.UI.ImageView",
		properties: {
			image: templateImagePaths[index % templateImagePaths.length],
			left: "5dp",
			touchEnabled: false,
		},
	});
}

function createListViewSectionItems() {
	const items = [];
	for (let index = 1; index <= 200; index++) {
		items.push({ label: { text: `Row ${index}` } });
	}
	return items;
}

const window = Ti.UI.createWindow();
window.add(Ti.UI.createListView({
	templates: {
		template: defaultTemplate,
	},
	fixedSize: true,
	defaultItemTemplate: 'template',
	sections: [Ti.UI.createListSection({
		headerTitle: "ListView",
		items: createListViewSectionItems(),
	})],
}));
window.open();

@build
Copy link
Contributor

build commented Oct 23, 2021

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Warnings
⚠️

Commit 4b5db63d9e1d2ffac53f2ec2702039c54f2b1663 has a message "docs" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 1a43fd5c90d759ba8f7705442208b6a47cf8233c has a message "docs" giving 2 errors:

  • subject may not be empty
  • type may not be empty
Messages
📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖

✅ All tests are passing
Nice one! All 19670 tests are passing.
(There are 1157 skipped tests not included in that total)

📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS against 4b5db63

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
FT: PASS

Looks like you need to fix the commit messages for Danger to pass. e.g:

docs(android): include fixedSize property

Copy link
Collaborator

@hansemannn hansemannn left a comment

Choose a reason for hiding this comment

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

Solid fix, thank you!

@hansemannn hansemannn merged commit d057eed into tidev:master Apr 12, 2022
@m1ga m1ga deleted the listViewFixedSize branch April 12, 2022 06:55
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

4 participants