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): window titleAttributes parity #13954

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Dec 17, 2023

Parity for titleAttribues: {color}.

iOS allows you to quickly set the window title color with titleAttributes: { color: #fff}. It has more options but for now I only added color to Android.

Screenshot_20231217-122719

Test 1:

var win = Titanium.UI.createWindow({
	barColor: "pink",
	backgroundColor: "white",
	title: 'Autos',
	titleAttributes: {
		top: 0,
		color: "blue",
	},
});

win.addEventListener("click", function() {
	win.titleAttributes = {
		color: "yellow"
	}
})
win.open();
  • title color is blue
  • click the window and it is yellow

Test 2:

Same but with a navigation window setup:

var win = Titanium.UI.createWindow({
	barColor: "pink",
	backgroundColor: "white",
	title: 'Autos',
	titleAttributes: {
		top: 0,
		color: "blue",
	},
});

var navWin = Titanium.UI.createNavigationWindow({
	window: win,
});

win.addEventListener("click", function() {
	win.titleAttributes = {
		color: "yellow"
	}
})
navWin.open();
  • title color is blue
  • click the window and it is yellow

Workaround

Currently you have to either add a custom toolbar/actionbar or use a theme

   <style name="MyTheme" parent="Theme.Titanium.DayNight">
        <item name="toolbarStyle">@style/Widget.App.Toolbar</item>
    </style>

    <style name="Widget.App.Toolbar" parent="Widget.MaterialComponents.Toolbar.Primary">
        <item name="titleTextColor">#ffffff</item>
        <item name="android:background">#ff00ff</item>
    </style>

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.

Looks good, thank you!

@hansemannn hansemannn merged commit eb19d17 into master Dec 17, 2023
7 checks passed
@m1ga m1ga deleted the 231217_android_titleAttributes branch January 12, 2024 11:36
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.

2 participants