使用Rxjava和Fresco实现图片和视频的播放

使用的依赖和权限  需要导入library依赖包

implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.13'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'
implementation 'com.facebook.fresco:fresco:0.12.0'
// 支持 GIF 动图,需要添加
implementation 'com.facebook.fresco:animated-gif:0.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation project(':library')
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
activity_main
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <com.viewpagerindicator.TabPageIndicator
        android:id="@+id/titles"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <android.support.v4.view.ViewPager
        android:id="@+id/vp"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </android.support.v4.view.ViewPager>

</LinearLayout>

fragment_img

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

fragment_video

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

img_item

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:face="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:orientation="horizontal">

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/imgtou1"
            android:layout_marginTop="5dp"
            android:layout_width="50dp"
            android:layout_height="50dp"
            face:roundAsCircle="true" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/text4"
            android:layout_marginLeft="15dp" />

    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/text3" />

    <com.facebook.drawee.view.SimpleDraweeView
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:id="@+id/img" />

</LinearLayout>

vedio_item

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:face="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:orientation="horizontal">

        <com.facebook.drawee.view.SimpleDraweeView
            android:id="@+id/imgtou"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_marginTop="5dp"
            face:roundAsCircle="true" />

        <TextView
            android:id="@+id/text2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp" />

    </LinearLayout>

    <TextView
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <VideoView
        android:id="@+id/surface_view"
        android:layout_width="match_parent"
        android:layout_height="200dp" />

</LinearLayout>

MainActivity

import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.bwie.test.adapter.TabPageIndicatorAdapter;
import com.viewpagerindicator.TabPageIndicator;

public class MainActivity extends AppCompatActivity {
    private TabPageIndicator mTabPageIndicator;
    private ViewPager mVp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //隐藏原有标题
        getSupportActionBar().hide();
        initView();
        FragmentPagerAdapter adapter = new TabPageIndicatorAdapter(getSupportFragmentManager());
        mVp.setAdapter(adapter);
        mTabPageIndicator.setViewPager(mVp);

    }

    private void initView() {
        mTabPageIndicator = (TabPageIndicator) findViewById(R.id.titles);
        mVp = (ViewPager) findViewById(R.id.vp);
    }
}

fragment文件夹下ImgFragment

import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.bwie.test.adapter.ImgAdapter;
import com.bwie.test.bean.ImgBean;
import com.bwie.test.bean.VideoBean;
import com.bwie.test.component.DaggerHttpComponent;
import com.bwie.test.mysecondweeks.R;
import com.bwie.test.mysecondweeks.base.BaseFragment;
import com.bwie.test.mysecondweeks.contract.WeekContract;
import com.bwie.test.mysecondweeks.presenter.WeekPresenter;
import java.util.ArrayList;
import java.util.List;

/**
 * 图片
 */
public class ImgFragmet extends BaseFragment<WeekPresenter> implements WeekContract.View{
    private List<ImgBean.DataBean> data = new ArrayList<>();
    private ImgAdapter imgAdapter;

    @Override
    public int getContentLayout() {
        return R.layout.fragment_img;
    }

    @Override
    public void inject() {
        DaggerHttpComponent.builder()
                .build()
                .inject(this);
    }

    @Override
    public void initView(View view) {
        RecyclerView rv = view.findViewById(R.id.rv);
        //设置布局管理器
        rv.setLayoutManager(new LinearLayoutManager(getContext()));
        //加分割线
        rv.addItemDecoration(new DividerItemDecoration(getContext(),RecyclerView.VERTICAL));
        //设置适配器
        imgAdapter = new ImgAdapter(getContext(), data);
        rv.setAdapter(imgAdapter);

        //先去请求数据
        mPresenter.getImage();
    }

    @Override
    public void imgSuccess(List<ImgBean.DataBean> data) {
        if (imgAdapter!=null){
            imgAdapter.setData(data);
        }
    }

    @Override
    public void videoSuccess(List<VideoBean.DataBean> data) {

    }
}

VideoFragment

