Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23578] Android 4.3: Error - Handle double clicked on views. (android)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2017-03-30T20:46:37.000+0000
Affected Version/sRelease 5.2.1, Release 5.2.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterNeeraj Mishra
AssigneeAshraf Abu
Created2016-06-29T23:09:41.000+0000
Updated2017-03-30T20:46:43.000+0000

Description

Issue Description

If we do a double click on a button, it opens two windows. This only happens in Android ver 4.3 and API 18. We tested on latest version of Android and do not see any issue.

Steps to Reproduce

1. Create a new Appcelerator alloy project for Android 2. Copy the view directory files into the new project created.(views.zip attached) 3. Copy the Controller directory files into the new project.(controllers.zip attached) 4. Copy the style directory files into the project.(styles.zip attached)

Expected Results

Clicking on button should create only single window

Attachments

FileDateSize
controllers.zip2016-06-29T23:07:44.000+00001536
styles.zip2016-06-29T23:07:44.000+00001831
views.zip2016-06-29T23:07:44.000+00001334

Comments

  1. Ashraf Abu 2016-08-02

    Tested on an API 18 emulator. Able to reproduce.
  2. Ashraf Abu 2016-08-02

    Classic app code:
       var win = Ti.UI.createWindow();
       
       var btn = Ti.UI.createButton({
         title: 'Double Click Here'
       });
       
       win.add(btn);
       win.open();
       
       btn.addEventListener('click', function(){
       
           var win2 = Ti.UI.createWindow({
               title:'Another Window',
           });
           var label1 = Titanium.UI.createLabel({
           color:'#999',
           text:'I am Another Window',
           font:{fontSize:20,fontFamily:'Helvetica Neue'},
           textAlign:'center',
           width:'auto'
           });
           win2.add(label1);
           win2.open();
       
       });
       
  3. Ashraf Abu 2016-08-02

    [~nmishra] This is a workaround as it's an API 18 specific issue. In your index.xml code, add an id to your button:
       <Alloy>
       	<Window id="window" class="container" layout="vertical">
       		<Button id="buttonId" top="10" height="100" width="Ti.UI.Fill" onClick="showNormalView">Double click here to open two new window</Button>
       		<!-- <Button top="10" height="100" width="Ti.UI.Fill" onClick="showConfigedView">Show Configed View</Button> -->
       	</Window>
       </Alloy>
       
    and in your index.js code, use this:
       $.window.open();
       
       function showNormalView() {
           $.buttonId.enabled = false;
       	var win = Alloy.createController("NormalView").getView();
       	win.open();
           setTimeout(function() {
               $.buttonId.enabled = true;
           },500);
       }
       
       function showConfigedView() {
       	var win = Alloy.createController("DismissKeyboarWhenLoadView").getView();
       	win.open();
       }
       
    What's happening is that in API 18, it seems that the system is slower and hence after you click the button, the new window is not opened yet and there is a split second you can click it again to open the window. This workaround disables the button for that split second and enables it back again. Please give it a try. I'll resolve this issue if this works for you.
  4. Lee Morris 2017-03-30

    Closing ticket as "Won't Fix". There has been no update for a while. If there is any problem, please open a new ticket.

JSON Source