Search in sources :

Example 1 with TypeTagVO

use of cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.TypeTagVO in project MyApp by MatthewDevelop.

the class ExampleUnitTest method APITest.

@Test
public void APITest() {
    String BASE_URL = "http://wanandroid.com/";
    OkHttpClient.Builder builder = new OkHttpClient.Builder();
    // 添加公共拦截器
    builder.addInterceptor(new CustomInterceptor());
    Retrofit retrofit = new Retrofit.Builder().client(builder.build()).baseUrl(BASE_URL).addCallAdapterFactory(RxJava2CallAdapterFactory.create()).addConverterFactory(GsonConverterFactory.create()).build();
    WanService movieService = retrofit.create(WanService.class);
    boolean test = true;
    if (test) {
    } else {
        movieService.getTagData().subscribe(new Observer<ResponseData<List<TypeTagVO>>>() {

            @Override
            public void onError(Throwable e) {
            }

            @Override
            public void onComplete() {
            }

            @Override
            public void onSubscribe(Disposable d) {
            }

            @Override
            public void onNext(ResponseData<List<TypeTagVO>> listResponseData) {
                System.out.println(listResponseData.toString());
            }
        });
        movieService.getHomeBannerList().subscribe(new Observer<ResponseData<List<BannerBean>>>() {

            @Override
            public void onError(Throwable e) {
                e.printStackTrace();
            }

            @Override
            public void onComplete() {
            }

            @Override
            public void onSubscribe(Disposable d) {
            }

            @Override
            public void onNext(ResponseData<List<BannerBean>> listResponseData) {
                System.out.println(listResponseData.toString());
            }
        });
        movieService.getHomeArticleList(5).subscribe(new Observer<ResponseData<ArticleListVO>>() {

            @Override
            public void onError(Throwable e) {
            }

            @Override
            public void onComplete() {
            }

            @Override
            public void onSubscribe(Disposable d) {
            }

            @Override
            public void onNext(ResponseData<ArticleListVO> articleListVOResponseData) {
                System.out.println(articleListVOResponseData.toString());
            }
        });
    }
}
Also used : Disposable(io.reactivex.disposables.Disposable) OkHttpClient(okhttp3.OkHttpClient) ResponseData(cn.foxconn.matthew.myapp.wanandroid.bean.ResponseData) CustomInterceptor(cn.foxconn.matthew.myapp.wanandroid.helper.interceptor.CustomInterceptor) WanService(cn.foxconn.matthew.myapp.wanandroid.api.WanService) Retrofit(retrofit2.Retrofit) ArticleListVO(cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.ArticleListVO) BannerBean(cn.foxconn.matthew.myapp.wanandroid.bean.pojo.BannerBean) TypeTagVO(cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.TypeTagVO) List(java.util.List) Test(org.junit.Test)

Example 2 with TypeTagVO

use of cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.TypeTagVO in project MyApp by MatthewDevelop.

the class TypePresenter method setTabUi.

/**
 * 设置tab
 */
public void setTabUi() {
    TabLayout tabLayout = mTypeView.getTabLayout();
    tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
    for (TypeTagVO bean : mDatas) {
        tabLayout.addTab(tabLayout.newTab().setText(bean.getName()));
    }
    tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {

        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            setTagUi(tab.getPosition());
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {
        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {
            if (llTag != null && llTag.getVisibility() == View.VISIBLE) {
                llTag.setVisibility(View.GONE);
            } else {
                setTagUi(tab.getPosition());
            }
        }
    });
}
Also used : TabLayout(android.support.design.widget.TabLayout) TypeTagVO(cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.TypeTagVO)

Aggregations

TypeTagVO (cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.TypeTagVO)2 TabLayout (android.support.design.widget.TabLayout)1 WanService (cn.foxconn.matthew.myapp.wanandroid.api.WanService)1 ResponseData (cn.foxconn.matthew.myapp.wanandroid.bean.ResponseData)1 BannerBean (cn.foxconn.matthew.myapp.wanandroid.bean.pojo.BannerBean)1 ArticleListVO (cn.foxconn.matthew.myapp.wanandroid.bean.pojovo.ArticleListVO)1 CustomInterceptor (cn.foxconn.matthew.myapp.wanandroid.helper.interceptor.CustomInterceptor)1 Disposable (io.reactivex.disposables.Disposable)1 List (java.util.List)1 OkHttpClient (okhttp3.OkHttpClient)1 Test (org.junit.Test)1 Retrofit (retrofit2.Retrofit)1