diff --git a/docs/html/auto/images/carlogos.png b/docs/html/auto/images/carlogos.png new file mode 100644 index 0000000000000..3522aa3b35009 Binary files /dev/null and b/docs/html/auto/images/carlogos.png differ diff --git a/docs/html/auto/images/figure01.png b/docs/html/auto/images/figure01.png new file mode 100644 index 0000000000000..30440203a3172 Binary files /dev/null and b/docs/html/auto/images/figure01.png differ diff --git a/docs/html/auto/images/figure02.png b/docs/html/auto/images/figure02.png new file mode 100644 index 0000000000000..1b87224a40754 Binary files /dev/null and b/docs/html/auto/images/figure02.png differ diff --git a/docs/html/auto/images/figure03.png b/docs/html/auto/images/figure03.png new file mode 100644 index 0000000000000..0c4e20da0315f Binary files /dev/null and b/docs/html/auto/images/figure03.png differ diff --git a/docs/html/auto/images/figure04.png b/docs/html/auto/images/figure04.png new file mode 100644 index 0000000000000..3e9c8947ffa92 Binary files /dev/null and b/docs/html/auto/images/figure04.png differ diff --git a/docs/html/auto/images/figure05.png b/docs/html/auto/images/figure05.png new file mode 100644 index 0000000000000..9c1d9b8ae6cd0 Binary files /dev/null and b/docs/html/auto/images/figure05.png differ diff --git a/docs/html/auto/images/figure06.png b/docs/html/auto/images/figure06.png new file mode 100644 index 0000000000000..8140f0c8163e8 Binary files /dev/null and b/docs/html/auto/images/figure06.png differ diff --git a/docs/html/auto/images/figure07.png b/docs/html/auto/images/figure07.png new file mode 100644 index 0000000000000..82c1c76f20d7b Binary files /dev/null and b/docs/html/auto/images/figure07.png differ diff --git a/docs/html/auto/images/figure08.png b/docs/html/auto/images/figure08.png new file mode 100644 index 0000000000000..f11e3a8b5c25c Binary files /dev/null and b/docs/html/auto/images/figure08.png differ diff --git a/docs/html/auto/images/hero.jpg b/docs/html/auto/images/hero.jpg new file mode 100644 index 0000000000000..3f9114f546f72 Binary files /dev/null and b/docs/html/auto/images/hero.jpg differ diff --git a/docs/html/auto/index.jd b/docs/html/auto/index.jd new file mode 100644 index 0000000000000..2a527b365e8cb --- /dev/null +++ b/docs/html/auto/index.jd @@ -0,0 +1,194 @@ +page.title=Android Auto +page.viewport_width=970 +fullpage=true +no_footer_links=true + +@jd:body + + + + + + +
+ + + +Maps, music, search and more in your vehicle, powered by your Android phone. + Voice actions and feedback. Useful local information. Clean user interfaces to + keep your eyes on the road.
+
+
+ When users connect their Android phone to an Android Auto enabled vehicle, the + system shows an interface that lets users select compatible apps and services to run. +
+Android Auto provides new APIs and tools that your existing Android apps can + leverage to run on any compatible vehicle. Users interact with your apps through the + touch screen and the physical buttons on the vehicle’s dashboard. Your apps can also + respond to voice commands. +
+We designed Android Auto to minimize driver distraction. Android Auto provides UI + templates for several app categories. These templates define the user interaction model + for any app and follow international best practices for reducing driver distraction.
+You can customize these templates to fit your brand and link them to your app’s + content and functionality, instead of building new UIs and testing them for driver + distraction, which is a lengthy and costly process.
+Android Auto locks any device that users connect to a compatible vehicle, so drivers + interact with the device using voice actions and the vehicle’s input controls.
++ Android Auto is coming soon to new cars from these manufacturers: +
+
+ In the coming months, we’ll be releasing the Android Auto SDK, which includes APIs + and tools to make your existing apps compatible with Android Auto. The first version + of the SDK will provide templates and APIs for music, podcast, live radio, and audio + news apps, as well as limited voice actions.
+Future versions of the Android Auto SDK will include support for a selection of + Android notifications, additional voice actions, and templates and APIs for + messaging, communication, local search, and more.
+ + +G+ Community
++ Join the Android Auto developer community on Google+ to stay involved, get the + latest updates, and exchange experiences with other developers. + +Android Auto Developers +
+Android Auto extends the Android platform to car entertainment systems. When users connect +their Android handheld device to a compatible vehicle, Android Auto lets users project apps on +the vehicle’s touchscreen and interact with them using the vehicle’s controls.
+ +We’ll release the Android Auto SDK in the coming months, which will let you test your +Android Auto experience on a regular Android device.
+ + +Digital experiences for cars should complement and augment driving, not demand the driver's +attention. Designing these experiences for cars is fundamentally different than in the case of +phones and tablets. It requires rethinking how these experiences unfold.
+ +Glanceable. We designed Android Auto to reduce UI complexity, optimize user +interactions, and lower cognitive load. Effective apps show just enough information +and only provide features that do not require excessive menu interaction and navigation.
+ +Predictive, yet predictable. Android Auto leverages rich, contextual awareness +to keep the driver informed about important situations. Timely help is combined with predictable +functions. Effective apps use patterns for common tasks and show timely information only when +relevant.
+ +Connected. Android Auto works with apps that drivers already use in other +devices. Android Auto promotes a continuous app experience from phones and tablets to cars, +providing access to user's existing settings, subscriptions, and digital libraries. Experiences +that bring personal content and context from other devices are part of Android Auto.
+ +Integrated. Android Auto blends your apps with the vehicle's entertainment +system, creating a truly integrated experience in every car. By using the vehicle's screen and +controls, apps feel tailored to each car.
+ +Android Auto is a new environment that leverages existing UI models where appropiate and adds +new models based on constrains and context. There are three primary concepts for Android Auto: +Suggest, a unified place for predictive content; Demand, a +pervasive way to interact with voice; and the Facets, organized spaces for +primary activities, apps and content.
+ +Android Auto uses the input and output mechanisms in each vehicle to tailor the interactions. +Some vehicles have dedicated hardware controls, while others have primarily touch-based systems. +Android Auto maps common actions and intents across these diverse sets of controls and outputs to +enable you to concentrate on your unique app experience.
+ + +The Android Auto app projects your app's customized UI on the vehicle's screen. To communicate +with the Android Auto app, your media app implements a set of media interfaces.
+ +
++ Figure 1 - Architecture of Android Auto. +
+The architecture consists of the following components:
+ +Media App - Runs a media service that exposes content through browsing and +playback APIs. The service provides content to the Android Auto app. This is your Android app.
+ +Android Auto App - Creates a templated UI and handles user interactions. +This app uses a media client to request content from the media service running in the media +app. The client requests data from the media service and monitors service states.
+ +Vehicle Display - Shows app content and supports user interaction via +on-screen soft buttons and other components, such as physical buttons or steering +wheel controls.
+ +Android media apps must implement binders to these APIs:
+ +The Android Auto app uses a templated UI to display content and user interaction +opportunities. Android Auto provides you with a set of standard UI templates that follow +international guidelines for minimizing driving distraction. You do not have to test your +app's UI for for driver distraction, which is a lengthy and expensive process involving +multiple legislations across the globe and different standards for each vehicle OEM.
+ +The UI templates define interfaces for browsing, searching, and listening to content from +media apps. Although you cannot change the standard template format or layout, you can customize +the template colors, action icons, background images, and more.
+ +The Launcher template shows all the compatible media apps installed on the user’s +Android device and lets users select one of them from an scrollable list:
+ +
++ Figure 2. The Launcher template. +
+After the user selects a media app, the display shows the primary app template. Figure +3 shows the elements of this template that you can customize:
+ +
++ Figure 3. The main application template. +
+You can customize the primary app template to show your own icons, app name, and +background images. Figure 4 shows an example of a customized template:
+ +
++ Figure 4. A customized template. +
+The primary app template supports four main actions on the action bar, four auxiliary actions +on the overflow bar, and the Return action. You can use standard controls and customize +the actions and icons, as shown in Figure 5.
+ +
++ Figure 5. Custom icons for auxiliary actions. +
+For browse actions, the display shows the drawer transition and template:
+ +
++ Figure 6. The drawer transition. +
+After the transition from the primary app template to the drawer template, the drawer +appears on the center. The customized drawer template shows the media containers and +media files provided by the media service in your app. You can also customize drawers +with icons for list items.
+ +
++ Figure 7. A customized drawer template. +
+All the templates support different color schemes for day and night, as shown in +Figure 8. The platform provides the state (day or night) and makes adjustments automatically.
+ +
++ Figure 8. Day and night transitions. +
+To customize the templates, provide the following app-specific resources and actions +to the Android Auto media client.
+ +If provided, the media client automatically uses them in the templated UI.
+ + +Note: When released, the Android Auto SDK will provide +media service interfaces, an APK for handheld devices that simulates the Android Auto +app, and other tools for Android Auto development.
+ +To create a media app for Android Auto, you include an Android service in your app +that implements the media service interfaces provided by the Android Auto SDK. These +interfaces define functionality for browsing and finding content, playing media, +customizing the UI template, and performing app-specific actions.
+ +The media service interfaces present the content library as a navigable tree and enable +clients to play media, get album art, obtain theme resources for the UI template, and +invoke app-specific actions.
+ +You don’t have to create a new app for Android Auto: you can extend your existing +Android app with implementations of the media service interfaces. Your service exposes +your app’s media content, theme resources, and app-specific actions using the methods and +data types specified by the media service interfaces. This simplifies the development +cycle because:
+ +The Android Auto client presents the customized UI to users and invokes the +functionality from your service as needed. This has two additional advantages:
+ +This also means that you do not have to worry about vehicle-specific hardware +differences such as screen resolutions, software interfaces, knobs and touch +controls.
+ + +The Android Auto SDK includes an APK with a media client implementation, which is +similar to those available in compatible vehicles. To test your app with this +client:
+ +The customized UI for your app appears on the client. You can navigate the content +library and play media. If your app provides app-specific actions, these actions appear +in the UI controls.
+ + +Media apps are available on the Google Play Store for compatible Android devices. +When users connect their Android device to a compatible vehicle, the +Android Auto media client shows a list of all the Android apps installed on the phone +that implement the media service interfaces.
+ +When users select one of these apps, the Android Auto media client uses the app’s +service to respond to user input and invoke the methods in the media service interfaces +to build the UI, navigate the content library, and play media.
+ +
+
+As a developer of apps for TV, you should follow certain patterns to enable users to + quickly understand and efficiently your app. This section describes recommended design patterns + for TV apps.
+ +Users typically navigate TV devices using a directional pad (D-Pad). This type of controller + limits movement to up, down, left, and right. In a typical D-Pad remote, hardware keys that + correspond to those directions are present and an additional action key is available to make a + selection. As you design your Android application for TVs, pay special attention to how users + navigate your application when using a remote control instead of a touchscreen.
+ +[add visual: D-Pad image or illustration]
+ +A key aspect of making your application work well with a D-Pad controller is to make sure + that there is always a object that is obviously in focus. If a user cannot see what is in focus, + they will not be able to navigate your app intuitively with this type of controller.
+ +Optimize your app screen layouts for D-Pad navigation. Align objects in your app lists and + grids to make navigation within each screen intuitive. Design your layout so it takes advantage of + two-axis navigation.
+ + ++ In addition to the D-Pad buttons, Android TV devices always include Home and Back buttons on their + controllers. Make sure the Back button functions within your app in a way that is consistent with + the general Android Design guidelines. +
+ + +Providing good focus and selection indicators is key to making your app useable on TV. As + mentioned previously, making sure that an object is always selected in your app is critical for + effective navigation using a D-Pad. This requirement also means that you must use focus indicators + that are easy to recognize and should be consistent throughout your app.
+ ++ [add visual of selected item on screen] +
+ +The default focus indicator used in Android TV use a combination of scale, shadow, + brightness, and opacity. The focus feedback is enhanced by displaying an animation going from a + non-focused to a focused state and back. Instead of immediately applying the focus transformation, + it is animated into place to reduce abrupt changes and help users notice how the object changed.
+ +Sounds on Android TV bring a cinematic quality to the interaction experience. You should + consider adding sounds for user actions or to provide feedback when a user is only partially + visually engaged with the screen (e.g., because they have their hands full or are multitasking). + You should also consider using sounds as alternatives to error messages, for example to indicate + that a user has reached the end of a list or is trying to navigate to an undefined location.
+ ++ App Banners represent your app on the home screen of TV devices and serves and as a way for + users to launch your app. Here are specific requirements for the banner image: +
+ +The app icon is shown in recommendation cards on the Home screen, search results and the main + Browse screen of your app if you use {@code BrowseFragment}. Here are the specific + requirements for the app icon:
+ +Full color: size: 52x52dp, PNG
Monocolor: size 52x52dp, white(#fff) icon with transparent background, PNG
Background images are displayed in the background of your app to provide additional visual + interest, information or branding. The BrowseFragment and DetailsFragment classes in the Leanback + support library provide specific support for background images and updating them as items are + brought into and out of focus. Here are the specific requirements for background images:
+ ++ Note: If the image does not meet this requirement, it is scaled to fit. +
\ No newline at end of file diff --git a/docs/html/design/tv/principles.jd b/docs/html/design/tv/principles.jd new file mode 100644 index 0000000000000..5c0ce10131742 --- /dev/null +++ b/docs/html/design/tv/principles.jd @@ -0,0 +1,45 @@ +page.title=Design Principles for TV +@jd:body + +Users bring a specific set of expectations to the experience of watching TV, versus + interacting with a phone or tablet. These principles have been developed by the Android User + Experience Team to guide creation of the Android TV platform and the apps that run on it.
+ +The TV is an entertainment interface, not a computer or mobile device. Optimize for + activities that put content at the center: from the casual posture of movie-watching, to + edge-of-seat, immersive gameplay, to hanging out with friends in a living room.
+ +Users expect immediate access to to content when they turn on a TV. Get users into the action + fast, be it the big game, their favorite show, or a game with friends. The next piece of content + to watch or play should only be a click or two away.
+ ++ [add a visual] +
+ + +Create immersive experiences for the user. Design for as little user interface and as much + content as possible on each screen. Use visual imagery, movement and sound to inform and delight + users. Avoid using on-screen text to convey information and purpose. Tell your story with pictures + and sound.
+ ++ [add a visual] +
+ + +An Android TV should be simple and magical. It’s all about finding and enjoying content and + apps with the least amount of friction. Minimize the number of navigation steps required to + perform actions. Build apps with the fewest screens possible between app entry and content + immersion. Avoid making users enter text whenever possible, and use voice interfaces when you + require text input.
+ ++ [add a visual] +
diff --git a/docs/html/design/tv/style.jd b/docs/html/design/tv/style.jd new file mode 100644 index 0000000000000..479ed91c093e2 --- /dev/null +++ b/docs/html/design/tv/style.jd @@ -0,0 +1,108 @@ +page.title=Style for TV +page.tags="design" +@jd:body + + +Follow these style guidelines to create beautiful, functional apps for TV.
+ + +The difference between a TV experience that feels right and one that does not greatly depends + on the number, spacing and size of on-screen elements. Although TV sizes and resolutions have + steadily increased over time, users expect TV experiences to be relatively simple and + uncluttered.
+ +The additional resolution and screen area afforded by modern displays is best used to display + things at better quality, rather than greater quantity. For example, use your layouts to show + large, beautiful pieces of content, or resize type for both easy reading and generous spacing.
+ +If you are creating an app for browsing and playing content, use the prebuilt fragments in the + Leanback support library. These layouts have been built specifically for use on TV devices with + the guidance of the Android User Experience team. For more information on using these classes, + see the User Interfaces guide. +
+ +Here are some additional recommendations for creating functional and attractive layout for TV + apps:
+ +Build layouts designed for landscape orientation. TV screens always use in this + orientation.
Put on-screen navigational controls on the left or right side of the screen and + save the vertical space for content.
Create UIs that are divided into sections, by using Fragments and use view groups + like GridView instead of ListView to make better use of the horizontal screen space.
Add sufficient margins between layout controls to avoid a cluttered interface.
TV devices running Android are intended to operate at HD resolution (1920 x 1080 pixels) or + higher. Design your artwork assets for best viewing at this resolution.
+ + +During the evolution of TV technology, overscan originally described an area of TV content + outside of a safe zone that most TVs could reliably display. Even on some of today’s HDTV flat + screens, areas outside that zone may not be visible.
+ +
+
+Build a 10% margin into your TV screen designs to account for overscan area the TV may not + display correctly. On a 1920 x 1080 pixel screen, this margin should be a minimum of 27px from the + top and bottom edges and a minimum of 48px from the right and left edges of the picture.
+ + +Color rendering on televisions can be imprecise compared to computer monitors or mobile + devices. LCD and Plasma TVs often apply smoothing and sharpening filters, and color rendering may + not match what you see on a computer screen.
+ +Subtle hue or brightness differences between elements may disappear or be over-emphasized on + TV screens. Some color gradient combinations will show bands. You should avoid pure whites and + highly saturated colors in large areas of the screen (especially reds, greens and blues). You + should also avoid using very dark or muddy colors, as TV settings may display these colors with + exaggerated contrast, causing them to be indistinguishable.
+ + +The text and controls in a TV application's UI should be easily visible and navigable from a + distance. The minimum recommended font size for TV is 12sp. The default text size setting should + be 18sp. We recommend the following guidelines for TV apps:
+ +[visual showing text on a TV screen (sidebar position)]
+ +Some TVs have strong sharpness and contrast settings as their defaults. These picture + settings make thin and light typefaces look jagged and make the text difficult for people to read. + Therefore you should avoid thin or light typefaces on TV.
+ +Use text in TV apps sparingly. The position of users relative to a TV screen + (typically about 10 away) makes it harder for users to read text and the expectation of users in a + TV environment not conducive to reading. Follow these tips for the best handling of text in your + app:
+ +The Android TV system user interface provides the launch pad for your app's big screen + experience. It's important to understand how your app is presented in the main user interface and + how your app can help users get to the content they want quickly, including contributing content + suggestions to the recommendations row.
+ +This section provides quick overview of the Android TV user interface.
+ + +The Home Screen is the start of a TV user's experience, providing search, content + recommendations, access to apps and settings. The Home Screen provides a rich and cinematic + overview of apps and content.
+ +
+
+
+By bringing the power of Google search to the big screen, Android TV makes new, dynamic + connections between content - a favorite movie may connect to the discovery of a new music artist, + planning trip to Paris might surface new YouTube content and photos.
+ +
+
+
+The recommendation row on Android TV is a central feature of the Home Screen that allows + users quick access to dynamic and relevant content for their media consumption activities. The + stream is optimized for quick browsing of personalized content and activity resumption (on the + device and across devices), while also providing a way for users to act on meaningful new content.
+ +
+
++ The recommendations are based on the user’s recent and frequent usage behaviors, as well as + expressed content preferences. They are presented as cards that represent a system or app action, + notification, activity, or piece of actionable media. Your app can provide suggestions for the + recommendations row to help get your content noticed. To learn more, see + Recommendations. +
+ + +Apps and Games rows both have special areas on the Home Screen. Within these respective + areas, Apps and Games titles are reordered to reflect the user’s recent usage.
+ +
+
+
+Access to Settings is found at the bottom of the Home Screen. From here, the user can access + Android and device-specific settings. Please see the "Settings" section for more detailed + information.
+ +
diff --git a/docs/html/index.jd b/docs/html/index.jd
index a4b0683a1a655..6394b73eae7fe 100644
--- a/docs/html/index.jd
+++ b/docs/html/index.jd
@@ -1,159 +1,83 @@
fullpage=true
page.viewport_width=970
no_footer_links=true
-carousel=true
excludeFromSuggestions=true
page.metaDescription=The official site for Android developers. Provides the Android SDK and documentation for app developers and designers.
page.customHeadTag=
@jd:body
-
L is an upcoming release for the Android platform +that offers new features for users and app developers. This document provides +an introduction to the most notable new APIs.
+ +L is currently available as a developer preview intended +for early adopters and testers. If you are interested in influencing the +direction of the Android framework, +give the L Developer Preview a +try and send us your feedback!
+ +Caution:You should not publish apps +using L Developer Preview to the Google Play store.
+ +If you have previously published an app for Android, be aware that your app + might be affected by changes in L.
+ +Notifications will be drawn with dark text atop white (or very light) +backgrounds to match the new material design widgets. Make sure that all your +notifications look right with the new color scheme. You should remove or update +assets and text styles that involve color. The system will automatically invert +action icons in notifications. Use +{@code android.app.Notification.Builder.setColor()} to set an accent color +in a circle behind your {@code Notification.icon} image.
+ +The system will ignore all non-alpha channels in action icons and the main +notification icon, so you should assume that these icons will be alpha-only. +
+ +If you are currently adding sounds and vibrations to your notifications by +using the {@link android.media.Ringtone}, {@link android.media.MediaPlayer}, +or {@link android.os.Vibrator} classes, make sure to remove this code so that +the system can present notifications correctly in Do not disturb mode. You +should use the {@link android.app.Notification.Builder} methods instead to add +sounds and vibration. +
+ +Lockscreens in L will not show transport controls for your +{@link android.media.RemoteControlClient}. Instead, your app can provide +media playback control from the lockscreen through a media notification. This +gives your app more control over the presentation of media buttons, while +providing a consistent experience for users across the lockscreen and +the unlocked device.
+ +You must call {@code Notification.Builder.setVisibility(Notification.VISIBILITY_PUBLIC)} to mark your media notification as safe to reveal, even when the lockscreen is secured +with a PIN, pattern, or password.
+ +Notifications now appear in a small floating window if all these conditions +are met: the user’s activity is in fullscreen mode, the screen is on, and the +device is unlocked. If your app implements fullscreen activities, make sure that +these heads-up notifications are presented correctly.
+ +With the introduction of the new document tasks feature in L (see below), +the {@code android.app.ActivityManager.getRecentTasks()} method is now +deprecated to improve user privacy. For backwards +compatibility, it will still return a small subset of its data including the +calling application’s own tasks and possibly some other non-sensitive tasks +such as home. If your app is using this method to retrieve its own tasks, +use {@code android.app.ActivityManager.getAppTasks()} instead to retrieve that +information.
+ +L adds support for the material design style. You can create +material design apps that are visually dynamic and have UI element transitions +which feel natural and delightful to users. This support includes:
+To learn more about adding material design functionality to your app, see +Material design on Android.
+ +Lockscreens in L Developer Preview have the ability to present notifications. +User can choose via Settings whether to allow sensitive notification +content to be shown over a secure lockscreen.
+ +Your app can control the level of detail visible when its notifications are +displayed over the secure lockscreen.To control the visibility level, call +{@code android.app.Notification.Builder.setVisibility()} and specify one of these +values:
+The L Developer Preview uses metadata associated with your app notifications +to more intelligently sort your notifications. The metadata you set also +controls how the system presents your app notifications when the user is in Do +not disturb mode. When constructing your notification, you can call the +following methods in {@code android.app.Notification.Builder}:
+ +In previous releases, the +Recents screen +could only display a single task for each app that the user interacted with +most recently. The L Developer Preview allows your app to open additional tasks +for concurrent activities or documents. This feature facilitates multitasking +by letting users quickly switch between individual activities and documents +from the Recents screen. Examples of such concurrent tasks might include web +pages in a browser app, documents in a productivity app, concurrent matches in +a game, or chats in a messaging app. Your app can manage its tasks +through the {@code android.app.ActivityManager.AppTask} class.
+ +To insert a logical break so that the system treats your activity as a new +document, use {@code android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT} when +launching the activity with {@link android.app.Activity#startActivity(android.content.Intent) startActivity()}. You can also get this behavior by declaring the +<activity> +attribute {@code documentLaunchMode="intoExisting"} or {@code ="always"} in your +manifest.
+ +You can also mark that a task should be removed from the Recents screen +when all its activities are closed by using {@code android.content.Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS} when starting the root activity for +the task. You can also set this behavior for an activity by declaring the +<activity> +attribute {@code autoRemoveFromRecents=“true”} in your manifest.
+ +To avoid cluttering the Recents screen, you can set the maximum number of +tasks from your app that can appear in the Recents screen through the +<application> attribute {@code android:maxRecent}. The current maximum that can be specified +is 100 tasks per user.
+ +The L Developer Preview updates the {@link android.webkit.WebView} +implementation to Chromium M36, bringing security and stability enhancements, +as well as bug fixes. The default user-agent string for a +{@link android.webkit.WebView} running on the L Developer Preview has +been updated to incorporate 36.0.0.0 as the version number.
+ +Additionally, this release brings support for the +WebAudio, WebGL, and +WebRTC open standards. To learn more about +the new features included in this release, see WebView for Android.
+ +Beginning in the L Developer Preview, users can more easily switch between +all input method editors (IME) supported by the platform. Performing the designated +switching action (usually touching a Globe icon on the soft keyboard) will cycle +among all such IMEs. This change takes place in +{@code android.view.inputmethod.InputMethodManager.shouldOfferSwitchingToNextInputMethod()}.
+ +In addition, the framework will now check whether the next IME includes a +switching mechanism at all, thus supporting switching to the IME after it. An +IME with a switching mechanism will not cycle to an IME without one. This +change takes place in +{@code android.view.inputmethod.InputMethodManager.switchToNextInputMethod()}. + +
To see an example of how to use the updated IME-switching APIs, refer to the +updated soft-keyboard implementation sample in this release.
+ +The L Developer Preview adds Java interfaces and native support for OpenGL +ES 3.1. Key new functionality provided in OpenGL ES 3.1 includes:
+ +The Java interface for OpenGL ES 3.1 on Android is provided with GLES31. When using OpenGL ES 3.1, be sure that you declare it in your manifest file with the +{@code <uses-feature>} tag and the {@code android:glEsVversion} attribute. For example:
+ ++<manifest> + <uses-feature android:glEsVersion="0x00030001" /> + ... +</manifest> ++ +
For more information about using OpenGL ES, including how to check the device’s supported OpenGL ES version at runtime, see the OpenGL ES API guide.
+ +The L Developer Preview introduces the new {@code android.hardware.camera2} +API to facilitate fine grain photo capture and image processing. You can now programmatically access the camera devices available to the system with {@code CameraManager.getCameraIdList()} and connect to a specific device with {@code CameraManager.openCamera()}. To start capturing images, you +need to create a {@code CameraCaptureSession} and specify the +{@link android.view.Surface} objects to send the captured images. The {@code CameraCaptureSession} can be configured to take single shots or multiple images +in a burst.
+ +To be notified when new images are captured, implement the +{@code CameraCaptureSession.CaptureListener()} interface and set it in your +capture request. Now when the system completes the image capture request, your +{@code CameraCaptureSession.CaptureListener()} receives a call to +{@code onCaptureCompleted()}, providing you with the image capture metadata in a +{@code CaptureResult}.
+ +This release includes the following changes for + {@code android.media.AudioTrack}:
+You can now build your own media controller app with the new +{@code android.media.session.MediaController} class, which provides +simplified transport controls APIs that replace those in +{@code android.media.RemoteControlClient}. The {@code MediaController} class +allows thread-safe control of playback from a non UI process, making it easier +to control your media playback service from your app’s user interface. + +
You can also create multiple controllers to send playback commands, +media keys, and other events to the same ongoing +{@code android.media.session.MediaSession}. When you add a controller, you must +call {@code MediaSession.getSessionToken()} to request an access +token in order for your app to interact with the session.
+ +Send transport commands such as "play", "stop", "skip", and +"set rating" by using {@code MediaController.TransportControls}. To handle +in-bound media transport commands from controllers attached to the session, you +should override the callback methods in +{@code MediaSession.TransportControlsCallback}.
+ +You can also create rich notifications that allow playback control tied to a +media session with the new {@code android.app.Notification.MediaStyle} class.
+ +The L Developer Preview extends the Storage Access Framework to let users +select an entire directory, rather than individual files, to give your app +read/write access to media files. When a directory is selected, your app also +has access to all its child directories and content.
+ +To get the absolute paths to directories on external storage devices where +applications can store media files, call the +{@code android.content.Context.getExternalMediaDirs()} method. No additional +permissions are needed by your app to read or write to the returned paths. +External storage devices here are those considered by the system to be a +permanent part of the device, and includes emulated external storage and +physical media slots such as SD cards in battery compartments.
+ +If you want to access a document in an existing directory, call the +{@code android.provider.DocumentsContract.buildDocumentViaUri()} method and pass +in a Uri representing the path to the parent directory and the target document +ID. The method returns a new {@link android.net.Uri} with which your app can +use to write media content with {@code DocumentsContract.createDocument()}. + +
The L Developer Preview provides new multi-networking APIs for your app to +dynamically scan for available networks with specific capabilities, and +establish a connection to them. This is useful when your app requires a +specialized network, such as an SUPL, MMS, or carrier-billing network, or if +you want to send data using a particular type of transport protocol.
+ +To select and connect to a network dynamically from your app, first +instantiate a {@code android.net.ConnectivityManager}. Next, create a +{@code android.net.NetworkRequest} to specify the network features and transport +type your app is interested in. To start scanning for suitable networks, call +{@code ConnectivityManager.requestNetwork()} or +{@code ConnectivityManager.registerNetworkCallback(), and pass in the +{@code NetworkRequest} object and an implementation of +{@code ConnectivityManager.NetworkCallbackListener}.
+ +When the system detects a suitable network, it connects to the network and +invokes the {@code NetworkCallbackListener.onAvailable()} callback. You can use +the {@code android.net.Network} object from the callback to get additional +information about the network, or to establish a socket connection.
+ +Android 4.3 introduced platform support for Bluetooth Low Energy +(BLE) in the central role. In the L Developer Preview, an Android device can now +act as a Bluetooth LE peripheral device and make its presence known to +nearby devices. For instance, you can build apps that allow a device to +function as a pedometer or health monitor and communicate its data with another +BLE device.
+ +The new {@code android.bluetooth.le} APIs enable your apps to broadcast advertisements, scan for responses, and form connections with nearby BLE devices. +You must add the {@code android.permission.BLUETOOTH_ADMIN} permission in your +manifest in order for your app to use the new advertising and scanning features. + +
To begin Bluetooth LE advertising so that other devices can discover the +device running your app, call {@code android.bluetooth.le.BluetoothAdvertiser.startAdvisertising()} and pass in an implementation of the +{@code android.bluetooth.le.AdvertiseCallback} class to report the success +or failure of the advertising operation.
+ +Conversely, if you want to scan for Bluetooth LE devices nearby, call +{@code android.bluetooth.le.BluetoothLeScanner.startScan()} and pass in an +implementation of {@code android.bluetooth.le.ScanCallback} to report if a +Bluetooth LE advertisement is found. Optionally, you can pass in filters to scan +for a specific type of device.
+ +The L Developer Preview adds these enhancements to enable wider and more +flexible use of NFC:
+ +The L Developer Preview provides a new {@code android.app.job.JobScheduler} +API that lets you define jobs for the system to run asynchronously at a later +time that optimizes battery life, such as when the device is charging. This is +useful when you want to defer non user-facing units of work, have application +code that accesses the network, or want to run a number of tasks as a batch on +a regular schedule.
+ +A {@code android.app.job.JobInfo} object encapsulates such a unit of work, +and provides an exact description of the criteria you are scheduling.
+ +Use the {@code android.app.job.JobInfo.Builder} to configure how the +scheduled task should run. You can schedule the task to run under specific +conditions such as only while the device is charging, when connected to an +unmetered network, or when the system deems the device is idle.
+ +For example, you can add code like this to run your task on an +unmetered network:
+ ++JobInfo uploadTask = new JobInfo.Builder(mJobId, mServiceComponent) + .setRequiredNetworkCapabilities(JobInfo.NetworkType.UNMETERED) + .build(); + +JobScheduler jobScheduler = + (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE) +jobScheduler.schedule(uploadTask); ++ +
The L Developer Preview provides several new developer tools and APIs to help +you better measure and understand your app's power usage.
+ +The {@code dumpsys batterystats} command allows you to generate interesting +statistical data about battery usage on a device, organized by unique user ID +(UID). The statistics generated by the tool include:
+ +Use the {@code --help} option to learn about the various options that you +can apply for tailoring the output. For example, to run the tool to print +battery usage statistics since the device was last charged for a given app +package, run this command: +
+$ adb shell dumpsys batterystats --charged++
The Battery Historian tool ({@code historian.par}) analyzes L-based Android +bug reports and creates an HTML visualization of power-related events. It can +also visualize power consumption data from a power monitor, and will attempt to +map power usage to the wakelocks seen. You can find the Battery Historian tool +in {@code <sdk>/tools}.
+ +For best results, you should first enable full wakelock reporting to allow +the Battery Historian tool to monitor uninterrupted over an extended period of +time:
++$ adb shell dumpsys batterystats --enable full-wake-history ++ +
You should also reset battery statistics at the beginning of a +measurement:
++$ adb shell dumpsys batterystats --reset ++ +
To generate an HTML visualization:
++$ historian.par [-p powerfile] bugreport.txt > out.html ++
You can use the {@code android.os.BatteryManager} API to obtain power +consumption information based on the battery fuel gauge included in Android +phones and tablets. This is useful in cases when it is not convenient to +connect external measurement equipment to the Android device.
+To retrieve the battery properties, call {@code BatteryManager.getIntProperty()} +or {@code BatteryManager.getLongProperty()}. The properties available, the +exact resolution of the values of each, and other characteristics such as +update frequency depend on the particular device being tested.
+ +The following properties can be inspected on all Android devices:
+ +| Property | +Description | +
|---|---|
| {@code BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER} | +Remaining battery capacity in microampere-hours. | +
| {@code BatteryManager.BATTERY_PROPERTY_CURRENT_NOW} | +Instantaneous battery current in microamperes. | +
| {@code BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE} | +Average battery current in microamperes | +
| {@code BatteryManager.BATTERY_PROPERTY_CAPACITY} | +Remaining battery capacity as an integer percentage. | +
| {@code BatteryManager.BATTERY_PROPERTY_ENERGY_COUNTER} | +Remaining energy in nanowatt-hours. | +
The L Developer Preview provides new functionality for running apps within +an enterprise environment:
+To start the manged provisioning process, send +{@code ACTION_PROVISION_MANAGED_PROFILE} in an {@link android.content.Intent}. A +user may be associated with more than one managed profile. To get a list of the +managed profiles associated with the user, call +{@code android.os.UserManager.getUserProfiles()}.
+ +Once a managed profile is created for a user, apps that are managed by the +device administrator will appear alongside non-managed apps in the user’s +Launcher, Recent apps screen, and notifications. A device policy management app +can make the managed apps visually prominent by appending a “work” badge to the +icon drawable with {@code android.os.UserManager.getBadgeDrawableForUser()}.
+ +If you are developing a Launcher app, you can use the new {@code android.content.pm.LauncherApps} class to get a list of launchable activities for the current user +and any associated managed profiles.
+ +You can now render PDF document pages into bitmap images for printing by +using the new {@code android.graphics.pdf.PdfRenderer} class. You must specify a +{@code ParcelFileDescriptor} that is seekable (that is, the file can be randomly +accessed) on which the system writes the the printable content. Your app can +obtain a page for rendering with {@code openPage()}, then call {@code render()} +to turn the opened {@code PdfRenderer.Page} into a bitmap. You can also set +additional parameters if you only wan to convert a portion of the document into +a bitmap image (for example, to implement tile rendering in order to zoom in on the document).
+ +The L Developer Preview adds the following support for testing and +accessibility:
+ +The following values are now supported in the {@code <uses-feature>} element so you +can ensure that your app is installed only on devices that provide the features +your app needs.
+ ++<uses-feature android:name="android.software.leanback" + android:required="true" /> ++ +
+<uses-feature android:name="android.software.managedprofiles" + android:required="true" /> ++
+<uses-feature android:name="android.software.webview" + android:required="true" /> ++
The following values are now supported in the {@code <uses-permission>} to declare the +permissions your app requires in order to access certain APIs. + +
An early look at the next release
+Test and build your apps against the next
+ version of Android to ensure they're ready
+ when the platform officially launches.
+
+
+ A New UI Design
++ Create a consistent experience across mobile and the web with + Material, the new Google design standard. +
++ Learn about +
+
+ A Rehauled Runtime
++ Test your apps and get them ready for ART (Android Runtime), + the default runtime in the next release. + +
++ Learn more +
+
+ Enhanced Notifications
++ Get more control over where notifications appear, + how they look, and automatic syncing to non-handheld devices. +
++ Learn more +
+
+ Project Volta
++ We've tuned the platform to be more energy efficient and + to give you more control over resource usage. +
++ Learn more +
+See the API overview for more information + on the rest of the new and updated features.
+We're giving you an early look at the SDK, so you can test your apps and build in new features.
+You'll get the system images for the Nexus 5, Nexus 7 (v2), + and the emulator to take the new platform for a spin. In addition, you'll have + access to all the APIs with a preview build of the SDK. +
+ +Check out the getting started, developer guides, and reference documentation + for all the information you need to get up and running.
+ + + Get Started + +Animations in material design give users feedback on their actions and provide visual +continuity as users interact with your app. The Material theme provides some default animations +for buttons and activity transitions, and the Android L Developer Preview provides additional +APIs that let you customize these animations and create new ones:
+ +In the Android L Developer Preview the default touch feedback animations for buttons use the new
+RippleDrawable class, which transitions between different states with a ripple
+effect.
To use this functionality in your custom views, create a RippleDrawable and set
+it as the background of your view. You can define a RippleDrawable as an XML resource
+using the ripple element.
The View.createRevealAnimator method enables you to animate a clipping circle
+to reveal or hide a view.
To reveal a previously invisible view using this effect:
+ ++// previously invisible view +View myView = findViewById(R.id.my_view); + +// get the center for the clipping circle +int cx = (myView.getLeft() + myView.getRight()) / 2; +int cy = (myView.getTop() + myView.getBottom()) / 2; + +// get the final radius for the clipping circle +int finalRadius = myView.getWidth(); + +// create and start the animator for this view +// (the start radius is zero) +ValueAnimator anim = myView.createRevealAnimator(cx, cy, 0, finalRadius); +anim.start(); ++ +
To hide a previously visible view using this effect:
+ +
+// previously visible view
+final View myView = findViewById(R.id.my_view);
+
+// get the center for the clipping circle
+int cx = (myView.getLeft() + myView.getRight()) / 2;
+int cy = (myView.getTop() + myView.getBottom()) / 2;
+
+// get the initial radius for the clipping circle
+int initialRadius = myView.getWidth();
+
+// create the animation (the final radius is zero)
+ValueAnimator anim = myView.createRevealAnimator(cx, cy, initialRadius, 0);
+
+// make the view invisible when the animation is done
+anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ super.onAnimationEnd(animation);
+ myView.setVisibility(View.INVISIBLE);
+ }
+});
+
+// start the animation
+anim.start();
+
+
+
+The Android L Developer Preview enables your app to customize the default animations for +activity transitions. You can specify custom animations for enter and exit transitions and for +transitions of shared elements between activities.
+ +
++ Figure 1 - A scene transition with one shared element. +
+ +First, enable window content transitions with the android:windowContentTransitions
+attribute when you define a style that inherits from the Material theme:
+<style name="BaseAppTheme" parent="android:Theme.Material"> + <!-- enable window content transitions --> + <item name="android:windowContentTransitions">true</item> + + <!-- specify enter and exit transitions --> + <item name="android:windowEnterTransition">@transition/explode</item> + <item name="android:windowExitTransition">@transition/explode</item> + + <!-- specify shared element transitions --> + <item name="android:windowSharedElementEnterTransition"> + @transition/move_image</item> + <item name="android:windowSharedElementExitTransition"> + @transition/move_image</item> +</style> ++ +
You can also specify enter, exit, and shared element transitions in your style definition.
+The move_image transition in this example is defined as follows:
+<!-- res/transition/move_image.xml --> +<!-- (see also Shared Transitions below) --> +<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> + <moveImage> + <targets> + <!-- shared view in the first activity --> + <target android:targetId="@id/image_small" /> + <!-- shared view in the second activity --> + <target android:targetId="@id/image_big" /> + </targets> + </moveImage> +</transitionSet> ++ +
The moveImage element corresponds to the android.transition.MoveImage
+class. For more information, see the API reference for android.transition.Transition.
+
To enable window content transitions in your code instead, call the
+Window.requestFeature method:
+// inside your activity +getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); + +// set an exit transition +getWindow().setExitTransition(new Explode()); ++ +
To specify transitions in your code, call these methods with a Transition
+object:
Window.setEnterTransitionWindow.setExitTransitionWindow.setSharedElementEnterTransitionWindow.setSharedElementExitTransitionIf you enable transitions and set an exit transition for an activity, the transition is activated
+when you launch another activity with the startActivity method. If you have set an
+enter transition for the second activity, the transition is also activated when the activity
+starts.
To make a screne transition animation between two activities that have a shared element:
+ +android:viewName attribute.ActivityOptions.makeSceneTransitionAnimation method.
+// get the element that receives the click event
+final View imgContainerView = findViewById(R.id.img_container);
+
+// get the common element for the transition in this activity
+final View androidRobotView = findViewById(R.id.android_robot_img);
+
+// define a click listener
+imgContainerView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Intent intent = new Intent(this, Activity2.class);
+ // create the transition animation - the images in the layouts
+ // of both activities are defined with android:viewName="robot"
+ ActivityOptions options = ActivityOptions
+ .makeSceneTransitionAnimation(this, androidRobotView, "robot");
+ // start the new activity
+ startActivity(intent, options.toBundle());
+ }
+});
+
+
+For shared dynamic views that you generate in your code, use the View.setViewName
+method to specify a common element name in both activities.
To make a scene transition animation between two activities that have more than one shared
+element, define the shared elements in both layouts with the android:viewName
+attribute (or use the View.setViewName in both activities), and create an
+ActivityOptions object as follows:
+ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this,
+ new Pair[] {
+ Pair.create(view1, "agreedName1"),
+ Pair.create(view2, "agreedName2"),
+ ...
+ }
+);
+
+
+
+Animations in material design rely on curves for time interpolation and spatial movement +patterns. The Android L Developer Preview provides new APIs that enable you to define custom +timing curves and curved motion patterns for animations.
+ +The PathInterpolator class is a new interpolator based on a Bézier curve or a
+Path object. This interpolator specifies a motion curve in a 1x1 square, with anchor
+points at (0,0) and (1,1) and control points as specified using the constructor arguments. You can
+also define a PathInterpolator as an XML resource:
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" + android:controlX1="0.4" + android:controlY1="0" + android:controlX2="1" + android:controlY2="1"/> ++ +
The Android L Developer Preview provides XML resources for the three basic curves in the +material design specification:
+ +@interpolator/fast_out_linear_in.xml@interpolator/fast_out_slow_in.xml@interpolator/linear_out_slow_in.xmlYou can pass a PathInterpolator object to the
+Animation.setInterpolation method.
The ObjectAnimator class has new constructors that enable you to animate
+coordinates along a path using two or more properties at once. For example, the following animator
+uses a Path object to animate the X and Y properties of a view:
+ObjectAnimator mAnimator; +mAnimator = ObjectAnimator.ofFloat(view, View.X, View.Y, path); +... +mAnimator.start(); ++ + +
The new StateListAnimator class lets you define animators that run when the state
+of a view changes. The following example shows how to define an StateListAnimator as
+an XML resource:
+<!-- animate the elevation property of a view when pressed --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true"> + <set> + <objectAnimator android:propertyName="elevation" + android:duration="100" + android:valueTo="60" + android:valueType="floatType"/> + <!-- you could have other objectAnimator elements + here for "x" and "y", or other properties --> + </set> + </item> + <item android:state_enabled="true" + android:state_pressed="false" + android:state_focused="true"> + <set> + <objectAnimator android:propertyName="elevation" + android:duration="100" + android:valueTo="10" + android:valueType="floatType"/> + </set> + </item> +</selector> ++ +
The new AnimatedStateListDrawable class lets you create drawables that show
+animations between state changes of the associated view. Some of the system widgets in the
+Android L Developer Preview use these animations by default. The following example shows how
+to define an AnimatedStateListDrawable as an XML resource:
+<!-- res/drawable/myanimstatedrawable.xml --> +<animated-selector + xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- provide a different drawable for each state--> + <item android:id="@+id/pressed" android:drawable="@drawable/drawableP" + android:state-pressed="true"/> + <item android:id="@+id/focused" android:drawable="@drawable/drawableF" + android:state-focused="true"/> + <item android:id="@id/default" + android:drawable="@drawable/drawableD"/> + + <!-- specify a transition --> + <transition android:fromId="@+id/default" android:toId="@+id/pressed"> + <animation-list> + <item android:duration="15" android:drawable="@drawable/dt1"/> + <item android:duration="15" android:drawable="@drawable/dt2"/> + ... + </animation-list> + </transition> + ... +</animated-selector> ++ + +
The Android L Developer Preview enables you to define bitmaps as an alpha mask and to tint +them using a color resource or a theme attribute that resolves to a color resource. You can +create these assets only once and color them automatically to match your theme.
+ +To apply a tint to a bitmap in your code, use the setTint method in these
+classes:
PaintDrawableNinePatchDrawableRippleDrawableIn your layouts, use the android:tint attribute instead.
The setTint method also lets you set the tint blending mode for
+NinePatchDrawable and RippleDrawable objects in your code. To set the
+tint mode in your layouts, use the android:tintMode attribute.
The new material design features (like the Material theme and custom animations) are only +available in the Android L Developer Preview. However, you can design your apps to make use of +these features when running on devices with the Android L Developer Preview and still be +compatible with previous releases of Android.
+ + +The Material theme is only available in the Android L Developer Preview. To configure your +app to use the Material theme on devices running the Android L Developer Preview and an older +theme on devices running earlier versions of Android:
+ +res/values/styles.xml.res/values-v21/styles.xml.Note: If you do not provide an alternative theme in this manner, +your app will not run on earlier versions of Android.
+ + +If the layouts that you design according to the material design guidelines do not use any +of the new XML attributes from the Android L Developer Preview, they will work on previous +versions of Android. Otherwise, you can provide alternative layouts. You can also provide +alternative layouts to customize how your app looks on earlier versions of Android.
+ +Create your layout files for the Android L Developer Preview inside res/layout-v21/
+and your alternative layout files for earlier versions of Android inside res/layout/.
+Alternative layouts have the same file name.
The RecyclerView and CardView widgets are included in the Android L
+Developer Preview Support Library, so they are available in earlier versions of Android.
The new APIs for custom animations are only available in the Android L Developer Preview. To +preserve compatibility with earlier verisons of Android, check the system version at runtime before +you invoke these APIs.
\ No newline at end of file diff --git a/docs/html/preview/material/get-started.jd b/docs/html/preview/material/get-started.jd new file mode 100644 index 0000000000000..27daf5cd81ca3 --- /dev/null +++ b/docs/html/preview/material/get-started.jd @@ -0,0 +1,124 @@ +page.title=Get Started + +@jd:body + +To create material design apps on Android:
+ +To update an existing app for the Android L Developer Preview, design new layouts following +material design guidelines and consider how you can improve the user experience for your app by +incorporating depth, touch feedback and animations in your UI.
+ +If you are creating a new app for the Android L Developer Preview, the material design +guidelines provide you with a solid design framework for your app. Follow these guidelines and +use the new functionality in the Android framework to design and develop your app.
+ + +
+Figure 1. Customizing the Material theme.
+The new Material theme provides:
+ +The Android L Developer Preview lets you easily customize the look of the Material theme +according to your brand identity with a color palette you control. You can tint the app bar and +the status bar using theme attributes, as shown in Figure 1.
+ +The system widgets have a new design and touch feedback animations. Activity transitions help +users navigate your app by providing visual continuity. You can customize the color palette, +the touch feedback animations, and the activity transitions for your app.
+ +The Material theme is defined as:
+ +@android:style/Theme.Material (dark version)@android:style/Theme.Material.Light (light version)@android:style/Theme.Material.Light.DarkActionBarFor a list of material styles that you can use, see the API reference for
+android.R.styles.
+Note: The Material theme is only available in the Android L Developer Preview. +For more information, see Compatibility. +
+ +In the Android L Developer Preview, elements in XML layout definitions can specify the
+android:theme attribute, which references a theme resource. This attribute modifies
+the theme for the element and any elements inflated below it, which is useful to alter theme
+color palettes in a specific portion of an interface.
In addition to applying the Material theme, you also have to:
+ +The Android L Developer Preview provides new attributes to make it easy to customize the +Material theme:
+ ++<resources> + <!-- inherit from the Material theme --> + <style name="BaseAppTheme" parent="android:Theme.Material"> + <!-- Main theme colors --> + <!-- your app's branding color (for the app bar) --> + <item name="android:colorPrimary">@color/primary</item> + <!-- darker variant of colorPrimary (for contextual app bars) --> + <item name="android:colorPrimaryDark">@color/primary_dark</item> + + <!-- other theme colors --> + <item name="android:colorBackground">@color/background</item> + <item name="android:colorAccent">@color/accent</item> + <item name="android:colorButtonNormal">@color/button_normal</item> + <item name="android:colorControlHighlight">@color/button_chigh</item> + <item name="android:windowBackground">@color/wbackground</item> + </style> +</resources> ++ +
Ensure that you follow material design guidelines when choosing colors for your app.
+ +Design your layouts according to the material design specification. In particular, pay +attention to:
+ +You still define layouts inside XML files using the standard tools from the Android framework.
+To specify the depth level of each view in your layout, use the android:elevation
+attribute.
The Android L Developer Preview includes support for material design apps. Material design +is a comprehensive guide for visual, motion, and interaction design across platforms and devices. +To use material design in your Android apps, follow the guidelines defined in the +material design specification and use the new components and functionality +available in the Android L Developer Preview.
+ +The Android L Developer Preview provides the following elements for you to build material +design apps:
+ +The Material theme provides a new style for your app, system widgets that let you set +their color palette, and default animations for touch feedback and activity transitions.
+ + +
+ Dark Material theme
+
+ Light Material theme
+The Android L Developer Preview includes two new widgets for displaying complex views:
+ + +
+ The new RecyclerView widget is a container for large sets of views that can be
+ recycled and scrolled very efficiently.
+ The new CardView widget lets you display important pieces of information inside
+ cards that have a consistent look and feel.
In addition to the X and Y components, views in the Android L Developer Preview have a Z +component. This new component represents the elevation of a view, which determines the size of +its shadow: views with higher Z values cast bigger shadows.
+ + +The Android L Developer Preview provides new APIs that let you create custom animations for +touch feedback in UI controls, view state changes, and activity transitions.
+ + +Respond to touch events in your views with touch feedback animations.
+Hide and show views with reveal effect animations.
+Switch between activities with custom activity transition animations.
+Create custom animation patterns with curved motion.
+Animate changes in one or more view properties with view state change animations.
+Show animations in state list drawables between view state changes.
+The Android L Developer Preview supports drawable tinting: you can define +bitmaps as an alpha mask and tint them using a color resource. You can create these assets only +once and color each instance to match your theme.
diff --git a/docs/html/preview/material/ui-widgets.jd b/docs/html/preview/material/ui-widgets.jd new file mode 100644 index 0000000000000..5c12a1af96927 --- /dev/null +++ b/docs/html/preview/material/ui-widgets.jd @@ -0,0 +1,188 @@ +page.title=UI Widgets + +@jd:body + + +The support library in the Android L Developer Preview contains two new widgets,
+RecyclerView and CardView. Use these widgets to show complex lists
+and cards in your app. These widgets have material design styles and animations by default.
RecyclerView is a more advanced version of ListView. This widget is
+a container for large sets of views that can be recycled and scrolled very efficiently. Use the
+RecyclerView widget when you have lists with elements that change dynamically.
RecyclerView is easy to use, because it provides:
You also have the flexibility to define custom layout managers and animations for this +widget.
+ +To use the RecyclerView widget, you have to specify an adapter and a layout
+manager. An adapter provides a binding from a dataset to views that are displayed
+within a RecyclerView. For example, if your dataset is an array of strings displayed
+as TextView items, the layout manager asks the adapter to:
+
TextView to one of the strings in the datasetTextView objectsTo create an adapter, you extend the RecyclerView.Adapter class. The details of
+the implementation depend on the specifics of your dataset and the type of views. Fore more
+information, see the examples below.
+
+ Figure 1 - The RecyclerView widget.
+
A layout manager positions item views inside a RecyclerView and
+determines when to reuse item views that are no longer visible to the user. To reuse (or
+recycle) a view, a layout manager may ask the adapter to replace the content of the
+view with a different element from the dataset. Recycling views in this manner improves
+performance by avoiding the creation of unnecessary views or performing expensive
+findViewById lookups.
+
RecyclerView provides two layout managers you can use:
LinearLayoutManager shows the items in a vertically scrolling list.GridLayoutManager shows the items in a rectangular grid.To create a custom layout, you extend the RecyclerView.LayoutManager class.
To include a RecyclerView in your layout:
+<!-- A RecyclerView with some commonly used attributes --> +<android.support.v7.widget.RecyclerView + android:id="@+id/my_recycler_view" + android:scrollbars="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent"/> ++ +
To get the RecyclerView object in your activity:
+public class MyActivity extends ActionBarActivity {
+ private RecyclerView mRecyclerView;
+ private RecyclerView.Adapter mAdapter;
+ private RecyclerView.LayoutManager mLayoutManager;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.my_activity);
+ mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
+
+ // improve performance if the size is fixed
+ mRecyclerView.setHasFixedSize(true);
+
+ // use a linear layout manager
+ mLayoutManager = new LinearLayoutManager(this);
+ mRecyclerView.setLayoutManager(mLayoutManager);
+
+ // specify an adapter (see also next example)
+ mAdapter = new MyAdapter(myDataset);
+ mRecyclerView.setAdapter(mAdapter);
+ }
+ ...
+}
+
+
+To create a simple adapter:
+ +
+public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
+ private String[] mDataset;
+
+ // Provide a reference to the type of views that you are using
+ // (custom viewholder)
+ public static class ViewHolder extends RecyclerView.ViewHolder {
+ public TextView mTextView;
+ public ViewHolder(TextView v) {
+ super(v);
+ mTextView = v;
+ }
+ }
+
+ // Provide a suitable constructor (depends on the kind of dataset)
+ public MyAdapter(String[] myDataset) {
+ mDataset = myDataset;
+ }
+
+ // Create new views (invoked by the layout manager)
+ @Override
+ public MyAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
+ int viewType) {
+ // create a new view
+ View v = new TextView(parent.getContext());
+ // set the view's size, margins, paddings and layout parameters
+ ...
+ ViewHolder vh = new ViewHolder(v);
+ return vh;
+ }
+
+ // Replace the contents of a view (invoked by the layout manager)
+ @Override
+ public void onBindViewHolder(ViewHolder holder, int position) {
+ // - get element from your dataset at this position
+ // - replace the contents of the view with that element
+ holder.mTextView.setText(mDataset[position]);
+
+ }
+
+ // Return the size of your dataset (invoked by the layout manager)
+ @Override
+ public int getItemCount() {
+ return mDataset.length;
+ }
+}
+
+
+
+CardView extends the FrameLayout class and lets you show information
+inside a card with optional rounded corners:
android:cardCornerRadius
+ attribute.CardView.setRadius method.To set the background color of a card, use the android:cardBackgroundColor
+attribute.
To include a CardView in your layout:
+<!-- A CardView that contains a TextView --> +<android.support.v7.widget.CardView + android:id="@+id/card_view" + android:layout_gravity="center" + android:layout_width="200dp" + android:layout_height="200dp" + card_view:cardCornerRadius="4dp"> + + <TextView + android:id="@+id/info_text" + android:layout_width="match_parent" + android:layout_height="match_parent" /> +</android.support.v7.widget.CardView> +\ No newline at end of file diff --git a/docs/html/preview/material/videos/ContactsAnim.mp4 b/docs/html/preview/material/videos/ContactsAnim.mp4 new file mode 100644 index 0000000000000..073f9dc723f3a Binary files /dev/null and b/docs/html/preview/material/videos/ContactsAnim.mp4 differ diff --git a/docs/html/preview/material/videos/ContactsAnim.ogv b/docs/html/preview/material/videos/ContactsAnim.ogv new file mode 100644 index 0000000000000..c5e751b416ed3 Binary files /dev/null and b/docs/html/preview/material/videos/ContactsAnim.ogv differ diff --git a/docs/html/preview/material/videos/ContactsAnim.webm b/docs/html/preview/material/videos/ContactsAnim.webm new file mode 100644 index 0000000000000..2a15ff57828bc Binary files /dev/null and b/docs/html/preview/material/videos/ContactsAnim.webm differ diff --git a/docs/html/preview/material/videos/Dial.mp4 b/docs/html/preview/material/videos/Dial.mp4 new file mode 100644 index 0000000000000..cd5a6a2aa3be4 Binary files /dev/null and b/docs/html/preview/material/videos/Dial.mp4 differ diff --git a/docs/html/preview/material/videos/Dial.ogv b/docs/html/preview/material/videos/Dial.ogv new file mode 100644 index 0000000000000..b7b29d089a630 Binary files /dev/null and b/docs/html/preview/material/videos/Dial.ogv differ diff --git a/docs/html/preview/material/videos/Dial.webm b/docs/html/preview/material/videos/Dial.webm new file mode 100644 index 0000000000000..e30d2a5637387 Binary files /dev/null and b/docs/html/preview/material/videos/Dial.webm differ diff --git a/docs/html/preview/material/views-shadows.jd b/docs/html/preview/material/views-shadows.jd new file mode 100644 index 0000000000000..52fe83cce37d4 --- /dev/null +++ b/docs/html/preview/material/views-shadows.jd @@ -0,0 +1,76 @@ +page.title=Views and Shadows + +@jd:body + + +
In material design apps, depth has meaning. You should assign higher elevation values to more +important UI elements in your app. The elevation value of a view determines the size of its +shadow: views with higher Z values cast bigger shadows. Views only cast shadows on the Z=0 plane +under an orthographic projection (the views do not scale for different values of Z).
+ + +The Z value for a view has two components, elevation and translation. The elevation is the +static component, and the translation is used for animations:
+ +Z = elevation + translationZ
To set the elevation of a view:
+ +android:elevation attribute.View.setElevation method.To set the translation of a view, use the View.setTranslationZ method.
The Z values are measured in the same units as the X and Y values (like dp or
+px).
The bounds of a view's background drawable determine the default shape of its shadow. To define
+a custom shape for a shadow, such as an oval, use the View.setOutline method:
+View v = findViewById(R.id.my_view); + +// add 10px to the static elevation +v.setTranslationZ(10); + +// set an oval shadow +Outline outline = new Outline(); +outline.setOval(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); +myView.setOutline(outline); ++ +
An Outline represents the outer shape of a graphics object. You can create
+Outline objects as in this example, or you can obtain the outline from a
+Drawable object with the getOutline method.
The outline of a view also defines the ripple area for touch feedback.
+ +To prevent a view from casting a shadow, set its outline to null.
The Android L Developer Preview lets you clip a view to its outline area using the
+View.setClipToOutline method. Only rectangle, circle, and round rectangle outlines
+support clipping, as determined by the Outline.canClip method.
To determine if a view has been clipped, use the View.getClipToOutline method.
+// clip a view to an oval
+View v = findViewById(R.id.my_view);
+outline.setOval(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
+myView.setOutline(outline);
+
+// if the view is not already clipped
+if (v.getClipToOutline() == false) {
+ v.setClipToOutline(true);
+}
+
\ No newline at end of file
diff --git a/docs/html/preview/preview_toc.cs b/docs/html/preview/preview_toc.cs
new file mode 100644
index 0000000000000..377c487381cd7
--- /dev/null
+++ b/docs/html/preview/preview_toc.cs
@@ -0,0 +1,44 @@
+
\ No newline at end of file
diff --git a/docs/html/preview/setup-devices.jd b/docs/html/preview/setup-devices.jd
new file mode 100644
index 0000000000000..9ffe9f4cb2bc5
--- /dev/null
+++ b/docs/html/preview/setup-devices.jd
@@ -0,0 +1,81 @@
+page.title=Setting Up Hardware and AVDs
+
+@jd:body
+
+The Android 5.0 developer preview provides you with 32-bit system images +to flash the following devices: +
+ +In addition, you also get the emulator system images, which includes +experimental 64-bit system images along with standard 32-bit system images. +
+ +Warning: This is a preview version of the Android +system image, and is subject to change. Your use of this system image is +governed by the Android SDK Preview License Agreement. The Android preview +system image is not a stable release, and may contain errors and defects that +can result in damage to your computer systems, devices, and data. The preview +Android system image is not subject to the same testing as the factory OS and +can cause your phone and installed services and applications to stop working. +
+ ++Click through Terms of Service: +https://docs.google.com/a/google.com/document/d/1OixnM1Q890ExOzDB3Z-FDD6Sb2kF4uZQiMxsYVII8F0/edit?usp=sharing +
+ +<extracted_images>.Alternatively, run adb reboot bootloader
+ with USB debugging turned on to enter fastboot mode.
+ The device must be booted up if you’re using this method.
<extracted-images>/flash-all script
+ corresponding to your platform. This script flashes all of the system data
+ onto the phone.fastboot oem lock
+ with the device in fastboot mode to lock it again. This does not wipe your
+ device, but if you want to flash again, you need to run fastboot oem
+ unlock, which wipes your device. We recommend you leave the
+ bootloader unlocked until you are done with flashing the device.Go to developers.google.com/android + and download the image you want to flash to for your device. + Follow the instructions there to flash the image to your device.
+ + +The Preview SDK is available from the Android SDK Manager. This document assumes that you +are familiar with Android Development, such as using the Android SDK Manager and creating +projects. If you're new to Android, see +Building Your First App training lesson first.
+ +Theme.Material
+ Big screen, big experience
+Engage your users from the comfort of their couch. + Put your app on TV and bring the whole family into + the action.
+
+
+
+
+ Simple
++ Smooth, fast interactions are key to a successful TV app. Keep navigation simple + and light. Bring your content forward to let users enjoy it with a minimum of + fuss. +
+ +
+
+ Cinematic
++ What would your app look like if it were a film? Use movement, animation and sound to make your app into an experience. +
+ +
+
+ Beautiful
++ Apps on TV should be a pleasure to look at, as well as enjoyable to use. Use + made-for-TV styles to make your app familiar and fun. +
+ +
+
+ Made for TV
++ Take advantage of pre-built fragments for browsing and interacting with media + catalogs. +
+ +
+
+ Get Found
++ Give your content the attention it deserves by including it in Android TV's global + search results. +
+ +
+
+ Recommend
++ Suggest content from your app to keep your users coming back. +
+ +You can begin building apps right away using these developer resources.
+Preview SDK
++ Get started building for Android TV using the Android L-preview SDK. The preview + SDK includes the Android TV emulator so you can start building your TV app right + away. +
+ +ADT-1 Developer Kit
++ While supplies last, developers can request an ADT-1 Developer Kit, a compact and + powerful streaming media player and gamepad, ideal for developing apps for Android + TV. +
+ +Small, powerful devices, worn on the body. - Useful information when you need it most. - Intelligent answers to spoken questions. - Tools to help reach fitness goals. +
+ Useful information when you need it most.
+ Intelligent answers to spoken questions.
+ Tools to help reach fitness goals.
Your key to a multiscreen world.
To get started with the Android Wear Developer Preview, you must agree to the - following terms and conditions and provide the email address for your Google account. -After signing up, you’ll have access to:
-- Important: Your email address is used to provide your Google account - access to the Android Wear Preview app Beta Preview on Google Play Store. As such, the - email address you provide below must be for the account you use to download apps on Google Play Store. - We may also use your email address to provide you with updates about the Android Wear - platform release. -
- - - - - - -