I am using the TiSwipeToReveal (https://github.com/rborn/TiSwipeToReveal) example code to allow users to swipe on a TableViewRow and display a star rating control. This is working fine on iOS but I have found a quirk on Android that has me stumped.
TiSwipeToRevea works by having two views on the TableViewRow. When the user swipes the first displayed view it is given an opacity of 0 (transparent) which allows the second view (the star rating control) to be visible. The user clicks on the stars on the second view which is the functionality I want.
What I have found on Android is that the first view is always responding to the singletap event even after its opacity is set to 0 (transparent). That means I don't get an event originating from the clicked star and can't save my rating.
I'm not sure how to code around it if the Android platform doesn't allow the second view to respond to events then I'll have to find another way to do this. TiSwipeToReveal states that it works for Android so I suspect the problems is me.
I add the views like:
row.add(hiddenView); row.v2 = defaultView; row.add(defaultView);The code for swipe is:
$.trainingTable.addEventListener('swipe', function(e){ if (!!current_row) { current_row.v2.animate({ opacity: 1, duration: 500 }); }; current_row = e.row; current_row.v2.animate({ opacity: 0, duration: 500 }); });And the code for responding to the singletap is:
$.trainingTable.addEventListener('singletap', function(e){ e.cancelBubble = true; if (e.source.is_rating == 1) { var rating = parseInt(e.source.rating) + 1; sendRating(e.rowData.drill_id, rating); e.row.v2.setOpacity(1); alert('Thanks for rating this drill!'); } else { e.row.v2.setOpacity(1); Ti.App.fireEvent('showDrill',{drill_id: e.rowData.drill_id}); } });