import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.bwie.test.adapter.VideoAdapter;
import com.bwie.test.bean.ImgBean;
import com.bwie.test.bean.VideoBean;
import com.bwie.test.component.DaggerHttpComponent;
import com.bwie.test.mysecondweeks.R;
import com.bwie.test.mysecondweeks.base.BaseFragment;
import com.bwie.test.mysecondweeks.contract.WeekContract;
import com.bwie.test.mysecondweeks.presenter.WeekPresenter;
import java.util.ArrayList;
import java.util.List;

/**
 * 视频
 */
public class VideoFragment extends BaseFragment<WeekPresenter> implements WeekContract.View{
    private List<VideoBean.DataBean> data = new ArrayList<>();
    private VideoAdapter videoAdapter;

    @Override
    public int getContentLayout() {
        return R.layout.fragment_video;
    }

    @Override
    public void inject() {
        DaggerHttpComponent.builder()
                .build()
                .inject(this);
    }

    @Override
    public void initView(View view) {
        RecyclerView rv = view.findViewById(R.id.rv);
        //设置布局管理器
        rv.setLayoutManager(new LinearLayoutManager(getContext()));
        //加分割线
        rv.addItemDecoration(new DividerItemDecoration(getContext(),RecyclerView.VERTICAL));
        //设置适配器
        videoAdapter = new VideoAdapter(getContext(), data);
        rv.setAdapter(videoAdapter);
        //请求数据
        mPresenter.getVideo();
    }

    @Override
    public void imgSuccess(List<ImgBean.DataBean> data) {

    }

    @Override
    public void videoSuccess(List<VideoBean.DataBean> data) {
        if (videoAdapter != null){
            videoAdapter.setData(data);
        }
    }
}

app文件夹下MyApp

import android.app.Application;
import com.facebook.drawee.backends.pipeline.Fresco;

public class MyApp extends Application{
    @Override
    public void onCreate() {
        super.onCreate();
        //初始化fresco
        Fresco.initialize(this);
    }
}

base文件夹下BaseContract

public interface BaseContract {
    interface BasePresenter<T extends BaseView> {
        void attachView(T view);
        void detachView();

    }

    interface BaseView {
        void showLoading();
    }
}

BaseFragment

扫描二维码关注公众号,回复: 1115886 查看本文章
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bwie.test.inter.IBase;
import javax.inject.Inject;

public abstract class BaseFragment<T extends BaseContract.BasePresenter> extends Fragment 
                                   implements IBase, BaseContract.BaseView {
    @Inject
    protected T mPresenter;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, 
                               @Nullable Bundle savedInstanceState) {
        inject();
        View view = inflater.inflate(getContentLayout(), null);
        initView(view);
        if (mPresenter != null) {
            mPresenter.attachView(this);
        }
        return view;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mPresenter != null) {
            mPresenter.detachView();
        }
    }

    @Override
    public void showLoading() {

    }
}

BasePresenter

public class BasePresenter<T extends BaseContract.BaseView> implements BaseContract.BasePresenter<T> {
    protected T mView;

    @Override
    public void attachView(T view) {
        if (view != null) {
            this.mView = view;
        }
    }

    @Override
    public void detachView() {
        if (mView != null) {
            mView = null;
        }
    }
}

contract文件夹下WeekContract

import com.bwie.test.bean.ImgBean;
import com.bwie.test.bean.VideoBean;
import com.bwie.test.mysecondweeks.base.BaseContract;
import java.util.List;

public interface WeekContract {
    interface View extends BaseContract.BaseView{
        void imgSuccess(List<ImgBean.DataBean> data);
        void videoSuccess(List<VideoBean.DataBean> data);
    }

    interface Presenter extends BaseContract.BasePresenter<View>{
        void getImage();
        void getVideo();
    }
}

presenter文件夹下WeekPresenter

import com.bwie.test.bean.ImgBean;
import com.bwie.test.bean.VideoBean;
import com.bwie.test.mysecondweeks.base.BasePresenter;
import com.bwie.test.mysecondweeks.contract.WeekContract;
import com.bwie.test.net.WeekApi;

import java.util.List;
import javax.inject.Inject;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;

public class WeekPresenter extends BasePresenter<WeekContract.View> implements WeekContract.Presenter{
    private WeekApi weekApi;

    @Inject
    public WeekPresenter(WeekApi weekApi) {
        this.weekApi = weekApi;
    }

