Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(android): refreshControl offset property #13970

Merged
merged 8 commits into from
Dec 15, 2024
Merged

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jan 20, 2024

Adding a property to the RefreshControl: offset: {start,end}.
The default RefreshControl spinner starts at 0 and goes down to around 80. With this property you can set custom values.

Native Android description: https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout#setProgressViewOffset(boolean,int,int)

var win = Ti.UI.createWindow();

var myTemplate = {
	childTemplates: [{
		type: 'Ti.UI.Label',
		bindId: "text",
	}]
};

const control = Ti.UI.createRefreshControl({
	offset: {
		start: 300,
		end: 400
	}
});
control.addEventListener("refreshstart", function() {
	setTimeout(function() {
		control.endRefreshing();
	}, 1000);
})

var listView = Ti.UI.createListView({
	templates: {
		'template': myTemplate
	},
	refreshControl: control,
	defaultItemTemplate: 'template'
});
var sections = [];
var items = [];
for (var i = 0; i < 50; ++i) {
	items.push({
		text: {
			text: "label " + i
		}
	})
}

var fruitSection = Ti.UI.createListSection({
	items: items
});
sections.push(fruitSection);

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

@m1ga m1ga added the feature label May 23, 2024
apidoc/Titanium/UI/RefreshControl.yml Outdated Show resolved Hide resolved
@hansemannn
Copy link
Collaborator

Can you resolve the merge conflicts please?

@hansemannn hansemannn merged commit 06248ec into master Dec 15, 2024
7 checks passed
@hansemannn hansemannn deleted the 240120_refreshOffset branch December 15, 2024 13:57
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants