调整首页
This commit is contained in:
parent
4c1c974605
commit
fcb43d9a33
|
@ -86,12 +86,12 @@ android {
|
|||
|
||||
}
|
||||
|
||||
google {
|
||||
/* google {
|
||||
applicationId "com.zhushou.yueshu"
|
||||
versionName "v1.0"
|
||||
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
|
||||
buildConfigField "String", "API_HOST", '""'
|
||||
}
|
||||
}*/
|
||||
|
||||
//批量配置
|
||||
productFlavors.all { flavor ->
|
||||
|
|
|
@ -452,7 +452,7 @@ public abstract class Activity_base extends AppCompatActivity implements Native
|
|||
} else {
|
||||
Log.d(TAG, String.format("checkAndRequestPermission: permision result requestCode %s,",requestCode ));
|
||||
// 如果用户没有授权,那么应该说明意图,引导用户去设置里面授权。
|
||||
Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show();
|
||||
// Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show();
|
||||
// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
// intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
// startActivity(intent);
|
||||
|
|
|
@ -188,7 +188,7 @@ public class Fragment_Shelf extends BasicFragment {
|
|||
novel2.checkAndUpdate();
|
||||
}
|
||||
}
|
||||
// loadNovelsOnShelf();
|
||||
loadNovelsOnShelf();
|
||||
|
||||
/* for(Novel nove : bookLists){
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ public class Fragment_booklist extends BasicFragment {
|
|||
}else if(!TextUtils.isEmpty(fn)){ //首页 更多
|
||||
mAdapter.setShowTop(true);
|
||||
// showProgressDialog(true, "正在加载更多");
|
||||
BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
BookSubscribe.getNovelPaihang(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
|
||||
|
||||
}
|
||||
else if(!TextUtils.isEmpty((cate))) { //分类
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.os.Handler;
|
|||
import android.os.Message;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
|
@ -214,7 +215,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
if(mBlocks.size()>blockIndex) {
|
||||
ll1.setVisibility(View.VISIBLE);
|
||||
mHotNewData_l = mBlocks.get(blockIndex).getNs().subList(0,mBlocks.get(blockIndex).getOneself());
|
||||
mHotNewData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size()-1);
|
||||
mHotNewData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size());
|
||||
tvBlock1.setText(mBlocks.get(blockIndex).getName());
|
||||
loadImageView(mBlocks.get(blockIndex).getIcon(),imageViewBlock1);
|
||||
if(TextUtils.isEmpty(mBlocks.get(blockIndex).getTitle())){
|
||||
|
@ -229,7 +230,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
if(mBlocks.size()>blockIndex) {
|
||||
ll2.setVisibility(View.VISIBLE);
|
||||
mHotLianZaiData_l = mBlocks.get(blockIndex).getNs().subList(0,mBlocks.get(blockIndex).getOneself());
|
||||
mHotLianZaiData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size()-1);
|
||||
mHotLianZaiData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size());
|
||||
tvBlock2.setText(mBlocks.get(blockIndex).getName());
|
||||
loadImageView(mBlocks.get(blockIndex).getIcon(),imageViewBlock2);
|
||||
|
||||
|
@ -245,7 +246,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
if(mBlocks.size()> blockIndex ) {
|
||||
ll3.setVisibility(View.VISIBLE);
|
||||
mFinishedData_l= mBlocks.get(blockIndex).getNs().subList(0,mBlocks.get(blockIndex).getOneself());
|
||||
mFinishedData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size()-1);
|
||||
mFinishedData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size());
|
||||
tvBlock3.setText(mBlocks.get(blockIndex).getName());
|
||||
loadImageView(mBlocks.get(blockIndex).getIcon(),imageViewBlock3);
|
||||
|
||||
|
@ -259,7 +260,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
if(mBlocks.size()> blockIndex ) {
|
||||
ll4.setVisibility(View.VISIBLE);
|
||||
mFinishedData_l= mBlocks.get(blockIndex).getNs().subList(0,mBlocks.get(blockIndex).getOneself());
|
||||
mFinishedData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size()-1);
|
||||
mFinishedData_g = mBlocks.get(blockIndex).getNs().subList(mBlocks.get(blockIndex).getOneself(),mBlocks.get(blockIndex).getNs().size());
|
||||
tvBlock3.setText(mBlocks.get(blockIndex).getName());
|
||||
loadImageView(mBlocks.get(blockIndex).getIcon(),imageViewBlock3);
|
||||
|
||||
|
@ -279,7 +280,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
@Override
|
||||
public void initViews() {
|
||||
|
||||
gridItemSpace = getResources().getDimensionPixelSize(R.dimen._10dp);
|
||||
gridItemSpace = getResources().getDimensionPixelSize(R.dimen._10dp)/2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -393,8 +394,19 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
// mViewpagerTuijian =( MyViewPager) rootView.findViewById(R.id.viewpager_tuijian);
|
||||
// if (mFragments == null || mFragments.size() == 0) {
|
||||
// mTitle = new String[]{"精选", "榜单", "书单"};
|
||||
if(mBlocks==null ||mBlocks.size()<2){
|
||||
return;
|
||||
}
|
||||
if(mFragments==null) {
|
||||
mFragments = new ArrayList<>();
|
||||
}else{
|
||||
mFragments.clear();
|
||||
}
|
||||
|
||||
NovelBlock block = mBlocks.get(1);
|
||||
if(block==null ){
|
||||
return;
|
||||
}
|
||||
loadImageView(mBlocks.get(1).getIcon(),imageViewBlock0);
|
||||
tvBlock0.setText( mBlocks.get(1).getName());
|
||||
List<Novel> nvs = new ArrayList<Novel>();
|
||||
|
@ -408,13 +420,16 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
nvs.add(novel);
|
||||
}
|
||||
}
|
||||
if(nvs.size()>0){
|
||||
mFragments.add(Fragment_jingxuan_tuijian.newInstance(nvs));
|
||||
}
|
||||
|
||||
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(getChildFragmentManager()) {
|
||||
FragmentStatePagerAdapter mAdapter = new FragmentStatePagerAdapter(getChildFragmentManager()) {
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mFragments.get(position);
|
||||
|
@ -432,6 +447,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
// }
|
||||
};
|
||||
cyclell.removeAllViews();
|
||||
mViewpagerTuijian.removeAllViews();
|
||||
mViewpagerTuijian.setAdapter(mAdapter);
|
||||
mViewpagerTuijian.clearOnPageChangeListeners();
|
||||
// mViewpagerTuijian.setOnPageChangeListener(new CyclePageIndicator(getContext(), cyclell, mFragments.size()));
|
||||
|
@ -464,6 +480,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
|
||||
void initialBookList() {
|
||||
|
||||
int gridItemsLayout =R.layout.recycle_list_item_large;
|
||||
int spanCnt =getSpanCnt();
|
||||
OnItemClickListener onItemClickListener = new OnItemClickListener() {
|
||||
|
||||
|
@ -496,7 +513,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
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,gridItemsLayout, new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
|
@ -549,7 +566,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
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, gridItemsLayout, new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
|
@ -603,7 +620,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
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, gridItemsLayout, new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
|
@ -632,7 +649,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
private int space;
|
||||
|
||||
public SpaceItemDecoration(int space) {
|
||||
this.space = space*3;
|
||||
this.space = space*2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -642,7 +659,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
// outRect.bottom = space;
|
||||
|
||||
//由于每行都只有3个,所以第一个都是3的倍数,把左边距设为0
|
||||
if (parent.getChildLayoutPosition(view) %getSpanCnt()==0) {
|
||||
/* if (parent.getChildLayoutPosition(view) %getSpanCnt()==0) {
|
||||
Log.d(TAG, "getItemOffsets: left " +parent.getChildLayoutPosition(view));
|
||||
//outRect.set(0,0,0,0);
|
||||
outRect.right=space;
|
||||
|
@ -657,7 +674,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
// outRect.right=space;
|
||||
// outRect.left=space;
|
||||
Log.d(TAG, "getItemOffsets: center " +parent.getChildLayoutPosition(view));
|
||||
}
|
||||
}*/
|
||||
// outRect.set(0,0,0,0);
|
||||
}
|
||||
|
||||
|
@ -665,6 +682,7 @@ public class Fragment_jingxuan extends BasicFragment implements OnBannerListener
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
initTuijianPagers();
|
||||
MobclickAgent.onPageStart(TAG);
|
||||
}
|
||||
@Override
|
||||
|
|
|
@ -713,7 +713,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
|
|||
}
|
||||
|
||||
if(!pageFactory.canExitSilent()){
|
||||
if(book.isOnShelf() ||pageFactory.getChapters().size()>0){
|
||||
if(book.isOnShelf() ||pageFactory.getChapters().size()==0){
|
||||
finish();
|
||||
}else {
|
||||
// showNormalDialog();
|
||||
|
|
|
@ -67,7 +67,7 @@ public interface HttpApi {
|
|||
|
||||
//小说排行 http://xiaoshuofenxiang.com/api/page/rank?fn=hot
|
||||
@GET("page/rank")
|
||||
Observable<ResponseBody> getNovelPaihang(@Query("fn") String fn,@Query("sex") int Sex);
|
||||
Observable<ResponseBody> getNovelPaihang(@Query("fn") String fn,@Query("pn") int pageNo,@Query("sex") int Sex);
|
||||
|
||||
//相关小说 http://xiaoshuofenxiang.com/api/n/6/about
|
||||
@GET("n/{novelId}/about")
|
||||
|
|
|
@ -53,8 +53,8 @@ public class BookSubscribe {
|
|||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
|
||||
public static void getNovelPaihang(String fn,int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/rank").getHttpApi().getNovelPaihang(fn,sex);
|
||||
public static void getNovelPaihang(String fn,int pageNo,int sex,DisposableObserver<ResponseBody> subscriber){
|
||||
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/rank").getHttpApi().getNovelPaihang(fn,pageNo,sex);
|
||||
HttpMethods.getInstance().toSubscribe(observable, subscriber);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,11 +125,11 @@ public class BookUtil {
|
|||
private Novel mNovel;
|
||||
|
||||
private void clearBook() {
|
||||
try{
|
||||
/* try{
|
||||
throw new Exception("chapters cleared");
|
||||
}catch (Exception e){
|
||||
Log.e(TAG, "prepare book: clearbook called", e);
|
||||
}
|
||||
}*/
|
||||
charPosition.clear();
|
||||
this.muluRetryCount=0;
|
||||
this.downloadStatus = DownloadStatus.notStart;
|
||||
|
@ -157,7 +157,7 @@ public class BookUtil {
|
|||
private SiteRule mSiteRule;
|
||||
|
||||
private Map<Integer,Cache> chaptCache = new HashMap<Integer,Cache>();
|
||||
private Map<Integer,DownloadStatus> chaptDownStatus = new HashMap<Integer, DownloadStatus>();
|
||||
protected Map<Integer,DownloadStatus> chaptDownStatus = new HashMap<Integer, DownloadStatus>();
|
||||
DownloadStatus downloadStatus = DownloadStatus.notStart;
|
||||
|
||||
|
||||
|
@ -624,6 +624,8 @@ public class BookUtil {
|
|||
if(file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
fileRetryCnt.clear();
|
||||
chaptDownStatus.clear();
|
||||
if(chaptCache.containsKey(chapterNo)){
|
||||
chaptCache.remove(chapterNo);
|
||||
}
|
||||
|
|
|
@ -686,6 +686,7 @@ public class PageFactory implements ChangeSource{
|
|||
|
||||
fileRetryCnt.clear();
|
||||
mBookUtil.fileRetryCnt.clear();
|
||||
|
||||
if( chaptMap.containsKey(getCurrentChapter())){
|
||||
chaptMap.remove(getCurrentChapter());
|
||||
}
|
||||
|
@ -1052,7 +1053,7 @@ private void hideSysUI(){
|
|||
// Log.d(TAG, String.format(" prepare book onDraw chapter _____________ %s ",currentChapter ) );
|
||||
|
||||
String chapterName =CommonUtil.subString(mBookUtil.getChapter(mBookUtil.getChapterNo()).getChapterName(),16); // CommonUtil.subString(getChapterName(),16);
|
||||
|
||||
Log.d(TAG, String.format(" prepare book reading chapter %s ",chapterName ) );
|
||||
|
||||
|
||||
|
||||
|
@ -1063,12 +1064,14 @@ private void hideSysUI(){
|
|||
public void run() {
|
||||
super.run();
|
||||
if (getNovel().getLastReadChapt() != currentChapter || getNovel().getLastReadPos() != currentPage.getBegin()) {
|
||||
|
||||
if(!TextUtils.isEmpty(chapterName)) {
|
||||
getNovel().setLastReadChaptName(chapterName);
|
||||
}
|
||||
|
||||
if (currentChapter > 1) {
|
||||
|
||||
getNovel().setLastReadChapt(currentChapter);
|
||||
if(!TextUtils.isEmpty(chapterName)){
|
||||
getNovel().setLastReadChaptName(chapterName);
|
||||
}
|
||||
|
||||
} else {
|
||||
getNovel().setToDefault("lastReadChapt");
|
||||
|
@ -2058,6 +2061,7 @@ private void hideSysUI(){
|
|||
public void retryChapt(int chapNum){
|
||||
fileRetryCnt.clear();
|
||||
mBookUtil.fileRetryCnt.clear();
|
||||
mBookUtil.chaptDownStatus.clear();
|
||||
changeChapter(chapNum);
|
||||
}
|
||||
public void openBookmark(int chapNum,long position){
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
style="@style/NovelImage.horizon"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:src="@drawable/googleg_standard_color_18" />
|
||||
<ImageView
|
||||
android:id="@+id/imageTop1"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_margin="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/item_selector"
|
||||
android:clickable="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="0dp">
|
||||
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
style="@style/NovelImage.grid"
|
||||
|
||||
|
||||
android:src="@drawable/googleg_standard_color_18" />
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextViewNovelTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="天龙八部天龙八部天龙八部"
|
||||
android:paddingRight="2dp"
|
||||
android:paddingLeft="2dp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -140,7 +140,6 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javac" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_aapt_derived_proguard_rules" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/legacy_multidex_main_dex_list" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint_jar" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged-not-compiled-resources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_jni_libs" />
|
||||
|
@ -156,7 +155,6 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shader_assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/validate_signing_config" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
|
|
Loading…
Reference in New Issue