    @Override
    public void getImage() {
        weekApi.getImage()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .map(new Function<ImgBean, List<ImgBean.DataBean>>() {
                    @Override
                    public List<ImgBean.DataBean> apply(ImgBean imgBean) throws Exception {
                        return imgBean.getData();
                    }
                }).subscribe(new Consumer<List<ImgBean.DataBean>>() {
            @Override
            public void accept(List<ImgBean.DataBean> dataBeans) throws Exception {
                if (mView != null){
                    mView.imgSuccess(dataBeans);
                }
            }
        });
    }

    @Override
    public void getVideo() {
        weekApi.getVideo()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .map(new Function<VideoBean, List<VideoBean.DataBean>>() {
                    @Override
                    public List<VideoBean.DataBean> apply(VideoBean videoBean) throws Exception {
                        return videoBean.getData();
                    }
                }).subscribe(new Consumer<List<VideoBean.DataBean>>() {
            @Override
            public void accept(List<VideoBean.DataBean> dataBeans) throws Exception {
                if (mView != null){
                    mView.videoSuccess(dataBeans);
                }
            }
        });
    }
}

adapter文件夹下ImgAdapter

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bwie.test.bean.ImgBean;
import com.bwie.test.mysecondweeks.R;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.backends.pipeline.PipelineDraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;

public class ImgAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private Context context;
    private List<ImgBean.DataBean> data;
    private LayoutInflater inflater;

    public ImgAdapter(Context context, List<ImgBean.DataBean> data) {
        this.context = context;
        this.data = data;
        inflater = LayoutInflater.from(context);
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.img_item, parent, false);
        return new ImgViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        ImgViewHolder imgViewHolder = (ImgViewHolder) holder;
        ImgBean.DataBean dataBean = data.get(position);
        imgViewHolder.imgtou1.setImageURI(dataBean.getProfile_image());
        imgViewHolder.text4.setText(dataBean.getName());
        imgViewHolder.text3.setText(dataBean.getText());
        if (dataBean.isIs_gif()) {
            PipelineDraweeController controller = (PipelineDraweeController) 
                                       Fresco.newDraweeControllerBuilder()
                            .setUri(dataBean.getImage0())
                            .setAutoPlayAnimations(true) //自动播放gif动画
                            .build();
            imgViewHolder.img.setController(controller);
        } else {
            imgViewHolder.img.setImageURI(dataBean.getImage0());
        }
    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class ImgViewHolder extends RecyclerView.ViewHolder {
        private final SimpleDraweeView imgtou1;
        private final TextView text4;
        private final TextView text3;
        private final SimpleDraweeView img;

        public ImgViewHolder(View itemView) {
            super(itemView);
            imgtou1 = itemView.findViewById(R.id.imgtou1);
            text4 = itemView.findViewById(R.id.text4);
            text3 = itemView.findViewById(R.id.text3);
            img = itemView.findViewById(R.id.img);
        }
    }

    public void setData(List<ImgBean.DataBean> list){
        if (data!=null){
            data.clear();
            data.addAll(list);
            notifyDataSetChanged();
        }
    }
}

TabPageIndicatorAdapter

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.bwie.test.mysecondweeks.fragment.ImgFragmet;
import com.bwie.test.mysecondweeks.fragment.VideoFragment;

public class TabPageIndicatorAdapter extends FragmentPagerAdapter {
    /**
     * Tab标题
     */
    private static final String[] TITLE = new String[]{"图片", "视频", "另一面", "女人",
            "财经", "数码", "情感", "科技"};

    public TabPageIndicatorAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment = null;
        if (position % 2 == 0) {
            fragment = new ImgFragmet();
        } else {
            fragment = new VideoFragment();
        }
        return fragment;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return TITLE[position % TITLE.length];
    }

    @Override
    public int getCount() {
        return TITLE.length;
    }
}

VideoAdapter

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.VideoView;

import com.bwie.test.bean.VideoBean;
import com.bwie.test.mysecondweeks.R;
import com.facebook.drawee.view.SimpleDraweeView;
import java.util.List;

public class VideoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    private Context context;
    private List<VideoBean.DataBean> data;
    private LayoutInflater inflater;

    public VideoAdapter(Context context, List<VideoBean.DataBean> data) {
        this.context = context;
        this.data = data;
        inflater = LayoutInflater.from(context);
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.vedio_item, parent, false);
        return new VideoViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        VideoViewHolder videoViewHolder = (VideoViewHolder) holder;
        VideoBean.DataBean dataBean = data.get(position);
        videoViewHolder.imgtou.setImageURI(dataBean.getProfile_image());
        videoViewHolder.text1.setText(dataBean.getText());
        videoViewHolder.text2.setText(dataBean.getName());
        videoViewHolder.videoView.setVideoPath(dataBean.getVideouri());
        videoViewHolder.videoView.start();
    }

    @Override
    public int getItemCount() {
        return data.size();
    }

    class VideoViewHolder extends RecyclerView.ViewHolder {
        private final SimpleDraweeView imgtou;
        private final TextView text2;
        private final TextView text1;
        private final VideoView videoView;

        public VideoViewHolder(View itemView) {
            super(itemView);
            imgtou = itemView.findViewById(R.id.imgtou);
            text2 = itemView.findViewById(R.id.text2);
            text1 = itemView.findViewById(R.id.text1);
            videoView = itemView.findViewById(R.id.surface_view);
        }
    }

    public void setData(List<VideoBean.DataBean> list) {
        if (data != null) {
            data.clear();
            data.addAll(list);
            notifyDataSetChanged();
        }
    }
}

inter文件夹下IBase

import android.view.View;

public interface IBase {
    int getContentLayout();
    void inject();
    void initView(View view);
}

component文件夹下HttpComponent

import com.bwie.test.module.HttpModule;
import com.bwie.test.mysecondweeks.fragment.ImgFragmet;
import com.bwie.test.mysecondweeks.fragment.VideoFragment;
import dagger.Component;

@Component(modules = HttpModule.class)
public interface HttpComponent {
    void inject(ImgFragmet imgFragmet);
    void inject(VideoFragment videoFragment);
}

module文件夹下HttpModule

import com.bwie.test.net.WeekApi;
import com.bwie.test.net.WeekApiService;
import java.util.concurrent.TimeUnit;

import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

@Module
public class HttpModule {
    @Provides
    OkHttpClient.Builder provideOkHttpClientBuilder(){
        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
        loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
        return new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .writeTimeout(20, TimeUnit.SECONDS)
                .readTimeout(20,TimeUnit.SECONDS)
                .connectTimeout(20,TimeUnit.SECONDS);
    }

    @Provides
    WeekApi provideWeekApi(OkHttpClient.Builder builder){
        WeekApiService weekApiService = new Retrofit.Builder()
                .baseUrl("https://www.apiopen.top/")
                .client(builder.build())
                .addConverterFactory(GsonConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .build()
                .create(WeekApiService.class);
        return WeekApi.getWeekApi(weekApiService);
    }
}

net文件夹下WeekApi

import com.bwie.test.bean.ImgBean;
import com.bwie.test.bean.VideoBean;
import io.reactivex.Observable;

public class WeekApi {
    private static WeekApi weekApi;
    private WeekApiService weekApiService;

    public WeekApi(WeekApiService weekApiService) {
        this.weekApiService = weekApiService;
    }

    public static WeekApi getWeekApi(WeekApiService weekApiService) {
        if (weekApi == null) {
            weekApi = new WeekApi(weekApiService);
        }
        return weekApi;
    }

    public Observable<ImgBean> getImage() {
        return weekApiService.getImage();
    }

    public Observable<VideoBean> getVideo() {
        return weekApiService.getVideo();
    }
}

WeekApiService

import com.bwie.test.bean.ImgBean;
import com.bwie.test.bean.VideoBean;
import io.reactivex.Observable;
import retrofit2.http.GET;

public interface WeekApiService {
    @GET("satinApi?type=3&page=1")
    Observable<ImgBean> getImage();

    @GET("satinApi?type=4&page=1")
    Observable<VideoBean> getVideo();
}

bean文件夹下ImgBean

import java.util.List;

public class ImgBean {

