Search in sources :

Example 1 with Movie

use of com.shizhefei.test.models.enties.Movie in project MVCHelper by LuckyJayce.

the class MovieDetailDataSource method loadMovies.

private List<Movie> loadMovies(int page) throws Exception {
    // 这里用百度首页模拟网络请求,如果网路出错的话,直接抛异常不会执行后面的获取books的语句
    HttpUtils.executeGet("https://www.baidu.com");
    Thread.sleep(300);
    List<Movie> movies = new ArrayList<Movie>();
    for (int i = 0; i < 20; i++) {
        movies.add(new Movie("海贼王第" + (20 * (page - 1) + i + 1) + " 集", i, "page" + page + " 海贼王剧情简介 " + i, "00:30"));
    }
    this.moviePage = page;
    return movies;
}
Also used : Movie(com.shizhefei.test.models.enties.Movie) ArrayList(java.util.ArrayList)

Example 2 with Movie

use of com.shizhefei.test.models.enties.Movie in project MVCHelper by LuckyJayce.

the class MovieDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ultrarecyclerview);
    PtrClassicFrameLayout contentLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    mvcHelper = new MVCUltraHelper<Data3<Movie, List<Discuss>, List<Movie>>>(contentLayout);
    // 设置数据源
    mvcHelper.setDataSource(new MovieDetailDataSource());
    // 设置适配器
    mvcHelper.setAdapter(new MovieDetailAdapter(this));
    // 加载数据
    mvcHelper.refresh();
}
Also used : Movie(com.shizhefei.test.models.enties.Movie) PtrClassicFrameLayout(in.srain.cube.views.ptr.PtrClassicFrameLayout) Data3(com.shizhefei.mvc.data.Data3) Discuss(com.shizhefei.test.models.enties.Discuss) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) MovieDetailAdapter(com.shizhefei.test.view.adapters.MovieDetailAdapter) MovieDetailDataSource(com.shizhefei.test.models.datasource.MovieDetailDataSource)

Example 3 with Movie

use of com.shizhefei.test.models.enties.Movie in project MVCHelper by LuckyJayce.

the class MovieDetailDataSource method refresh.

@Override
public Data3<Movie, List<Discuss>, List<Movie>> refresh() throws Exception {
    Movie value1 = new Movie("海贼王第23集", 67.0, "哲普的出现,揭露了他和克利克都到过伟大的航路的事实,从阿金口中得知他们在伟大的航路碰上一个神秘的男人,他竟独力打败了五十艘海贼船,而就在克利克为抢夺哲普的航海日记及海上餐厅这艘船时,传说中鹰眼的男人出现了", "00:30");
    Data3<Movie, List<Discuss>, List<Movie>> data = new Data3<Movie, List<Discuss>, List<Movie>>(value1, loadDiscuss(1), null);
    bookPage = 1;
    moviePage = 0;
    return data;
}
Also used : Movie(com.shizhefei.test.models.enties.Movie) Data3(com.shizhefei.mvc.data.Data3) Discuss(com.shizhefei.test.models.enties.Discuss) List(java.util.List) ArrayList(java.util.ArrayList)

Example 4 with Movie

use of com.shizhefei.test.models.enties.Movie in project MVCHelper by LuckyJayce.

the class MoviesDataSource method load.

private List<Movie> load(int page) throws Exception {
    // 这里用百度首页模拟网络请求,如果网路出错的话,直接抛异常不会执行后面的获取books的语句
    HttpUtils.executeGet("https://www.baidu.com");
    Thread.sleep(300);
    List<Movie> movies = new ArrayList<Movie>();
    for (int i = 0; i < 20; i++) {
        movies.add(new Movie("海贼王第" + (20 * (page - 1) + i + 1) + " 集", i, "page" + page + " 海贼王剧情简介 " + i, "00:30"));
    }
    this.moviePage = page;
    return movies;
}
Also used : Movie(com.shizhefei.test.models.enties.Movie) ArrayList(java.util.ArrayList)

Example 5 with Movie

use of com.shizhefei.test.models.enties.Movie in project MVCHelper by LuckyJayce.

the class MovieDetailAdapter method onBindOtherMovieViewHolder.

private void onBindOtherMovieViewHolder(ViewHolder holder, int position) {
    OtherViewHolder viewHolder = (OtherViewHolder) holder;
    Movie movie = mData.getValue3().get(position - 1 - mData.getValue2().size());
    viewHolder.description.setText(movie.getDescription());
    viewHolder.name.setText(movie.getName());
    viewHolder.time.setText(movie.getTime());
}
Also used : Movie(com.shizhefei.test.models.enties.Movie)

Aggregations

Movie (com.shizhefei.test.models.enties.Movie)6 ArrayList (java.util.ArrayList)3 Data3 (com.shizhefei.mvc.data.Data3)2 Discuss (com.shizhefei.test.models.enties.Discuss)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 MovieDetailDataSource (com.shizhefei.test.models.datasource.MovieDetailDataSource)1 MovieDetailAdapter (com.shizhefei.test.view.adapters.MovieDetailAdapter)1 PtrClassicFrameLayout (in.srain.cube.views.ptr.PtrClassicFrameLayout)1 List (java.util.List)1