Android Open Source - pypodroid A P I






From Project

Back to project page pypodroid.

License

The source code is released under:

Apache License

If you think the Android project pypodroid 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 de.daxbau.pypodroid.pypo;
//  w w  w .ja  v  a  2s  . c o  m
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestHandle;
import com.loopj.android.http.RequestParams;

public class API {

    private static String BASE_URL;

    private static AsyncHttpClient client = new AsyncHttpClient();


    public static RequestHandle get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
        return client.get(getAbsoluteUrl(url), params, responseHandler);

    }

    public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
        client.post(getAbsoluteUrl(url), params, responseHandler);
    }

    private static String getAbsoluteUrl(String relativeUrl) {
        return BASE_URL + relativeUrl;
    }

    public static void login(String username, String password, String baseURL)
    {
        if (baseURL != null) {
            BASE_URL = baseURL;
        }
        client.setBasicAuth(username, password);

    }
}




Java Source Code List

de.daxbau.pypodroid.BuildConfig.java
de.daxbau.pypodroid.ItemDetailActivity.java
de.daxbau.pypodroid.ItemDetailFragment.java
de.daxbau.pypodroid.ItemListActivity.java
de.daxbau.pypodroid.ItemListFragment.java
de.daxbau.pypodroid.SettingsActivity.java
de.daxbau.pypodroid.SettingsFragment.java
de.daxbau.pypodroid.pypo.API.java
de.daxbau.pypodroid.pypo.Item.java