Android Open Source - SurgePriceWidget Surge Price Widget Application






From Project

Back to project page SurgePriceWidget.

License

The source code is released under:

MIT License

If you think the Android project SurgePriceWidget 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 me.mattlogan.surgepricewidget;
/*w  ww.j av a 2  s  . com*/
import android.app.Application;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import me.mattlogan.surgepricewidget.api.UberApi;
import me.mattlogan.surgepricewidget.api.UberApiBus;
import me.mattlogan.surgepricewidget.api.UberApiHandler;
import me.mattlogan.surgepricewidget.location.LocationBus;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;

public class SurgePriceWidgetApplication extends Application {

    static final String ENDPOINT = "https://api.uber.com";

    UberApiHandler uberApiHandler;

    @Override public void onCreate() {
        super.onCreate();

        final String serverToken = getString(R.string.server_token);
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override public void run() {
                uberApiHandler = new UberApiHandler(buildUberApi(serverToken),
                        UberApiBus.getInstance());
            }
        });
    }

    private UberApi buildUberApi(final String serverToken) {
        return new RestAdapter.Builder()
                .setEndpoint(ENDPOINT)
                .setRequestInterceptor(new RequestInterceptor() {
                    @Override public void intercept(RequestFacade request) {
                        request.addQueryParam("server_token", serverToken);
                    }
                })
                .build()
                .create(UberApi.class);
    }
}




Java Source Code List

me.mattlogan.surgepricewidget.ApplicationTest.java
me.mattlogan.surgepricewidget.SurgePriceWidgetApplication.java
me.mattlogan.surgepricewidget.api.UberApiBus.java
me.mattlogan.surgepricewidget.api.UberApiHandler.java
me.mattlogan.surgepricewidget.api.UberApi.java
me.mattlogan.surgepricewidget.api.event.RetrievePricesFailedEvent.java
me.mattlogan.surgepricewidget.api.event.RetrievePricesRequestedEvent.java
me.mattlogan.surgepricewidget.api.event.RetrievePricesSuccessEvent.java
me.mattlogan.surgepricewidget.api.model.PriceListWrapper.java
me.mattlogan.surgepricewidget.api.model.Price.java
me.mattlogan.surgepricewidget.location.CurrentLocationClient.java
me.mattlogan.surgepricewidget.location.LocationBus.java
me.mattlogan.surgepricewidget.location.event.LocationClientConnectedEvent.java
me.mattlogan.surgepricewidget.widget.SurgePriceWidgetProvider.java