package jp.gr.procon.proconapp.ui.fragment;
import android.app.Activity;
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.bumptech.glide.Glide;
import jp.gr.procon.proconapp.R;
import jp.gr.procon.proconapp.model.GamePhoto;
public class PhotoDetailFragment extends BaseFragment {
private static final String ARG_PHOTO = "arg_photo";
private GamePhoto mGamePhoto;
public static PhotoDetailFragment newInstance(GamePhoto photo) {
PhotoDetailFragment fragment = new PhotoDetailFragment();
Bundle args = new Bundle();
args.putSerializable(ARG_PHOTO, photo);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mGamePhoto = (GamePhoto) getArguments().getSerializable(ARG_PHOTO);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_photo_detail, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ImageView imageView = (ImageView) view.findViewById(R.id.image_view);
Glide.with(this)
.load(mGamePhoto.getmOriginalUrl())
.into(imageView);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
@Override
public void onDetach() {
super.onDetach();
}
}