Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24058] Android: backgroundSelectedColor & backgroundSelectedImage property does not work for tableviewrow

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-05-16T17:18:32.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsqe-6.0.0
ReporterLokesh Choudhary
AssigneeLokesh Choudhary
Created2016-10-20T21:07:06.000+0000
Updated2017-05-16T17:23:03.000+0000

Description

*This a regression. It broke in 5.4.0.GA.Works fine in 5.3.1.GA.*

Steps to reproduce:

1. Use the code below in your app.js & build for android device/emulator.
var _window = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

var data = [];

for (var i = 0; i < 10; i++) {
    var tvr = Ti.UI.createTableViewRow({
        title: 'test ' + i,
        hasChild: true,
        // backgroundSelectedImage:'/KS_nav_ui.png',
        backgroundSelectedColor: 'red',
        height:'30',
        focusable:true
    });
    data.push(tvr);
}


var tv = Ti.UI.createTableView({
    data: data,
    separatorColor:'black'
});

_window.add(tv);
_window.open();
2. After the app launches press & hold on any of the tableviewrows.

Actual results:

1. The background color for the tableview row does not turn red or if the the backgroundSelectedImage property is used image does not appear when you touch the table view row.

Expected results:

1. The background color for the tableview row should turn red as long as you hold your finger on the screen. 2. As soon as you lift your finger the red color should go back to the default white or window background color. Ref: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableViewRow-property-backgroundSelectedColor http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableViewRow-property-backgroundSelectedImage

Attachments

FileDateSize
TIMOB-24058.mov2017-01-04T00:41:44.000+00001366218

Comments

  1. Gary Mathews 2016-11-03

    master: https://github.com/appcelerator/titanium_mobile/pull/8579
  2. Abir Mukherjee 2017-01-04

    Tested with this environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.1.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.1.0.v20170103080657 Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.2 Android Device 6.0.1 Android Emulator 6.0.1_x86 Testing was done on both Device and Emulator with the demo code above. On the device, the app worked as expected. On the Emulator, however, the row did not stay consistently red while the mouse button was pressed. Occasionally, the row flickered red after the mouse button was released. The attached clip "TIMOB-24058.mov" shows the behavior. The circle around the cursor shows when the mouse is pressed down.
  3. Gary Mathews 2017-05-03

    [~amukherjee] I cannot reproduce the issue on emulator.
  4. Lokesh Choudhary 2017-05-03

    [~gmathews], backgroundSelectedColor works now but backgroundSelectedImage does not. I do not see the image when I click on the row. Studio Ver : 4.9.0.201704240654 SDK Ver : 6.1.0.v20170502132103 OS Ver : 10.12.3 Xcode Ver : Xcode 8.3.2 Appc NPM : 4.2.9 Appc CLI : 6.2.0 Ti CLI Ver : 5.0.12 Alloy Ver : 1.9.11 Node Ver : 6.10.1 Java Ver : 1.8.0_101 Devices : google Nexus 6P --- Android 7.1.1 google Nexus 5 --- Android 5.1.1
  5. Gary Mathews 2017-05-05

    [~lchoudhary] Working fine on both emulator and device, you need to hold down a row to see the background:
       var win = Ti.UI.createWindow({backgroundColor: 'gray'}),
           tv = Ti.UI.createTableView({separatorColor: 'black'}),
           data = [];
       
       for (var i = 0; i < 3; i++) {
           var tvr = Ti.UI.createTableViewRow({
               title: 'TEST ' + i,
               hasChild: true,
               backgroundSelectedImage: 'android/default.png',
               height: 96,
               focusable: true
           });
           data.push(tvr);
       }
       tv.data = data;
       
       win.add(tv);
       win.open();
       
  6. Lokesh Choudhary 2017-05-06

    [~gmathews], Checked again. Me & [~smohammed] can't see the image when we hold down on a tableviewrow. Checked with 6.1.0.v20170505162105.
  7. Gary Mathews 2017-05-16

    [~lchoudhary] Images placed in Resources/android should be accessible. *EXAMPLE*
       // Resources/android/default.png
       // should be accessible like this
       backgroundSelectedImage: 'default.png'
       
    If this is an issue, it is a separate issue from this ticket.
  8. Lokesh Choudhary 2017-05-16

    [~gmathews], It was user error, I can see the backgroundSelectedImage from Resources/android/ as well.
  9. Lokesh Choudhary 2017-05-16

    Verified the fix. backgroundSelectedColor & backgroundSelectedImage can be seen when tableviewrow is tapped & held. Closing. Studio Ver: 4.9.0.201705110256 SDK Ver: 6.1.0.v20170514022959 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.2 Appc NPM: 4.2.9 Appc CLI: 6.2.1 Ti CLI Ver: 5.0.13 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ oneplus A0001 --- Android 6.0.1

JSON Source