Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Ti.UI.OptionBar #12388

Closed
wants to merge 2 commits into from
Closed

Conversation

jquick-axway
Copy link
Contributor

@jquick-axway jquick-axway commented Jan 16, 2021

JIRA:
https://jira.appcelerator.org/browse/TIMOB-28317

Summary:

  • On iOS, the Ti.UI.OptionBar works just like Ti.UI.TabbedBar and shows a segmented control.
  • On Android, this supports a "style" property which can be set to...
    • Ti.UI.OPTION_STYLE_BUTTON to show a material toggle button group. (See: link)
    • Ti.UI.OPTION_STYLE_CHIP to show a "Chip Choice" group. (See: link)
    • Ti.UI.OPTION_STYLE_RADIO to show a radio button group. (See: link)

Example:
The below is what the new Ti.UI.OptionBar looks like on Android and iOS with all 3 styles. Note that iOS ignores the "style" property and always shows the segmented control instead.
OptionBar-Android OptionBar-iOS

Test:

  1. Create a Classic project using OptionBarTest.js from TIMOB-28317.
  2. Add the below <application/> element to the "tiapp.xml" file.
  3. Build and run on Android.
  4. Verify that the appears as shown in the screenshot above.
  5. Tap on "Button 2" and verify the following gets logged.
    @@@ Button click index: 1
  6. Tap on "Chip 2" and verify the following gets logged.
    @@@ Chip click index: 1
  7. Tap on horizontal "Radio 2" and verify the following gets logged.
    @@@ Horizontal radio click index: 1
  8. Tap on vertical "Radio 2" and verify the following gets logged.
    @@@ Vertical radio click index: 1
  9. Build and run on iOS.
  10. Verify the app looks like the iOS screenshot above.
  11. Tap on "Button 2" and verify the following gets logged.
    @@@ Button click index: 1
<ti:app>
	<android xmlns:android="http://schemas.android.com/apk/res/android">
		<manifest>
			<application android:theme="@style/Theme.MaterialComponents.Light.DarkActionBar"/>
		</manifest>
	</android>
</ti:app>

Fixes TIMOB-28317
@build
Copy link
Contributor

build commented Jan 16, 2021

Fails
🚫 Tests have failed, see below for more information.
Warnings
⚠️ This PR has milestone set to 10.0.0, but the version defined in package.json is 10.1.0 Please either: - Update the milestone on the PR - Update the version in package.json - Hold the PR to be merged later after a release and version bump on this branch
⚠️

iphone/cli/commands/_build.js#L6229 - iphone/cli/commands/build.js line 6229 – 'reject' is defined but never used. Allowed unused args must match /^.+/u. (no-unused-vars)

Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 1 tests have failed There are 1 tests failing and 954 skipped out of 15203 total tests.
📖

💾 Here's the generated SDK zipfile.

Tests:

ClassnameNameTimeError
ios.iphone.Titanium.Analytics.properties.optedOut can be assigned a Boolean value (14.4.0)28.396
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
run@file:///ti.main.js:8719:22
processImmediateQueue@file:///ti.main.js:8782:18
drainQueues@file:///ti.main.js:8759:52

Generated by 🚫 dangerJS against f99a8bb

@hansemannn
Copy link
Collaborator

This makes absolutely no sense as an own API, sorry. In addition to TIMOB-28274, Titanium would then have the same UI on iOS in three different API's?!

  • Ti.UI.TabbedBar
  • Ti.UI.OptionBar
  • Ti.UI.ButtonBar

Just deprecate the button-bar, add Android support + the style property to the "TabbedBar" API and everyone is happy.

@jquick-axway
Copy link
Contributor Author

@hansemannn, Ti.UI.ButtonBar is very different where the buttons are not toggle-able (ie: there is no selection/check state) and works more like a toolbar.

And yes the Ti.UI.TabbedBar and Ti.UI.OptionBar do work the same, but a widget named TabbedBar implies it should show "tabs" and I think it should continue to use native tab widgets on Android. Versus something named OptionBar implies it should show options buttons (like toggle-able button bar or radio buttons)... and the name OptionBar pairs well with our Ti.UI.OptionDialog which also shows radio buttons within a dialog.

@jquick-axway
Copy link
Contributor Author

Closing in favor of PR #12510 which removes the "style" property and only implements the toggle button group on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants