package com.joker.fourfun.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.joker.fourfun.R;
import com.joker.fourfun.base.BaseMvpFragment;
import com.joker.fourfun.model.PicOne;
import com.joker.fourfun.presenter.PictureChildPresenter;
import com.joker.fourfun.presenter.contract.PictureChildContract;
import com.joker.fourfun.utils.GlideUtil;
import com.orhanobut.logger.Logger;

import butterknife.BindView;
import butterknife.ButterKnife;

public class PictureChildFragment extends BaseMvpFragment<PictureChildContract.View,
        PictureChildPresenter> implements PictureChildContract.View {
    @BindView(R.id.iv_content)
    ImageView mIvContent;
    private int mPosition = 0;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_picture_child, container, false);
        ButterKnife.bind(this, view);

        return view;
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
        Logger.e("onLazyInitView");
        mPresenter.getContent(mPosition * -1);
    }

    public void setFragmentPosition(int position) {
        mPosition = position;
    }

    @Override
    public void showContent(PicOne picOne) {
        GlideUtil.setImage(mActivity, picOne.getPicUrl(), mIvContent);
    }

    @Override
    public void showError(String message) {

    }

    @Override
    protected void initInject() {
        getComponent().inject(this);
    }
}

@@ -228,16 +228,48 @@
 ageView;
+%0Aimport android.widget.TextView;
 %0A%0Aimport
@@ -861,33 +861,252 @@
     
-private int mPosition = 0
+@BindView(R.id.tv_VOL)%0A    TextView mTvVOL;%0A    @BindView(R.id.tv_author)%0A    TextView mTvAuthor;%0A    @BindView(R.id.tv_des)%0A    TextView mTvDes;%0A    @BindView(R.id.tv_date)%0A    TextView mTvDate;%0A    // %E7%BD%91%E9%A1%B5%E6%9B%B4%E6%96%B0%E6%85%A2%E4%B8%80%E5%A4%A9%EF%BC%8C%E6%89%80%E4%BB%A5%E9%BB%98%E8%AE%A4%E5%80%BC%E4%B8%BA 1%0A    private int mDay = 1
 ;%0A%0A 
@@ -1608,24 +1608,19 @@
 ontent(m
-Position
+Day
  * -1);%0A
@@ -1674,24 +1674,49 @@
 position) %7B%0A
+        // %E7%BD%91%E9%A1%B5%E6%9B%B4%E6%96%B0%E6%85%A2%E4%B8%80%E5%A4%A9 %E6%95%85%E8%A6%81 +1%0A
         mPos
@@ -1712,24 +1712,19 @@
        m
-Position
+Day
  = posit
@@ -1726,16 +1726,20 @@
 position
+ + 1
 ;%0A    %7D%0A
@@ -1794,24 +1794,24 @@
 e picOne) %7B%0A
-
         Glid
@@ -1869,16 +1869,206 @@
 ntent);%0A
+        mTvAuthor.setText(picOne.getAuthorWork());%0A        mTvVOL.setText(picOne.getVOL());%0A        mTvDes.setText(picOne.getPicDescription());%0A        mTvDate.setText(picOne.getPicDate());%0A
     %7D%0A%0A 

add field