[TIMOB-26315] Android: Support touch feedback on backgroundImage, backgroundGradient, and transparent backgrounds
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Low |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2020-08-11T15:08:31.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 9.1.0 |
| Components | Android |
| Labels | androd, background, material-design, touch, view |
| Reporter | Hans Knöchel |
| Assignee | Joshua Quick |
| Created | 2018-08-18T08:28:14.000+0000 |
| Updated | 2021-03-09T01:50:49.000+0000 |
Description
*Summary:*
A
Ti.UI.View object's touchFeedback and touchFeedbackColor properties will only show a touch/tap ripple animation if you set the view's backgroundColor property to a non-transparent color. This is a documented limitation.
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-touchFeedback
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-touchFeedbackColor
We should add touch feedback to the following as well:
* backgroundImage property (only apply ripple to non-transparent part)
* backgroundGradient property (only apply ripple to non-transparent part)
* No background (ripple applied to entire transparent background)
*Use-Case:*
This is needed for developers who want to show buttons with custom image backgrounds.
var window = Ti.UI.createWindow();
var button = Ti.UI.createButton({
title: "Tap Me",
backgroundImage: "android.resource://android/drawable/panel_picture_frame_bg_focus_blue",
touchFeedbackColor: "yellow",
touchFeedback: true,
});
button.addEventListener("click", function() {
Ti.API.info("### Button was clicked on.");
});
window.add(button);
window.open();
*Note:*
The touch feedback feature only works on Android 5.0 and newer OS versions.
PR: https://github.com/appcelerator/titanium_mobile/pull/10986
Above PR was closed in favor of the below. PR (master): https://github.com/appcelerator/titanium_mobile/pull/11795
FR Passed, waiting on Jenkins build.
merged to master manually (after fixing conflict) for 9.1.0 target
*Closing ticket*. Improvement verified in SDK version
9.1.0.v20200810120239.*Test and other information can be found at:* https://github.com/appcelerator/titanium_mobile/pull/11795