Search in sources :

Example 1 with RestAdapter

use of retrofit.RestAdapter in project cw-omnibus by commonsguy.

the class QuestionsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View result = super.onCreateView(inflater, container, savedInstanceState);
    setRetainInstance(true);
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("https://api.stackexchange.com").build();
    StackOverflowInterface so = restAdapter.create(StackOverflowInterface.class);
    so.questions("android", this);
    return (result);
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) RestAdapter(retrofit.RestAdapter)

Example 2 with RestAdapter

use of retrofit.RestAdapter in project enroscar by stanfy.

the class RetrofitClientTest method shouldWorkForHttpScheme.

// http
@Test
public void shouldWorkForHttpScheme() throws Exception {
    MockWebServer server = new MockWebServer();
    server.play();
    server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponse));
    RestAdapter adapter = getRestAdapter(server.getUrl("/").toString());
    fetchAndTest(adapter);
    server.shutdown();
}
Also used : MockResponse(com.squareup.okhttp.mockwebserver.MockResponse) MockWebServer(com.squareup.okhttp.mockwebserver.MockWebServer) RestAdapter(retrofit.RestAdapter) Test(org.junit.Test)

Example 3 with RestAdapter

use of retrofit.RestAdapter in project wh-app-android by WhiteHouse.

the class SearchManager method search.

public Observable<SearchResults> search(String query) {
    SearchService ss;
    RestAdapter ra = getRestAdapter();
    if (BuildConfig.DEBUG) {
        ra.setLogLevel(RestAdapter.LogLevel.FULL);
    }
    ss = ra.create(SearchService.class);
    return ss.search(query);
}
Also used : RestAdapter(retrofit.RestAdapter)

Example 4 with RestAdapter

use of retrofit.RestAdapter in project cw-omnibus by commonsguy.

the class QuestionsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View result = super.onCreateView(inflater, container, savedInstanceState);
    setRetainInstance(true);
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("https://api.stackexchange.com").build();
    StackOverflowInterface so = restAdapter.create(StackOverflowInterface.class);
    so.questions("android", this);
    return (result);
}
Also used : TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) RestAdapter(retrofit.RestAdapter)

Example 5 with RestAdapter

use of retrofit.RestAdapter in project cw-omnibus by commonsguy.

the class QuestionsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View result = super.onCreateView(inflater, container, savedInstanceState);
    setRetainInstance(true);
    RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("https://api.stackexchange.com").build();
    StackOverflowInterface so = restAdapter.create(StackOverflowInterface.class);
    String search = getArguments().getString(ARG_SEARCH);
    if (search == null) {
        so.questions("android", this);
    } else {
        so.search(search, this);
    }
    return (result);
}
Also used : ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) RestAdapter(retrofit.RestAdapter)

Aggregations

RestAdapter (retrofit.RestAdapter)16 View (android.view.View)3 ListView (android.widget.ListView)3 TextView (android.widget.TextView)3 Test (org.junit.Test)3 OkClient (retrofit.client.OkClient)3 ImageView (android.widget.ImageView)2 InterestingApi (com.kdubb.retrofitexamples.api.InterestingApi)2 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)2 RetrofitError (retrofit.RetrofitError)2 Response (retrofit.client.Response)2 GsonConverter (retrofit.converter.GsonConverter)2 Uri (android.net.Uri)1 WeekViewEvent (com.alamkanak.weekview.WeekViewEvent)1 MyJsonService (com.alamkanak.weekview.sample.apiclient.MyJsonService)1 Gson (com.google.gson.Gson)1 AsynchronousApi (com.kdubb.retrofitexamples.api.AsynchronousApi)1 SimpleApi (com.kdubb.retrofitexamples.api.SimpleApi)1 JacksonConverter (com.kdubb.retrofitexamples.converter.JacksonConverter)1 CustomChild (com.kdubb.retrofitexamples.domain.CustomChild)1