Home > Devices > Fire Phone

DynamicPerspectiveControls Sample App


The DynamicPerspectiveControls sample app, included in the Fire Phone SDK, contains demo versions of the various Dynamic Perspective UI controls. This page provides an introduction to the DynamicPerspectiveControls sample and demonstrates the required elements that you need to build an app that uses the Euclid package for the Dynamic Perspective UI.

Setting Up an App That Uses Euclid

To set up an app that uses Euclid (modeled on the DynamicPerspectiveControls sample app):

  1. After following the instructions in Setting Up the Your Development Environment, import the DynamicPerspectiveControls sample to your workspace. The DynamicPerspectiveControls sample is located in the samples folder.
  2. Browse the new project and note the following files and folders included in the sample app:
    • AndroidManifest.xml
    • src folder
    • res folder
  3. Open the AndroidManifest.xml file:
    1. In the attributes of the <application /> element, note that the app uses one of the Euclid themes (Euclid.Light or Euclid.Dark) <application android:allowBackup="true" android:icon="@drawable/euclid_sample_app" android:label="@string/app_name" android:theme="@euclid:style/Theme.Euclid.Dark">
    2. Note the required Euclid and Foundation Controls (EAC) libraries in the <application/> element:
      <uses-library android:name="euclidlibrary" android:required="true"/>
      <uses-library android:name="eaclibrary" android:required="true"/>
  4. To see layout examples for each of the Euclid controls, browse the layout XML files in the res/layout/ folder. Each control has its own activity file, named activity_<control_name>.xml. Some controls have additional files corresponding to different states and options for the control.
    When you add Euclid components to your own apps, note that Euclid controls are all designated with a "Z" prefix. Use the ZContainer, ZViewHost, and ZShadowReceiver containers to add 3D characteristics to the UI of your app.
    Apps that use the Euclid package have the following requirements:
    • If you use any euclid:*, attributes, add the following namespace: "xmlns:euclid="http://schemas.android.com/apk/res/euclid".
    • If you use any amazon:*, attributes, add the following namespace: "xmlns:amazon="http://schemas.android.com/apk/res/amazon".
    • All Euclid controls must have the euclid:layout_depth parameter. For most apps, use wrap_content in conjunction with layout_depth. (Containers do not need this parameter to be set.)
  5. View the Visual Bundle (VBL) files included in the project, located in the res/raw directory of the project. VBLs allow you to add custom 3D content to your app. The DynamicPerspectiveControls sample includes a sample custom VBL file named sdk_samples.vbl.
  6. Build and validate your app:
    1. Following the instructions in the samples README, navigate to your project folder, and build the project in Android Studio or using the Gradle command line.
    2. Connect your device to your host machine and install the APK to your device.
    3. Try to run your app on the device. If everything is set up and has built correctly, you should see a working version of the DynamicPerspectiveControls sample.