Android Open Source - FirePhoneDemos Fire Fly Plugin






From Project

Back to project page FirePhoneDemos.

License

The source code is released under:

Apache License

If you think the Android project FirePhoneDemos listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.zappos.firephone.firefly;
//  w  w w.ja v  a  2  s . c o m
import android.util.Log;

import com.amazon.mw.entity.DigitalEntity;
import com.amazon.mw.entity.DigitalEntityFilter;
import com.amazon.mw.entity.FacetType;
import com.amazon.mw.plugin.DigitalEntityUI;
import com.amazon.mw.plugin.PluginError;
import com.amazon.mw.plugin.SimplePlugin;
import com.zappos.firephone.R;

/**
 * For firefly. This is where you declare the type of DigitalEntities your app can handle.
 * This one filters out everything except phone numbers and products.
 */
public class FireFlyPlugin extends SimplePlugin {
    // TAG used for logging
    private static String TAG = FireFlyPlugin.class.getSimpleName();

    /**
     * Configure the plugin to resolve product identifications by
     * adding the PRODUCT facet type to the DigitalEntityFilter object.
     * @return a DigitalEntityFilter
     */
    @Override
    public DigitalEntityFilter getDigitalEntityFilter() {
        DigitalEntityFilter filter = new DigitalEntityFilter();
        filter.addAnyOfFacets(FacetType.PRODUCT, FacetType.PHONENUMBER);
        return filter;
    }

    /**
     * Define a factory method to create a DigitalEntityUI object for this plugin.
     * @param digitalEntity the DigitalEntityUI
     * @return a FireFlyDigitalEntityUI
     */
    @Override
    public DigitalEntityUI createDigitalEntityUI(DigitalEntity digitalEntity) {
        return new FireFlyDigitalEntityUI(digitalEntity);
    }

    /**
     * Define an error callback in case something goes wrong; for example, the service takes
     * too long to respond and Firefly gives up.
     * @param error the PluginError
     */
    @Override
    public void onError(PluginError error) {
        Log.e(TAG, "Error: " + error.getMessage());
    }

    /**
     * Return a one line description of the plugin's function.
     * @return the description
     */
    @Override
    public String getPluginDescription() {
        return getContext().getString(R.string.description);
    }
}




Java Source Code List

com.zappos.firephone.ApplicationTest.java
com.zappos.firephone.activity.BaseActivity.java
com.zappos.firephone.activity.GestureActivity.java
com.zappos.firephone.activity.HeadTrackingCircleActivity.java
com.zappos.firephone.activity.HomeActivity.java
com.zappos.firephone.activity.HomeWidgetActivity.java
com.zappos.firephone.activity.NumericBadgeActivity.java
com.zappos.firephone.firefly.FireFlyDigitalEntityUI.java
com.zappos.firephone.firefly.FireFlyPhoneActivity.java
com.zappos.firephone.firefly.FireFlyPlugin.java
com.zappos.firephone.firefly.FireFlyProductActivity.java
com.zappos.firephone.receiver.WidgetBroadcastReceiver.java
com.zappos.firephone.view.CircleView.java