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

Android: Allow SearchBar "color" and "hintTextColor" properties to be set dynamically

    Details

    • Story Points:
      1
    • Sprint:
      2018 Sprint 04 SDK

      Description

      Summary:
      Add the ability to set the text color and hint text color of a "Ti.UI.SearchBar" on Android
      The Android "Ti.UI.SearchBar" supports undocumented properties "color" and "hintTextColor" for changing its text field colors. However, these properties can only be set upon creation. We should allow these properties to be set dynamically.

      This is especially needed for parity since we're adding this feature on iOS via TIMOB-10368.

      Note:
      We plan on adding a similar feature to Android's "SearchView" in 7.1.0. See: TIMOB-25668

      Test Code:
      Once this feature has been implemented, verify that the SearchBar's hint text color is "blue" and the entered text is "red".

      var window = Ti.UI.createWindow();
      var searchBar = Ti.UI.createSearchBar(
      {
      	barColor: "white",
      	hintText: "Hint Text...",
      });
      window.addEventListener("open", function(e) {
      	var dialog = Ti.UI.createAlertDialog(
      	{
      		message: "Show SearchBar in...",
      		buttonNames: ["Window", "ListView", "TableView"],
      	});
      	dialog.addEventListener("click", function(e) {
      		searchBar.color = "red";
      		searchBar.hintTextColor = "blue";
      		switch (e.index) {
      			case 0:
      				searchBar.top = 0;
      				searchBar.left = 0;
      				searchBar.width = Ti.UI.FILL;
      				searchBar.height = "50dp";
      				window.add(searchBar);
      				window.add(Ti.UI.createLabel({ text: "Window" }));
      				break;
      			case 1:
      				var listView = Ti.UI.createListView(
      				{
      					searchView: searchBar,
      					sections: [Ti.UI.createListSection({ headerTitle: "ListView" })],
      					width: Ti.UI.FILL,
      					height: Ti.UI.FILL,
      				});
      				window.add(listView);
      				break;
      			case 2:
      				var tableView = Ti.UI.createTableView(
      				{
      					search: searchBar,
      					data: [Ti.UI.createTableViewRow({ title: "TableView" })],
      					width: Ti.UI.FILL,
      					height: Ti.UI.FILL,
      				});
      				window.add(tableView);
      				break;
      		}
      	});
      	dialog.show();
      });
      window.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                jquick Joshua Quick
                Reviewer:
                Gary Mathews
              • Watchers:
                2 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 Source Code