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

Android: Add TEXT_ALIGNMENT_JUSTIFY support

    Details

    • Story Points:
      3
    • Sprint:
      2021 Sprint 4

      Description

      Currently there is no TEXT_ALIGNMENT_JUSTIFY for Android. This PR will add parity with iOS and allows the text to be justified.

      It also adds the possibility to add features like TEXT_ALIGNMENT_JUSTIFY + last line right but I didn't include that in this PR to keep it simple and just add the iOS parity.

      var win = Ti.UI.createWindow({
      	backgroundColor: 'white',
      	layout: "vertical"
      });
      var l = Ti.UI.createLabel({
      	color: "#000",
      	left: 20,
      	right: 20,
      	borderWidth: 1,
      	borderColor: "#000",
      	textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
      	text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate"
      });
      var l1 = Ti.UI.createLabel({
      	color: "#000",
      	left: 20,
      	right: 20,
      	borderWidth: 1,
      	borderColor: "#000",
      	textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
      	text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate"
      });
      var l2 = Ti.UI.createLabel({
      	color: "#000",
      	left: 20,
      	right: 20,
      	borderWidth: 1,
      	borderColor: "#000",
      	textAlign: Ti.UI.TEXT_ALIGNMENT_JUSTIFY,
      	text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate"
      });
      var l3 = Ti.UI.createLabel({
      	color: "#000",
      	left: 20,
      	right: 20,
      	borderWidth: 1,
      	borderColor: "#000",
      	textAlign: Ti.UI.TEXT_ALIGNMENT_RIGHT,
      	text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate"
      });
      var btn = Ti.UI.createButton({
      	title: "all left"
      })
      var toggle = false;
      btn.addEventListener("click", function() {
      	if (toggle) {
      		l.textAlign = Ti.UI.TEXT_ALIGNMENT_LEFT;
      		l1.textAlign = Ti.UI.TEXT_ALIGNMENT_CENTER;
      		l2.textAlign = Ti.UI.TEXT_ALIGNMENT_JUSTIFY;
      		l3.textAlign = Ti.UI.TEXT_ALIGNMENT_RIGHT;
      	} else {
      		l.textAlign = Ti.UI.TEXT_ALIGNMENT_LEFT;
      		l1.textAlign = Ti.UI.TEXT_ALIGNMENT_LEFT;
      		l2.textAlign = Ti.UI.TEXT_ALIGNMENT_LEFT;
      		l3.textAlign = Ti.UI.TEXT_ALIGNMENT_LEFT;
      	}
      	toggle = !toggle;
      })
      win.add([l, l1, l2, l3, btn]);
      win.open();
      win.addEventListener("open", function() {
      	console.log(l.textAlign);
      	console.log(l1.textAlign);
      	console.log(l2.textAlign);
      	console.log(l3.textAlign);
      })
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              michael Michael Gangolf
              Reviewer:
              Joshua Quick
              Tester:
              Samir Mohammed
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration