fix bug
This commit is contained in:
parent
0638761d96
commit
d2b450806c
|
@ -168,4 +168,8 @@ dependencies {
|
|||
implementation 'com.github.ixiaow:multilayout:1.0.0'
|
||||
implementation 'com.umeng.umsdk:analytics:8.0.2'
|
||||
implementation 'com.umeng.umsdk:common:2.0.2'
|
||||
|
||||
|
||||
implementation 'q.rorbin:VerticalTabLayout:1.2.5'
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<activity
|
||||
android:name=".ReadActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/ToolBarTheme.NoActionBar"></activity>
|
||||
<activity
|
||||
android:name=".Main2Activity"
|
||||
|
|
|
@ -9,28 +9,42 @@ import android.util.Log;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ixiaow.multilayout.MultiLayout;
|
||||
import com.novelbook.android.Fragments.BasicFragment;
|
||||
import com.novelbook.android.Fragments.Fragment_booklist;
|
||||
import com.novelbook.android.Fragments.Fragment_shudan_list;
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.novelbook.android.bean.ProgressType;
|
||||
import com.novelbook.android.utils.Constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
public class Activity_cate_books extends Activity_base {
|
||||
import static com.novelbook.android.utils.Constants.lstNt;
|
||||
import static com.novelbook.android.utils.Constants.lstProgress;
|
||||
import static com.novelbook.android.utils.Constants.lstSex;
|
||||
|
||||
public class Activity_cate_books extends Activity_base {
|
||||
public static final String TAG=Activity_cate_books.class.getSimpleName();
|
||||
public static String EXTRNAME="catename";
|
||||
@BindView(R.id.viewpager)
|
||||
ViewPager mViewpager;
|
||||
@BindView(R.id.tab_layout)
|
||||
SlidingTabLayout tabLayout;
|
||||
|
||||
@BindView(R.id.topic_layout)
|
||||
MultiLayout topic_layout;
|
||||
|
||||
String cate="";
|
||||
private ArrayList<BasicFragment> mFragments;
|
||||
ArrayList<View> mList;
|
||||
String[] mTitle;
|
||||
public static String TAG="com.novelbook.android.Activity_cate_books";
|
||||
|
||||
private int tabPos;
|
||||
|
||||
@Override
|
||||
public int getLayoutRes() {
|
||||
|
@ -40,7 +54,7 @@ public class Activity_cate_books extends Activity_base {
|
|||
@Override
|
||||
protected void initViews() {
|
||||
creatToolbar();
|
||||
initTabs();
|
||||
initTabs2();
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,17 +76,87 @@ public class Activity_cate_books extends Activity_base {
|
|||
//---------tabs-------------
|
||||
|
||||
void initTabs() {
|
||||
List<String> lstType = new ArrayList<String>() ;//Arrays.asList(lstProgress);
|
||||
for(ProgressType progressType : Constants.lstProgressType){
|
||||
lstType.add(progressType.getName());
|
||||
}
|
||||
topic_layout.initTabNames(lstType) ;
|
||||
topic_layout.setOnTabSelectListener(new MultiLayout.OnTabSelectListener() {
|
||||
@Override
|
||||
public void select(TextView textView, int i, int i1) {
|
||||
Log.d(TAG, String.format("select: text %s,i %s i1 %s ",textView.getText(),i,i1));
|
||||
tabPos = i1;
|
||||
tabChanged();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
void initTabs2() {
|
||||
|
||||
|
||||
if (mFragments == null ) {
|
||||
|
||||
if (mFragments == null || mFragments.size() == 0) {
|
||||
mTitle = new String[]{"新书", "连载", "完本"};
|
||||
mFragments = new ArrayList<BasicFragment>();
|
||||
}
|
||||
mFragments.clear();
|
||||
|
||||
mFragments.add(Fragment_booklist.newInstance(cate, 1));
|
||||
mFragments.add(Fragment_booklist.newInstance(cate, 2));
|
||||
mFragments.add(Fragment_booklist.newInstance(cate, 3));
|
||||
for(ProgressType progressType : Constants.lstProgressType) {
|
||||
mFragments.add(Fragment_booklist.newInstance(cate, progressType.getId()));
|
||||
}
|
||||
|
||||
Log.d(TAG, "initial fragments in tabs ");
|
||||
|
||||
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(getSupportFragmentManager()) {
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mFragments.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
|
||||
//ViewPager与TabLayout绑定后,这里获取到PageTitle就是Tab的Text
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return Constants.lstProgressType.get(position).getName();
|
||||
}
|
||||
};
|
||||
mViewpager.setAdapter(mAdapter);
|
||||
mViewpager.setOffscreenPageLimit( Constants.lstProgressType.size()+1);
|
||||
tabLayout.setViewPager(mViewpager);
|
||||
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
||||
mViewpager.setCurrentItem(0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
int tmp=0;
|
||||
private void tabChanged() {
|
||||
|
||||
Log.d(TAG, String.format("tabChanged: to load data tmp %s" , tmp ));
|
||||
tmp++;
|
||||
|
||||
if(lstSex==null) return;
|
||||
|
||||
|
||||
|
||||
if (mFragments == null ) {
|
||||
|
||||
mFragments = new ArrayList<BasicFragment>();
|
||||
}
|
||||
mFragments.clear();
|
||||
|
||||
mFragments.add(Fragment_booklist.newInstance(cate, Constants.lstProgressType.get(tabPos).getId()));
|
||||
|
||||
|
||||
Log.d(TAG, "initial fragments in tabs ");
|
||||
|
||||
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(getSupportFragmentManager()) {
|
||||
|
@ -93,16 +177,17 @@ public class Activity_cate_books extends Activity_base {
|
|||
}
|
||||
};
|
||||
mViewpager.setAdapter(mAdapter);
|
||||
mViewpager.setOffscreenPageLimit(3);
|
||||
mViewpager.setOffscreenPageLimit(2);
|
||||
|
||||
|
||||
|
||||
tabLayout.setViewPager(mViewpager);
|
||||
// tabLayout.setViewPager(mViewpager);
|
||||
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
||||
mViewpager.setCurrentItem(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
|
|
|
@ -30,6 +30,7 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
@BindView(R.id.tab_layout)
|
||||
SlidingTabLayout tabLayout;
|
||||
public static final String EXTR_FN="fn";
|
||||
public static final String EXTR_CID="cid";
|
||||
public static final String EXTR_TITLE="title";
|
||||
public static final String EXTR_BANGDAN ="bangdan";
|
||||
public static final String EXTR_SEARCH ="search";
|
||||
|
@ -47,7 +48,7 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
|
||||
initTabs();
|
||||
}
|
||||
|
||||
int cid;
|
||||
String bangdan,fn,keyword,histroy;
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +59,7 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
|
||||
}
|
||||
fn = getIntent().getStringExtra(EXTR_FN);
|
||||
|
||||
cid = getIntent().getIntExtra(EXTR_CID,-1);
|
||||
bangdan = getIntent().getStringExtra(EXTR_BANGDAN);
|
||||
|
||||
String title = getIntent().getStringExtra(EXTR_TITLE);
|
||||
|
@ -95,6 +96,8 @@ public static String TAG ="com.novelbook.android.paihangbang";
|
|||
|
||||
}else if(!TextUtils.isEmpty(fn)){
|
||||
mFragments.add(Fragment_booklist.newInstance(fn, bangdan)); //首页更多
|
||||
}else if(cid>0){
|
||||
mFragments.add(Fragment_booklist.newInstance(cid, bangdan)); //首页更多
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -268,7 +268,12 @@ public class BookActivity extends Activity_base {
|
|||
this.txtLatestCate.setText(mNovel.getChapterName());
|
||||
tvLastUpdate.setText(CommonUtil.getDateString( mNovel.getLastUpdateTime()));
|
||||
loadImageView(mNovel.getCover(),imageView);
|
||||
try {
|
||||
gaosiHeadPic();
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "setBookDetailInfo: gosiheadpic error", e);
|
||||
}
|
||||
|
||||
}
|
||||
void gaosiHeadPic(){
|
||||
//new BlurTransformation(BookActivity.this, 10)).into(mImageView);
|
||||
|
|
|
@ -134,7 +134,7 @@ public abstract class BasicFragment extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
public abstract void setFTag();
|
||||
public void setFTag(){};
|
||||
|
||||
Handler handler = new Handler() {
|
||||
@Override
|
||||
|
@ -380,7 +380,7 @@ public abstract class BasicFragment extends Fragment {
|
|||
Intent intent = new Intent(activity, Activity_paihangbang.class);
|
||||
String title = TextUtils.isEmpty(nb.getTitle()) ? nb.getName() : nb.getTitle() ;
|
||||
|
||||
intent.putExtra(Activity_paihangbang.EXTR_FN,nb.getFn() );
|
||||
intent.putExtra(Activity_paihangbang.EXTR_CID,nb.getCid() );
|
||||
intent.putExtra(Activity_paihangbang.EXTR_TITLE,title );
|
||||
intent.putExtra(Activity_paihangbang.EXTR_BANGDAN,title );
|
||||
startActivity(intent);
|
||||
|
|
|
@ -177,7 +177,7 @@ public class CatalogFragment extends BasicFragment implements MarkActivity.Sortc
|
|||
}
|
||||
}
|
||||
|
||||
int maxSlept =NetUtil.isNetworkConnected()?50 :200;
|
||||
int maxSlept =NetUtil.isNetworkConnected()?250 :100;
|
||||
int slepttime = 0;
|
||||
while ( slepttime < maxSlept && ( pageFactory.isReadingCatalogs() || pageFactory.getChapters().size() == 0)) {
|
||||
try {
|
||||
|
|
|
@ -80,6 +80,7 @@ public class Fragment_Shelf extends BasicFragment {
|
|||
private List<Novel> bookLists;
|
||||
// private ShelfAdapter adapter;
|
||||
private String noveIds ;
|
||||
BottomSheetDialog bottomSheetDialog;
|
||||
public Fragment_Shelf() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
@ -330,7 +331,7 @@ void test(int maxAge){
|
|||
|
||||
private void initDialog(int position) {
|
||||
|
||||
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this.activity);
|
||||
bottomSheetDialog = new BottomSheetDialog(this.activity);
|
||||
bottomSheetDialog.setContentView(R.layout.fragment_shelf_botoomsheetdialog);
|
||||
//给布局设置透明背景色
|
||||
bottomSheetDialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet)
|
||||
|
@ -488,7 +489,9 @@ void test(int maxAge){
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
getUpdatedData(); //TODO: 更新书的状态,是不有更新
|
||||
|
||||
if(bottomSheetDialog!=null){
|
||||
bottomSheetDialog.hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@ public class Fragment_bangdan extends BasicFragment {
|
|||
public static final String TAG=Fragment_bangdan.class.getSimpleName();
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
private static final String ARG_CID = "CID";
|
||||
private BandanAdapterNew mAdapter;
|
||||
private List<NovelBlock> mBlocks;
|
||||
private List<NovelBlock> mMoreBlocks;
|
||||
|
@ -42,11 +41,11 @@ public class Fragment_bangdan extends BasicFragment {
|
|||
// @BindView(R.id.topic_layout)
|
||||
// MultiLayout topic_layout;
|
||||
|
||||
public static Fragment_bangdan newInstance(String param1, String param2) {
|
||||
private int cid;
|
||||
public static Fragment_bangdan newInstance(int cid) {
|
||||
Fragment_bangdan fragment = new Fragment_bangdan();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
args.putInt(ARG_CID, cid);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
@ -74,6 +73,11 @@ public class Fragment_bangdan extends BasicFragment {
|
|||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
if (getArguments() != null) {
|
||||
cid = getArguments().getInt(ARG_CID);
|
||||
}
|
||||
|
||||
if(pageNo==1) {
|
||||
|
||||
if(mBlocks!=null){ //下拉刷新
|
||||
|
@ -116,7 +120,7 @@ public class Fragment_bangdan extends BasicFragment {
|
|||
showProgressDialog(true, "正在加载");
|
||||
mMoreBlocks =null;
|
||||
|
||||
BookSubscribe.getSiteRanks( Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
BookSubscribe.getPaihangBangByCate( Constants.SEX,cid,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
package com.novelbook.android.Fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.novelbook.android.R;
|
||||
import com.novelbook.android.bean.BangdanCate;
|
||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
||||
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
||||
import com.novelbook.android.utils.Constants;
|
||||
import com.novelbook.android.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import q.rorbin.verticaltablayout.VerticalTabLayout;
|
||||
|
||||
|
||||
public class Fragment_bangdans extends BasicFragment {
|
||||
|
||||
public static String TAG= Fragment_bangdans.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.viewpager)
|
||||
ViewPager mViewpager;
|
||||
@BindView(R.id.tablayout)
|
||||
VerticalTabLayout tabLayout;
|
||||
private FragmentStatePagerAdapter mAdapter =null;
|
||||
private ArrayList<BasicFragment> mFragments;
|
||||
ArrayList<View> mList;
|
||||
String[] mTitle;
|
||||
|
||||
List<BangdanCate> mCateList;
|
||||
protected void processArguments(){
|
||||
if (getArguments() != null) {
|
||||
Bundle bundle = getArguments() ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Fragment_bangdans newInstance(String param1, String param2) {
|
||||
Fragment_bangdans fragment = new Fragment_bangdans();
|
||||
Bundle args = new Bundle();
|
||||
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (getArguments() != null) {
|
||||
// mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
// mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutRes() {
|
||||
return R.layout.fragment_bangdans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
showProgressDialog(false,"正在加载榜单列表");
|
||||
getCateTabTtitle();
|
||||
|
||||
}
|
||||
@Override
|
||||
public void fillData() {
|
||||
|
||||
// initTabs();
|
||||
};
|
||||
|
||||
public void onSexSwitch(){
|
||||
if(mAdapter!=null) {
|
||||
for(BasicFragment bf:mFragments){
|
||||
bf.initData();
|
||||
}
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initViews(){
|
||||
mFragments = new ArrayList<>();
|
||||
mAdapter = new FragmentStatePagerAdapter(getChildFragmentManager()) {
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mFragments.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragments.size();
|
||||
}
|
||||
//ViewPager与TabLayout绑定后,这里获取到PageTitle就是Tab的Text
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mCateList.get(position).getName();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// mViewpager.setAdapter(mAdapter);
|
||||
// tabLayout.setupWithViewPager(mViewpager);
|
||||
}
|
||||
|
||||
//---------tabs-------------
|
||||
|
||||
void initTabs() {
|
||||
Log.d(TAG, "getCateTabTtitle: init tabs");
|
||||
// if(mFragments ==null || mFragments.size() ==0)
|
||||
{
|
||||
// mTitle = new String[]{"精选", "榜单", "书单"};
|
||||
mFragments.clear();
|
||||
|
||||
for(BangdanCate bangdanCate : mCateList) {
|
||||
mFragments.add(Fragment_bangdan.newInstance(bangdanCate.getCid()));
|
||||
}
|
||||
|
||||
// mFragments.add(new Fragment_shudan());
|
||||
Log.d(TAG,"initial fragments in tabs ");
|
||||
}
|
||||
Log.d(TAG,"set viewPager adapter ");
|
||||
// FragmentPagerAdapter mAdapter = new FragmentPagerAdapter(activity.getSupportFragmentManager()) { 第一次进入没问题,再次进入ViewPager的fragment时里面内容就没了,数据丢失 https://blog.csdn.net/allan_bst/article/details/64920076
|
||||
mAdapter.notifyDataSetChanged();
|
||||
// mViewpager.setOffscreenPageLimit(30);//预加载设置
|
||||
if(mCateList!=null){
|
||||
mViewpager.setOffscreenPageLimit(mCateList.size()+1);//预加载设置
|
||||
}
|
||||
mViewpager.setAdapter(mAdapter);
|
||||
tabLayout.setupWithViewPager(mViewpager);
|
||||
// tabLayout.setViewPager(mViewpager, mTitle, activity, mFragments);
|
||||
// mViewpager.setCurrentItem(0);
|
||||
}
|
||||
|
||||
|
||||
void getCateTabTtitle(){
|
||||
|
||||
Log.d(TAG, "getCateTabTtitle: prepare cate tabs");
|
||||
|
||||
BookSubscribe.getPaihangBangCateList(Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
try {
|
||||
|
||||
mCateList = GsonUtil.parserBangdanCate(result,"subCategories");
|
||||
|
||||
initTabs();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onSuccess: prepare book",e );
|
||||
e.printStackTrace();
|
||||
}
|
||||
handler.sendEmptyMessage(0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMsg) {
|
||||
//失败
|
||||
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||
// getSearchTabTtitle();
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
},getActivity()));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -28,6 +28,7 @@ public class Fragment_bookStore extends BasicFragment {
|
|||
SlidingTabLayout tabLayout;
|
||||
private FragmentStatePagerAdapter mAdapter =null;
|
||||
private ArrayList<BasicFragment> mFragments;
|
||||
private ArrayList<BasicFragment> mFragments_cp;
|
||||
ArrayList<View> mList;
|
||||
String[] mTitle;
|
||||
|
||||
|
@ -75,9 +76,14 @@ public class Fragment_bookStore extends BasicFragment {
|
|||
}
|
||||
public void onSexSwitch(){
|
||||
if(mAdapter!=null) {
|
||||
for(BasicFragment bf:mFragments){
|
||||
for(BasicFragment bf: mFragments_cp){
|
||||
bf.initData();
|
||||
}
|
||||
/* for(int i=0;i<mAdapter.getCount();i++){
|
||||
((BasicFragment) mAdapter.getItem(i)).initData();
|
||||
}*/
|
||||
|
||||
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
@ -97,8 +103,9 @@ public class Fragment_bookStore extends BasicFragment {
|
|||
mFragments = new ArrayList<>();
|
||||
mFragments.add(new Fragment_jingxuan());
|
||||
mFragments.add(FragmentCates.newInstance());
|
||||
mFragments.add(new Fragment_bangdan());
|
||||
|
||||
mFragments.add(new Fragment_bangdans());
|
||||
mFragments_cp = new ArrayList<>();
|
||||
mFragments_cp.addAll(mFragments);
|
||||
// mFragments.add(new Fragment_shudan());
|
||||
Log.d(TAG,"initial fragments in tabs ");
|
||||
}
|
||||
|
|
|
@ -50,12 +50,13 @@ public class Fragment_booklist extends BasicFragment {
|
|||
private static final String EXTR_FN ="fn" ;
|
||||
private static final String EXTR_BANGDAN ="bangdan" ;
|
||||
private static final String EXTR_HISTORY ="history" ;
|
||||
private static final String EXTR_CID ="cid" ;
|
||||
private BookListAdapter mAdapter;
|
||||
// private BookListAdapter mAdapter;
|
||||
private List<Novel> mData;;
|
||||
private List<Novel> mMoreData;
|
||||
private String cate;
|
||||
private int progress;
|
||||
private int progress,cid;
|
||||
private String keyWord ,fn,bangdan,history;
|
||||
private int listItem =R.layout.recycle_list_item_horizon;
|
||||
//private int pageNo=1;
|
||||
|
@ -75,6 +76,14 @@ public class Fragment_booklist extends BasicFragment {
|
|||
public Fragment_booklist() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
public static Fragment_booklist newInstance(int cid,String bangdan) {
|
||||
Fragment_booklist fragment = new Fragment_booklist();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(EXTR_CID,cid);
|
||||
args.putString(EXTR_BANGDAN,bangdan);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
public static Fragment_booklist newInstance(String fn,String bangdan) {
|
||||
Fragment_booklist fragment = new Fragment_booklist();
|
||||
Bundle args = new Bundle();
|
||||
|
@ -112,7 +121,7 @@ public class Fragment_booklist extends BasicFragment {
|
|||
Bundle bundle = getArguments() ;
|
||||
bangdan =bundle.getString(EXTR_BANGDAN);
|
||||
fn= bundle.getString(EXTR_FN);
|
||||
|
||||
cid =bundle.getInt(EXTR_CID);
|
||||
if(!TextUtils.isEmpty((fn))){
|
||||
return;
|
||||
}
|
||||
|
@ -230,10 +239,10 @@ public class Fragment_booklist extends BasicFragment {
|
|||
|
||||
Log.d(TAG,String.format("fn is %s",fn) );
|
||||
|
||||
if(!TextUtils.isEmpty(bangdan) && !TextUtils.isEmpty(fn)){ //榜单
|
||||
if(!TextUtils.isEmpty(bangdan) && (cid >0 || !TextUtils.isEmpty(fn))){ //榜单
|
||||
// showProgressDialog(true, "正在加载榜单");
|
||||
mAdapter.setShowTop(true);
|
||||
BookSubscribe.getSiteRankDetail(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
BookSubscribe.getPaihangBangList(Constants.SEX,pageNo,cid,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
|
|
|
@ -9,16 +9,13 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ixiaow.multilayout.MultiLayout;
|
||||
import com.novelbook.android.R;
|
||||
|
||||
import com.novelbook.android.adapter.JudgeNestedScrollView;
|
||||
import com.novelbook.android.bean.Progress;
|
||||
|
||||
import com.novelbook.android.bean.ProgressType;
|
||||
import com.novelbook.android.db.Novel;
|
||||
import com.novelbook.android.netapi.RandomHost;
|
||||
import com.novelbook.android.netsubscribe.BookSubscribe;
|
||||
|
@ -31,10 +28,10 @@ import com.novelbook.android.utils.OnItemClickListener;
|
|||
import com.novelbook.android.adapter.BookListAdapter;
|
||||
import com.flyco.tablayout.CommonTabLayout;
|
||||
import com.flyco.tablayout.listener.CustomTabEntity;
|
||||
import com.flyco.tablayout.listener.OnTabSelectListener;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.litepal.util.Const;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -213,7 +210,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
}
|
||||
};
|
||||
showProgressDialog(false, "正在加载...");
|
||||
BookSubscribe.getCateNovelList(cate, pageNo, tab1Pos+1, tab3Pos+1, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, Constants.lstProgressType.get(tab3Pos).getId(), new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
|
||||
|
||||
}
|
||||
|
@ -221,7 +218,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
public void initViews(){
|
||||
appBarLayout.setVisibility(View.GONE);
|
||||
if(lstNt==null) {
|
||||
getSearchTabTtitle();
|
||||
// getSearchTabTtitle();
|
||||
}
|
||||
else {
|
||||
initTabs();
|
||||
|
@ -263,7 +260,10 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
}*/
|
||||
|
||||
|
||||
List<String> lstType = Arrays.asList(lstProgress);
|
||||
List<String> lstType = new ArrayList<String>() ;//Arrays.asList(lstProgress);
|
||||
for(ProgressType progressType : Constants.lstProgressType){
|
||||
lstType.add(progressType.getName());
|
||||
}
|
||||
topic_layout.initTabNames(lstNt) ;
|
||||
topic_layout1.initTabNames( lstSex) ;
|
||||
topic_layout2.initTabNames(lstType) ;
|
||||
|
@ -322,8 +322,8 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
String sex = lstSex.get(tab1Pos);
|
||||
String cate = lstNt.get(tab2Pos);
|
||||
String selectedKey = lstSex.get(tab1Pos) +" " +
|
||||
cate +" " +
|
||||
lstProgress[tab3Pos] ;
|
||||
cate +" " + Constants.lstProgressType.get(tab3Pos).getName();
|
||||
// lstProgress[tab3Pos] ;
|
||||
|
||||
|
||||
|
||||
|
@ -331,7 +331,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
tvHint.setText(selectedKey);
|
||||
Log.d(TAG, String.format("tabChanged: to load data %s,pageno %s, tmp %s" , selectedKey,pageNo ,tmp));
|
||||
|
||||
if( tmp<4) return;
|
||||
if( tmp<lstProgress.length+1) return;
|
||||
|
||||
loadSearchData();
|
||||
|
||||
|
@ -402,92 +402,14 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
@BindView(R.id.tvHint)
|
||||
TextView tvHint;
|
||||
//------------滑动监听
|
||||
/* @BindView(R.id.n_scroll_view)
|
||||
JudgeNestedScrollView mNestedScrollView;
|
||||
@BindView(R.id.llTabs)
|
||||
LinearLayout llTabs;
|
||||
@BindView(R.id.tvHint)
|
||||
TextView tvHint;
|
||||
|
||||
private boolean isShowHint =false;
|
||||
void setScrollListner(){
|
||||
|
||||
llTabs.measure(0,0);
|
||||
final int height = llTabs.getMeasuredHeight(); //获得当前组件的宽度和高度
|
||||
// final int height = llTabs.getLayoutParams().height;
|
||||
mNestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
|
||||
// 将透明度声明成局部变量用于判断
|
||||
//int alpha = 0;
|
||||
// int count = 0;
|
||||
// float scale = 0;
|
||||
@Override
|
||||
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||
isShowHint = scrollY > height;
|
||||
if (scrollY <= height) {
|
||||
// scale = (float) scrollY / height;
|
||||
// alpha = (int) (255 * scale);
|
||||
tvHint.setVisibility(View.GONE);
|
||||
// 随着滑动距离改变透明度
|
||||
// Log.e("al=","="+alpha);
|
||||
// re.setBackgroundColor(Color.argb(alpha, 255, 0, 0));
|
||||
mNestedScrollView.setNeedScroll(true);
|
||||
} else {
|
||||
tvHint.setVisibility(View.VISIBLE);
|
||||
// if (alpha < 255) {
|
||||
// Log.e("执行次数", "=" + (++count));
|
||||
// 防止频繁重复设置相同的值影响性能
|
||||
// alpha = 255;
|
||||
// re.setBackgroundColor(Color.argb(alpha, 255, 0, 0));
|
||||
// }
|
||||
mNestedScrollView.setNeedScroll(false);
|
||||
}
|
||||
*//* LinearLayoutManager layoutManager = (LinearLayoutManager) NestedScrollView.getLayoutManager();
|
||||
int lastVisibleItemPosition = 0;
|
||||
int totalItemCount = layoutManager.getItemCount();
|
||||
|
||||
if(v.getChildAt(v.getChildCount() - 1) != null) {
|
||||
if (scrollY >= (v.getChildAt(v.getChildCount()-1).getMeasuredHeight() - v.getMeasuredHeight())
|
||||
&& scrollY > oldScrollY) {
|
||||
if (layoutManager instanceof LinearLayoutManager) {
|
||||
lastVisibleItemPosition = ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
|
||||
}
|
||||
|
||||
if (totalItemCount < previousTotalItemCount) {
|
||||
this.currentPage = this.startingPageIndex;
|
||||
this.previousTotalItemCount = totalItemCount;
|
||||
if (totalItemCount == 0) {
|
||||
this.loading = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (loading && (totalItemCount > previousTotalItemCount)) {
|
||||
loading = false;
|
||||
previousTotalItemCount = totalItemCount;
|
||||
}
|
||||
|
||||
if (!loading && (lastVisibleItemPosition + visibleThreshold) > totalItemCount) {
|
||||
currentPage++;
|
||||
onLoadMore();
|
||||
loading = true;
|
||||
}
|
||||
}
|
||||
}*//*
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//mNestedScrollView.smoothScrollBy(1,1);
|
||||
// tvHint.setVisibility(isShowHint? View.VISIBLE:View.GONE);
|
||||
|
||||
tmp=0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -496,38 +418,6 @@ final String TAG = Fragment_paihang.class.getSimpleName();
|
|||
|
||||
}
|
||||
|
||||
void getSearchTabTtitle(){
|
||||
|
||||
|
||||
BookSubscribe.getSearchTitles(Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||
try {
|
||||
|
||||
Constants.lstSex = GsonUtil.parserStringBlocks(result,"sex");
|
||||
Constants.lstNt =GsonUtil.parserStringBlocks(result,"nt");
|
||||
// Constants.lstProgress =GsonUtil.parserProgressBlocks(result,"progress");
|
||||
initTabs();
|
||||
loadSearchData();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onSuccess: prepare book",e );
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMsg) {
|
||||
//失败
|
||||
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||
// getSearchTabTtitle();
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
},getActivity()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class Main2Activity extends Activity_base
|
|||
|
||||
initialSexOption();
|
||||
checkUpdate(true);
|
||||
// getSearchTabTtitle();
|
||||
getSearchTabTtitle();
|
||||
|
||||
}
|
||||
|
||||
|
@ -551,6 +551,39 @@ private int bottomSelectedIndex;
|
|||
}
|
||||
|
||||
//----get master domain
|
||||
void getSearchTabTtitle(){
|
||||
|
||||
|
||||
BookSubscribe.getSearchTitles(Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
// mFirstPage= gson.fromJson(result, FirstPage.class);
|
||||
try {
|
||||
|
||||
Constants.lstSex = GsonUtil.parserStringBlocks(result,"sex");
|
||||
Constants.lstNt =GsonUtil.parserStringBlocks(result,"nt");
|
||||
Constants.lstProgressType =GsonUtil.parserProgressType(result,"progress");
|
||||
|
||||
// initTabs();
|
||||
// loadSearchData();
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onSuccess: prepare book",e );
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFault(String errorMsg) {
|
||||
//失败
|
||||
Log.d(TAG, "error on get firstpage: " + errorMsg);
|
||||
// getSearchTabTtitle();
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
},this));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.novelbook.android.adapter.MyPagerAdapter;
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.view.animation.Animation;
|
|||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
@ -111,6 +112,8 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
|
||||
@BindView(R.id.llTopAd)
|
||||
LinearLayout llTopAd;
|
||||
@BindView(R.id.imgLoading)
|
||||
pl.droidsonroids.gif.GifImageView imgLoading;
|
||||
|
||||
private Config config;
|
||||
private WindowManager.LayoutParams lp;
|
||||
|
@ -178,6 +181,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
|
||||
config = Config.getInstance();
|
||||
pageFactory = PageFactory.getInstance(getApplicationContext());
|
||||
pageFactory.clear();
|
||||
pageFactory.setAd(this);
|
||||
llTopAd.setVisibility(View.GONE);
|
||||
|
||||
|
@ -589,7 +593,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
pageFactory.setPageWidget(bookpage);
|
||||
if (id == R.id.action_add_bookmark){
|
||||
if( pageFactory.isReady())
|
||||
if (pageFactory.getCurrentPage() != null) {
|
||||
|
@ -804,6 +808,21 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
btnRefresh.setVisibility(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showProgressbar(boolean dismissAble,String msg) {
|
||||
showProgressDialog(dismissAble,msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideProgressbar() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoading(boolean isShow) {
|
||||
imgLoading.setVisibility(isShow?View.VISIBLE:View.GONE);
|
||||
}
|
||||
|
||||
private void showSystemUI() {
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
|
@ -886,6 +905,7 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
|
|||
R.id.tv_dayornight,R.id.tv_pagemode, R.id.tv_setting, R.id.bookpop_bottom, /*R.id.rl_bottom,*/R.id.tv_stop_read
|
||||
,R.id.llTopAd,R.id.btnRefresh})
|
||||
public void onClick(View view) {
|
||||
pageFactory.setPageWidget(bookpage);
|
||||
// if( pageFactory.isReady())
|
||||
switch (view.getId()) {
|
||||
// case R.id.btn_return:
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.novelbook.android.bean;
|
||||
|
||||
public class BangdanCate {
|
||||
private int cid;
|
||||
private String fn;
|
||||
private String name;
|
||||
private String title;
|
||||
|
||||
public int getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public void setCid(int cid) {
|
||||
this.cid = cid;
|
||||
}
|
||||
|
||||
public String getFn() {
|
||||
return fn;
|
||||
}
|
||||
|
||||
public void setFn(String fn) {
|
||||
this.fn = fn;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.novelbook.android.db.Novel;
|
|||
import java.util.List;
|
||||
|
||||
public class NovelBlock{
|
||||
private int cid;
|
||||
private String fn;
|
||||
private String title;
|
||||
private int oneself;
|
||||
|
@ -14,6 +15,14 @@ public class NovelBlock{
|
|||
private List<String> pictures;
|
||||
private List<Novel> ns;
|
||||
|
||||
public int getCid() {
|
||||
return cid;
|
||||
}
|
||||
|
||||
public void setCid(int cid) {
|
||||
this.cid = cid;
|
||||
}
|
||||
|
||||
public String getFn() {
|
||||
return fn;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.novelbook.android.bean;
|
||||
|
||||
public class Progress {
|
||||
public class ProgressType {
|
||||
private int id;
|
||||
private String name;
|
||||
|
|
@ -272,7 +272,9 @@ public class Novel extends LitePalSupport implements Serializable{
|
|||
}
|
||||
public static List<Novel> getNovelsOnShelf(){
|
||||
|
||||
return LitePal.where("isOnShelf=?","1").order("isTop desc,isUpdated desc,lastVisit desc" ).find(Novel.class);
|
||||
// return LitePal.where("isOnShelf=?","1").order("isTop desc,isUpdated desc,lastVisit desc,lastUpdateTime desc" ).find(Novel.class);
|
||||
return LitePal.where("isOnShelf=?","1").order("isTop desc,lastUpdateTime desc" ).find(Novel.class);
|
||||
|
||||
|
||||
}
|
||||
public static List<Novel> getLocalNovels(){
|
||||
|
@ -305,8 +307,12 @@ public class Novel extends LitePalSupport implements Serializable{
|
|||
}
|
||||
@Override
|
||||
public int update(long id){
|
||||
setValues();
|
||||
setValues();try {
|
||||
return super.update(id);
|
||||
}catch (Exception e){
|
||||
Log.e("NOVELDB", "update:error ", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public void testUpdate(){
|
||||
isUpdated=true;
|
||||
|
|
|
@ -357,22 +357,23 @@ public class SettingDialog extends Dialog {
|
|||
case R.id.iv_bg_default:
|
||||
setBookBg(Config.BOOK_BG_DEFAULT);
|
||||
selectBg(Config.BOOK_BG_DEFAULT);
|
||||
config.setDayOrNight(false);
|
||||
break;
|
||||
case R.id.iv_bg_1:
|
||||
setBookBg(Config.BOOK_BG_1);
|
||||
selectBg(Config.BOOK_BG_1);
|
||||
selectBg(Config.BOOK_BG_1); config.setDayOrNight(false);
|
||||
break;
|
||||
case R.id.iv_bg_2:
|
||||
setBookBg(Config.BOOK_BG_2);
|
||||
selectBg(Config.BOOK_BG_2);
|
||||
selectBg(Config.BOOK_BG_2); config.setDayOrNight(false);
|
||||
break;
|
||||
case R.id.iv_bg_3:
|
||||
setBookBg(Config.BOOK_BG_3);
|
||||
selectBg(Config.BOOK_BG_3);
|
||||
selectBg(Config.BOOK_BG_3); config.setDayOrNight(false);
|
||||
break;
|
||||
case R.id.iv_bg_4:
|
||||
setBookBg(Config.BOOK_BG_4);
|
||||
selectBg(Config.BOOK_BG_4);
|
||||
selectBg(Config.BOOK_BG_4); config.setDayOrNight(false);
|
||||
break;
|
||||
case R.id.tv_lhadd:
|
||||
addLineSpace();
|
||||
|
|
|
@ -74,11 +74,11 @@ public interface HttpApi {
|
|||
@GET("n/{novelId}/author")
|
||||
Observable<ResponseBody> getNovelsSameAuthor(@Path("novelId") int novelId);
|
||||
//站点榜单http://xiaoshuofenxiang.com/api/page/siteranks?sex=1
|
||||
@GET("page/siteranks")
|
||||
/* @GET("page/siteranks")
|
||||
Observable<ResponseBody> getSiteRanks(@Query("sex") int Sex);
|
||||
//http://xiaoshuofenxiang.com/api/page/siterank?fn=qidian-yuanchuangfengyunbang&pn=3
|
||||
@GET("page/siterank")
|
||||
Observable<ResponseBody> getSiteRankDetail(@Query("fn")String fn,@Query("pn")int pageNo,@Query("sex") int Sex);
|
||||
Observable<ResponseBody> getSiteRankDetail(@Query("fn")String fn,@Query("pn")int pageNo,@Query("sex") int Sex);*/
|
||||
@GET( "search/{keyword}/{pageno}")
|
||||
Observable<ResponseBody> getSeachNolvelist(@Path("keyword")String keyWord,@Path("pageno")int pageNo,@Query("sex") int Sex);
|
||||
// 搜索分类 http://xiaoshuofenxiang.com/api/page/topdata
|
||||
|
@ -94,5 +94,11 @@ public interface HttpApi {
|
|||
@GET("download/version.xml")
|
||||
Observable<ResponseBody> getVersion();
|
||||
|
||||
@GET("page/category")
|
||||
Observable<ResponseBody> getPaihangBangCateList(@Query("sex") int Sex,@Query("type") String type);
|
||||
@GET("page/siteranks")
|
||||
Observable<ResponseBody> getPaihangBangByCate(@Query("sex") int Sex,@Query("cid") int cid);
|
||||
@GET("page/siterank")
|
||||
Observable<ResponseBody> getPaihangBangList(@Query("sex") int Sex,@Query("cid") int cid,@Query("pn")int pageNo);
|
||||
|
||||
}
|
||||
|
|
|
@ -62,14 +62,14 @@ public class BookSubscribe {
|
|||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
|
||||
public static void getSiteRanks( int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
/* public static void getSiteRanks( int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/siteranks").getHttpApi().getSiteRanks(sex);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
public static void getSiteRankDetail( String fn,int pageNo,int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/siteranks").getHttpApi().getSiteRankDetail(fn,pageNo,sex);
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/siterank").getHttpApi().getSiteRankDetail(fn,pageNo,sex);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
}*/
|
||||
|
||||
public static void getSearchNovelList( String keyWord,int pageNo,int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance(String.format("/api/search/%s/%s",keyWord ,pageNo)).getHttpApi().getSeachNolvelist(keyWord,pageNo,sex);
|
||||
|
@ -92,5 +92,16 @@ public class BookSubscribe {
|
|||
Observable<ResponseBody> observable = HttpMethods.getInstance("download/version.xml").getHttpApi().getVersion();
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
|
||||
public static void getPaihangBangCateList(int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("page/category").getHttpApi().getPaihangBangCateList(sex,"rank");
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
public static void getPaihangBangByCate(int sex,int cid ,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("page/siteranks").getHttpApi().getPaihangBangByCate(sex,cid);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
public static void getPaihangBangList(int sex,int pageNo,int cid ,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("page/siterank").getHttpApi().getPaihangBangList(sex,cid,pageNo);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,36 +31,58 @@ public class RetryInterceptor implements Interceptor {
|
|||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
String oldUrl = request.url().toString();
|
||||
Log.d(TAG, "HttpMethods intercept: request url:"+oldUrl);
|
||||
String prefix = REUtil.match("(?i)http[s]?://[^/]+", oldUrl);
|
||||
Log.d(TAG, "HttpMethods intercept: prefix:"+prefix);
|
||||
|
||||
if (prefix == null){
|
||||
Response response = doRequest(chain, request);
|
||||
|
||||
if(response!=null)
|
||||
{
|
||||
return response;
|
||||
}else
|
||||
{
|
||||
|
||||
int i=0;
|
||||
while(response==null && i<3){
|
||||
request = chain.request();
|
||||
i++;
|
||||
}
|
||||
if(response==null) {
|
||||
throw new IOException();
|
||||
}else {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
String path = oldUrl.substring(prefix.length());
|
||||
Log.d(TAG, "HttpMethods intercept: path:"+path);
|
||||
RandomHost rh = null;
|
||||
boolean isMainApi =path.equals("/api/g/");
|
||||
if(oldUrl.indexOf("xiaoshuofenxiang.com") == -1 || !path.startsWith("/api/") || NetUtil.getHost(isMainApi)==null){
|
||||
// rh = null;
|
||||
|
||||
Response response = doRequest(chain, request);
|
||||
if(response!=null)
|
||||
{
|
||||
return response;
|
||||
}else
|
||||
{
|
||||
|
||||
int i=0;
|
||||
while(response==null && i<3){
|
||||
request = chain.request();
|
||||
i++;
|
||||
}
|
||||
if(response==null) {
|
||||
throw new IOException();
|
||||
}else {
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
try {
|
||||
rh = new RandomHost(NetUtil.getHost(isMainApi), path);
|
||||
Log.d(TAG, "HttpMethods intercept: api path is "+path);
|
||||
Log.d(TAG, "HttpMethods intercept: create new RandomHost--------------------------");
|
||||
|
||||
} catch (JSONException e) {
|
||||
|
@ -104,10 +126,17 @@ public class RetryInterceptor implements Interceptor {
|
|||
|
||||
|
||||
if (response != null) { try {response.close();} catch (IllegalStateException e) {} }
|
||||
|
||||
response = doRequest(chain, newRequest);
|
||||
|
||||
Log.d(TAG, String.format("HttpMethods intercept: response is null? %s", response == null));
|
||||
|
||||
int i=0;
|
||||
while(response==null && i<3){
|
||||
request = chain.request();
|
||||
i++;
|
||||
}
|
||||
|
||||
if (response != null) {
|
||||
Log.d(TAG, String.format("HttpMethods intercept: response .code? %s", response.code()));
|
||||
}
|
||||
|
@ -173,10 +202,12 @@ public class RetryInterceptor implements Interceptor {
|
|||
|
||||
private Response doRequest(Chain chain, Request request) throws IOException {
|
||||
Response response = null;
|
||||
|
||||
|
||||
try {
|
||||
response = chain.proceed(request);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "doRequest: error 1 ",e );
|
||||
Log.e(TAG, "doRequest: error, " + request.url(),e );
|
||||
}
|
||||
|
||||
return response;
|
||||
|
|
|
@ -134,11 +134,13 @@ public class ServiceDownload extends Service {
|
|||
|
||||
protected void onHandleIntent( Intent intent) {
|
||||
Log.d(TAG,"ServiceDownload onHandleIntent...begin");
|
||||
|
||||
if(null==intent){
|
||||
return;
|
||||
}
|
||||
String key ="taskId";
|
||||
int taskId =0;
|
||||
|
||||
if(intent.hasExtra(key)){
|
||||
if ( intent.hasExtra(key)){
|
||||
taskId= intent.getExtras().getInt(key);
|
||||
DownloadTask dt = LitePal.find(DownloadTask.class,taskId);
|
||||
|
||||
|
|
|
@ -9,4 +9,8 @@ public interface AdInterface {
|
|||
public void showAd(boolean showAd,int height,int adY);
|
||||
public void hideSystemUI();
|
||||
public void showRefresh(int visible);
|
||||
public void showProgressbar(boolean dismissAble,String msg);
|
||||
public void hideProgressbar();
|
||||
public void showLoading(boolean isShow);
|
||||
|
||||
}
|
||||
|
|
|
@ -553,8 +553,10 @@ public class BookUtil {
|
|||
if(chaptCache.containsKey(chapterNo)){
|
||||
chaptCache.remove(chapterNo);
|
||||
}
|
||||
if(pagefactory!=null) {
|
||||
pagefactory.changeChapter(chapterNo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class BookTask extends AsyncTask<String,Void,Boolean> {
|
||||
|
@ -647,9 +649,10 @@ public class BookUtil {
|
|||
}
|
||||
chId = chId <= mChapters.size() ? chId: mChapters.size();
|
||||
Log.d(TAG, "changing Source: to open chapter with new site source " + chId + " : "+ mChangeTitle );
|
||||
if(pagefactory!=null)
|
||||
pagefactory.changeChapter(chId);
|
||||
// mChangeChapId=0;
|
||||
Toast.makeText(mContext,"换源成功",Toast.LENGTH_LONG).show();
|
||||
// Toast.makeText(mContext,"换源成功",Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Log.d(TAG, "changing Source: failed " );
|
||||
}
|
||||
|
@ -1374,7 +1377,7 @@ int muluRetryCount =0;
|
|||
// isDownloadChapt =true;
|
||||
Log.d(TAG,String.format("handler msg, download %s",true) );
|
||||
}else if(msg.what==99){
|
||||
// Toast.makeText(mContext,"网络拥堵,将帮您切换其它源",Toast.LENGTH_SHORT);
|
||||
Toast.makeText(mContext,"网络拥堵,已帮您切换其它源",Toast.LENGTH_LONG).show();
|
||||
// getSiteRule();
|
||||
// pagefactory .changeChapter(getChapterNo());
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.novelbook.android.utils;
|
||||
|
||||
import com.novelbook.android.bean.Progress;
|
||||
|
||||
import com.novelbook.android.bean.ProgressType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -22,6 +23,7 @@ public class Constants {
|
|||
public static List<String> lstNt=null;
|
||||
//public static List<Progress> lstProgress=null;
|
||||
public static String[] lstProgress={"连载中","已完本","新书"};
|
||||
public static List<ProgressType> lstProgressType=null;
|
||||
public static int retryCnt =5;
|
||||
public static int muluRetryCnt =5;
|
||||
// public static List<String> lstProgress=null;
|
||||
|
|
|
@ -5,8 +5,10 @@ import com.google.gson.JsonArray;
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.novelbook.android.bean.BangdanCate;
|
||||
import com.novelbook.android.bean.NovelBlock;
|
||||
import com.novelbook.android.bean.Progress;
|
||||
import com.novelbook.android.bean.ProgressType;
|
||||
import com.novelbook.android.bean.ProgressType;
|
||||
import com.novelbook.android.db.Novel;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
@ -49,10 +51,10 @@ public class GsonUtil {
|
|||
}
|
||||
return lst;
|
||||
}
|
||||
public static List<Progress> parserProgressBlocks(String restult, String blockName ) throws JSONException {
|
||||
public static List<ProgressType> parserProgressType(String restult, String blockName ) throws JSONException {
|
||||
JSONObject jsonObject = new JSONObject(restult);
|
||||
String strJson = jsonObject.getString(blockName);
|
||||
List<Progress> list = new ArrayList<Progress>();
|
||||
List<ProgressType> list = new ArrayList<ProgressType>();
|
||||
//创建一个Gson对象
|
||||
// Gson gson = new Gson();
|
||||
//创建一个JsonParser
|
||||
|
@ -78,10 +80,44 @@ public class GsonUtil {
|
|||
while (it.hasNext()) {
|
||||
JsonElement e = (JsonElement) it.next();
|
||||
//JsonElement转换为JavaBean对象
|
||||
list.add((Progress) gson.fromJson(e, Progress.class));
|
||||
list.add((ProgressType) gson.fromJson(e, ProgressType.class));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public static List<BangdanCate> parserBangdanCate(String restult, String blockName ) throws JSONException {
|
||||
JSONObject jsonObject = new JSONObject(restult);
|
||||
String strJson = jsonObject.getString(blockName);
|
||||
List<BangdanCate> list = new ArrayList<BangdanCate>();
|
||||
//创建一个Gson对象
|
||||
// Gson gson = new Gson();
|
||||
//创建一个JsonParser
|
||||
JsonParser parser = new JsonParser();
|
||||
//通过JsonParser对象可以把json格式的字符串解析成一个JsonElement对象
|
||||
JsonElement el = parser.parse(strJson);
|
||||
|
||||
//把JsonElement对象转换成JsonObject
|
||||
JsonObject jsonObj = null;
|
||||
if (el.isJsonObject()) {
|
||||
jsonObj = el.getAsJsonObject();
|
||||
}
|
||||
|
||||
|
||||
//把JsonElement对象转换成JsonArray
|
||||
JsonArray jsonArray = null;
|
||||
if (el.isJsonArray()) {
|
||||
jsonArray = el.getAsJsonArray();
|
||||
}
|
||||
|
||||
//遍历JsonArray对象
|
||||
Iterator it = jsonArray.iterator();
|
||||
while (it.hasNext()) {
|
||||
JsonElement e = (JsonElement) it.next();
|
||||
//JsonElement转换为JavaBean对象
|
||||
list.add((BangdanCate) gson.fromJson(e, BangdanCate.class));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<NovelBlock> parserNovleBlocks(String restult,String blockName ) throws JSONException {
|
||||
JSONObject jsonObject = new JSONObject(restult);
|
||||
String strJson = jsonObject.getString(blockName);
|
||||
|
|
|
@ -102,7 +102,7 @@ public class LogcatHelper {
|
|||
// cmds = "logcat -s way";//打印标签过滤信息
|
||||
// cmds = "logcat *:e *:i | grep \"(" + mPID + ")\"";
|
||||
cmds = "logcat *:D | grep \"(" + mPID + ")\"";
|
||||
|
||||
// cmds = "logcat *:D";
|
||||
}
|
||||
|
||||
public void stopLogs() {
|
||||
|
|
|
@ -183,7 +183,7 @@ public class PageFactory implements ChangeSource{
|
|||
private AdInterface mAd;
|
||||
private BookTask bookTask;
|
||||
private int MSG_NEXTPAGE=2;
|
||||
|
||||
private int MSG_HIDEPROGRESS=3;
|
||||
public AdInterface getmAd() {
|
||||
return mAd;
|
||||
}
|
||||
|
@ -221,6 +221,13 @@ public class PageFactory implements ChangeSource{
|
|||
// drawStatus();
|
||||
Log.d(TAG, "prepare book to load next page");
|
||||
nextPage();
|
||||
} else if (msg.what == MSG_HIDEPROGRESS) {
|
||||
dismissProgressDialog();
|
||||
if(mAd!=null) {
|
||||
mAd.showRefresh(View.GONE);
|
||||
// mAd.hideProgressbar();
|
||||
mAd.showLoading(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<Integer,Integer> fileRetryCnt = new HashMap<Integer,Integer>();
|
||||
|
@ -483,11 +490,13 @@ public class PageFactory implements ChangeSource{
|
|||
mStatus= Status.CHANGESOURCE;
|
||||
statusChangeSource="正在换源...";
|
||||
if(!TextUtils.isEmpty(domainName)) {
|
||||
statusChangeSource = "前往 " + domainName + " ...";
|
||||
statusChangeSource = "前往 " + domainName.substring(0,domainName.length()>5?5:domainName.length()) + "...";
|
||||
}
|
||||
|
||||
drawStatus();
|
||||
mBookUtil.pagefactory=this;
|
||||
mBookUtil.changeSource(domain, chapId, chapTitle);
|
||||
|
||||
}
|
||||
|
||||
/* public String getChapterName() {
|
||||
|
@ -666,11 +675,16 @@ private void hideSysUI(){
|
|||
private void drawStatus(Bitmap bitmap){
|
||||
hideSysUI();
|
||||
mAd.showRefresh(View.VISIBLE);
|
||||
mAd.hideProgressbar();
|
||||
mAd.showLoading(false);
|
||||
String status = "";
|
||||
switch (mStatus){
|
||||
case OPENING:
|
||||
status = loadingTxt+ "正在拼命加载" ;
|
||||
status = "正在拼命加载" + loadingTxt;
|
||||
mAd.showRefresh(View.GONE);
|
||||
// mAd.showProgressbar(false,status);
|
||||
mAd.showLoading(true);
|
||||
// showProgressDialog();
|
||||
break;
|
||||
case FAIL:
|
||||
status = "读取错误,请稍后重试";
|
||||
|
@ -685,6 +699,7 @@ private void hideSysUI(){
|
|||
case FINISH:
|
||||
status = "加载成功";
|
||||
mAd.showRefresh(View.GONE);
|
||||
mAd.hideProgressbar();
|
||||
break;
|
||||
case CHANGESOURCE:
|
||||
status = statusChangeSource;
|
||||
|
@ -736,7 +751,10 @@ private void hideSysUI(){
|
|||
// Log.d(TAG, String.format(" prepare book onDraw chapter _____________ %s ",currentChapter ) );
|
||||
//更新数据库进度
|
||||
|
||||
if(mAd!=null){
|
||||
|
||||
handler.sendEmptyMessage(MSG_HIDEPROGRESS);
|
||||
}
|
||||
|
||||
|
||||
if ( mStatus ==Status.FINISH && currentPage != null && getNovel() != null) {
|
||||
|
@ -761,6 +779,7 @@ private void hideSysUI(){
|
|||
}
|
||||
getNovel().setToDefault("isUpdated"); //去除更新标志
|
||||
getNovel().setLastReadPos(currentPage.getBegin());
|
||||
|
||||
getNovel().update(getNovel().getId()); //If you set a default value to a field, the corresponding
|
||||
// * column won't be updated.
|
||||
// getNovel().save();
|
||||
|
@ -797,9 +816,7 @@ private void hideSysUI(){
|
|||
float space =m_fontSize + lineSpace;
|
||||
paragraphSpace = prate * lineSpace;
|
||||
|
||||
if(mAd!=null){
|
||||
mAd.showRefresh(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
if (m_lines.size() > 0) {
|
||||
float y = marginHeight;
|
||||
|
@ -907,11 +924,11 @@ private void hideSysUI(){
|
|||
|
||||
String source =String.format("本章节内容来自网络");
|
||||
if(!TextUtils.isEmpty(sn)){
|
||||
source =String.format("本章节内容来自第三方网站:%s",getSite().getName());
|
||||
source =String.format("本章节内容来自第三方网站:%s",sn);
|
||||
}
|
||||
int anny= (int) CommonUtil.convertDpToPixel(mContext,40);
|
||||
int anny= (int) CommonUtil.convertDpToPixel(mContext,25);
|
||||
c.drawText(source, marginWidth, statusMarginBottom + mBatterryFontSize+anny, mBatterryPaint);
|
||||
anny= (int) CommonUtil.convertDpToPixel(mContext,60);
|
||||
anny= (int) CommonUtil.convertDpToPixel(mContext,45);
|
||||
c.drawText( Constants.announcement, marginWidth, statusMarginBottom + mBatterryFontSize+anny, mBatterryPaint);
|
||||
|
||||
}
|
||||
|
@ -1054,7 +1071,7 @@ private void hideSysUI(){
|
|||
|
||||
Log.d(TAG, "prepare book: start prepare book " + book.getName());
|
||||
|
||||
clear();
|
||||
|
||||
if(getNovel()!=null &&getNovel().getNovelId() !=book.getNovelId()){ //取消未上本书完成的web请求,待验证效果
|
||||
try {
|
||||
NetUtil.cancelRequest(getNovel().getNovelId() );
|
||||
|
@ -1066,6 +1083,7 @@ private void hideSysUI(){
|
|||
}
|
||||
|
||||
mBookUtil = new BookUtil();
|
||||
mBookUtil.pagefactory=this;
|
||||
//this.mBookUtil.setContext(context);
|
||||
this.mBookUtil.setNovel(book);
|
||||
this.mBookUtil.getTargetSites();
|
||||
|
@ -1076,9 +1094,10 @@ private void hideSysUI(){
|
|||
* @throws IOException
|
||||
*/
|
||||
public void openBook(Novel book ,Context context) throws IOException {
|
||||
if(book==null){
|
||||
|
||||
if(book==null){
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(book.isLocalBook() || mBookUtil==null){ //离线书籍重新初始化加载mBookUtil
|
||||
mBookUtil = new BookUtil();
|
||||
}
|
||||
|
@ -1245,6 +1264,8 @@ if(book==null){
|
|||
float width = 0;
|
||||
float height = 0;
|
||||
String line = "";
|
||||
// boolean isFirstPage =false;
|
||||
int firstPageLine =0;
|
||||
if(mBookUtil.getPosition(chaptId)==0) {
|
||||
lines.add("\n");//lines.add("\n");
|
||||
}
|
||||
|
@ -1258,6 +1279,8 @@ if(book==null){
|
|||
if ( !line.isEmpty()){
|
||||
if (showChapTitleOnTopWhenNextPage && lines.size() >0 && mBookUtil.isChapterTitle(line)) {
|
||||
Log.d(TAG,String.format("title is %s\n,size is %s ,position is %s" ,line,line.length(),mBookUtil.getPosition(chaptId) ));
|
||||
//isFirstPage =true;
|
||||
firstPageLine=1;
|
||||
break;
|
||||
}
|
||||
// Log.d(TAG, String.format(" loadchapt getNextLines(),chaptId %s, new line with enter '%s' ", chaptId, line+word ));
|
||||
|
@ -1267,7 +1290,7 @@ if(book==null){
|
|||
width = 0;
|
||||
height += paragraphSpace - lineSpace;
|
||||
calculateLineCount(height);
|
||||
if (lines.size()>= mLineCount){
|
||||
if (lines.size()>= mLineCount +firstPageLine){
|
||||
// Log.d(TAG,String.format("lines count limit a %s,lines size %s",mLineCount,lines.size()));
|
||||
line ="";
|
||||
break;
|
||||
|
@ -1296,7 +1319,7 @@ if(book==null){
|
|||
}
|
||||
}
|
||||
|
||||
if (lines.size() == mLineCount){
|
||||
if (lines.size() == mLineCount +firstPageLine){
|
||||
// Log.d(TAG,String.format("loadchapt lines count ,chaptId %s limit c %s,lines size %s",chaptId ,mLineCount,lines.size()));
|
||||
if (!line.isEmpty()){
|
||||
// mBookUtil.setPostition(mBookUtil.getPosition() - line.length()-2);// mBookUtil.setPostition(mBookUtil.getPosition() - 1);
|
||||
|
@ -1314,7 +1337,7 @@ if(book==null){
|
|||
}
|
||||
}*/
|
||||
|
||||
if (!line.isEmpty() && lines.size() < mLineCount){
|
||||
if (!line.isEmpty() && lines.size() < mLineCount +firstPageLine){
|
||||
|
||||
if (!(showChapTitleOnTopWhenNextPage && mBookUtil.isChapterTitle(line) ) ) {
|
||||
lines.add(line);
|
||||
|
@ -1400,6 +1423,7 @@ if(book==null){
|
|||
//上一章
|
||||
public void preChapter(){
|
||||
fileRetryCnt.clear();
|
||||
mBookUtil.fileRetryCnt.clear();
|
||||
if(currentChapter==1){
|
||||
Toast.makeText(mContext,"到头了",Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
@ -1425,6 +1449,7 @@ if(book==null){
|
|||
//下一章
|
||||
public void nextChapter(){
|
||||
fileRetryCnt.clear();
|
||||
mBookUtil.fileRetryCnt.clear();
|
||||
int num = currentChapter;
|
||||
if (num == 0){
|
||||
num = getCurrentChapter();
|
||||
|
@ -1648,7 +1673,7 @@ if(book==null){
|
|||
bookPath = "";
|
||||
bookName = "";
|
||||
//getNovel() = null;
|
||||
mBookPageWidget = null;
|
||||
// mBookPageWidget = null;
|
||||
mPageEvent = null;
|
||||
cancelPage = null;
|
||||
prePage = null;
|
||||
|
|
|
@ -129,7 +129,7 @@ public class PageWidget extends View {
|
|||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
super.onTouchEvent(event);
|
||||
if ( PageFactory.getStatus() == PageFactory.Status.OPENING){
|
||||
if ( PageFactory.getStatus() != PageFactory.Status.FINISH){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,16 @@
|
|||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
|
||||
<com.ixiaow.multilayout.MultiLayout
|
||||
android:id="@+id/topic_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tab_indicator_color="@color/colorAccent"
|
||||
app:tab_indicator_height="0dp"
|
||||
app:tab_indicator_radius="0dp"
|
||||
app:tab_text_size="15sp"
|
||||
app:tab_text_width="60dp"
|
||||
app:tl_textUnselectColor="@color/darkgray" />
|
||||
<com.flyco.tablayout.SlidingTabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<q.rorbin.verticaltablayout.VerticalTabLayout
|
||||
android:id="@+id/tablayout"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#EDEDED"
|
||||
app:indicator_color="#FFFFFF"
|
||||
app:indicator_gravity="fill"
|
||||
app:tab_height="50dp"
|
||||
android:layout_weight="0"
|
||||
android:paddingTop="50dp"
|
||||
android:layout_margin="1dp"
|
||||
app:tab_mode="scrollable" />
|
||||
<!-- <com.flyco.tablayout.SlidingTabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/white"
|
||||
app:tl_indicator_color="@color/tabSelected"
|
||||
app:tl_indicator_corner_radius="1.5dp"
|
||||
app:tl_indicator_height="2dp"
|
||||
app:tl_indicator_width="45dp"
|
||||
app:tl_textSelectColor="@color/tabSelected"
|
||||
app:tl_textUnselectColor="@color/grey"
|
||||
app:tl_textsize="14sp"
|
||||
app:tl_textBold="SELECT"
|
||||
app:tl_tab_space_equal ="true"
|
||||
app:tl_indicator_bounce_enable ="true"
|
||||
/>-->
|
||||
<!-- app:tl_indicator_color="@color/crimson" -->
|
||||
<android.support.v4.view.ViewPager
|
||||
android:paddingTop="20dp"
|
||||
android:paddingLeft="2dp"
|
||||
android:id="@+id/viewpager"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</android.support.v4.view.ViewPager>
|
||||
|
||||
</LinearLayout>
|
|
@ -12,9 +12,9 @@ app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/common_full_open_on_phone"
|
||||
>
|
||||
|
||||
>
|
||||
<!--android:background="@drawable/common_full_open_on_phone"-->
|
||||
<FrameLayout
|
||||
android:id="@+id/realtabcontent"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -43,6 +43,17 @@
|
|||
android:layout_height="match_parent"
|
||||
|
||||
/>
|
||||
<pl.droidsonroids.gif.GifImageView
|
||||
android:id="@+id/imgLoading"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:src="@mipmap/loading"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:contentDescription="TODO" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnRefresh"
|
||||
android:layout_width="100dp"
|
||||
|
@ -67,7 +78,6 @@
|
|||
android:src="@color/whitesmoke"
|
||||
android:scaleType="centerCrop"
|
||||
|
||||
|
||||
android:contentDescription="TODO" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 273 B |
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
|
@ -131,98 +131,101 @@
|
|||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:design:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:localbroadcastmanager:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: jp.wasabeef:glide-transformations:2.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:annotations:4.9.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\juniversalchardet-1.0.3.jar:unspecified@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource:3.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:loader:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:runtime:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:extensions:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:disklrucache:4.9.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata-core:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.packetzoom:pz-android-sdk:3.2.43@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:cursoradapter:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:gifdecoder:4.9.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.17.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:adapter-rxjava2:2.5.0@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core:3.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-compat:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\galaxy-v2.0.jar:unspecified@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:cardview-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-audience:16.0.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.astuetz:pagerslidingtabstrip:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.youth.banner:banner:1.4.10@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.chengzipi:Searchbox:v1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.litepal.android:java:3.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:recyclerview-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:monitor:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:28.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: __local_aars__:D.\android\sdk\build-tools\28.0.3\renderscript\lib\renderscript-v8.jar:unspecified@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.alterac.blurkit:blurkit:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:interpolator:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:transition:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:drawerlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-plus:16.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-v4:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout-solver:1.1.3@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxandroid:2.1.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.5@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:multidex:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.litepal.android:core:3.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.reactivestreams:reactive-streams:1.0.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.timqi.collapsibletextview:library:1.1.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:converter-gson:2.5.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:logging-interceptor:3.14.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.umeng.umsdk:common:2.0.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout:1.1.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:4.9.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:common:1.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:retrofit:2.5.0@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:viewpager:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: pl.droidsonroids.gif:android-gif-drawable:1.2.16@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement:16.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.ixiaow:multilayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:customview:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:design:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-fragment:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: jp.wasabeef:glide-transformations:2.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:annotations:4.9.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:viewmodel:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource:3.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:runtime:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okio:okio:1.17.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: q.rorbin:badgeview:1.1.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:cardview-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-audience:16.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.astuetz:pagerslidingtabstrip:1.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.youth.banner:banner:1.4.10@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.chengzipi:Searchbox:v1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:monitor:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.alterac.blurkit:blurkit:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:interpolator:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:transition:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:livedata:1.1.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:drawerlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.umeng.umsdk:analytics:8.0.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-annotations:9.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:documentfile:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife:9.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.5@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:slidingpanelayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\Msc.jar:unspecified@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:okhttp:3.14.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:multidex:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support:multidex-instrumentation:1.0.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.litepal.android:core:3.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.reactivestreams:reactive-streams:1.0.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.packetzoom:pz-okhttp3-interceptor:3.2.43@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: io.reactivex.rxjava2:rxjava:2.2.7@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:collections:28.0.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.timqi.collapsibletextview:library:1.1.2@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:converter-gson:2.5.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.umeng.umsdk:common:2.0.2@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.okhttp3:logging-interceptor:3.14.0@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:asynclayoutinflater:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support.constraint:constraint-layout:1.1.3@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:print:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-runtime:9.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.bumptech.glide:glide:4.9.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.core:common:1.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:versionedparcelable:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:16.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\com.baidu.tts_2.2.9.20161020_154fa02_release.jar:unspecified@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:retrofit:2.5.0@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:viewpager:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement:16.0.1@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.github.ixiaow:multilayout:1.0.0@aar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.1.1@jar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:coordinatorlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:customview:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:swiperefreshlayout:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: q.rorbin:VerticalTabLayout:1.2.5@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat:28.0.0@aar" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks:16.0.1@aar" level="project" />
|
||||
</component>
|
||||
|
|
Loading…
Reference in New Issue