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): refreshControl offset property #13970

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

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?

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.

2 participants