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): collapseToolbar layout #13711

Merged
merged 15 commits into from
Feb 6, 2023

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jan 9, 2023

New Android layout: CollapseToolbar

simplescreenrecorder-2023-01-09_19.23.51.mp4

based on the DrawerLayout setup I've created a basic collapsing toolbar.

const win = Ti.UI.createWindow({
	theme: "Theme.Titanium.DayNight.NoTitleBar"
});

const centerView = Ti.UI.createView({
	layout: "vertical",
	height: Ti.UI.SIZE
});

for (let i = 0; i < 40; ++i) {
	let lbl = Ti.UI.createLabel({
		text: "test " + i,
		height: 40
	});
	centerView.add(lbl);
}

const collapsingToolbar = Ti.UI.Android.createCollapseToolbar({
	contentView: centerView,
	contentScrimColor: "#333",
	top: 0,
	image: "/images/img.jpg",
	title: "Collapsing toolbar"
});


win.addEventListener('open', function() {
	collapsingToolbar.onHomeIconItemSelected = function() {
		alert("click click");
	};
	collapsingToolbar.displayHomeAsUp = true;
	collapsingToolbar.flags = Ti.UI.Android.SCROLL_FLAG_SCROLL | Ti.UI.Android.SCROLL_FLAG_ENTER_ALWAYS; // scroll out - always move in
});

win.add(collapsingToolbar);
win.open();

Features:

  • background image
  • parallax effect (fixed)
  • flag support (e.g. move out when scrolling down and move in as soon as scoll down)
  • bar color
  • collapsed bar color (called contentScrimColor)
  • title
  • displayHomeAsUp
  • onHomeIconItemSelected
  • started the docs
  • added SCROLL_* flags as constants
  • imageHeight for the image height (normal height for the toolbar height)
  • variable color (title) and navigationIconColor (arrow)

@m1ga
Copy link
Contributor Author

m1ga commented Jan 9, 2023

using different flags and displayHomeAsUp:

simplescreenrecorder-2023-01-09_23.07.00.mp4

@m1ga m1ga changed the title fet(android): collapseToolbar layout feat(android): collapseToolbar layout Jan 13, 2023
@m1ga m1ga marked this pull request as ready for review January 16, 2023 11:07
@hansemannn hansemannn merged commit e144d61 into master Feb 6, 2023
@m1ga m1ga deleted the 221027_android_collapsing_title branch March 4, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants