146 lines
3.4 KiB
Plaintext
146 lines
3.4 KiB
Plaintext
|
package com.novelbook.android.Fragments;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.os.Bundle;
|
||
|
import android.support.v7.widget.LinearLayoutManager;
|
||
|
import android.support.v7.widget.RecyclerView;
|
||
|
import android.view.View;
|
||
|
import android.widget.Toast;
|
||
|
|
||
|
import com.novelbook.android.R;
|
||
|
import com.novelbook.android.adapter.ShudanAdapter;
|
||
|
import com.novelbook.android.db.Novel;
|
||
|
import com.novelbook.android.db.BookDan;
|
||
|
import com.novelbook.android.utils.OnItemClickListener;
|
||
|
import com.novelbook.android.adapter.BookListAdapter;
|
||
|
import com.umeng.analytics.MobclickAgent;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
import butterknife.BindView;
|
||
|
|
||
|
public class Fragment_shudan_list extends BasicFragment {
|
||
|
public static final String TAG=Fragment_shudan_list.class.getSimpleName();
|
||
|
|
||
|
private char cnt;
|
||
|
ShudanAdapter mAdapter;
|
||
|
// private BookListAdapter mAdapter;
|
||
|
private List<BookDan> mData;;
|
||
|
|
||
|
@BindView(R.id.rvShudan)
|
||
|
RecyclerView rvShudan;
|
||
|
public Fragment_shudan_list() {
|
||
|
// Required empty public constructor
|
||
|
|
||
|
}
|
||
|
|
||
|
// TODO: Rename and change types and number of parameters
|
||
|
public static Fragment_shudan_list newInstance(char cnt) {
|
||
|
Fragment_shudan_list fragment = new Fragment_shudan_list();
|
||
|
|
||
|
Bundle args = new Bundle();
|
||
|
|
||
|
|
||
|
fragment.setArguments(args);
|
||
|
return fragment;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void fillData() {
|
||
|
}
|
||
|
@Override
|
||
|
public void onCreate(Bundle savedInstanceState) {
|
||
|
super.onCreate(savedInstanceState);
|
||
|
if (getArguments() != null) {
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
protected void processArguments(){
|
||
|
if (getArguments() != null) {
|
||
|
Bundle bundle = getArguments() ;
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected int getLayoutRes() {
|
||
|
return R.layout.fragment_fragment_shudan_list;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void initData() {
|
||
|
mData = new ArrayList<BookDan>();
|
||
|
for (int i = 'A'; i < 'X'; i++)
|
||
|
{
|
||
|
BookDan bd = new BookDan();
|
||
|
bd.setName("读者书单" + (char) i);
|
||
|
bd.setAuthor("小猫"+i);
|
||
|
bd.setCover(i);
|
||
|
bd.setDesc("书单描述.....");
|
||
|
|
||
|
mData.add(bd);
|
||
|
}
|
||
|
mAdapter = new ShudanAdapter(activity, mData, R.layout.recycle_list_item_shudan, new OnItemClickListener() {
|
||
|
|
||
|
@Override
|
||
|
public void onItemClick(View view, int position) {
|
||
|
showShudanDetail(position);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void onItemLongClick(View view, int position) {
|
||
|
// initDialog(position);
|
||
|
// mAdapter.removeData(position);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void onLinearOutClick(View view, int position ,int llId) {
|
||
|
Toast.makeText(activity, "book " + position + " clicked",
|
||
|
Toast.LENGTH_SHORT).show();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
@Override
|
||
|
public void initViews(){
|
||
|
initialBookList();
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public void onAttach(Context context) {
|
||
|
super.onAttach(context);
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void setFTag() {
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void onDetach() {
|
||
|
super.onDetach();
|
||
|
|
||
|
}
|
||
|
|
||
|
//---------------------------------------------------book cate list-------------------------------begin
|
||
|
|
||
|
|
||
|
void initialBookList() {
|
||
|
|
||
|
rvShudan.setLayoutManager(new LinearLayoutManager(activity));
|
||
|
rvShudan.setAdapter(mAdapter);
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|