Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28517] Android: CardView "touchFeedbackColor" property is ignored

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2021-08-09T10:24:11.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.2
ComponentsAndroid
LabelsCardView, android, touchfeedback
ReporterJoshua Quick
AssigneeJoshua Quick
Created2021-08-06T03:21:06.000+0000
Updated2021-08-09T10:24:11.000+0000

Description

*Summary:* The [Ti.UI.Android.CardView](https://titaniumsdk.com/api/titanium/ui/android/cardview.html) has always ignored the "touchFeedback" and "touchFeedbackColor" properties and would never show a ripple effect. Now that Titanium 10.x.x uses the Java MaterialCardView widget, we shouldn't ignore these properties anymore because this native "material" widget shows a ripple effect by default. *Steps to reproduce:*

Build and run the below on Android.

Tap on the card view in the app.

Notice the ripple effect is gray and not yellow. _(This is the bug.)_

const window = Ti.UI.createWindow();
const cardView = Ti.UI.Android.createCardView({
	elevation: 20,
//	touchFeedback: false,
	touchFeedbackColor: "yellow",
	top: "20dp",
	left: "20dp",
	bottom: "20dp",
	right: "20dp",
});
cardView.add(Ti.UI.createLabel({
	text: 'Tap Me',
	touchEnabled: false,
}));
window.add(cardView);
window.open();
*Note:* As of Titanium 10.0.0, setting the "touchFeedback" and "touchFeedbackColor" properties causes the following warning message to be logged. We should resolve this issue too.
[INFO]  MaterialCardView: Setting a custom background is not supported.
*Work-Around:* Add a view to the CardView and set it up with touch feedback.

Comments

  1. Joshua Quick 2021-08-06

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/13000
  2. Ewan Harris 2021-08-09

    Merged to master and 10_0_X

JSON Source