From c92fd2e52d3acaf8624b331e95614a05e7235987 Mon Sep 17 00:00:00 2001
From: mwang <8205347@qq.com>
Date: Fri, 5 Jul 2019 23:21:37 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3url=E8=BF=87=E6=BB=A4?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zhuike/build.gradle | 20 +-
zhuike/src/main/AndroidManifest.xml | 4 +-
.../novelbook/android/Activity_ChgSource.java | 13 +-
.../android/Fragments/CatalogFragment.java | 4 +-
.../android/Fragments/Fragment_Shelf.java | 3 +-
.../java/com/novelbook/android/db/Novel.java | 6 +-
.../com/novelbook/android/utils/BookUtil.java | 69 ++++-
.../com/novelbook/android/utils/GsonUtil.java | 7 +-
.../android/utils/NovelParseUtil.java | 4 +
.../novelbook/android/utils/PageFactory.java | 69 +++--
.../novelbook/android/view/PageWidget.java | 10 +-
.../view/animation/SimulationAnimation.java | 2 +-
.../main/res/layout/ad_qq_activity_splash.xml | 2 +-
zhuike/src/main/res/layout/content_book.xml | 282 +++++++++---------
zhuike/zhuike.iml | 99 ++----
15 files changed, 315 insertions(+), 279 deletions(-)
diff --git a/zhuike/build.gradle b/zhuike/build.gradle
index 1095815..2d536aa 100644
--- a/zhuike/build.gradle
+++ b/zhuike/build.gradle
@@ -17,8 +17,8 @@ android {
// applicationId "com.zhushou.yueshu"
minSdkVersion 19 //target 19 Android 4.4 以下版本仅占比4.1%
targetSdkVersion 28
- versionCode 1
- versionName "v1.0"
+ versionCode 6
+ versionName "v6.0"
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -62,7 +62,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// versionCode 1
// versionName "v1.0"
- applicationVariants.all { variant ->
+ /* applicationVariants.all { variant ->
variant.outputs.all { output ->
def outFile = output.outputFile
if (outFile != null && outFile.name.endsWith(".apk")) {
@@ -71,21 +71,24 @@ android {
outputFileName = fileName;
}
}
- }
+ }*/
signingConfig signingConfigs.releaseConfig
}
}
//渠道
productFlavors {
// googleplay {}
- g {
+/* g {
applicationId "com.zhushou.yueshu"
versionName "v1.0"
buildConfigField "String", "MAIN_HOST", '"http://g.xiaoshuofenxiang.com/api/"'
buildConfigField "String", "API_HOST", '""'
}
-
+ //批量配置
+ productFlavors.all { flavor ->
+ flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
+ }*/
/* google {
applicationId "com.zhushou.yueshu"
versionName "v1.0"
@@ -93,10 +96,7 @@ android {
buildConfigField "String", "API_HOST", '""'
}*/
- //批量配置
- productFlavors.all { flavor ->
- flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
- }
+
}
android {
diff --git a/zhuike/src/main/AndroidManifest.xml b/zhuike/src/main/AndroidManifest.xml
index 916445c..bb357e0 100644
--- a/zhuike/src/main/AndroidManifest.xml
+++ b/zhuike/src/main/AndroidManifest.xml
@@ -197,8 +197,8 @@
-
-
+
+
(Arrays.asList(pageFactory.getNovelSites().getSites()));
+ ArrayList tmp = new ArrayList(Arrays.asList(pageFactory.getNovelSites().getSites()));
+
+ for(Site site : tmp){
+ if(!TextUtils.isEmpty(site.getMuluUrl())){
+ mSites.add(site);
+ }
+ }
+
+
+
+
handler.sendEmptyMessage(1);
}}.start();;
diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/CatalogFragment.java b/zhuike/src/main/java/com/novelbook/android/Fragments/CatalogFragment.java
index 3537799..fc36793 100644
--- a/zhuike/src/main/java/com/novelbook/android/Fragments/CatalogFragment.java
+++ b/zhuike/src/main/java/com/novelbook/android/Fragments/CatalogFragment.java
@@ -334,11 +334,11 @@ public class CatalogFragment extends BasicFragment implements MarkActivity.Sortc
public void hideProgressSelf() {
Log.d(TAG, "prepare book hideProgress2 called" );
- try{
+ /* try{
throw new Exception("who dismissed");
}catch (Exception e){
Log.e(TAG, "prepare book hideProgress2: ", e);
- }
+ }*/
if (mProgressDialog2 == null)
return;
diff --git a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java
index 97876c5..dfe54a5 100644
--- a/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java
+++ b/zhuike/src/main/java/com/novelbook/android/Fragments/Fragment_Shelf.java
@@ -205,7 +205,7 @@ public class Fragment_Shelf extends BasicFragment {
@Override
public void onFault(String errorMsg) {
//失败
- Log.d(TAG, "error on get firstpage: " + errorMsg);
+ Log.d(TAG, "error on get novel update list: " + errorMsg);
handler.sendEmptyMessage(1);
}
};
@@ -793,6 +793,7 @@ public class Fragment_Shelf extends BasicFragment {
public void onResume() {
super.onResume();
getUpdatedData();
+
if (bottomSheetDialog != null) {
bottomSheetDialog.hide();
}
diff --git a/zhuike/src/main/java/com/novelbook/android/db/Novel.java b/zhuike/src/main/java/com/novelbook/android/db/Novel.java
index c0402c7..eeec0cc 100644
--- a/zhuike/src/main/java/com/novelbook/android/db/Novel.java
+++ b/zhuike/src/main/java/com/novelbook/android/db/Novel.java
@@ -341,15 +341,15 @@ public void testUpdate(){
lastUpdateTime - nv.lastUpdateTime
) );
- // isUpdated = isUpdated && !(!TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.chapterName) && (chapterName.equals(nv.lastReadChaptName) ));
- // boolean isLastReadchaptUpdated = !TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.lastReadChaptName) && !(chapterName.equals(nv.lastReadChaptName));
- boolean isLastReadchaptUpdated = TextUtils.isEmpty(nv.lastReadChaptName) || !(chapterName.equals(nv.lastReadChaptName)); //没看过最新章节
+ /* boolean isLastReadchaptUpdated = TextUtils.isEmpty(nv.lastReadChaptName) || !(chapterName.equals(nv.lastReadChaptName)); //没看过最新章节
boolean isLastChaptUpdated = !TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.chapterName) && !(chapterName.equals(nv.chapterName));
Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername %s,chaptername %s,lastreadchapt %s" , chapterName,nv.chapterName,nv.lastReadChaptName ) );
isUpdated = isUpdated && isLastReadchaptUpdated || isLastChaptUpdated ;
Log.d("Novel", String.format( " isupdated %s, server lastUpdateTime isLastReadchaptUpdated %s,isLastChaptUpdated %s" ,isUpdated,isLastReadchaptUpdated,isLastChaptUpdated ) );
+ */
+
if(!isUpdated){
setToDefault("isUpdated");
}
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java
index 62433e5..94f0ea2 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/BookUtil.java
@@ -249,29 +249,47 @@ public class BookUtil {
Log.d(TAG, String.format("prepare book %s get novel sites count %s .",mNovel.getName(), nvs.getSites().length) );
if(nvs.getSites().length ==0){
- throw new RuntimeException("书本错误 code 001"); //无目标网站
+ throw new RuntimeException("书本错误 no site, code 001"); //无目标网站
// return;
}
-
+ mSite =null;
if(nvs.getSites().length > 0){
for (Site site:nvs.getSites() ) {
+ if(TextUtils.isEmpty(site.getMuluUrl())){
+ continue;
+ }
if(!TextUtils.isEmpty(mNovel.getDomain()) && site.getDomain().equals(mNovel.getDomain())){
mSite = site;
break;
}
}
- if(mSite ==null)
- for (Site site:nvs.getSites() ) {
- if(site.getSelectedByDefault()){
+ if(mSite ==null) {
+ for (Site site : nvs.getSites()) {
+ if(TextUtils.isEmpty(site.getMuluUrl())){
+ continue;
+ }
+ if (site.getSelectedByDefault()) {
mSite = site;
break;
}
}
- if(mSite ==null)
- mSite =nvs.getSites()[0];
+ }
+
+ if(mSite ==null) {
+ for (Site site : nvs.getSites()) {
+ if(TextUtils.isEmpty(site.getMuluUrl())){
+ continue;
+ }
+ mSite = site;
+ break;
+ }
+
+ }
+ }
+ if(mSite!=null) {
+ getSiteRule();
}
- getSiteRule();
}
private void setSiteInfo() {
@@ -865,6 +883,10 @@ int muluRetryCount =0;
}
String url = mSite.getMuluUrl();
int maxAge= isForceRefresh ?0 : mNovel.getMaxAge();
+ if(!isHttpOrHttps(url)){
+ return ;
+ }
+
Request request = getTagRequest(url,REUtil.getDomain(url),maxAge);
mMuluStatus = MuluStatus.isDownloading;
@@ -1761,6 +1783,14 @@ int muluRetryCount =0;
return block;
}
+ boolean isHttpOrHttps(String url){
+ if(TextUtils.isEmpty(url) || !url.toLowerCase().startsWith("http") && !url.toLowerCase().startsWith("https")){
+ Log.d(TAG, String.format("prepare book isHttpOrHttps: url % is bad for request ",url));
+ return false ;
+ }
+ return true;
+ }
+
Map fileRetryCnt = new HashMap();
private void loadChaptContent(final int chapterIndex) throws JSONException, InterruptedException {
/* 章节内容没有缓存在本地
@@ -1797,6 +1827,11 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
JSONObject siteJson = new JSONObject();
siteJson.put("chapterContentRegex", mSiteRule.getChapterContentRegex());
siteJson.put("chapterContentDumpRegex", mSiteRule.getChapterContentDumpRegex());
+
+ if(!isHttpOrHttps(url)){
+ return ;
+ }
+
Request request = getTagRequest(url, refUrl,-1);
@@ -1921,13 +1956,14 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
*/
private Request getTagRequest(String url, String refUrl ,int maxAge) {
+ try {
Request.Builder builder = new Request.Builder()
.tag(mNovel.getNovelId()) //标记 请求的tag,切换小说或离开小说界面(BookActivity) 时 取消未执行完毕的 此tag的所有请求
.url(url)
.removeHeader("Pragma");
- if(!TextUtils.isEmpty(refUrl)){
- builder.header("Referer",refUrl);
+ if (!TextUtils.isEmpty(refUrl)) {
+ builder.header("Referer", refUrl);
}
for (int i = 0; i < mSiteRule.getHeaders().length; i += 2) {
@@ -1935,21 +1971,24 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
}
- if(mSiteRule.getUserAgents()!=null && mSiteRule.getUserAgents().length>0){
- String siteAgent =mSiteRule.getUserAgents()[new Random().nextInt( mSiteRule.getUserAgents().length-1)];
+ if (mSiteRule.getUserAgents() != null && mSiteRule.getUserAgents().length > 0) {
+ String siteAgent = mSiteRule.getUserAgents()[new Random().nextInt(mSiteRule.getUserAgents().length - 1)];
Log.d(TAG, "prepare book on getTagRequest:add site user agent " + siteAgent);
- builder.removeHeader("User-Agent").addHeader("User-Agent",siteAgent ); //加 随机agent
+ builder.removeHeader("User-Agent").addHeader("User-Agent", siteAgent); //加 随机agent
- }else{
- builder.removeHeader("User-Agent").addHeader("User-Agent", HttpMethods.USERAGENT);
+ } else {
+ builder.removeHeader("User-Agent").addHeader("User-Agent", HttpMethods.USERAGENT);
}
if (maxAge > 0) {
builder.header("Cache-Control", "public, max-age=" + maxAge);
}
return builder.build();
+ }catch (Exception er){
+ }
+ return null;
}
private String getRequestHeader(Request request) {
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java
index 9ab6dda..1f3d3ea 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/GsonUtil.java
@@ -22,7 +22,9 @@ import java.util.List;
public class GsonUtil {
private static Gson gson = new Gson();
- public static Novel getNovel(String json){
+
+ public static List
+ /*public static Novel getNovel(String json){
Novel nv = new Novel();
try {
JSONObject jsonObject = new JSONObject(json);
@@ -41,8 +43,7 @@ public class GsonUtil {
e.printStackTrace();
}
return nv;
- }
- public static List parserStringBlocks(String result,String blockName ) throws JSONException {
+ }*/parserStringBlocks(String result,String blockName ) throws JSONException {
JSONObject jsonObject = new JSONObject(result);
JSONArray array = jsonObject.getJSONArray(blockName);
List lst = new ArrayList();
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/NovelParseUtil.java b/zhuike/src/main/java/com/novelbook/android/utils/NovelParseUtil.java
index c19fc2a..ed00a52 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/NovelParseUtil.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/NovelParseUtil.java
@@ -1,6 +1,7 @@
package com.novelbook.android.utils;
+import android.text.TextUtils;
import android.util.Log;
import com.novelbook.android.db.Chapter;
@@ -279,6 +280,9 @@ public class NovelParseUtil {
private static String access(String url,int maxAge, SiteRule siteRule) {
+ if(TextUtils.isEmpty(url) || !url.toLowerCase().startsWith("http") || !url.toLowerCase().startsWith("https")){
+ return "";
+ }
Request.Builder builder = new Request.Builder()
// .tag(mNovel.getNovelId()) //标记 请求的tag,切换小说或离开小说界面(BookActivity) 时 取消未执行完毕的 此tag的所有请求
.url(url)
diff --git a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java
index 27bb15a..372aea1 100644
--- a/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java
+++ b/zhuike/src/main/java/com/novelbook/android/utils/PageFactory.java
@@ -1155,7 +1155,7 @@ private void hideSysUI(){
// Log.d(TAG, strLine);
// Log.d(TAG,"最后字符 。。。" +strLine.charAt(strLine.length()-1) + "");
lastLine =strLine;
- strLine = strLine.replace("�","");
+ // strLine = strLine.replace("�","");
if(lineNo==trPage.getNativeBannerStartLine()){
if(showAd && mAd!=null){
@@ -1165,7 +1165,7 @@ private void hideSysUI(){
// mAd.showNativeBannerInLines(trPage.getNativeBannerHeight(),(int)y);
}
y+=trPage.getNativeBannerHeight() +m_fontSize +lineSpace ;
- Log.d(TAG, String.format("onDraw showNativeBannerInLines : lineno %s,strline %s ",lineNo,strLine));
+ // Log.d(TAG, String.format("onDraw showNativeBannerInLines : lineno %s,strline %s ",lineNo,strLine));
space = m_fontSize + lineSpace;
// y-=lineSpace;
if (strLine.length() > 0 && (strLine.charAt(strLine.length() - 1) + "").equals("\n")) {
@@ -1197,7 +1197,7 @@ private void hideSysUI(){
// Log.d(TAG,String.format("getNavigationBarSize mHeight is %s ,last line height %s, power %s, %s", //
// mHeight,y,mHeight - CommonUtil.convertDpToPixel(mContext,10) + mBorderWidth - statusMarginBottom, lastLine));
// lastLine =lastLine.trim().replace(Constants.BAD_CHAR,"");
- Log.d(TAG, String.format("onDraw: last line lenth %s,%s, ",lastLine.length() ,lastLine));
+ // Log.d(TAG, String.format("onDraw: last line lenth %s,%s, ",lastLine.length() ,lastLine));
float adHeight = mHeight -y - space -marginHeight-statusMarginBottom;
float adY =y ;//+space;
adY= lastLine.length()==0 ?adY-m_fontSize - lineSpace :adY;
@@ -1218,7 +1218,7 @@ private void hideSysUI(){
// showAd((int) adHeight, (int) adY);
- Log.d(TAG, String.format("loadBannerAd: AD is requested, adtype %s, adHeight %s, ady %s",mAdType,adHeight,adY));
+ // Log.d(TAG, String.format("loadBannerAd: AD is requested, adtype %s, adHeight %s, ady %s",mAdType,adHeight,adY));
}
// Log.d(TAG,String.format("ad + statusMarginBottom %s ",200+ statusMarginBottom));
// Log.d(TAG,String.format("adHeight %s, adY %s",adHeight,adY));
@@ -1245,11 +1245,11 @@ private void hideSysUI(){
c.drawText(strPercent, mWidth - nPercentWidth, botoomY, mBatterryPaint);//x y为坐标值
c.drawText(date, marginWidth ,botoomY, mBatterryPaint);
// 画电池
- Log.d(TAG, String.format("updateBattery to draw: level1 %s ",level));
+ // Log.d(TAG, String.format("updateBattery to draw: level1 %s ",level));
// level = batteryInfoIntent.getIntExtra( "level" , 0 );
int scale = batteryInfoIntent.getIntExtra("scale", 100);
mBatteryPercentage = (float) level / scale;
- Log.d(TAG, String.format("updateBattery to draw: level2 %s ",level));
+ // Log.d(TAG, String.format("updateBattery to draw: level2 %s ",level));
float rect1Left = marginWidth + dateWith + statusMarginBottom;//电池外框left位置
//画电池外框
@@ -1324,11 +1324,11 @@ private void hideSysUI(){
}
public void showAd(){
- Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s ",mAdType ));
+ // Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s ",mAdType ));
if(mStatus == Status.LASTPAGE || mAd==null ||currentPage==null || !Constants.AD_SETTING.isShowAdsense()){
return;
}
- Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s, pageNo %s",mAdType, currentPage.getPageNo()));
+ // Log.d(TAG, String.format("loadBannerAd showAd: mAdType %s, pageNo %s",mAdType, currentPage.getPageNo()));
if(mAdType ==AdTpye.BANNER){
mAd.showTopBanner(mAdHeight,mAdY);
}else if(mAdType == AdTpye.NATIVEINLINES){
@@ -1374,7 +1374,7 @@ private void hideSysUI(){
}
}
- Log.d(TAG, "prepare book prePage: to open prepage: ");
+ // Log.d(TAG, "prepare book prePage: to open prepage: ");
cancelPage = currentPage;
if(mBookPageWidget==null){
return;
@@ -1384,13 +1384,13 @@ private void hideSysUI(){
if(mBookPageWidget==null){
return;
}
- Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
+ // Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
onDraw(mBookPageWidget.getNextPage(),currentPage ,true,true);
}else{
if(mBookPageWidget==null){
return;
}
- Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
+ // Log.d(TAG, " prePage() onDraw: mBookPageWidget.getNextPage() ");
currentPage = getPrePage();
onDraw(mBookPageWidget.getNextPage(),currentPage ,true,true);
@@ -1411,7 +1411,7 @@ private void hideSysUI(){
return;
}
- Log.d(TAG, "prepare book nextPage:chaptid " +mBookUtil.getChapterNo());
+ // Log.d(TAG, "prepare book nextPage:chaptid " +mBookUtil.getChapterNo());
if (currentPage.getEnd() >= mBookUtil.getChapterLen()) {
Log.d(TAG,"已经是本章最后一页了");
File file =new File( mBookUtil.fileChapterName(currentChapter+1));
@@ -1470,9 +1470,9 @@ private void hideSysUI(){
if(mBookPageWidget==null){
return;
}
- Log.d(TAG, "nextPage() onDraw: mBookPageWidget.getCurPage() ");
+ // Log.d(TAG, "nextPage() onDraw: mBookPageWidget.getCurPage() ");
// onDraw(mBookPageWidget.getCurPage(),currentPage ,true,false);
- Log.d(TAG, "nextpage:set current bitmap ..ondraw");
+ // Log.d(TAG, "nextpage:set current bitmap ..ondraw");
prePage = currentPage;
currentPage = getNextPage();
mLoadingChaptNo=0;
@@ -1480,9 +1480,9 @@ private void hideSysUI(){
if(mBookPageWidget==null){
return;
}
- Log.d(TAG, "nextPage() onDraw: mBookPageWidget.getNextPage() ");
+ // Log.d(TAG, "nextPage() onDraw: mBookPageWidget.getNextPage() ");
onDraw(mBookPageWidget.getNextPage(),currentPage ,true,true);
- Log.d("nextPage","nextPagenext");
+ // Log.d("nextPage","nextPagenext");
HashMap map = new HashMap();
map.put("novel",bookName);
@@ -1510,18 +1510,19 @@ private void hideSysUI(){
public void prepareBook(Novel book){
- Log.d(TAG, "prepare book: start prepare book " + book.getName());
+
+ Log.d(TAG, "prepare book: start prepare book " + book.getName());
if(getNovel()!=null) {
if (getNovel().getNovelId() != book.getNovelId()) { //取消未上本书完成的web请求,待验证效果
try {
NetUtil.cancelRequest(getNovel().getNovelId());
} catch (Exception e) {
- Log.e(TAG, "prepare book: error on canceling request " + e.getMessage());
+ // Log.e(TAG, "prepare book: error on canceling request " + e.getMessage());
e.printStackTrace();
}
}else{
- Log.d(TAG, "prepare book: has been prepared, return.... " + book.getName());
+ // Log.d(TAG, "prepare book: has been prepared, return.... " + book.getName());
if(mBookUtil!=null) {
return;
}
@@ -1663,8 +1664,8 @@ private void hideSysUI(){
public TRPage getNextPage(){
int nextPageNo =currentPage.getPageNo();
- Log.e(TAG,String.format("prepare book getNextPage() currentChapter %s, chapters().size() %s,currentChaptPages .size() is %s,currentpage pageno is %s"
- ,currentChapter, getChapters().size(), currentChaptPages.size() , nextPageNo));
+// Log.e(TAG,String.format("prepare book getNextPage() currentChapter %s, chapters().size() %s,currentChaptPages .size() is %s,currentpage pageno is %s"
+// ,currentChapter, getChapters().size(), currentChaptPages.size() , nextPageNo));
if(nextPageNo==0){
drawStatus();
}
@@ -1690,7 +1691,7 @@ private void hideSysUI(){
int prePageNo =currentPage.getPageNo()-1;
- Log.d(TAG,String.format("currentPageno %s,total pagno %s",currentPage.getPageNo(),currentChaptPages.size()));
+ // Log.d(TAG,String.format("currentPageno %s,total pagno %s",currentPage.getPageNo(),currentChaptPages.size()));
if(prePageNo <=0){
@@ -1726,7 +1727,7 @@ private void hideSysUI(){
if(currentChaptPages.size()==0){
return new TRPage();
}
- Log.d(TAG, String.format("prepare book getPageForBegin: currentChaptPages count %s, chaptid %s, begin %s ",currentChaptPages.size(),currentChapter,begin));
+ // Log.d(TAG, String.format("prepare book getPageForBegin: currentChaptPages count %s, chaptid %s, begin %s ",currentChaptPages.size(),currentChapter,begin));
for(TRPage page : currentChaptPages)
{
if(page.getEnd() >=begin){
@@ -1751,7 +1752,8 @@ private void hideSysUI(){
}
int adHeight = trpage.getNativeBannerHeight()+trpage.getBannerHeight();
calculateLineCount(adHeight );
- Log.d(TAG, String.format("getNextChapterPage getNextLines: pageNo %s, adHeight %s, totalLines %s",trpage.getPageNo(),adHeight,mLineCount));
+ // Log.d(TAG, String.format("getNextChapterPage getNextLines: pageNo %s, adHeight %s, totalLines %s",trpage.getPageNo(),adHeight,mLineCount));
+ boolean newParagraph =false;
while (mBookUtil.next(true,chaptId) != -1){
char word = (char) mBookUtil.next(false,chaptId);
// Log.d(TAG, String.format(" loadchapt getNextLines(), chaptId %s, word '%s'", chaptId,word ));
@@ -1761,9 +1763,10 @@ private void hideSysUI(){
//判断是否换行
if ((word + "" ).equals("\n") ){// if ((word + "" ).equals("\r") && (((char) mBookUtil.next(true)) + "").equals("\n")){
// mBookUtil.next(false);
+ newParagraph =true;
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) ));
+ // 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;
@@ -1788,6 +1791,14 @@ private void hideSysUI(){
continue;
}
+ if(newParagraph && line.length()==0) {
+ newParagraph = false;
+ if(!(word+"").equals(Constants.BAD_CHAR)){
+ line += Constants.BAD_CHAR + Constants.BAD_CHAR;
+ widthChar += 2* mPaint.measureText( Constants.BAD_CHAR + "");
+ }
+
+ }
width += widthChar;
// Log.d(TAG, String.format(" loadchapt getNextLines(),widthChar %s ,width %s,mVisibleWidth %s",widthChar, width ,mVisibleWidth ));
@@ -1978,7 +1989,7 @@ private void hideSysUI(){
*/
currentChapter = mBookUtil.getChapterNo();
- Log.d(TAG, String.format(" prepare book onDraw chapter after mBookUtil.getChapterNo(),currentChapter %s ",currentChapter ) );
+ Log.d(TAG, String.format(" prepare book onDraw chapter after mBookUtil.getChapterNo(),currentChapter %s ",currentChapter ) );
return currentChapter ;
}
@@ -1988,9 +1999,9 @@ private void hideSysUI(){
if(mBookPageWidget==null){
return;
}
- Log.d(TAG, "currentPage onDraw: mBookPageWidget.getCurPage() ");
+ // Log.d(TAG, "currentPage onDraw: mBookPageWidget.getCurPage() ");
onDraw(mBookPageWidget.getCurPage(),currentPage ,updateChapter,false);
- Log.d(TAG, "currentPage onDraw: mBookPageWidget.getNextPage() ");
+ // Log.d(TAG, "currentPage onDraw: mBookPageWidget.getNextPage() ");
onDraw(mBookPageWidget.getNextPage(),currentPage ,updateChapter,true);
}
@@ -1999,7 +2010,7 @@ private void hideSysUI(){
hideSysUI();
if (currentPage != null && mBookPageWidget != null && !mBookPageWidget.isRunning()) {
- Log.d(TAG, String.format("updateBattery: level old %s, new %s",level,mLevel));
+ // Log.d(TAG, String.format("updateBattery: level old %s, new %s",level,mLevel));
if (level != mLevel) {
level = mLevel;
currentPage(false);
diff --git a/zhuike/src/main/java/com/novelbook/android/view/PageWidget.java b/zhuike/src/main/java/com/novelbook/android/view/PageWidget.java
index a600c89..f9fe55c 100644
--- a/zhuike/src/main/java/com/novelbook/android/view/PageWidget.java
+++ b/zhuike/src/main/java/com/novelbook/android/view/PageWidget.java
@@ -176,7 +176,7 @@ int mPageMode =0;
protected void onDraw(Canvas canvas) {
// canvas.drawColor(0xFFAAAAAA);
canvas.drawColor(mBgColor);
- Log.e("pagewidget onDraw","isMoveing isNext:" + isNext + " isRuning:" + isRuning);
+ // Log.e("pagewidget onDraw","isMoveing isNext:" + isNext + " isRuning:" + isRuning);
if (isRuning) {
mAnimationProvider.drawMove(canvas);
} else {
@@ -196,7 +196,7 @@ int mPageMode =0;
int x = (int)event.getX();
int y = (int)event.getY();
- Log.d(TAG, String.format("onTouchEvent: x %s,y %s ",x,y));
+ // Log.d(TAG, String.format("onTouchEvent: x %s,y %s ",x,y));
mAnimationProvider.setTouchPoint(x,y);
if (event.getAction() == MotionEvent.ACTION_DOWN){ //mAnimationProvider.setCancel(false); https://github.com/PeachBlossom/treader/issues/4
downX = (int) event.getX();
@@ -219,7 +219,7 @@ int mPageMode =0;
if (!isMove) {
isMove = Math.abs(downX - x) > slop || Math.abs(downY - y) > slop;
}
- Log.d(TAG, String.format("onTouchEvent:ACTION_MOVE isMove %s, isbusy %s",isMove,PageFactory.busy()));
+ // Log.d(TAG, String.format("onTouchEvent:ACTION_MOVE isMove %s, isbusy %s",isMove,PageFactory.busy()));
if(!PageFactory.busy())
if (isMove){
isMove = true;
@@ -291,7 +291,7 @@ int mPageMode =0;
}
}else if (event.getAction() == MotionEvent.ACTION_UP){
//Log.e(TAG,"ACTION_UP");
- Log.d(TAG, String.format("onTouchEvent:ACTION_UP isMove %s, isbusy %s",isMove,PageFactory.busy()));
+ // Log.d(TAG, String.format("onTouchEvent:ACTION_UP isMove %s, isbusy %s",isMove,PageFactory.busy()));
if (!isMove || PageFactory.busy()){
cancelPage = false;
//是否点击了中间
@@ -337,7 +337,7 @@ int mPageMode =0;
if (!noNext) {
isRuning = true;
- Log.d(TAG, "onTouchEvent: startanimation");
+ // Log.d(TAG, "onTouchEvent: startanimation");
mAnimationProvider.startAnimation(mScroller);
mTouchListener.showAdAfterIni();
this.postInvalidate();
diff --git a/zhuike/src/main/java/com/novelbook/android/view/animation/SimulationAnimation.java b/zhuike/src/main/java/com/novelbook/android/view/animation/SimulationAnimation.java
index c82e656..f6247da 100644
--- a/zhuike/src/main/java/com/novelbook/android/view/animation/SimulationAnimation.java
+++ b/zhuike/src/main/java/com/novelbook/android/view/animation/SimulationAnimation.java
@@ -87,7 +87,7 @@ public class SimulationAnimation extends AnimationProvider {
@Override
public void drawMove(Canvas canvas) {
- Log.d(TAG, "isMoveing drawMove: ");
+ // Log.d(TAG, "isMoveing drawMove: ");
if (getDirection().equals(Direction.next)) {
calcPoints();
drawCurrentPageArea(canvas, mCurPageBitmap, mPath0);
diff --git a/zhuike/src/main/res/layout/ad_qq_activity_splash.xml b/zhuike/src/main/res/layout/ad_qq_activity_splash.xml
index 98e3609..7dc4cd8 100644
--- a/zhuike/src/main/res/layout/ad_qq_activity_splash.xml
+++ b/zhuike/src/main/res/layout/ad_qq_activity_splash.xml
@@ -38,7 +38,7 @@
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="16dp"
- android:layout_marginTop="20dp"
+ android:layout_marginTop="30dp"
android:background="@drawable/background_circle"
android:gravity="center"
android:text="@string/click_to_skip"
diff --git a/zhuike/src/main/res/layout/content_book.xml b/zhuike/src/main/res/layout/content_book.xml
index a86b5a7..4a80d29 100644
--- a/zhuike/src/main/res/layout/content_book.xml
+++ b/zhuike/src/main/res/layout/content_book.xml
@@ -14,57 +14,57 @@
android:layout_height="match_parent"
android:orientation="vertical">
-
+ -->
@@ -98,32 +98,32 @@
android:text="简介" />
-
+ />
+
+ android:text="一句话概括了书单的内容"
+ android:visibility="gone" />
-
-
+ android:visibility="visible">
+ android:visibility="gone" />
@@ -164,28 +162,29 @@
android:orientation="horizontal">
+ android:layout_width="25dp"
+ android:layout_height="25dp"
+ android:layout_gravity="center"
+ android:layout_marginRight="5dp"
+ android:layout_weight="0"
+ android:src="@mipmap/directory" />
+
+ android:visibility="gone" />
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+
@@ -209,91 +209,95 @@
+
+
+ -->
+
+
+ android:id="@+id/tvAuthorMore"
+ style="@style/NovelBlockTitle"
+ android:layout_marginTop="5dp"
+ android:layout_marginBottom="5dp"
+ android:layout_weight="1"
+ android:text=" 其他作品" />
-
+ android:id="@+id/rvBooklist"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:divider="#ffff0000"
+ android:dividerHeight="10dp"
+ android:nestedScrollingEnabled="false"
+ android:paddingBottom="2dp" />
+
+
+
+
+
+ android:paddingBottom="50dp" />
+
diff --git a/zhuike/zhuike.iml b/zhuike/zhuike.iml
index 298b0bd..b7eb323 100644
--- a/zhuike/zhuike.iml
+++ b/zhuike/zhuike.iml
@@ -8,81 +8,39 @@
-
-
-
+
+
+
- generateGDebugSources
+ generateDebugSources
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -130,17 +88,25 @@
+
+
+
+
+
+
+
+
-
+
@@ -148,17 +114,16 @@
-
-
+
-
+
+
-