tidev/titanium-sdk

Android: TabbedBar icon doesn't tint like the label.

Closed this issue · 1 comments

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

I'm using BarItemType for icons in a tabbed bar but unlike the label, it doesn't tint/color to any colour. I've tried a few properties but nothing will change it, it keeps to the default blue color.

Expected Behavior

For the icon to change to whatever colour i set like it does with labels

Actual behavior

Stays the default material/android blue.

Reproducible sample

In XML

<TabbedBar id='tabbedBar' class='tabbedBar' onClick='onTabClick'>
	<BarItemTypes>
		<BarItemType id='tab1' image=''/> <!--put image here-->
	</BarItemTypes>
</TabbedBar>

In TSS

".tabbedBar" : {
	height : 50,
	width : Ti.UI.FILL,
	tintColor : '#D4AF37',
	selectedTextColor : '#000000',
	backgroundFocusedColor : '#D4AF37',
	selectedBackgroundColor : '#D4AF37',
	bottom : 5
}

Steps to reproduce

use the code above and observe the active colour being blue

Platform

No response

SDK version you are using

12.2.1.GA

Alloy version you are using

No response

m1ga commented

A quick test with:

tab.getIcon().setColorFilter(
	TiConvert.toColor(proxy.getProperty("tintColor"), TiApplication.getAppCurrentActivity()),
	PorterDuff.Mode.SRC_IN
);

in https://github.com/tidev/titanium-sdk/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUITabbedBar.java#L263

and also for the bottom navigation bellow. Should be menuItem.setIconTintList(ColorStateList); or something like this.

This will tint all icons with the same color. Then it should use a selected tintColor for the selected icon.

Classic test code for the app.js in the SDK:

var win = Ti.UI.createWindow();
var bb1 = Ti.UI.createTabbedBar({
  height : 50,
  	width : Ti.UI.FILL,
  	tintColor : '#D4AF37',
  	selectedTextColor : '#000000',
  	backgroundFocusedColor : '#D4AF37',
  	selectedBackgroundColor : '#D4AF37',
  	selectedTintColor : '#f00',
  	bottom : 5,
  	labels: [{label:"test", image:"KS_nav_ui.png"}, {label:"test", image:"KS_nav_ui.png"}, {label:"test", image:"KS_nav_ui.png"}]
});
win.add(bb1);
win.open();