No se han encontrado resultados
Kindle Fire tablets use a soft key toolbar to provide a versatile user experience. In an earlier post on the Kindle Fire (1stgeneration), we discussed how developers can optimize their layouts for the soft key toolbar . With the new screen sizes and capabilities of Kindle Fire tablets, there are more options to expose, use, and control the soft key toolbar in a dynamic manner.
In our earlier post on optimizing layouts, we detailed how the soft key toolbar can appear at either the bottom of the screen (in portrait mode) or along the right side of the screen (in landscape mode). The soft key menu is either fully visible, or if collapsed, revealed by a tap on the drag handle. When designing your app, you should be aware that the soft key toolbar and the drag handle appear over your content rather than resizing the drawable area.
By default, the soft key toolbar contains buttons for “Home, ”“Back,” “Search,” “Favorites,” and an overflow menu. Certain other APIs, such as GameCircle,can also position icons on the soft key toolbar.
Expanded soft key toolbar
Soft key toolbar collapsed just showing drag handle
Kindle Fire uses this key to replicate the functionality of the standard Android device button. Apps must appropriately use the Home soft key to allow quick navigation to and from the Kindle Fire carousel.
By default, the Home soft key returns users to the Kindle Fire carousel. When the home key is pressed, the current activity’s onPause() method will be called before the user is presented with the carousel. When your app is re-launched, the onResume() method will be called. In order to ensure that the app returns to its previous state, your app should save state in the onPause() method and reload the state in the onResume() method.
For more information about the onPause() and onResume() methods, please see our earlier blog post in the Top10 Optimizations for Kindle Fire series.
The back soft key's default action is to call finish() on the current activity and then resume the previous activity on the stack (as managed by the OS).
If your app has launched several activities and you want the back soft key to return the user to the previous activity, you don't need to do anything—this is the default behavior. If the user is already at the main activity of your app, the back soft key will call finish() on the activity and exit your app.
A typical solution to prevent premature exiting of the app is to override the back soft key functionality on your app's main activity to trigger a confirmation dialog. Override the function of the back soft key in an activity by including the following code in the Activity class:
@Override
public void onBackPressed() {
// do something when the back button is pressed
return;
}
To maximize screen real estate in your mobile apps, you can place less frequently used actions on the overflow menu. The overflow menu can hold a maximum of 6 items and does not scroll or word wrap; try to keep your text small and use consistent capitalization and punctuation for clarity. Easily instantiate your menu when the user presses the overflow menu button by overriding the Activity.onCreateOptionsMenu method in your Activity class as described here.
If you want to provide app specific search then you need to override the onSearchRequested functionality and handle the action as described here.
@Override
public booleanonSearchRequested() {
// your logic here
return false; // don't bubble up to thedevice search box
}
If you are working with the soft key toolbar, it is important that you are familiar with the layout guidelines to understand how it impacts the available screen size.
Although not directly related to the soft key toolbar, it is worth noting that when the toolbar is visible, the status bar is visible as well, which means your app should also be prepared for the user to interact with the Quick Settings capability, as well as the layout to cater for that overlay.
Status bar visible,showing notifications and access to Quick Settings.
For more details, please refer to the App Optimization and User Experience Guidelines.