Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24881

Android: Label ellipsize modes START and MIDDLE don't work if "autoLink" is true

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: Release 6.1.1
    • Fix Version/s: Release 8.1.0
    • Component/s: Android
    • Labels:
    • Story Points:
      3
    • Sprint:
      2019 Sprint 11

      Description

      Summary:
      When a Label is set up to "autoLink" its text which contains at least 1 URL, then ellipsize modes START and MIDDLE are not honored. The label will use ellipsize mode END instead.

      Code Example:

      var window = Ti.UI.createWindow();
      window.add(Ti.UI.createLabel(
      {
      	text: "https://www.appcelerator.com",
      	font: { fontSize: "50dp" },
      	autoLink: Ti.UI.AUTOLINK_URLS,
      //	ellipsize: Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_START,
      	ellipsize: Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_MIDDLE,
      	width: "100%",
      }));
      window.open();
      

      Result:
      Ellipsis are shown at the end instead of the start or middle.

      Reason:
      Android's Java "TextView does not support displaying START or MIDDLE ellipsis while a "MovementMethod" (such as "LinkMovementMethod" in this case) is applied to it. Our existing "TiUILabel.java" code works-around this problem and applies an END ellipsis in this case instead.

      Suggested Solution:
      Android 5.0 and above supports URL taps without a MovementMethod, but Android 4.0 does not (I'm not sure which OS versions in the middle do support it). This is because Google's "TextView.java" code in its onTouchEvent() method handles URL taps for newer OS versions (see their code on github). So, the recommended solution here is to not set a MovementMethod in "TiUILabel.java" and for us to replicate what Google does in their TextView.onTouchEvent() in our TiUILabel code so that we can support URL taps on all Android OS versions.

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-10825
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code