| | |
| | | import android.content.SharedPreferences; |
| | | import android.os.Bundle; |
| | | import android.support.v4.widget.SwipeRefreshLayout; |
| | | import android.support.v7.widget.LinearLayoutManager; |
| | | import android.support.v7.widget.RecyclerView; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | |
| | | import com.weikou.beibeivideo.BasicTextHttpResponseHandler; |
| | | import com.weikou.beibeivideo.BeibeiVideoAPI; |
| | | import com.weikou.beibeivideo.entity.VideoInfo; |
| | | import com.weikou.beibeivideo.ui.discover.StarWorksAdapter; |
| | | import com.yeshi.buwanshequ.R; |
| | | import com.weikou.beibeivideo.entity.video.VideoContent; |
| | | import com.weikou.beibeivideo.ui.video.VideoCloumn1Adapter; |
| | | import com.weikou.beibeivideo.util.DimenUtils; |
| | | import com.weikou.beibeivideo.util.ui.DividerItemDecoration; |
| | | import com.weikou.beibeivideo.R; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | OnClickListener { |
| | | private View specifi_detail_top; |
| | | private SwipeRefreshLayout rl_specific_detail; |
| | | private ListView lv_specific_detail; |
| | | private RecyclerView rv_specific_detail; |
| | | private ImageView specific_detail_banner; |
| | | private TextView specific_detail_name, specific_detail_introduction; |
| | | |
| | | private List<VideoInfo> mVideoInfos; |
| | | private StarWorksAdapter mSpecificMovieAdapter; |
| | | private List<VideoContent> mVideoInfos; |
| | | private VideoCloumn1Adapter mSpecificMovieAdapter; |
| | | |
| | | private String id; |
| | | |
| | |
| | | public void onCreateView(View contentView, Bundle savedInstanceState) { |
| | | Bundle bundle = getArguments(); |
| | | id = bundle.getString("id"); |
| | | rl_specific_detail = (SwipeRefreshLayout) contentView.findViewById(R.id.rl_specific_detail); |
| | | lv_specific_detail = (ListView) contentView |
| | | .findViewById(R.id.lv_specific_detail); |
| | | rl_specific_detail = contentView.findViewById(R.id.rl_specific_detail); |
| | | rv_specific_detail = contentView |
| | | .findViewById(R.id.rv_specific_detail); |
| | | |
| | | specifi_detail_top = LayoutInflater.from(lv_specific_detail.getContext()).inflate( |
| | | rv_specific_detail.setLayoutManager(new LinearLayoutManager(getContext())); |
| | | DividerItemDecoration decoration = new DividerItemDecoration(); |
| | | decoration.setSize(DimenUtils.dip2px(rv_specific_detail.getContext(), 6)); |
| | | rv_specific_detail.addItemDecoration(decoration); |
| | | |
| | | specifi_detail_top = LayoutInflater.from(rv_specific_detail.getContext()).inflate( |
| | | R.layout.specific_detail_top, null); |
| | | |
| | | specific_detail_banner = (ImageView) specifi_detail_top |
| | | specific_detail_banner = specifi_detail_top |
| | | .findViewById(R.id.specific_detail_banner); |
| | | specific_detail_name = (TextView) specifi_detail_top |
| | | specific_detail_name = specifi_detail_top |
| | | .findViewById(R.id.specific_detail_name); |
| | | specific_detail_introduction = (TextView) specifi_detail_top |
| | | specific_detail_introduction = specifi_detail_top |
| | | .findViewById(R.id.specific_detail_introduction); |
| | | |
| | | mVideoInfos = new ArrayList<VideoInfo>(); |
| | | mSpecificMovieAdapter = new StarWorksAdapter(mVideoInfos, |
| | | getActivity().getApplicationContext()); |
| | | lv_specific_detail.addHeaderView(specifi_detail_top); |
| | | mVideoInfos = new ArrayList<>(); |
| | | mSpecificMovieAdapter = new VideoCloumn1Adapter(getActivity(), mVideoInfos); |
| | | mSpecificMovieAdapter.setHeaderView(specifi_detail_top); |
| | | rl_specific_detail.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { |
| | | @Override |
| | | public void onRefresh() { |
| | | getSpecialDetail(); |
| | | } |
| | | }); |
| | | lv_specific_detail.setAdapter(mSpecificMovieAdapter); |
| | | rv_specific_detail.setAdapter(mSpecificMovieAdapter); |
| | | |
| | | lv_specific_detail.postDelayed(new Runnable() { |
| | | rv_specific_detail.postDelayed(new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | |
| | | "user", Context.MODE_PRIVATE); |
| | | String uid = preferences.getString("uid", ""); |
| | | |
| | | BeibeiVideoAPI.getSpecialDetail(lv_specific_detail.getContext(), uid, id, |
| | | BeibeiVideoAPI.getSpecialDetail(getContext(), uid, id, |
| | | new BasicTextHttpResponseHandler() { |
| | | |
| | | @Override |
| | |
| | | Glide.with(getActivity().getApplicationContext()) |
| | | .load(jsonObject.getJSONObject("Data") |
| | | .getJSONObject("special") |
| | | .optString("Picture")).crossFade() |
| | | .optString("Picture")) |
| | | .into(specific_detail_banner); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | |
| | | .getJSONArray("data").toString(), |
| | | new TypeToken<List<VideoInfo>>() { |
| | | }.getType()); |
| | | mVideoInfos.addAll(videoInfos); |
| | | List<VideoContent> videoContentList = new ArrayList<>(); |
| | | for (VideoInfo video : videoInfos) { |
| | | videoContentList.add(VideoContent.createVideoContent(video)); |
| | | } |
| | | mVideoInfos.clear(); |
| | | mVideoInfos.addAll(videoContentList); |
| | | mSpecificMovieAdapter.notifyDataSetChanged(); |
| | | } |
| | | |