Have questions about buying, selling or renting during COVID-19? Learn more

Zillow Tech Hub

A Few Irons in the Fire (Phone)

When we first heard of all the features available on the new Amazon Fire Phone, we were excited to try them all!  After a quick check to make sure our current app ran fine on the new device, we were ready to roll.  We started with putting in a Hero Widget (or App Widget) and 3D icon:

3D icon and Hero Widget

To build the Hero Widget, all we did was start a service to provide data, then build a GroupedListHeroWidget object and ListEntry objects to showcase nearby open houses and homes for sale.

ListEntry listEntry =
   new ListEntry( getApplicationContext() );
listEntry.setVisualStyle(
   GroupedListHeroWidget.VisualStyle.PEEKABLE );
listEntry.setPrimaryIcon(
   Uri.parse( home.getImageLink() ) );
listEntry.setPrimaryText( home.getHomeStatusAndPrice() );
…

With that under our belts, we tackled the new motion gestures. Since the Zillow experience is all about finding the right home, we decided to let users access filters and menus with a simple flick of the wrist (i.e. the “tilt” gesture).

Menu opened when tilting the phone.

We were able to use existing Android constructs for our layouts and the Amazon GestureListener interface:

public class AmazonGestureExample
implements GestureListener
{
    public AmazonGestureExample( Activity activity )
    {
        // Setup Amazon gesture handling
        GestureManager gestureManager =
           GestureManager.createInstance( activity );

        // Get the tilt gesture
        Gesture tiltGesture =
           Gesture.getGestureFromId( Gesture.TILT );

        // Register Amazon gesture listener
        gestureManager.registerListener(
                this,
                tiltGesture,
                ( GestureEvent.Direction.LEFT |
                  GestureEvent.Direction.RIGHT ) );
    }

    /**
     * Called when an Amazon gesture is detected by the
     * com.amazon.motiongestures.GestureManager
     */
    @Override
    public void onGestureEvent( GestureEvent event )
    {
        // Is this a left or right tilt?
        switch ( event.direction )
        {
            case GestureEvent.Direction.RIGHT:
                // Handle desired behavior, such as
                // closing/opening navigation drawers
                break;

            case GestureEvent.Direction.LEFT:
                // Handle desired behavior, such as
                // closing/opening navigation drawers
                break;
        }
    }
}

Finally, we couldn’t develop for this phone without exploring the Dynamic Perspective and head-tracking functionality.  In our app, we let users peer around zoomed in photos, similar to peering around a corner.  As the user’s head moves, we move the photo to expose more details.

head tracking photos

Like the gesture code above, it was little more than using the HeadTrackingManager, registering a listener, and overriding the onHeadTrackingEvent method.

That’s it!  A few simple changes to the make the most of the new Fire Phone.  Cheers and happy coding!

Celebrating the announcement of the Fire Phone
The Fire Phone team celebrating the announcement. From left to right: Stick Figure Mike Knecht, Karen Milfeld, Steven Kwan, Jenny Feinberg, Todd Glover, Jeremy Wacksman, and Steve Perrin

A Few Irons in the Fire (Phone)