titanium-sdk icon indicating copy to clipboard operation
titanium-sdk copied to clipboard

feat(android): TableView/ListView with GridLayout

Open m1ga opened this issue 3 years ago • 3 comments

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

Optional Description:

normal: Screenshot_20201121-162636

gridColumns: 3 Screenshot_20201121-162624

Listview:

var win = Ti.UI.createWindow({backgroundColor: 'gray'});
var listView = Ti.UI.createListView({
	gridColumns: 2
});
var sections = [];

var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
    {properties: { title: 'Apple'}},
    {properties: { title: 'Banana'}},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables'});
var vegDataSet = [
    {properties: { title: 'Carrots'}},
    {properties: { title: 'Potatoes'}},
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);

listView.sections = sections;
win.add(listView);
win.open();

var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish'});
var fishDataSet = [
    {properties: { title: 'Cod'}},
    {properties: { title: 'Haddock'}},
];
fishSection.setItems(fishDataSet);
listView.appendSection(fishSection);

TableView

Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();
var columnCount = 1;
var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'}, {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];

var table = Ti.UI.createTableView({
  data: tableData,
  gridColumns: columnCount
});
win.add(table);

var btn = Ti.UI.createButton({title: "change", bottom: 20});

btn.addEventListener("click", function() {
	columnCount++;
	table.gridColumns = columnCount;
	if (columnCount >= 4) {
		columnCount = 0;
	}
})
win.add(btn);

win.open();

m1ga avatar Nov 21 '20 15:11 m1ga

@m1ga We need the root level package-lock.json, so that shouldn't be removed. But the android/package-lock.json should.

sgtcoolguy avatar Nov 21 '20 15:11 sgtcoolguy

@sgtcoolguy oh, my bad. I just wanted to remove it from my PR! Sorry about that, will include it again

m1ga avatar Nov 21 '20 15:11 m1ga

Fails
:no_entry_sign:

:microscope: 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
:warning:

Commit eb6c5cae209c1a58dc3dfd0d7bc45ee2954de381 has a message "else case" giving 2 errors:

  • subject may not be empty
  • type may not be empty
:warning:

Commit 84926ba69f51a30fde551eba7d2255c8ab5f36a9 has a message "tableview" giving 2 errors:

  • subject may not be empty
  • type may not be empty
:warning:

Commit 36f319c8f31a1228ac19c5ce2653897ab03bfed2 has a message "fix missing files" giving 2 errors:

  • subject may not be empty
  • type may not be empty
:warning:

Commit 9dd20e968adcf83c994aa93d5871938d8b2c2678 has a message "doc" giving 2 errors:

  • subject may not be empty
  • type may not be empty
:warning:

Commit 2318b0bf9f870af050a785daecd65df94bc9bb07 has a message "remove package-lock" giving 2 errors:

  • subject may not be empty
  • type may not be empty
:warning: Tests have failed, see below for more information.
:warning: This PR has milestone set to 10.0.0, but the version defined in package.json is 10.2.0 Please either: - Update the milestone on the PR - Update the version in package.json - Hold the PR to be merged later after a release and version bump on this branch
Messages
:book:

:rotating_light: 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.

:book: :x: 3 tests have failed There are 3 tests failing and 1162 skipped out of 21541 total tests.
:book: :tada: Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. :thumbsup:
:book:

:floppy_disk: Here's the generated SDK zipfile.

Tests:

ClassnameNameTimeError
android.emulator.main.Titanium.Geolocation.methods#forwardGeocoder() works via callback argument (12)5.009
Error: expected false to be true
at Assertion.fail (/node_modules/should/cjs/should.js:275:13)
      at Assertion.value (/node_modules/should/cjs/should.js:356:9)
      at Geolocation.<anonymous> (/ti.geolocation.test.js:585:32)
ios.macos.Titanium.Filesystem.File.remoteBackup assigning Boolean value doesn't throw (11.4.0)2.191
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
run@file:///Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-12284/tmp/mocha/build/iphone/build/Products/Debug-maccatalyst/mocha.app/Contents/Resources/ti.main.js:9415:22
processImmediateQueue@file:///Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-12284/tmp/mocha/build/iphone/build/Products/Debug-maccatalyst/mocha.app/Contents/Resources/ti.main.js:9478:18
drainQueues@file:///Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-12284/tmp/mocha/build/iphone/build/Products/Debug-maccatalyst/mocha.app/Contents/Resources/ti.main.js:9455:52
ios.macos.Titanium.Media.AudioPlayer.properties.duration gives around 45 seconds for test input (11.4.0)1.125
Error: expected -2147483648 to be within 45250..45500
value@file:///Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-12284/tmp/mocha/build/iphone/build/Products/Debug-maccatalyst/mocha.app/Contents/Resources/node_modules/should/cjs/should.js:356:23
file:///Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-12284/tmp/mocha/build/iphone/build/Products/Debug-maccatalyst/mocha.app/Contents/Resources/ti.media.audioplayer.test.js:134:51

Generated by :no_entry_sign: dangerJS against f6e555ac1811f26edd87ff8d837abe1ad606bb8f

build avatar Nov 21 '20 15:11 build