148 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			148 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| package com.novelbook.android.Fragments;
 | |
| 
 | |
| import android.content.Intent;
 | |
| import android.os.Bundle;
 | |
| import android.view.LayoutInflater;
 | |
| import android.view.View;
 | |
| import android.view.ViewGroup;
 | |
| import android.widget.ImageView;
 | |
| import android.widget.TextView;
 | |
| 
 | |
| import com.novelbook.android.R;
 | |
| import com.novelbook.android.db.Novel;
 | |
| import com.umeng.analytics.MobclickAgent;
 | |
| 
 | |
| import java.util.List;
 | |
| 
 | |
| import butterknife.BindView;
 | |
| import butterknife.ButterKnife;
 | |
| import butterknife.OnClick;
 | |
| 
 | |
| public class Fragment_jingxuan_tuijian extends BasicFragment {
 | |
|      public static final  String TAG =Fragment_jingxuan.class.getSimpleName();
 | |
|     @BindView(R.id.imageGallary1)
 | |
|     ImageView imageView1;
 | |
|     @BindView(R.id.imageGallary2)
 | |
|     ImageView imageView2;
 | |
|     @BindView(R.id.imageGallary3)
 | |
|     ImageView imageView3;
 | |
|     @BindView(R.id.tvGallaryName1)
 | |
|     TextView tvName1;
 | |
|     @BindView(R.id.tvGallaryName2)
 | |
|     TextView tvName2;
 | |
|     @BindView(R.id.tvGallaryName3)
 | |
|     TextView tvName3;
 | |
| 
 | |
|     private Novel novel1,novel2,novel3;
 | |
| 
 | |
|     private static String EXTR_NV1="nv1";
 | |
|     private static String EXTR_NV2="nv2";
 | |
|     private static String EXTR_NV3="nv3";
 | |
| 
 | |
|     public static Fragment_jingxuan_tuijian newInstance(List<Novel> novels) {
 | |
|         Fragment_jingxuan_tuijian fragment = new Fragment_jingxuan_tuijian();
 | |
|         Bundle args = new Bundle();
 | |
| 
 | |
|         args.putSerializable(EXTR_NV1,novels.get(0));
 | |
|         args.putSerializable(EXTR_NV2,novels.get(1));
 | |
|         args.putSerializable(EXTR_NV3,novels.get(2));
 | |
| 
 | |
|         fragment.setArguments(args);
 | |
|         return fragment;
 | |
|     }
 | |
|     @Override
 | |
|     protected  void fillData() {
 | |
|     }
 | |
| 
 | |
|     protected   void processArguments(){
 | |
|         if (getArguments() != null) {
 | |
|             Bundle bundle = getArguments() ;
 | |
| 
 | |
| 
 | |
|             novel1 = (Novel) bundle.getSerializable(EXTR_NV1);
 | |
| 
 | |
| 
 | |
| 
 | |
|             novel2= (Novel) bundle.getSerializable(EXTR_NV2);
 | |
| 
 | |
| 
 | |
| 
 | |
|             novel3 = (Novel) bundle.getSerializable(EXTR_NV3);
 | |
| 
 | |
| 
 | |
|         }
 | |
|     }
 | |
| 
 | |
| /*
 | |
|     @Override
 | |
|     public View onCreateView(LayoutInflater inflater, ViewGroup container,
 | |
|                              Bundle savedInstanceState) {
 | |
|         // Inflate the layout for this fragment
 | |
|         View view = inflater.inflate(R.layout.fragment_jingxuan_tuijian, container, false);
 | |
| 
 | |
|         ButterKnife.bind(this, view);
 | |
|         return view;
 | |
|     }
 | |
| */
 | |
|     @OnClick({R.id.llGallary1,R.id.llGallary2,R.id.llGallary3})
 | |
|     void onGallaryClick(View view){
 | |
|         switch (view.getId()){
 | |
|             case R.id.llGallary1:
 | |
|                 if(novel1!=null)
 | |
|                 showBookDetail(novel1);
 | |
|                 break;
 | |
|             case R.id.llGallary2:
 | |
|                 if(novel2!=null) showBookDetail(novel2);
 | |
|                 break;
 | |
|             case R.id.llGallary3:
 | |
|                 if(novel3!=null)
 | |
|                 showBookDetail(novel3);
 | |
|                 break;
 | |
|         }
 | |
|     }
 | |
|     @Override
 | |
|     protected int getLayoutRes() {
 | |
|         return R.layout.fragment_jingxuan_tuijian;
 | |
|     }
 | |
| 
 | |
|     @Override
 | |
|     public void initData() {
 | |
| 
 | |
| 
 | |
|     }
 | |
|     @Override
 | |
|     public void initViews(){
 | |
| 
 | |
|         if(novel1!=null) {
 | |
|             tvName1.setText(novel1.getName());
 | |
|             loadImageView(novel1.getCover(),imageView1);
 | |
| 
 | |
|         }
 | |
|         if(novel2!=null) {
 | |
|             tvName2.setText(novel2.getName());
 | |
|             loadImageView(novel2.getCover(),imageView2);
 | |
|         }
 | |
|         if(novel3!=null) {
 | |
|             tvName3.setText(novel3.getName());
 | |
|             loadImageView(novel3.getCover(),imageView3);
 | |
|         }
 | |
| 
 | |
|     }
 | |
| 
 | |
|     @Override
 | |
|     public void setFTag() {
 | |
| 
 | |
|     }
 | |
| 
 | |
|     @Override
 | |
|     public void onResume() {
 | |
|         super.onResume();
 | |
|         MobclickAgent.onPageStart(TAG);
 | |
|     }
 | |
|     @Override
 | |
|     public void onPause(){
 | |
|         super.onPause();
 | |
|         MobclickAgent.onPageEnd(TAG);
 | |
|     }
 | |
| }
 |