Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11088] Android: Autolink tap area automatically takes the whole line space.

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2013-02-26T06:31:04.000+0000
Affected Version/sRelease 2.1.2, Release 2.1.3
Fix Version/sRelease 3.0.2
ComponentsAndroid
Labelsn/a
ReporterAmuktha Akkinepally
Assigneejithinpv
Created2012-09-24T17:46:50.000+0000
Updated2017-03-20T20:47:47.000+0000

Description

When using long text for auto link, some of the text wraps in to a second line leaving a white area in the first line. Tapping on this white area opens the email client or the phone app. (The auto link behavior).

Steps to Reproduce:

1. Load a new project with the below app.js. 2. Click anywhere on the white space next to the link. Expected Behavior: The e-mail client or the Phone Dial pad should only open when the link is clicked. Actual Behavior: They open even when the blank space next to the link is tapped.
var win = Ti.UI.createWindow({
	backgroundColor:'white'
});
var text = "1234@gmail.com 123456789012346789012345678901234567890 abc@gmail.com qrstuvwxyz123456789@abcdefghijk.com 123456789 123456789 123-456-7890"

var lbl2 = Ti.UI.createLabel({
    text: text,
    width:'auto',
    top: 60,
    autoLink: Ti.UI.Android.LINKIFY_ALL
});

win.add(lbl2);
win.open();

Comments

  1. Pedro Enrique 2012-09-27

    This seems to be normal Android behavior, I tested it with a native Java android application:

    main.xml

       <?xml version="1.0" encoding="utf-8"?>
       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           android:orientation="vertical" >
       
           <TextView
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="0.44"
               android:id="@+id/label"
               android:text="@string/hello" />
       
       </LinearLayout>
       

    HelloWorldActivity.java

       package com.pec1985.helloworld;
       
       import android.app.Activity;
       import android.os.Bundle;
       import android.text.util.Linkify;
       import android.widget.TextView;
       
       public class HelloWorldActivity extends Activity {
           /** Called when the activity is first created. */
           @Override
           public void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
               setContentView(R.layout.main);
               
               TextView label =  (TextView)findViewById(R.id.label);
               label.setTextSize(18);
               label.setText("1234@gmail.com 123456789012346789012345678901234567890 abc@gmail.com qrstuvwxyz123456789@abcdefghijk.com 123456789 123456789 123-456-7890");
               Linkify.addLinks(label, Linkify.ALL);
               
           }
       }
       

    Result, the same as in Titanium, taping on empty space triggers last link.

  2. jithinpv 2013-02-26

    The issue reported here is not a bugg. Actually the 'lbl2' is a view and it's width will be set according to the length of the var 'text'. So the lbl2 should capture events on its entire area. When a user makes a click on the white space after the link, lbl2's event listener is getting triggered. Therefore it cannot be treated as a bug. For more clarification give a background color for lb2 and set its width to some dimension like 'width:300' and repeate the steps.
  3. Lee Morris 2017-03-20

    Closing ticket as invalid.

JSON Source