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

Android: Add "MaterialButton" support to "Ti.UI.Button"

    Details

      Description

      Summary:
      Our Ti.UI.Button is currently using the Java android.widget.Button class. It should be updated to use the newer "MaterialToolbar" class. The newer class supports the material theme and new styles such as "outline" and "text-only" buttons.
      https://material.io/design/components/buttons.html
      https://developer.android.com/reference/com/google/android/material/button/MaterialButton

      To-Do:
      Ti.UI.Button supports a style property which is currently iOS only. We should add support for this property on Android. The iOS-only Ti.UI.iOS.SystemButtonStyle should be deprecated and its style constants should be moved to Ti.UI as shown below.

      • Ti.UI.BUTTON_STYLE_FILLED
      • Ti.UI.BUTTON_STYLE_OUTLINED
      • Ti.UI.BUTTON_STYLE_TEXT
      • Ti.UI.BUTTON_STYLE_OPTION_POSITIVE // = Ti.UI.iOS.SystemButtonStyle.DONE
      • Ti.UI.BUTTON_STYLE_OPTION_NEGATIVE
      • Ti.UI.BUTTON_STYLE_OPTION_NEUTRAL // = Ti.UI.iOS.SystemButtonStyle.PLAIN/BORDERED

      The Ti.UI.BUTTON_STYLE_FILLED matches Android's old solid button behavior. The other styles are new on Android.

      Note that iOS only supports text-only buttons. Apple dropped support for bordered buttons a while ago. So, using any other unsupported style on iOS causes it to use text-only buttons.

      Test:
      Each button style can be tested with the attached ButtonStyleTest.js script, which will display what's shown in the screenshots below.

      Breaking-Change:
      The app must use a "Theme.MaterialComponents" based theme or else an exception will occur. So, app's using a custom theme based from "Theme.AppCompat" or similar will crash. This is normal and the exception will state that the theme will need to change.

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Satyam Sekhri
            • Watchers:
              6 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