parent
bcd0d91ffb
commit
0e5e8968d6
|
@ -10,6 +10,7 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.novelbook.android.Fragments.BasicFragment;
|
||||||
import com.novelbook.android.Fragments.Fragment_booklist;
|
import com.novelbook.android.Fragments.Fragment_booklist;
|
||||||
import com.novelbook.android.Fragments.Fragment_shudan_list;
|
import com.novelbook.android.Fragments.Fragment_shudan_list;
|
||||||
import com.flyco.tablayout.SlidingTabLayout;
|
import com.flyco.tablayout.SlidingTabLayout;
|
||||||
|
@ -26,7 +27,7 @@ public class Activity_cate_books extends Activity_base {
|
||||||
@BindView(R.id.tab_layout)
|
@BindView(R.id.tab_layout)
|
||||||
SlidingTabLayout tabLayout;
|
SlidingTabLayout tabLayout;
|
||||||
String cate="";
|
String cate="";
|
||||||
private ArrayList<Fragment> mFragments;
|
private ArrayList<BasicFragment> mFragments;
|
||||||
ArrayList<View> mList;
|
ArrayList<View> mList;
|
||||||
String[] mTitle;
|
String[] mTitle;
|
||||||
public static String TAG="com.novelbook.android.Activity_cate_books";
|
public static String TAG="com.novelbook.android.Activity_cate_books";
|
||||||
|
@ -57,17 +58,17 @@ public class Activity_cate_books extends Activity_base {
|
||||||
|
|
||||||
void initTabs() {
|
void initTabs() {
|
||||||
|
|
||||||
if(mFragments ==null || mFragments.size() ==0){
|
if (mFragments == null || mFragments.size() == 0) {
|
||||||
mTitle = new String[]{"新书", "连载", "完本"};
|
mTitle = new String[]{"新书", "连载", "完本"};
|
||||||
mFragments = new ArrayList<>();
|
mFragments = new ArrayList<BasicFragment>();
|
||||||
|
|
||||||
mFragments.add( Fragment_booklist.newInstance(cate,1));
|
mFragments.add(Fragment_booklist.newInstance(cate, 1));
|
||||||
mFragments.add( Fragment_booklist.newInstance(cate,2));
|
mFragments.add(Fragment_booklist.newInstance(cate, 2));
|
||||||
mFragments.add( Fragment_booklist.newInstance(cate,3));
|
mFragments.add(Fragment_booklist.newInstance(cate, 3));
|
||||||
|
|
||||||
Log.d(TAG,"initial fragments in tabs ");
|
Log.d(TAG, "initial fragments in tabs ");
|
||||||
}
|
}
|
||||||
Log.d(TAG,"set viewPager adapter ");
|
Log.d(TAG, "set viewPager adapter ");
|
||||||
// FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(activity.getSupportFragmentManager()) { 第一次进入没问题,再次进入ViewPager的fragment时里面内容就没了,数据丢失 https://blog.csdn.net/allan_bst/article/details/64920076
|
// FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(activity.getSupportFragmentManager()) { 第一次进入没问题,再次进入ViewPager的fragment时里面内容就没了,数据丢失 https://blog.csdn.net/allan_bst/article/details/64920076
|
||||||
FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
|
FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,6 +80,7 @@ public class Activity_cate_books extends Activity_base {
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return mFragments.size();
|
return mFragments.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
//ViewPager与TabLayout绑定后,这里获取到PageTitle就是Tab的Text
|
//ViewPager与TabLayout绑定后,这里获取到PageTitle就是Tab的Text
|
||||||
@Override
|
@Override
|
||||||
public CharSequence getPageTitle(int position) {
|
public CharSequence getPageTitle(int position) {
|
||||||
|
@ -86,13 +88,14 @@ public class Activity_cate_books extends Activity_base {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mViewpager.setAdapter(mAdapter);
|
mViewpager.setAdapter(mAdapter);
|
||||||
|
mViewpager.setOffscreenPageLimit(3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tabLayout.setViewPager(mViewpager);
|
tabLayout.setViewPager(mViewpager);
|
||||||
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
||||||
mViewpager.setCurrentItem(0);
|
mViewpager.setCurrentItem(0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,6 +74,8 @@ public abstract class BasicFragment extends Fragment {
|
||||||
|
|
||||||
public static String TAG = "need to be replaced";
|
public static String TAG = "need to be replaced";
|
||||||
protected View rootView;
|
protected View rootView;
|
||||||
|
protected int pageNo=1;
|
||||||
|
protected int pageCount;
|
||||||
protected abstract int getLayoutRes();
|
protected abstract int getLayoutRes();
|
||||||
protected abstract void initData();
|
protected abstract void initData();
|
||||||
protected abstract void fillData();
|
protected abstract void fillData();
|
||||||
|
@ -256,9 +258,7 @@ public abstract class BasicFragment extends Fragment {
|
||||||
|
|
||||||
// 开始刷新,设置当前为刷新状态
|
// 开始刷新,设置当前为刷新状态
|
||||||
//swipeRefreshLayout.setRefreshing(true);
|
//swipeRefreshLayout.setRefreshing(true);
|
||||||
|
pageNo=1;
|
||||||
// 这里是主线程
|
|
||||||
// 一些比较耗时的操作,比如联网获取数据,需要放到子线程去执行
|
|
||||||
initData();
|
initData();
|
||||||
// TODO 获取数据
|
// TODO 获取数据
|
||||||
|
|
||||||
|
@ -366,4 +366,7 @@ public abstract class BasicFragment extends Fragment {
|
||||||
public void reload() {
|
public void reload() {
|
||||||
initViews();
|
initViews();
|
||||||
}
|
}
|
||||||
|
public void loadData() {
|
||||||
|
initData();
|
||||||
|
} //on tab changed
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,9 @@ import android.view.View;
|
||||||
|
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
import com.novelbook.android.adapter.BandanAdapterNew;
|
import com.novelbook.android.adapter.BandanAdapterNew;
|
||||||
|
import com.novelbook.android.adapter.BookListAdapter;
|
||||||
import com.novelbook.android.bean.NovelBlock;
|
import com.novelbook.android.bean.NovelBlock;
|
||||||
|
import com.novelbook.android.db.Novel;
|
||||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||||
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
||||||
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
||||||
|
@ -17,6 +19,7 @@ import com.novelbook.android.utils.Constants;
|
||||||
import com.novelbook.android.utils.GsonUtil;
|
import com.novelbook.android.utils.GsonUtil;
|
||||||
import com.novelbook.android.utils.OnItemClickListener;
|
import com.novelbook.android.utils.OnItemClickListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
|
@ -29,6 +32,7 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
private static final String ARG_PARAM2 = "param2";
|
private static final String ARG_PARAM2 = "param2";
|
||||||
private BandanAdapterNew mAdapter;
|
private BandanAdapterNew mAdapter;
|
||||||
private List<NovelBlock> mBlocks;
|
private List<NovelBlock> mBlocks;
|
||||||
|
private List<NovelBlock> mMoreBlocks;
|
||||||
// private List<Novel> mData;
|
// private List<Novel> mData;
|
||||||
@BindView(R.id.rvBangdan)
|
@BindView(R.id.rvBangdan)
|
||||||
RecyclerView rvBandan;
|
RecyclerView rvBandan;
|
||||||
|
@ -44,38 +48,11 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void fillData() {
|
protected void fillData() {
|
||||||
|
|
||||||
if(mBlocks==null){
|
if(mMoreBlocks!=null) {
|
||||||
return;
|
|
||||||
|
mAdapter.AddFooterItem(mMoreBlocks);
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
mAdapter = new BandanAdapterNew(activity ,mBlocks,R.layout.recycle_list_item_bangdannew,new OnItemClickListener()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(View view, int position)
|
|
||||||
{
|
|
||||||
// showBookDetail(mBlocks.get(blockId).getNs().get(novelIndex));
|
|
||||||
// showPaihangbang(mBlocks.get(position));
|
|
||||||
// Toast.makeText(getActivity(),"待。。。。。做",Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemLongClick(View view, int position)
|
|
||||||
{
|
|
||||||
// initDialog(position);
|
|
||||||
// mAdapter.removeData(position);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onLinearOutClick(View view, int blockId,int novelIndex) {
|
|
||||||
// Toast.makeText(activity, "book "+ bookId + " clicked", Toast.LENGTH_SHORT).show();
|
|
||||||
showPaihangbang(mBlocks.get(blockId));
|
|
||||||
// showBookDetail(mBlocks.get(blockId).getNs().get(novelIndex));
|
|
||||||
//showPaihangbang("分类名称" +position);
|
|
||||||
Log.d(TAG,String.format("clicked: position %s,lineId %s",novelIndex,blockId));
|
|
||||||
|
|
||||||
// openBook();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
initialBookList();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,9 +69,47 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
|
if(pageNo==1) {
|
||||||
|
|
||||||
|
if(mBlocks!=null){ //下拉刷新
|
||||||
|
mBlocks = new ArrayList<NovelBlock>();
|
||||||
|
mAdapter.setData(mBlocks);
|
||||||
|
initialBookList();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
mBlocks = new ArrayList<NovelBlock>();
|
||||||
|
mAdapter = new BandanAdapterNew(activity, mBlocks, R.layout.recycle_list_item_bangdannew, new OnItemClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(View view, int position) {
|
||||||
|
// showBookDetail(mBlocks.get(blockId).getNs().get(novelIndex));
|
||||||
|
// showPaihangbang(mBlocks.get(position));
|
||||||
|
// Toast.makeText(getActivity(),"待。。。。。做",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemLongClick(View view, int position) {
|
||||||
|
// initDialog(position);
|
||||||
|
// mAdapter.removeData(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLinearOutClick(View view, int blockId, int novelIndex) {
|
||||||
|
// Toast.makeText(activity, "book "+ bookId + " clicked", Toast.LENGTH_SHORT).show();
|
||||||
|
showPaihangbang(mBlocks.get(blockId));
|
||||||
|
// showBookDetail(mBlocks.get(blockId).getNs().get(novelIndex));
|
||||||
|
//showPaihangbang("分类名称" +position);
|
||||||
|
Log.d(TAG, String.format("clicked: position %s,lineId %s", novelIndex, blockId));
|
||||||
|
|
||||||
|
// openBook();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
initialBookList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showProgressDialog(true, "正在加载");
|
showProgressDialog(true, "正在加载");
|
||||||
|
mMoreBlocks =null;
|
||||||
|
|
||||||
BookSubscribe.getSiteRanks( Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
BookSubscribe.getSiteRanks( Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,7 +117,7 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
|
|
||||||
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||||
try {
|
try {
|
||||||
mBlocks = GsonUtil.parserNovleBlocks(result,"ranks");
|
mMoreBlocks = GsonUtil.parserNovleBlocks(result,"ranks");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Log.d(TAG, "error on : " + e.getMessage());
|
Log.d(TAG, "error on : " + e.getMessage());
|
||||||
|
@ -128,6 +143,7 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialBookList() {
|
void initialBookList() {
|
||||||
|
mAdapter.setShowFootView(true);
|
||||||
rvBandan.setLayoutManager(new LinearLayoutManager(activity));
|
rvBandan.setLayoutManager(new LinearLayoutManager(activity));
|
||||||
rvBandan.setAdapter(mAdapter);
|
rvBandan.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class Fragment_bookStore extends BasicFragment {
|
||||||
mFragments.add(new Fragment_bangdan());
|
mFragments.add(new Fragment_bangdan());
|
||||||
// mFragments.add(new Fragment_shudan());
|
// mFragments.add(new Fragment_shudan());
|
||||||
Log.d(TAG,"initial fragments in tabs ");
|
Log.d(TAG,"initial fragments in tabs ");
|
||||||
}
|
}
|
||||||
Log.d(TAG,"set viewPager adapter ");
|
Log.d(TAG,"set viewPager adapter ");
|
||||||
// FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(activity.getSupportFragmentManager()) { 第一次进入没问题,再次进入ViewPager的fragment时里面内容就没了,数据丢失 https://blog.csdn.net/allan_bst/article/details/64920076
|
// FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(activity.getSupportFragmentManager()) { 第一次进入没问题,再次进入ViewPager的fragment时里面内容就没了,数据丢失 https://blog.csdn.net/allan_bst/article/details/64920076
|
||||||
FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(getChildFragmentManager()) {
|
FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(getChildFragmentManager()) {
|
||||||
|
@ -108,6 +108,7 @@ public class Fragment_bookStore extends BasicFragment {
|
||||||
return mTitle[position];
|
return mTitle[position];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
mViewpager.setOffscreenPageLimit(3);//预加载设置
|
||||||
mViewpager.setAdapter(mAdapter);
|
mViewpager.setAdapter(mAdapter);
|
||||||
tabLayout.setViewPager(mViewpager);
|
tabLayout.setViewPager(mViewpager);
|
||||||
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.novelbook.android.Fragments;
|
package com.novelbook.android.Fragments;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
@ -19,6 +20,7 @@ import com.novelbook.android.Activity_Search;
|
||||||
import com.novelbook.android.Main2Activity;
|
import com.novelbook.android.Main2Activity;
|
||||||
import com.novelbook.android.R;
|
import com.novelbook.android.R;
|
||||||
import com.novelbook.android.activity_cates;
|
import com.novelbook.android.activity_cates;
|
||||||
|
import com.novelbook.android.adapter.BandanAdapterNew;
|
||||||
import com.novelbook.android.bean.NovelBlock;
|
import com.novelbook.android.bean.NovelBlock;
|
||||||
import com.novelbook.android.db.Novel;
|
import com.novelbook.android.db.Novel;
|
||||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||||
|
@ -55,12 +57,20 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
private String fn;
|
private String fn;
|
||||||
private String bangdan;
|
private String bangdan;
|
||||||
|
|
||||||
private int pageNo=1;
|
//private int pageNo=1;
|
||||||
private int totalCount;
|
private int totalCount;
|
||||||
private int pageCount;
|
// private int pageCount;
|
||||||
@BindView(R.id.rvBooklist)
|
@BindView(R.id.rvBooklist)
|
||||||
RecyclerView mRecyclerView;
|
RecyclerView mRecyclerView;
|
||||||
|
|
||||||
|
@SuppressLint("ValidFragment")
|
||||||
|
public Fragment_booklist(String cate, int progress) {
|
||||||
|
this.cate =cate;
|
||||||
|
this.progress = progress;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public Fragment_booklist() {
|
public Fragment_booklist() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
@ -108,39 +118,22 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void fillData() {
|
protected void fillData() {
|
||||||
|
|
||||||
if(mData==null) {
|
if(mRecyclerView.getAdapter()==null) {
|
||||||
mData = new ArrayList<Novel>();
|
|
||||||
mAdapter = new BookListAdapter(activity, mData, R.layout.recycle_list_item_horizon, new OnItemClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(View view, int position) {
|
|
||||||
showBookDetail(mData.get(position));
|
|
||||||
// openBook(mData.get(position),mAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(mMoreData!=null) {
|
if(mMoreData!=null) {
|
||||||
if(mMoreData.size()>0) {
|
if(mMoreData.size()>0) {
|
||||||
pageNo++;
|
pageNo++;
|
||||||
}
|
}
|
||||||
int status = pageCount > pageNo ? BookListAdapter.PULLUP_LOAD_MORE : BookListAdapter.NO_LOAD_MORE;
|
int status = pageCount >= pageNo ? BookListAdapter.PULLUP_LOAD_MORE : BookListAdapter.NO_LOAD_MORE;
|
||||||
|
// mAdapter.setPercent(pageNo/pageCount);
|
||||||
mAdapter.AddFooterItem(mMoreData);
|
mAdapter.AddFooterItem(mMoreData);
|
||||||
mAdapter.changeMoreStatus(status);
|
mAdapter.changeMoreStatus(status);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +147,43 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
|
|
||||||
|
int pn = pageNo;
|
||||||
|
|
||||||
|
if(pageNo==1) {
|
||||||
|
|
||||||
|
if (mData != null) { //下拉刷新
|
||||||
|
mData = new ArrayList<Novel>();
|
||||||
|
mAdapter.setData(mData);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
mData = new ArrayList<Novel>();
|
||||||
|
mAdapter = new BookListAdapter(activity, mData, R.layout.recycle_list_item_horizon, new OnItemClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(View view, int position) {
|
||||||
|
showBookDetail(mData.get(position));
|
||||||
|
// openBook(mData.get(position),mAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mAdapter.setShowFootView(true);
|
||||||
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
|
||||||
|
mRecyclerView.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
/* if(mAdapter!=null){
|
/* if(mAdapter!=null){
|
||||||
mAdapter.changeMoreStatus(BookListAdapter.LOADING_MORE);
|
mAdapter.changeMoreStatus(BookListAdapter.LOADING_MORE);
|
||||||
}*/
|
}*/
|
||||||
|
@ -189,7 +219,7 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
Log.d(TAG,String.format("fn is %s",fn) );
|
Log.d(TAG,String.format("fn is %s",fn) );
|
||||||
|
|
||||||
if(!TextUtils.isEmpty(bangdan) && !TextUtils.isEmpty(fn)){ //榜单
|
if(!TextUtils.isEmpty(bangdan) && !TextUtils.isEmpty(fn)){ //榜单
|
||||||
showProgressDialog(true, "正在加载榜单");
|
// showProgressDialog(true, "正在加载榜单");
|
||||||
BookSubscribe.getSiteRankDetail(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
BookSubscribe.getSiteRankDetail(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String result) {
|
public void onSuccess(String result) {
|
||||||
|
@ -217,16 +247,16 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
|
|
||||||
|
|
||||||
}else if(!TextUtils.isEmpty(fn)){ //首页 更多
|
}else if(!TextUtils.isEmpty(fn)){ //首页 更多
|
||||||
showProgressDialog(true, "正在加载更多");
|
// showProgressDialog(true, "正在加载更多");
|
||||||
BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!TextUtils.isEmpty((cate))) { //分类
|
else if(!TextUtils.isEmpty((cate))) { //分类
|
||||||
showProgressDialog(true, "正在加载分类");
|
// showProgressDialog(true, "正在加载分类");
|
||||||
BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, progress, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, progress, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||||
|
|
||||||
}else if(!TextUtils.isEmpty(keyWord)){ //搜索
|
}else if(!TextUtils.isEmpty(keyWord)){ //搜索
|
||||||
showProgressDialog(true, "正在加载搜索");
|
// showProgressDialog(true, "正在加载搜索");
|
||||||
BookSubscribe.getSearchNovelList( keyWord,pageNo, Constants.SEX, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
BookSubscribe.getSearchNovelList( keyWord,pageNo, Constants.SEX, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,11 +288,15 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
//判断RecyclerView的状态 是空闲时,同时,是最后一个可见的ITEM时才加载
|
//判断RecyclerView的状态 是空闲时,同时,是最后一个可见的ITEM时才加载
|
||||||
if(newState==RecyclerView.SCROLL_STATE_IDLE&&lastVisibleItem+1==mAdapter.getItemCount()){
|
if(newState==RecyclerView.SCROLL_STATE_IDLE&&lastVisibleItem+1==mAdapter.getItemCount()){
|
||||||
|
|
||||||
//设置正在加载更多
|
if(pageNo <= pageCount) {
|
||||||
mAdapter.changeMoreStatus(mAdapter.LOADING_MORE);
|
//设置正在加载更多
|
||||||
|
mAdapter.changeMoreStatus(mAdapter.LOADING_MORE);
|
||||||
|
|
||||||
//改为网络请求
|
//改为网络请求
|
||||||
initData();
|
initData();
|
||||||
|
}else{
|
||||||
|
mAdapter.changeMoreStatus(mAdapter.NO_LOAD_MORE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,6 +313,11 @@ public class Fragment_booklist extends BasicFragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public void onResume(){
|
||||||
|
super.onResume();
|
||||||
|
pageNo=1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.novelbook.android.Fragments;
|
package com.novelbook.android.Fragments;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
@ -74,14 +75,16 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
MyViewPager mViewpagerTuijian;
|
MyViewPager mViewpagerTuijian;
|
||||||
//@BindView(R.id.titleIndictator)
|
//@BindView(R.id.titleIndictator)
|
||||||
// TitlePageIndicator titleIndicator;
|
// TitlePageIndicator titleIndicator;
|
||||||
|
@BindView(R.id.imageBlock0)
|
||||||
|
ImageView imageViewBlock0;
|
||||||
@BindView(R.id.imageBlock1)
|
@BindView(R.id.imageBlock1)
|
||||||
ImageView imageViewBlock1;
|
ImageView imageViewBlock1;
|
||||||
@BindView(R.id.imageBlock2)
|
@BindView(R.id.imageBlock2)
|
||||||
ImageView imageViewBlock2;
|
ImageView imageViewBlock2;
|
||||||
@BindView(R.id.imageBlock3)
|
@BindView(R.id.imageBlock3)
|
||||||
ImageView imageViewBlock3;
|
ImageView imageViewBlock3;
|
||||||
|
@BindView(R.id.tvBlock0)
|
||||||
|
TextView tvBlock0;
|
||||||
@BindView(R.id.tvBlock1)
|
@BindView(R.id.tvBlock1)
|
||||||
TextView tvBlock1;
|
TextView tvBlock1;
|
||||||
@BindView(R.id.tvBlock2)
|
@BindView(R.id.tvBlock2)
|
||||||
|
@ -118,7 +121,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
private int INDEX_BANNER =1;
|
private int INDEX_BANNER =1;
|
||||||
private int INDEX_TUIJIAN =2;
|
private int INDEX_TUIJIAN =2;
|
||||||
private int blockIndex =3; //从第3个block 开始处理
|
private int blockIndex =3; //从第3个block 开始处理
|
||||||
|
private int gridItemSpace = 0;
|
||||||
public Fragment_jingxuan() {
|
public Fragment_jingxuan() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
|
|
||||||
|
@ -273,7 +276,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initViews() {
|
public void initViews() {
|
||||||
|
gridItemSpace = getResources().getDimensionPixelSize(R.dimen._10dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,6 +396,8 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
// mTitle = new String[]{"精选", "榜单", "书单"};
|
// mTitle = new String[]{"精选", "榜单", "书单"};
|
||||||
mFragments = new ArrayList<>();
|
mFragments = new ArrayList<>();
|
||||||
NovelBlock block = mBlocks.get(1);
|
NovelBlock block = mBlocks.get(1);
|
||||||
|
loadImageView(mBlocks.get(1).getIcon(),imageViewBlock0);
|
||||||
|
tvBlock0.setText( mBlocks.get(1).getName());
|
||||||
List<Novel> nvs = new ArrayList<Novel>();
|
List<Novel> nvs = new ArrayList<Novel>();
|
||||||
for(Novel novel : block.getNs() ){
|
for(Novel novel : block.getNs() ){
|
||||||
|
|
||||||
|
@ -488,7 +493,10 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
}
|
}
|
||||||
if(mHotNewData_g!=null) {
|
if(mHotNewData_g!=null) {
|
||||||
rvHotNewG.setLayoutManager(new GridLayoutManager(activity, spanCnt));
|
rvHotNewG.setLayoutManager(new GridLayoutManager(activity, spanCnt));
|
||||||
|
if( rvHotNewG.getItemDecorationCount()>0){
|
||||||
|
rvHotNewG.removeItemDecorationAt(0);
|
||||||
|
}
|
||||||
|
rvHotNewG.addItemDecoration(new SpaceItemDecoration( gridItemSpace));
|
||||||
rvHotNewG.setAdapter(new BookListAdapter(activity, mHotNewData_g, R.layout.recycle_list_item, new OnItemClickListener() {
|
rvHotNewG.setAdapter(new BookListAdapter(activity, mHotNewData_g, R.layout.recycle_list_item, new OnItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -538,7 +546,10 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
}
|
}
|
||||||
if(mHotLianZaiData_g!=null) {
|
if(mHotLianZaiData_g!=null) {
|
||||||
rvLianZaiG.setLayoutManager(new GridLayoutManager(activity, spanCnt));
|
rvLianZaiG.setLayoutManager(new GridLayoutManager(activity, spanCnt));
|
||||||
|
if( rvLianZaiG.getItemDecorationCount()>0){
|
||||||
|
rvLianZaiG.removeItemDecorationAt(0);
|
||||||
|
}
|
||||||
|
rvLianZaiG.addItemDecoration(new SpaceItemDecoration( gridItemSpace));
|
||||||
rvLianZaiG.setAdapter(new BookListAdapter(activity, mHotLianZaiData_g, R.layout.recycle_list_item, new OnItemClickListener() {
|
rvLianZaiG.setAdapter(new BookListAdapter(activity, mHotLianZaiData_g, R.layout.recycle_list_item, new OnItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -589,7 +600,10 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
}
|
}
|
||||||
if(mFinishedData_g!=null) {
|
if(mFinishedData_g!=null) {
|
||||||
rvFinishG.setLayoutManager(new GridLayoutManager(activity, spanCnt));
|
rvFinishG.setLayoutManager(new GridLayoutManager(activity, spanCnt));
|
||||||
|
if( rvFinishG.getItemDecorationCount()>0){
|
||||||
|
rvFinishG.removeItemDecorationAt(0);
|
||||||
|
}
|
||||||
|
rvFinishG.addItemDecoration(new SpaceItemDecoration( gridItemSpace));
|
||||||
rvFinishG.setAdapter(new BookListAdapter(activity, mFinishedData_g, R.layout.recycle_list_item, new OnItemClickListener() {
|
rvFinishG.setAdapter(new BookListAdapter(activity, mFinishedData_g, R.layout.recycle_list_item, new OnItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -614,6 +628,40 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
|
private int space;
|
||||||
|
|
||||||
|
public SpaceItemDecoration(int space) {
|
||||||
|
this.space = space*3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
//不是第一个的格子都设一个左边和底部的间距
|
||||||
|
//outRect.left = space;
|
||||||
|
// outRect.bottom = space;
|
||||||
|
|
||||||
|
//由于每行都只有3个,所以第一个都是3的倍数,把左边距设为0
|
||||||
|
if (parent.getChildLayoutPosition(view) %getSpanCnt()==0) {
|
||||||
|
Log.d(TAG, "getItemOffsets: left " +parent.getChildLayoutPosition(view));
|
||||||
|
//outRect.set(0,0,0,0);
|
||||||
|
outRect.right=space;
|
||||||
|
outRect.left=0;
|
||||||
|
}else if(parent.getChildLayoutPosition(view) %getSpanCnt()==2){
|
||||||
|
Log.d(TAG, "getItemOffsets: right " +parent.getChildLayoutPosition(view));
|
||||||
|
// outRect.set(0,0,0,0);
|
||||||
|
outRect.right=0;
|
||||||
|
outRect.left=space;
|
||||||
|
}else {
|
||||||
|
// outRect.set(space, 0, space, 0);
|
||||||
|
// outRect.right=space;
|
||||||
|
// outRect.left=space;
|
||||||
|
Log.d(TAG, "getItemOffsets: center " +parent.getChildLayoutPosition(view));
|
||||||
|
}
|
||||||
|
// outRect.set(0,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -91,7 +91,7 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
mData3 = new ArrayList<>();
|
mData3 = new ArrayList<>();
|
||||||
mData1.add(new TabEntry("男A",0,0) );
|
mData1.add(new TabEntry("男A",0,0) );
|
||||||
mData1.add(new TabEntry("女A",0,0));
|
mData1.add(new TabEntry("女A",0,0));
|
||||||
for (int i = 'A'; i < 'I'; i++)
|
for (int i = 'A'; i < 'F'; i++)
|
||||||
{
|
{
|
||||||
mData2.add(new TabEntry("类" + (char) i,0,0) );
|
mData2.add(new TabEntry("类" + (char) i,0,0) );
|
||||||
if(i<'D')
|
if(i<'D')
|
||||||
|
@ -171,6 +171,7 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
tabLayout2.setTabData(mData2);
|
tabLayout2.setTabData(mData2);
|
||||||
|
|
||||||
tabLayout2.setOnTabSelectListener(new OnTabSelectListener() {
|
tabLayout2.setOnTabSelectListener(new OnTabSelectListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTabSelect(int position) {
|
public void onTabSelect(int position) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class BandanAdapterNew extends RecyclerView.Adapter<BandanAdapterNew.MyViewHolder> {
|
public class BandanAdapterNew extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
private final int EMPTY_VIEW = 1;
|
private final int EMPTY_VIEW = 1;
|
||||||
private final int PROGRESS_VIEW = 2;
|
private final int PROGRESS_VIEW = 2;
|
||||||
private final int IMAGE_VIEW = 3;
|
private final int IMAGE_VIEW = 3;
|
||||||
|
@ -31,6 +31,11 @@ public class BandanAdapterNew extends RecyclerView.Adapter<BandanAdapterNew.MyVi
|
||||||
private List<NovelBlock> mDatas = new ArrayList<NovelBlock>();
|
private List<NovelBlock> mDatas = new ArrayList<NovelBlock>();
|
||||||
private OnItemClickListener mOnItemClickLitener;
|
private OnItemClickListener mOnItemClickLitener;
|
||||||
private int listItemID;
|
private int listItemID;
|
||||||
|
private boolean showFootView =false;
|
||||||
|
|
||||||
|
public void setShowFootView(boolean showFootView) {
|
||||||
|
this.showFootView = showFootView;
|
||||||
|
}
|
||||||
public BandanAdapterNew(Context context, List<NovelBlock> mDatas, int listItemID, OnItemClickListener clickLitener) {
|
public BandanAdapterNew(Context context, List<NovelBlock> mDatas, int listItemID, OnItemClickListener clickLitener) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.mDatas = mDatas;
|
this.mDatas = mDatas;
|
||||||
|
@ -55,12 +60,16 @@ public class BandanAdapterNew extends RecyclerView.Adapter<BandanAdapterNew.MyVi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
|
||||||
{
|
{
|
||||||
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
if(viewType == EMPTY_VIEW){
|
||||||
context).inflate(listItemID, parent,
|
EmptyViewHolder holder = new EmptyViewHolder (LayoutInflater.from(context).inflate(R.layout.recycle_list_empty_item, parent, false));
|
||||||
false));
|
return holder;
|
||||||
return holder;
|
}
|
||||||
|
|
||||||
|
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(context).inflate(listItemID, parent,
|
||||||
|
false));
|
||||||
|
return holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,9 +85,17 @@ public class BandanAdapterNew extends RecyclerView.Adapter<BandanAdapterNew.MyVi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(MyViewHolder holder, int position)
|
public void onBindViewHolder(RecyclerView.ViewHolder hd, int position)
|
||||||
{
|
{
|
||||||
|
if (hd instanceof EmptyViewHolder) {
|
||||||
|
EmptyViewHolder holder = (EmptyViewHolder)hd;
|
||||||
|
holder.tvEmpty.setVisibility(View.VISIBLE);
|
||||||
|
holder.tvEmpty.setText(R.string.noRecord);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MyViewHolder holder = (MyViewHolder)hd;
|
||||||
NovelBlock nb = mDatas.get(position);
|
NovelBlock nb = mDatas.get(position);
|
||||||
holder.tvCateName.setText(nb.getName());
|
holder.tvCateName.setText(nb.getName());
|
||||||
if(nb==null){return;}
|
if(nb==null){return;}
|
||||||
|
@ -148,11 +165,29 @@ public class BandanAdapterNew extends RecyclerView.Adapter<BandanAdapterNew.MyVi
|
||||||
// mDatas.add(position, "Insert One");
|
// mDatas.add(position, "Insert One");
|
||||||
notifyItemInserted(position);
|
notifyItemInserted(position);
|
||||||
}
|
}
|
||||||
|
public void setData(List<NovelBlock> items) {
|
||||||
|
// mDatas.add(position, "Insert One");
|
||||||
|
mDatas = items;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
public void removeData(int position) {
|
public void removeData(int position) {
|
||||||
mDatas.remove(position);
|
mDatas.remove(position);
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddFooterItem(List<NovelBlock> items) {
|
||||||
|
mDatas.addAll(items);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
class EmptyViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
@BindView(R.id.tvLoadText)
|
||||||
|
TextView tvEmpty;
|
||||||
|
public EmptyViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
ButterKnife.bind(this,itemView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder
|
class MyViewHolder extends RecyclerView.ViewHolder
|
||||||
{
|
{
|
||||||
@BindView(R.id.ll1)
|
@BindView(R.id.ll1)
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
private final int IMAGE_VIEW = 3;
|
private final int IMAGE_VIEW = 3;
|
||||||
private static final int TYPE_ITEM = 4;
|
private static final int TYPE_ITEM = 4;
|
||||||
private static final int TYPE_FOOTER = 5;
|
private static final int TYPE_FOOTER = 5;
|
||||||
|
private static final int NO_FOOTER = 6;
|
||||||
// private MyImageLoader loader = new MyImageLoader();
|
// private MyImageLoader loader = new MyImageLoader();
|
||||||
private Context context;
|
private Context context;
|
||||||
private List<Novel> mDatas ;
|
private List<Novel> mDatas ;
|
||||||
|
@ -48,8 +49,19 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
public static final int NO_LOAD_MORE = 2;
|
public static final int NO_LOAD_MORE = 2;
|
||||||
|
|
||||||
//上拉加载更多状态-默认为0
|
//上拉加载更多状态-默认为0
|
||||||
private int mLoadMoreStatus = 0;
|
private int mLoadMoreStatus = 2;
|
||||||
|
private boolean showFootView =false;
|
||||||
|
|
||||||
|
private float percent =0;
|
||||||
|
|
||||||
|
public void setPercent(float percent) {
|
||||||
|
this.percent = percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setShowFootView(boolean showFootView) {
|
||||||
|
this.showFootView = showFootView;
|
||||||
|
}
|
||||||
|
|
||||||
public BookListAdapter(Context context, List<Novel> datas) {
|
public BookListAdapter(Context context, List<Novel> datas) {
|
||||||
context = context;
|
context = context;
|
||||||
|
@ -83,10 +95,14 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
public int getItemViewType(int position) {
|
public int getItemViewType(int position) {
|
||||||
if (mDatas.size() == 0) {
|
if (mDatas.size() == 0) {
|
||||||
return EMPTY_VIEW;
|
return EMPTY_VIEW;
|
||||||
} else if (mDatas.get(position) == null) {
|
}else if ( position < mDatas.size()) {
|
||||||
return PROGRESS_VIEW;
|
|
||||||
} else if ( position + 1 == getItemCount()) {
|
|
||||||
//最后一个item设置为footerView
|
//最后一个item设置为footerView
|
||||||
|
return TYPE_ITEM;
|
||||||
|
} else if ( position == mDatas.size()) {
|
||||||
|
//最后一个item设置为footerView
|
||||||
|
if(!showFootView){
|
||||||
|
return NO_FOOTER;
|
||||||
|
}
|
||||||
return TYPE_FOOTER;
|
return TYPE_FOOTER;
|
||||||
} else {
|
} else {
|
||||||
return TYPE_ITEM;
|
return TYPE_ITEM;
|
||||||
|
@ -110,6 +126,8 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
}else if(viewType == EMPTY_VIEW){
|
}else if(viewType == EMPTY_VIEW){
|
||||||
EmptyViewHolder holder = new EmptyViewHolder (LayoutInflater.from(context).inflate(R.layout.recycle_list_empty_item, parent, false));
|
EmptyViewHolder holder = new EmptyViewHolder (LayoutInflater.from(context).inflate(R.layout.recycle_list_empty_item, parent, false));
|
||||||
return holder;
|
return holder;
|
||||||
|
}else if(viewType == NO_FOOTER){
|
||||||
|
return new NoShowViewHolder (LayoutInflater.from(context).inflate(R.layout.recycle_list_noshow_item, parent, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
View itemView = mInflater.inflate(listItemID, parent, false);
|
View itemView = mInflater.inflate(listItemID, parent, false);
|
||||||
|
@ -144,18 +162,31 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
|
|
||||||
switch (mLoadMoreStatus) {
|
switch (mLoadMoreStatus) {
|
||||||
case PULLUP_LOAD_MORE:
|
case PULLUP_LOAD_MORE:
|
||||||
footerViewHolder.mTvLoadText.setText("上拉加载更多...");
|
footerViewHolder.mTvLoadText.setText(String.format("上拉加载更多.."));
|
||||||
break;
|
break;
|
||||||
case LOADING_MORE:
|
case LOADING_MORE:
|
||||||
footerViewHolder.mTvLoadText.setText("正加载更多...");
|
footerViewHolder.mTvLoadText.setText("正加载更多...");
|
||||||
break;
|
break;
|
||||||
case NO_LOAD_MORE:
|
case NO_LOAD_MORE:
|
||||||
|
if(!showFootView){
|
||||||
|
footerViewHolder.mLoadLayout.setVisibility(View.GONE);
|
||||||
|
footerViewHolder.itemView.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
//隐藏加载更多
|
//隐藏加载更多
|
||||||
footerViewHolder.mLoadLayout.setVisibility(View.GONE);
|
footerViewHolder.mTvLoadText.setText("到底了");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}else if (hd instanceof MyViewHolder) {
|
}else if (hd instanceof EmptyViewHolder) {
|
||||||
|
EmptyViewHolder holder = (EmptyViewHolder)hd;
|
||||||
|
holder.tvEmpty.setVisibility(View.VISIBLE);
|
||||||
|
holder.tvEmpty.setText(R.string.noRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else if (hd instanceof MyViewHolder) {
|
||||||
|
|
||||||
MyViewHolder holder = (MyViewHolder)hd;
|
MyViewHolder holder = (MyViewHolder)hd;
|
||||||
holder.tvTitle.setText(mDatas.get(position).getName());
|
holder.tvTitle.setText(mDatas.get(position).getName());
|
||||||
|
@ -190,7 +221,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return mDatas.size();
|
return mDatas.size()+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addData(int position) {
|
public void addData(int position) {
|
||||||
|
@ -215,18 +246,30 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
ButterKnife.bind(this,itemView);
|
ButterKnife.bind(this,itemView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class EmptyViewHolder extends RecyclerView.ViewHolder {
|
class EmptyViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
@BindView(R.id.tvLoadText)
|
||||||
|
TextView tvEmpty;
|
||||||
public EmptyViewHolder(View itemView) {
|
public EmptyViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
ButterKnife.bind(this,itemView);
|
ButterKnife.bind(this,itemView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class NoShowViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
public NoShowViewHolder(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public void AddHeaderItem(List<Novel> items) {
|
public void AddHeaderItem(List<Novel> items) {
|
||||||
mDatas.addAll(0, items);
|
mDatas.addAll(0, items);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
public void setData(List<Novel> items) {
|
||||||
|
// mDatas.add(position, "Insert One");
|
||||||
|
mDatas = items;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
public void AddFooterItem(List<Novel> items) {
|
public void AddFooterItem(List<Novel> items) {
|
||||||
mDatas.addAll(items);
|
mDatas.addAll(items);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
@ -239,4 +282,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
|
||||||
mLoadMoreStatus=status;
|
mLoadMoreStatus=status;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class HttpMethods {
|
||||||
public Response intercept(Chain chain) throws IOException {
|
public Response intercept(Chain chain) throws IOException {
|
||||||
Request request = chain.request();
|
Request request = chain.request();
|
||||||
if (!NetUtil.isNetworkConnected()) {
|
if (!NetUtil.isNetworkConnected()) {
|
||||||
int maxStale = 60 * 60 * 24 * 28;
|
int maxStale = 0;// 60 * 60 * 24 * 28;
|
||||||
request = request.newBuilder()
|
request = request.newBuilder()
|
||||||
.removeHeader("Pragma")
|
.removeHeader("Pragma")
|
||||||
.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
|
.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class OnSuccessAndFaultSub extends DisposableObserver<ResponseBody>
|
||||||
|
|
||||||
private void showProgressDialog() {
|
private void showProgressDialog() {
|
||||||
if (showProgress && null != progressDialog) {
|
if (showProgress && null != progressDialog) {
|
||||||
|
progressDialog.setMessage("正在请求网络");
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/ToolBarTheme.AppBarOverlay">
|
android:theme="@style/ToolBarTheme.AppBarOverlay">
|
||||||
|
<!--android:layout_height="?attr/actionBarSize"-->
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="40dp"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/ToolBarTheme.PopupOverlay" >
|
app:popupTheme="@style/ToolBarTheme.PopupOverlay" >
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
style="@style/llOutside"
|
style="@style/llOutside"
|
||||||
|
tools:showIn="@layout/activity_cates"
|
||||||
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
>
|
||||||
tools:context=".activity_cates"
|
|
||||||
tools:showIn="@layout/activity_cates">
|
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/recycleViewCateList"
|
android:id="@+id/recycleViewCateList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="60dp"
|
||||||
|
|
||||||
>
|
>
|
||||||
</android.support.v7.widget.RecyclerView>
|
</android.support.v7.widget.RecyclerView>
|
||||||
|
<!--android:background="@color/whitesmoke"-->
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
</android.support.constraint.ConstraintLayout>
|
|
|
@ -20,8 +20,10 @@
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:divider="#ffff0000"
|
android:divider="#ffff0000"
|
||||||
android:dividerHeight="10dp"
|
android:dividerHeight="10dp"
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="1dp"
|
||||||
android:paddingBottom="40dp" />
|
android:paddingBottom="40dp"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/llShelfBottom"
|
android:id="@+id/llShelfBottom"
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/rvBangdan"
|
android:id="@+id/rvBangdan"
|
||||||
android:divider="#ffff0000"
|
android:divider="#ffff0000"
|
||||||
android:dividerHeight="10dp"
|
android:dividerHeight="5dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingBottom="50dp"
|
android:paddingBottom="30dp"
|
||||||
android:layout_marginBottom="-2dp"
|
android:layout_marginBottom="-2dp"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="5dp"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
|
@ -45,12 +45,14 @@
|
||||||
style="@style/NovelBlockHead"
|
style="@style/NovelBlockHead"
|
||||||
>
|
>
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/imageBlock0"
|
||||||
style="@style/NovelBlockImg"
|
style="@style/NovelBlockImg"
|
||||||
android:src="@drawable/googleg_standard_color_18" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tvBlock0"
|
||||||
style="@style/NovelBlockTitle"
|
style="@style/NovelBlockTitle"
|
||||||
android:text="重磅推荐"
|
android:text=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -102,7 +104,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageBlock1"
|
android:id="@+id/imageBlock1"
|
||||||
style="@style/NovelBlockImg"
|
style="@style/NovelBlockImg"
|
||||||
android:src="@drawable/googleg_standard_color_18" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvBlock1"
|
android:id="@+id/tvBlock1"
|
||||||
|
@ -124,10 +126,13 @@
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/rvHotNewL"
|
android:id="@+id/rvHotNewL"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:divider="#ffff0000"
|
android:divider="#ffff0000"
|
||||||
android:dividerHeight="10dp"
|
android:dividerHeight="10dp"
|
||||||
android:nestedScrollingEnabled="false" />
|
android:nestedScrollingEnabled="false"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/rvHotNewG"
|
android:id="@+id/rvHotNewG"
|
||||||
|
@ -158,7 +163,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageBlock2"
|
android:id="@+id/imageBlock2"
|
||||||
style="@style/NovelBlockImg"
|
style="@style/NovelBlockImg"
|
||||||
android:src="@drawable/googleg_standard_color_18" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvBlock2"
|
android:id="@+id/tvBlock2"
|
||||||
|
@ -216,7 +221,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageBlock3"
|
android:id="@+id/imageBlock3"
|
||||||
style="@style/NovelBlockImg"
|
style="@style/NovelBlockImg"
|
||||||
android:src="@drawable/googleg_standard_color_18" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvBlock3"
|
android:id="@+id/tvBlock3"
|
||||||
|
@ -277,7 +282,7 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageBlock4"
|
android:id="@+id/imageBlock4"
|
||||||
style="@style/NovelBlockImg"
|
style="@style/NovelBlockImg"
|
||||||
android:src="@drawable/googleg_standard_color_18" />
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvBlock4"
|
android:id="@+id/tvBlock4"
|
||||||
|
@ -305,7 +310,7 @@
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp" />
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
android:id="@+id/rvG"
|
android:id="@+id/rvG"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/loadLayout"
|
android:id="@+id/loadLayout"
|
||||||
android:padding="10dp"
|
android:padding="5dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
@ -17,10 +17,12 @@
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/pbLoad"
|
android:id="@+id/pbLoad"
|
||||||
android:layout_width="20dp"
|
android:layout_width="5dp"
|
||||||
android:layout_height="20dp"
|
android:layout_height="5dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:indeterminate="false"/>
|
android:indeterminate="false"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvLoadText"
|
android:id="@+id/tvLoadText"
|
||||||
|
@ -32,8 +34,8 @@
|
||||||
android:layout_toRightOf="@id/pbLoad"
|
android:layout_toRightOf="@id/pbLoad"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:text="魂牵梦萦 魂牵梦萦 "
|
android:text="魂牵梦萦 魂牵梦萦 "
|
||||||
android:textColor="#000000"
|
style="@style/TextViewNovelDesc.titles"
|
||||||
android:textSize="16sp"/>
|
/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -8,32 +8,15 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="5dip"
|
|
||||||
android:layout_marginTop="5dip"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<ProgressBar
|
<TextView
|
||||||
android:id="@+id/pbLoad"
|
style="@style/TextViewNovelDesc.titles"
|
||||||
android:layout_width="20dp"
|
android:id="@+id/tvLoadText"
|
||||||
android:layout_height="20dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_height="wrap_content"
|
||||||
android:indeterminate="false"/>
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
<TextView
|
android:text="@string/noRecord"
|
||||||
android:id="@+id/tvLoadText"
|
/>
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginLeft="4dip"
|
|
||||||
android:layout_toRightOf="@id/pbLoad"
|
|
||||||
android:clickable="true"
|
|
||||||
android:text="没有数据 "
|
|
||||||
android:textColor="#000000"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/item_selector"
|
android:background="@drawable/item_selector"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_margin="0dp"
|
||||||
android:padding="2dp">
|
android:padding="2dp">
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
style="@style/TextViewNovelTitle"
|
style="@style/TextViewNovelTitle"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_width="75dp"
|
android:layout_width="75dp"
|
||||||
android:gravity="top|center"
|
android:gravity="top|center"
|
||||||
android:text="天龙八部天龙八部天龙八部"
|
android:text="天龙八部天龙八部天龙八部"
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/item_selector"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout style="@style/llGraySplit" />
|
<LinearLayout style="@style/llGraySplit" />
|
||||||
|
|
||||||
<LinearLayout
|
<!--<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
@ -25,14 +26,14 @@
|
||||||
android:text="更多"
|
android:text="更多"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll1"
|
android:id="@+id/ll1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="@drawable/item_selector"
|
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/cardView"
|
android:id="@+id/cardView"
|
||||||
android:layout_marginRight="2dp"
|
android:layout_marginRight="5dp"
|
||||||
android:layout_marginLeft="2dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
app:cardCornerRadius="6dp"
|
app:cardCornerRadius="6dp"
|
||||||
|
@ -27,10 +27,12 @@
|
||||||
|
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:padding="2dp"
|
android:padding="2dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
android:id="@+id/imageViewCate"
|
android:id="@+id/imageViewCate"
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="100dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
android:src="@drawable/googleg_standard_color_18"
|
android:src="@drawable/googleg_standard_color_18"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
style="@style/TextViewNovelTitle.horizon"
|
style="@style/TextViewNovelTitle.horizon"
|
||||||
|
|
||||||
android:text="射雕英雄传"
|
android:text=" "
|
||||||
/>
|
/>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
|
@ -35,12 +35,12 @@
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/TextViewNovelType"
|
style="@style/TextViewNovelType"
|
||||||
android:id="@+id/category"
|
android:id="@+id/category"
|
||||||
android:text="武侠小说"
|
android:text=" "
|
||||||
/>
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/author"
|
android:id="@+id/author"
|
||||||
style="@style/TextViewNovelAuthor"
|
style="@style/TextViewNovelAuthor"
|
||||||
android:text="金庸"
|
android:text=" "
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/loadLayout"
|
||||||
|
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -45,6 +45,7 @@
|
||||||
<dimen name="marginBottom">5dp</dimen>
|
<dimen name="marginBottom">5dp</dimen>
|
||||||
<!-- 底部导航栏高度 -->
|
<!-- 底部导航栏高度 -->
|
||||||
<dimen name="botoomNavi">42dp</dimen>
|
<dimen name="botoomNavi">42dp</dimen>
|
||||||
|
<dimen name="_10dp">10dp</dimen>
|
||||||
|
|
||||||
|
|
||||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
|
|
@ -184,6 +184,7 @@
|
||||||
<string name="readseting">设置</string>
|
<string name="readseting">设置</string>
|
||||||
|
|
||||||
<string name="aboutContent">如风小说阅读是专注于提供更舒适的阅读体验,主打本地阅读,操作方式简单易上手,目前支持txt格式。</string>
|
<string name="aboutContent">如风小说阅读是专注于提供更舒适的阅读体验,主打本地阅读,操作方式简单易上手,目前支持txt格式。</string>
|
||||||
|
<string name="noRecord">没有数据</string>
|
||||||
|
|
||||||
<string-array name="voicer_cloud_entries">
|
<string-array name="voicer_cloud_entries">
|
||||||
<item>小燕—女青、中英、普通话</item>
|
<item>小燕—女青、中英、普通话</item>
|
||||||
|
|
|
@ -158,6 +158,7 @@
|
||||||
<item name="android:layout_gravity">center</item>
|
<item name="android:layout_gravity">center</item>
|
||||||
<item name="android:gravity">center_horizontal</item>
|
<item name="android:gravity">center_horizontal</item>
|
||||||
<item name="android:scaleType">fitStart</item>
|
<item name="android:scaleType">fitStart</item>
|
||||||
|
<item name="android:paddingTop">2dp</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="NovelImage.horizon">
|
<style name="NovelImage.horizon">
|
||||||
<item name="android:layout_weight">0</item>
|
<item name="android:layout_weight">0</item>
|
||||||
|
@ -213,7 +214,7 @@
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_weight">1</item>
|
<item name="android:layout_weight">1</item>
|
||||||
</style>
|
</style>
|
||||||
|
<!-- <item name="android:background">@color/colorAccent</item>-->
|
||||||
<style name="llOutside">
|
<style name="llOutside">
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
|
|
Loading…
Reference in New Issue