    private int code;
    private String msg;
    private List<DataBean> data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {

        private String type;
        private String text;
        private String user_id;
        private String name;
        private String screen_name;
        private String profile_image;
        private String created_at;
        private Object create_time;
        private String passtime;
        private String love;
        private String hate;
        private String comment;
        private String repost;
        private String bookmark;
        private String bimageuri;
        private Object voiceuri;
        private Object voicetime;
        private Object voicelength;
        private String status;
        private String theme_id;
        private String theme_name;
        private String theme_type;
        private String videouri;
        private int videotime;
        private String original_pid;
        private int cache_version;
        private Object playcount;
        private Object playfcount;
        private String cai;
        private Object weixin_url;
        private String image1;
        private String image2;
        private boolean is_gif;
        private String image0;
        private Object image_small;
        private String cdn_img;
        private String width;
        private String height;
        private String tag;
        private int t;
        private String ding;
        private String favourite;
        private Object top_cmt;
        private Object themes;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public String getUser_id() {
            return user_id;
        }

        public void setUser_id(String user_id) {
            this.user_id = user_id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getScreen_name() {
            return screen_name;
        }

        public void setScreen_name(String screen_name) {
            this.screen_name = screen_name;
        }

        public String getProfile_image() {
            return profile_image;
        }

        public void setProfile_image(String profile_image) {
            this.profile_image = profile_image;
        }

        public String getCreated_at() {
            return created_at;
        }

        public void setCreated_at(String created_at) {
            this.created_at = created_at;
        }

        public Object getCreate_time() {
            return create_time;
        }

        public void setCreate_time(Object create_time) {
            this.create_time = create_time;
        }

        public String getPasstime() {
            return passtime;
        }

        public void setPasstime(String passtime) {
            this.passtime = passtime;
        }

        public String getLove() {
            return love;
        }

        public void setLove(String love) {
            this.love = love;
        }

        public String getHate() {
            return hate;
        }

        public void setHate(String hate) {
            this.hate = hate;
        }

        public String getComment() {
            return comment;
        }

        public void setComment(String comment) {
            this.comment = comment;
        }

        public String getRepost() {
            return repost;
        }

        public void setRepost(String repost) {
            this.repost = repost;
        }

        public String getBookmark() {
            return bookmark;
        }

        public void setBookmark(String bookmark) {
            this.bookmark = bookmark;
        }

        public String getBimageuri() {
            return bimageuri;
        }

        public void setBimageuri(String bimageuri) {
            this.bimageuri = bimageuri;
        }

        public Object getVoiceuri() {
            return voiceuri;
        }

        public void setVoiceuri(Object voiceuri) {
            this.voiceuri = voiceuri;
        }

        public Object getVoicetime() {
            return voicetime;
        }

        public void setVoicetime(Object voicetime) {
            this.voicetime = voicetime;
        }

        public Object getVoicelength() {
            return voicelength;
        }

        public void setVoicelength(Object voicelength) {
            this.voicelength = voicelength;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getTheme_id() {
            return theme_id;
        }

        public void setTheme_id(String theme_id) {
            this.theme_id = theme_id;
        }

        public String getTheme_name() {
            return theme_name;
        }

        public void setTheme_name(String theme_name) {
            this.theme_name = theme_name;
        }

        public String getTheme_type() {
            return theme_type;
        }

        public void setTheme_type(String theme_type) {
            this.theme_type = theme_type;
        }

        public String getVideouri() {
            return videouri;
        }

        public void setVideouri(String videouri) {
            this.videouri = videouri;
        }

        public int getVideotime() {
            return videotime;
        }

        public void setVideotime(int videotime) {
            this.videotime = videotime;
        }

        public String getOriginal_pid() {
            return original_pid;
        }

        public void setOriginal_pid(String original_pid) {
            this.original_pid = original_pid;
        }

        public int getCache_version() {
            return cache_version;
        }

        public void setCache_version(int cache_version) {
            this.cache_version = cache_version;
        }

        public Object getPlaycount() {
            return playcount;
        }

        public void setPlaycount(Object playcount) {
            this.playcount = playcount;
        }

        public Object getPlayfcount() {
            return playfcount;
        }

        public void setPlayfcount(Object playfcount) {
            this.playfcount = playfcount;
        }

        public String getCai() {
            return cai;
        }

        public void setCai(String cai) {
            this.cai = cai;
        }

        public Object getWeixin_url() {
            return weixin_url;
        }

        public void setWeixin_url(Object weixin_url) {
            this.weixin_url = weixin_url;
        }

        public String getImage1() {
            return image1;
        }

        public void setImage1(String image1) {
            this.image1 = image1;
        }

        public String getImage2() {
            return image2;
        }

        public void setImage2(String image2) {
            this.image2 = image2;
        }

        public boolean isIs_gif() {
            return is_gif;
        }

        public void setIs_gif(boolean is_gif) {
            this.is_gif = is_gif;
        }

        public String getImage0() {
            return image0;
        }

        public void setImage0(String image0) {
            this.image0 = image0;
        }

        public Object getImage_small() {
            return image_small;
        }

        public void setImage_small(Object image_small) {
            this.image_small = image_small;
        }

        public String getCdn_img() {
            return cdn_img;
        }

        public void setCdn_img(String cdn_img) {
            this.cdn_img = cdn_img;
        }

        public String getWidth() {
            return width;
        }

        public void setWidth(String width) {
            this.width = width;
        }

        public String getHeight() {
            return height;
        }

        public void setHeight(String height) {
            this.height = height;
        }

        public String getTag() {
            return tag;
        }

        public void setTag(String tag) {
            this.tag = tag;
        }

        public int getT() {
            return t;
        }

        public void setT(int t) {
            this.t = t;
        }

        public String getDing() {
            return ding;
        }

        public void setDing(String ding) {
            this.ding = ding;
        }

        public String getFavourite() {
            return favourite;
        }

        public void setFavourite(String favourite) {
            this.favourite = favourite;
        }

        public Object getTop_cmt() {
            return top_cmt;
        }

        public void setTop_cmt(Object top_cmt) {
            this.top_cmt = top_cmt;
        }

        public Object getThemes() {
            return themes;
        }

        public void setThemes(Object themes) {
            this.themes = themes;
        }
    }
}

VideoBean

import java.util.List;

public class VideoBean {

    private int code;
    private String msg;
    private List<DataBean> data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {

        private String type;
        private String text;
        private String user_id;
        private String name;
        private String screen_name;
        private String profile_image;
        private String created_at;
        private Object create_time;
        private String passtime;
        private String love;
        private String hate;
        private String comment;
        private String repost;
        private String bookmark;
        private String bimageuri;
        private Object voiceuri;
        private Object voicetime;
        private Object voicelength;
        private String status;
        private String theme_id;
        private String theme_name;
        private String theme_type;
        private String videouri;
        private int videotime;
        private String original_pid;
        private int cache_version;
        private String playcount;
        private String playfcount;
        private String cai;
        private Object weixin_url;
        private String image1;
        private String image2;
        private boolean is_gif;
        private String image0;
        private String image_small;
        private String cdn_img;
        private String width;
        private String height;
        private String tag;
        private int t;
        private String ding;
        private String favourite;
        private Object top_cmt;
        private Object themes;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }

        public String getUser_id() {
            return user_id;
        }

        public void setUser_id(String user_id) {
            this.user_id = user_id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getScreen_name() {
            return screen_name;
        }

        public void setScreen_name(String screen_name) {
            this.screen_name = screen_name;
        }

        public String getProfile_image() {
            return profile_image;
        }

        public void setProfile_image(String profile_image) {
            this.profile_image = profile_image;
        }

        public String getCreated_at() {
            return created_at;
        }

        public void setCreated_at(String created_at) {
            this.created_at = created_at;
        }

        public Object getCreate_time() {
            return create_time;
        }

        public void setCreate_time(Object create_time) {
            this.create_time = create_time;
        }

        public String getPasstime() {
            return passtime;
        }

        public void setPasstime(String passtime) {
            this.passtime = passtime;
        }

        public String getLove() {
            return love;
        }

        public void setLove(String love) {
            this.love = love;
        }

        public String getHate() {
            return hate;
        }

        public void setHate(String hate) {
            this.hate = hate;
        }

        public String getComment() {
            return comment;
        }

        public void setComment(String comment) {
            this.comment = comment;
        }

        public String getRepost() {
            return repost;
        }

        public void setRepost(String repost) {
            this.repost = repost;
        }

        public String getBookmark() {
            return bookmark;
        }

        public void setBookmark(String bookmark) {
            this.bookmark = bookmark;
        }

        public String getBimageuri() {
            return bimageuri;
        }

        public void setBimageuri(String bimageuri) {
            this.bimageuri = bimageuri;
        }

        public Object getVoiceuri() {
            return voiceuri;
        }

        public void setVoiceuri(Object voiceuri) {
            this.voiceuri = voiceuri;
        }

        public Object getVoicetime() {
            return voicetime;
        }

        public void setVoicetime(Object voicetime) {
            this.voicetime = voicetime;
        }

        public Object getVoicelength() {
            return voicelength;
        }

        public void setVoicelength(Object voicelength) {
            this.voicelength = voicelength;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getTheme_id() {
            return theme_id;
        }

        public void setTheme_id(String theme_id) {
            this.theme_id = theme_id;
        }

        public String getTheme_name() {
            return theme_name;
        }

        public void setTheme_name(String theme_name) {
            this.theme_name = theme_name;
        }

        public String getTheme_type() {
            return theme_type;
        }

        public void setTheme_type(String theme_type) {
            this.theme_type = theme_type;
        }

        public String getVideouri() {
            return videouri;
        }

        public void setVideouri(String videouri) {
            this.videouri = videouri;
        }

        public int getVideotime() {
            return videotime;
        }

        public void setVideotime(int videotime) {
            this.videotime = videotime;
        }

        public String getOriginal_pid() {
            return original_pid;
        }

        public void setOriginal_pid(String original_pid) {
            this.original_pid = original_pid;
        }

        public int getCache_version() {
            return cache_version;
        }

        public void setCache_version(int cache_version) {
            this.cache_version = cache_version;
        }

        public String getPlaycount() {
            return playcount;
        }

        public void setPlaycount(String playcount) {
            this.playcount = playcount;
        }

        public String getPlayfcount() {
            return playfcount;
        }

        public void setPlayfcount(String playfcount) {
            this.playfcount = playfcount;
        }

        public String getCai() {
            return cai;
        }

        public void setCai(String cai) {
            this.cai = cai;
        }

        public Object getWeixin_url() {
            return weixin_url;
        }

        public void setWeixin_url(Object weixin_url) {
            this.weixin_url = weixin_url;
        }

        public String getImage1() {
            return image1;
        }

        public void setImage1(String image1) {
            this.image1 = image1;
        }

        public String getImage2() {
            return image2;
        }

        public void setImage2(String image2) {
            this.image2 = image2;
        }

        public boolean isIs_gif() {
            return is_gif;
        }

        public void setIs_gif(boolean is_gif) {
            this.is_gif = is_gif;
        }

        public String getImage0() {
            return image0;
        }

        public void setImage0(String image0) {
            this.image0 = image0;
        }

        public String getImage_small() {
            return image_small;
        }

        public void setImage_small(String image_small) {
            this.image_small = image_small;
        }

        public String getCdn_img() {
            return cdn_img;
        }

        public void setCdn_img(String cdn_img) {
            this.cdn_img = cdn_img;
        }

        public String getWidth() {
            return width;
        }

        public void setWidth(String width) {
            this.width = width;
        }

        public String getHeight() {
            return height;
        }

        public void setHeight(String height) {
            this.height = height;
        }

        public String getTag() {
            return tag;
        }

        public void setTag(String tag) {
            this.tag = tag;
        }

        public int getT() {
            return t;
        }

        public void setT(int t) {
            this.t = t;
        }

        public String getDing() {
            return ding;
        }

        public void setDing(String ding) {
            this.ding = ding;
        }

        public String getFavourite() {
            return favourite;
        }

        public void setFavourite(String favourite) {
            this.favourite = favourite;
        }

        public Object getTop_cmt() {
            return top_cmt;
        }

        public void setTop_cmt(Object top_cmt) {
            this.top_cmt = top_cmt;
        }

        public Object getThemes() {
            return themes;
        }

        public void setThemes(Object themes) {
            this.themes = themes;
        }
    }
}

猜你喜欢

转载自blog.csdn.net/gh323093/article/details/80411764
今日推荐