Skip to content

Latest commit

 

History

History
116 lines (76 loc) · 11.2 KB

README.md

File metadata and controls

116 lines (76 loc) · 11.2 KB

Titanium 5.0.0 Sample App

screenshots

This sample app demonstrates many of the new APIs introduced in Titanium 5.0. Since this release is a big one, we've created separate sample apps for:

We're working on another sample to demonstrate Windows Runtime Direct API Access as well as the Hyperloop Module for iOS now available via Appcelerator Labs.

For a lists of all the changes see the release notes and linked JIRA filters.

iOS: Icons & Launch Images

To support App Thinning we now generate Asset Catalogs for the app icons and launch images. In most cases you won't notice, but be aware that:

  • You no longer need to have any appicon*.png files in assets/iphone. Just provide a 1024x1024 24-bit DefaultIcon.png in your project root and Titanium will generate the missing required sizes for you.
  • The build will fail if your icons do not meet Apple requirements and you don't provide a valid DefaultIcon.png.
  • You can no longer use launch images within the app itself like this.
  • Localized Splash Screens still work, but App Thinning for these images will not because Launch Images do not support localized Asset Catalogs.

For more information see the iOS graphic asset requirements and options guide. We will add support for DefaultIcon.png to the other platforms soon. Bye bye TiCons ;)

Attributed Strings

The Attributed Strings sample demonstrate the use of the new Alloy <AttributedString> proxy property. You can use this as a child element of <Label>, <TextArea> and <TextField>. As you can see the last one also supports <AttributedHintText>.

For iOS only we've also added support for the attribute type ATTRIBUTE_LINE_BREAK. Use this with one of the Ti.UI.ATTRIBUTE_LINE_BREAK_BY_* constants found in the sample's TSS to determine how lines break.

Alloy Themes

Apart from tiapp.xml you can now theme almost everything. We've added support for i18n, lib and platform folders. If you have a white-label app you can now easily brand strings, libraries and Android icons, splash screens and themes.

Sample

The Alloy sample demonstrates all three new theming features. The last one for Android only, where it should show the thumbs up image of the theme, not the default thumbs down.

Alloy Event Management

Alloy controllers have 3 new APIs to manage event listeners for Titanium view proxies. All events you add via XML now use $.addListener(proxy, type, callback) which is also available to you in the controller. Use $.getListener([proxy], [type]) to get all callbacks or only for a specific proxy and/or event type. Finally $.removeListener([proxy], [type], [callback]) can be used to remove all or specific event listeners. Just like $.destroy() you can call this when the controller's UI is "closed" to avoid memory leaks, e.g. by calling it in a Window close event.

Sample

In the Alloy sample you will find that we add the same callback as listener to the different events on the first button. In the controller you can see that the second button needs only one line of code to remove all listeners from that first button. While you're in the controller, also observe that when the controller is created we add a third tracked listener to the first button before logging all tracked listeners. When the window closes we remove all event listeners to any proxy or event in one call. See the console logs for details.

More Alloy

The Alloy sample also demonstrates the following new features:

  • You can now use Alloy.CFG.* properties in XML.
  • As well as Alloy.Globals.* variables.

iOS APIs

The iOS sample demonstrates a few new API's:

  • After MobileWeb and Windows Phone, iOS now also supports Ti.UI.ActivityIndicator.indicatorColor to set the color of the indicator.
  • For iPad-only, use showUndoRedoActions on TextFields and TextAreas to determine if iOS 9 should show the undo/redo and copy/paste actions in the toolbar above the soft keyboard. Be aware of TIMOB-19614 when toggling this property.

actions

Android Themes

This release introduces new predefined Titanium themes for Android to hide the action bar and optionally the status bar:

  • Theme.AppCompat.NoTitleBar: Hides the action and title bar
  • Theme.AppCompat.NoTitleBar.Fullscreen: Hides the above plus the status bar.

There are four ways to use the existing and new built-in themes:

  1. Set the android:theme attribute of the Android manifest application element in tiapp.xml to @style/ plus the theme name to apply it to use it as default for all windows.
  2. Set the parent attribute of your custom theme style element to @style/ plus the theme name.
  3. Use it for an individual Window via the creation-only theme property.
  4. Instead, set <navbar-hidden> or <fullscreen> to true in tiapp.xml to select Theme.AppCompat.NoTitleBar or Theme.AppCompat.NoTitleBar.Fullscreen.

Sample

Play around with the comments in tiapp.xml to see the different themes in action. You can also change the parent attribute of our custom_theme.xml. Be aware that you need to remove or comment out the <application> element to test <navbar-hidden> and <fullscreen>. The Android sample demonstrates the use of a window's theme property. when using a window's theme property

NOTE: If you use a TabGroup in your app then you can not use a theme without action bar. Also be aware of TIMOB-19613.

Android Elevation

Since Titanium 3.3 iOS has viewShadowOffset and now Android gets elevation. Is it the same? Let Google explain why it's not.

Sample

The android sample demonstrates this new property. Use the slider to change the elevation value. As the TSS shows you need to make sure your view has some space around it or else the parent will clip the elevation shadow. The view also needs a backgroundColor since a transparent view wouldn't cast much shadow.

elevation

Other Android APIs

This release supports adding a large icon to be shown in the content area of a notification. As the android sample demonstrates simply set the Ti.Android.Notification.largeIcon property to a system or app drawable, like the big fast forward icon I use:

elevation

Also new is Ti.UI.Picker.selectionOpens which determines whether calling the method setSelectedRow() also opens the picker. Tap the button under the picker to see it in action.

CLIs

Not demonstrated in the sample, but definitely worth mentioning are some new features in the different CLIs:

Appcelerator CLI

Also new on the CLI front are two command for the Appcelerator CLI. The info commands combines the results from appc ti info with information about Appcelerator CLI Installer and Core Package. The other allows you to switch to another org without needing to logout and in again. Pass --org-id <id> if you know the ID. We're working on making this easier in Studio as well.

appc info
	Display development environment information
appc switch org [options]
	switch logged in org

Titanium CLI

If you clean a project in Studio or via CLI using [appc] ti clean it used to only clean the build folder, but now it also cleans the Resources folder if it's an Alloy project. Whenever you run into an issue, always first clean to rule out any errors introduced by the incremental builds we do to speed up your development workflow.

Alloy CLI

Thanks to a PR by Kosuke Isobe Alloy now has some of the new commands Kosuke introduced in alloy-smelter:

[appc] alloy copy <source> <destination>
	copy the controller, view, and style files from <source> to <destination>

[appc] alloy move <source> <destination>
	move the controller, view, and style files from <source> to <destination>

[appc] alloy remove <source>
	remove the controller, view, and style files at <source>

Windows

Alloy now supports <CommandBar> for Windows. We've also added support for Windows to a lot of API's of Ti.Media, Ti.Clipboard, Ti.UI.ScrollView, Ti.UI.Switch and Ti.UI.View. Since you'll know most of these APIs from iOS and Android I haven't include them in the sample.