This commit is contained in:
mwang 2019-07-14 23:18:28 +08:00
parent 27e08bb384
commit 7e820840fe
22 changed files with 276 additions and 82 deletions

View File

@ -19,6 +19,8 @@ import com.novelbook.android.utils.Constants;
import com.novelbook.android.utils.GsonUtil;
import com.novelbook.android.utils.HistoryCache;
import org.litepal.util.Const;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -97,7 +99,7 @@ public class Activity_Search extends Activity_base {
}
};
BookSubscribe.getHotKeyWords( new OnSuccessAndFaultSub(successAndFaultListener,this));
BookSubscribe.getHotKeyWords(Constants.SEX, new OnSuccessAndFaultSub(successAndFaultListener,this));
}

View File

@ -120,7 +120,7 @@ public abstract class BasicFragment extends Fragment /*implements NativeADUnif
int error_try=0;
int error_try_max=5;
protected List<Integer> noveIds = new ArrayList<Integer>();
public BasicFragment() {
// Required empty public constructor
}
@ -278,7 +278,7 @@ void initTabs(){
pageFactory.prepareBook(nv );
Log.d(TAG, String.format("prepare book %s 开始open book.",nv.getName()) );
ReadActivity.openBook(nv ,activity);
new Thread(){
/* new Thread(){
@Override
public void run() {
super.run();
@ -289,7 +289,7 @@ void initTabs(){
}
handler.sendEmptyMessage(99);
}
}.start();
}.start();*/
}

View File

@ -452,26 +452,38 @@ public class Fragment_Shelf extends BasicFragment {
TextView tvLatestChapt = (TextView) bottomSheetDialog.findViewById(R.id.txtLatestCate);
TextView tvAuthor = (TextView) bottomSheetDialog.findViewById(R.id.tvAuthor);
tvTitle.setText(bookLists.get(position).getName());
ImageView imageView = (ImageView) bottomSheetDialog.findViewById(R.id.imageG1);
// TextView tvImportTitle = (TextView) bottomSheetDialog.findViewById(R.id.tvImportTitle);
if (!bookLists.get(position).isLocalBook()) {
tvLatestChapt.setText(bookLists.get(position).getChapterName());
tvAuthor.setText(bookLists.get(position).getAuthor());
TextView tvLatest = (TextView) bottomSheetDialog.findViewById(R.id.txtLatestUpdate);
tvLatestChapt.setText(bookLists.get(position).getChapterName());
tvLatest.setText(CommonUtil.getDateString(bookLists.get(position).getLastUpdateTime()));
TextView tvLastVisit = (TextView) bottomSheetDialog.findViewById(R.id.txtLatestVisit);;
tvLastVisit.setText( CommonUtil.getDateString( bookLists.get(position).getLastVisit()));
TextView tvLastReadChpapt = (TextView) bottomSheetDialog.findViewById(R.id.txtLatestReadChapter);;
tvLastReadChpapt.setText( bookLists.get(position).getLastReadChaptName()) ;
TextView tvLastDomain = (TextView) bottomSheetDialog.findViewById(R.id.txtLastDomain);
tvLastDomain. setText( "[" + bookLists.get(position).getDomainName()+"]") ;
ImageUtil.loadImage(activity, bookLists.get(position).getCover(), imageView);
// tvImportTitle.setVisibility(View.GONE);
imageView.setVisibility(View.VISIBLE);
} else {
tvLatestChapt.setText("本地导入");
tvAuthor.setText("");
// imageView.setImageResource(R.drawable.blankcover);
imageView.setVisibility(View.GONE);
// tvImportTitle.setText(bookLists.get(position).getName());
// tvImportTitle.setVisibility(View.VISIBLE);
}
ImageView imageView = (ImageView) bottomSheetDialog.findViewById(R.id.imageG1);
ImageUtil.loadImage(activity, bookLists.get(position).getCover(), imageView);
TextView tvLastVisit = (TextView) bottomSheetDialog.findViewById(R.id.txtLatestVisit);;
tvLastVisit.setText( CommonUtil.getDateString( bookLists.get(position).getLastVisit()));
TextView tvLastReadChpapt = (TextView) bottomSheetDialog.findViewById(R.id.txtLatestReadChapter);
String lastReadChapt = bookLists.get(position).getLastReadChaptName();
lastReadChapt = TextUtils.isEmpty(lastReadChapt)? "":lastReadChapt;
lastReadChapt =lastReadChapt.replace("null","").trim();
tvLastReadChpapt.setText( lastReadChapt) ;
Log.d(TAG, "initDialog: " + lastReadChapt);
LinearLayout lldetail = (LinearLayout) bottomSheetDialog.findViewById(R.id.llBookdetail);
if (!bookLists.get(position).isLocalBook())

View File

@ -168,7 +168,7 @@ public class Fragment_booklist extends BasicFragment {
// int pn = pageNo;
if(pageNo==1) {
noveIds = new ArrayList<Integer>();
if (mData != null) { //下拉刷新
mData = new ArrayList<Novel>();
mAdapter.setData(mData);
@ -191,7 +191,14 @@ public class Fragment_booklist extends BasicFragment {
try {
JSONObject jsonObject = new JSONObject(result);
setPageCount(jsonObject.getInt("pageCount")); ;
mMoreData = GsonUtil. parserJsonArray(jsonObject,Constants.BLOCK_TITLE_NOVELS);
List<Novel> list = GsonUtil. parserJsonArray(jsonObject,Constants.BLOCK_TITLE_NOVELS);
mMoreData =new ArrayList<Novel>();
for(Novel novel :list){
if(!noveIds.contains(novel.getNovelId())){
mMoreData.add(novel);
noveIds.add(novel.getNovelId());
}
}
if(mMoreData.size()>0){
loadListAd(mAdapter,1,mData.size()>0);
}
@ -225,7 +232,19 @@ public class Fragment_booklist extends BasicFragment {
JSONObject jsonObject = new JSONObject(result);
String resultstr = jsonObject.getString("rank") ;
setPageCount(jsonObject.getJSONObject("rank").getInt("pageCount")); ;
mMoreData = GsonUtil. parserJsonArray(resultstr,Constants.BLOCK_TITLE_NOVELS);
List<Novel> list = GsonUtil. parserJsonArray(resultstr,Constants.BLOCK_TITLE_NOVELS);
mMoreData =new ArrayList<Novel>();
for(Novel novel :list){
if(!noveIds.contains(novel.getNovelId())){
mMoreData.add(novel);
noveIds.add(novel.getNovelId());
}
}
Log.d(TAG, "排行榜详细 onSuccess: pageCount " + getPageCount());
if(mMoreData.size()>0){
loadListAd(mAdapter,1,mData.size()>0);

View File

@ -134,6 +134,14 @@ public static final String TAG = Fragment_paihang.class.getSimpleName();
loadSearchData();
}
private void loadSearchData(){
try{
throw new Exception();
}catch (Exception e){
Log.e(TAG, "loadSearchData: ", e);
}
int pn = pageNo;
if(lstSex==null){
// getSearchTabTtitle();
@ -145,7 +153,7 @@ public static final String TAG = Fragment_paihang.class.getSimpleName();
String sex = lstSex.get(tab1Pos);
String cate = lstNt.get(tab2Pos);
if(pageNo==1) {
noveIds = new ArrayList<Integer>();
if (mData != null) { //下拉刷新
mData = new ArrayList<Novel>();
mAdapter.setData(mData);
@ -194,7 +202,18 @@ public static final String TAG = Fragment_paihang.class.getSimpleName();
JSONObject jsonObject = new JSONObject(result);
setPageCount(jsonObject.getInt("pageCount"));
mMoreData = GsonUtil. parserJsonArray(jsonObject,Constants.BLOCK_TITLE_NOVELS);
List<Novel> list = GsonUtil. parserJsonArray(jsonObject,Constants.BLOCK_TITLE_NOVELS);
Log.d(TAG, "onSuccess: noveIds list size "+noveIds.size());
mMoreData =new ArrayList<Novel>();
for(Novel novel :list){
if(!noveIds.contains(novel.getNovelId())){
mMoreData.add(novel);
noveIds.add(novel.getNovelId());
}
}
Log.d(TAG, "onSuccess: mMoreData list size "+mMoreData.size());
if(mMoreData.size()>0){
loadListAd(mAdapter,1,mData.size()>0);
}
@ -335,7 +354,7 @@ public static 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<lstProgress.length) return;
if( tmp<=lstProgress.length) return;
loadSearchData();

View File

@ -300,14 +300,38 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
if (holder.tvLastRead != null) holder.tvLastRead.setText(CommonUtil.getDateString( novel.getLastVisit() ));
// if (holder.tvProgress != null) holder.tvProgress.setText( String.format("上次看到第 %s 章,共%s章",mDatas.get(position).getLastReadChapt(),mDatas.get(position).getChaptCnt()) );
if (holder.tvProgress != null) holder.tvProgress.setText( String.format("%s",novel.getLastReadChaptName()) );
if (holder.tvProgress != null) {
String lastReadChapt = novel.getLastReadChaptName();
if( TextUtils.isEmpty(lastReadChapt)){
holder.tvProgress.setVisibility(View.GONE);
}else{
holder.tvProgress.setVisibility(View.VISIBLE);
}
// lastReadChapt = TextUtils.isEmpty(lastReadChapt)? "":lastReadChapt;
// lastReadChapt =lastReadChapt.replace("null","");
holder.tvProgress.setText( lastReadChapt );
}
if (holder.tvReadtime != null) holder.tvReadtime.setText( "总计阅读了 "+CommonUtil.getTimeCnt4Read( novel.getReadtime() ,true) );
if (holder.tvStatus != null) holder.tvStatus.setText(novel.getProgress());
if (holder.imageView != null/* && !TextUtils.isEmpty(mDatas.get(position).getCover())*/) {
// ImageUtil.loadImage(mContext, mDatas.get(position).getCover(), holder.imageView);
loader.displayImage(mContext, NetUtil.getCoverUrl(novel.getCover()) ,holder.imageView);
if(!novel.isLocalBook()) {
loader.displayImage(mContext, NetUtil.getCoverUrl(novel.getCover()), holder.imageView);
}else{
holder.imageView.setImageResource(R.drawable.blankcover);
// loader.displayImage(mContext, R.drawable.blankcover, holder.imageView);
}
}
if (holder.tvImportTitle != null) {
holder.tvImportTitle.setVisibility(View.GONE);
holder.tvImportTitle.setText("");
if(novel.isLocalBook()) {
holder.tvImportTitle.setVisibility(View.VISIBLE);
holder.tvImportTitle.setText(novel.getName());
}
}
if (holder.imageTop != null) {
if( novel.isTop()){

View File

@ -58,7 +58,9 @@ public class MyViewHolder extends RecyclerView.ViewHolder {
@Nullable
@BindView(R.id.tvLastRead)
TextView tvLastRead;
@Nullable
@BindView(R.id.tvImportTitle)
TextView tvImportTitle;
public MyViewHolder(View view) {
super(view);

View File

@ -101,7 +101,7 @@ public class AdSetting {
public int getSource() {
return source;
// return 1 ;
// return Constants.AD_MOB ;
}
public void setSource(int source) {

View File

@ -46,7 +46,7 @@ public class Novel extends LitePalSupport implements Serializable{
private long readtime; //阅读时间
private int chaptCnt; //总章数
private long lastVisit;//最近浏览,如何设置默认时间
private String lastReadChaptName;
private String lastReadChaptName="";
public int getChaptCnt() {
return chaptCnt;
}
@ -112,8 +112,7 @@ public class Novel extends LitePalSupport implements Serializable{
}
public String getChapterName() {
return chapterName;
return filterBlankHtml(chapterName);
}
public void setChapterName(String chapterName) {
@ -364,9 +363,9 @@ public void testUpdate(){
) );
boolean isLastChaptNotRead = TextUtils.isEmpty(nv.lastReadChaptName) || !( !TextUtils.isEmpty(chapterName) && (chapterName.trim()).equals(nv.lastReadChaptName.trim())); //没看过最新章节
boolean isLastChaptUpdated = !TextUtils.isEmpty(chapterName) && !TextUtils.isEmpty(nv.chapterName) && !(chapterName.trim().equals(nv.chapterName.trim()));
Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername '%s',chaptername %s,lastreadchapt '%s'" , chapterName,nv.chapterName,nv.lastReadChaptName ) );
boolean isLastChaptNotRead = TextUtils.isEmpty(nv.lastReadChaptName) || !( !TextUtils.isEmpty(getChapterName()) && (getChapterName().trim()).equals(nv.lastReadChaptName.trim())); //没看过最新章节
boolean isLastChaptUpdated = !TextUtils.isEmpty(getChapterName()) && !TextUtils.isEmpty(nv.getChapterName()) && !(getChapterName().trim().equals(nv.getChapterName().trim()));
Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername '%s',chaptername %s,lastreadchapt '%s'" , getChapterName(),nv.getChapterName(),nv.lastReadChaptName ) );
/*
isUpdated = isUpdated && isLastReadchaptUpdated || isLastChaptUpdated ;
@ -375,6 +374,9 @@ public void testUpdate(){
Log.d("Novel", String.format( " is updated %s, server lastUpdateTime isLastChaptNotRead %s,isLastChaptUpdated %s" ,isUpdated,isLastChaptNotRead,isLastChaptUpdated ) );
// Log.d("Novel", String.format( " server lastUpdateTime ,server chaptername '%s',chaptername '%s',lastreadchapt '%s'" , chapterName,nv.chapterName,nv.lastReadChaptName ) );
if(isUpdated && !isLastChaptUpdated){
Log.e("Novel", "......................................checkAndUpdate:server lastUpdateTime last time updated but last chapter not.............................................. ");
}
isUpdated = isUpdated && isLastChaptUpdated || lastUpdateTime > nv.lastVisit;
@ -399,10 +401,18 @@ public void testUpdate(){
}
public String getLastReadChaptName() {
return lastReadChaptName;
return filterBlankHtml(lastReadChaptName);
}
public void setLastReadChaptName(String lastReadChaptName) {
this.lastReadChaptName = lastReadChaptName;
}
private String filterBlankHtml(String targets){
String blank ="&nbsp;";
if(!TextUtils.isEmpty(targets) && targets.contains(blank)){
return targets.substring(targets.indexOf(blank)+blank.length());
}
return targets;
}
}

View File

@ -91,7 +91,7 @@ public interface HttpApi {
Observable<ResponseBody> getNovelsByIds(@Path("nvs")String nvs );
//返回指定id列表的小说列表
@GET("page/hot-keywords")
Observable<ResponseBody> getSearchHotKeys();
Observable<ResponseBody> getSearchHotKeys(@Query("sex") int Sex);
@GET("download/version.xml")
Observable<ResponseBody> getVersion();

View File

@ -85,8 +85,8 @@ public class BookSubscribe {
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/topdata").getHttpApi().getSearchTitles(sex);
HttpMethods.getInstance().toSubscribe(observable, subscriber);
}
public static void getHotKeyWords(DisposableObserver<ResponseBody> subscriber){
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/hot-keywords").getHttpApi().getSearchHotKeys();
public static void getHotKeyWords(int sex,DisposableObserver<ResponseBody> subscriber){
Observable<ResponseBody> observable = HttpMethods.getInstance("/api/page/hot-keywords").getHttpApi().getSearchHotKeys(sex);
HttpMethods.getInstance().toSubscribe(observable, subscriber);
}
public static void getNovelsByIds(String ids,DisposableObserver<ResponseBody> subscriber){

View File

@ -108,7 +108,7 @@ public class BookUtil {
private final int MSG_READCHAPTER_FAIL=2;
private final int MSG_READCHAPTER_SUCCESS=3;
private static final int MSG_READBOOK_FAIL = 4;
private static final int MSG_READBOOK_EMPTY_CONTENT = 5;
private String m_strCharsetName;
private String bookName;
@ -130,6 +130,7 @@ public class BookUtil {
}catch (Exception e){
Log.e(TAG, "prepare book: clearbook called", e);
}*/
chaptId=0;
charPosition.clear();
this.muluRetryCount=0;
this.downloadStatus = DownloadStatus.notStart;
@ -459,12 +460,18 @@ public class BookUtil {
}
void reportMsg(String reportType,String url,String content,String headers,String httpStatus){
String msg = String.format("{\"type\":%s, \"id\":%s ,\"name\":\"%s\",\"site\":\"%s\",\"url\":\"%s\",\"content\":\"%s\",\"requestHeader\":\"%s\",\"httpStatus\":\"%s\"}," ,
/* String msg = String.format("{\"type\":%s, \"id\":%s ,\"name\":\"%s\",\"site\":\"%s\",\"url\":\"%s\",\"content\":\"%s\",\"requestHeader\":\"%s\",\"httpStatus\":\"%s\"}," ,
reportType ,mNovel.getId(),mNovel.getName(),mSite.getDomain(),url ,content,headers,httpStatus);
msg = String.format("{\"type\":\"%s\", \"novelId\":%s ,\"site\":\"%s\",\"url\":\"%s\",\"httpStatus\":\"%s\",\"content\":\"%s\"}" ,
*/
String key =mNovel.getNovelId()+url;
if(Constants.REPORT_HIS.contains(key)){
return;
}
Constants.REPORT_HIS.add(key);
String msg = String.format("{\"type\":\"%s\", \"novelId\":%s ,\"site\":\"%s\",\"url\":\"%s\",\"httpStatus\":\"%s\",\"content\":\"%s\"}" ,
reportType ,mNovel.getNovelId(),mSite.getDomain(),url ,httpStatus,content);
BookSubscribe.reportMsg(reportType ,msg);
@ -494,6 +501,14 @@ public class BookUtil {
}
public void setChapterNo(int chapterNo) {
try{
throw new Exception();
}catch (Exception e){
Log.e(TAG, "prepare book setChapterNo: who set chaptno "+ chapterNo,e );
}
this.chapterNo = chapterNo;
/*
if(chapterNo <= mChapters.size()) {
@ -507,7 +522,7 @@ public class BookUtil {
public int getChapterNo() {
if(chapterNo > mChapters.size()){
// Log.d(TAG, String.format(" prepare book getChapterNo ,chapterNo %s, getChapters().size() %s ,mChangeChapId %s" ,chapterNo , mChapters.size(),mChangeChapId) );
Log.d(TAG, String.format(" prepare book getChapterNo ,chapterNo %s, getChapters().size() %s ,mChangeChapId %s" ,chapterNo , mChapters.size(),mChangeChapId) );
if(mChangeChapId>0){
return mChangeChapId;
}
@ -515,7 +530,7 @@ public class BookUtil {
}
chapterNo = chapterNo<=0 ?1 :chapterNo;
// Log.d(TAG, String.format(" prepare book getChapterNo ,chapterNo %s, getChapters().size() %s " ,chapterNo , mChapters.size()) );
Log.d(TAG, String.format(" prepare book getChapterNo ,chapterNo %s, getChapters().size() %s " ,chapterNo , mChapters.size()) );
return chapterNo;
}
@ -1408,6 +1423,7 @@ int muluRetryCount =0;
return cachedPath + mNovel.getName() + index ;
}
public String fileChapterName(int chaptId ) {
checkAndCreateDir(chapterPath);
if(mNovel!=null && !TextUtils.isEmpty(mNovel.getDomain())){
return getChapterPath() +mNovel.getDomain()+"/"+ chaptId ;
@ -1537,6 +1553,10 @@ int muluRetryCount =0;
if(pagefactory!=null)
pagefactory.drawStatus(PageFactory.Status.FAIL);
}
else if(msg.what==MSG_READBOOK_EMPTY_CONTENT ) { //change source
if(pagefactory!=null)
pagefactory.drawStatus(PageFactory.Status.CONTENTPARESERROR);
}
}
@ -1545,7 +1565,8 @@ int muluRetryCount =0;
notStart,
downloading,
failure,
success
success,
emptyContent
}
public boolean isChapterContentExist(int index) {
@ -1637,7 +1658,7 @@ int muluRetryCount =0;
Log.d(TAG, String.format("prepare book chaptDownStatus.containsKey %s ? %s", Integer.valueOf(index),chaptDownStatus.containsKey(Integer.valueOf(index))));
if (!chaptDownStatus.containsKey(Integer.valueOf(index))) {
if (!chaptDownStatus.containsKey(Integer.valueOf(index)) || !file.exists() &&chaptDownStatus.get(Integer.valueOf(index))== DownloadStatus.success ) {
chaptDownStatus.put(index, DownloadStatus.downloading);
Log.d(TAG, String.format("prepare book put chaptDownStatus index %s,start to load chapcontent", index));
loadChaptContent(index);
@ -1659,8 +1680,8 @@ int muluRetryCount =0;
Log.d(TAG, String.format(" prepare book loadChaptContent slept %s for downloading,isDownload %s thread %s ", slepttime, getDownloadStatus(), Thread.currentThread().getName()));
}*/
while (!file.exists() && NetUtil.isNetworkConnected() && chaptDownStatus.get(Integer.valueOf(index)) == DownloadStatus.downloading && slepttime < maxSleep ) {
Thread.sleep(500);
slepttime += 500;
Thread.sleep(200);
slepttime += 200;
Log.d(TAG, String.format(" prepare book loadChaptContent %s , slept %s for downloading, thread %s ",index, slepttime, Thread.currentThread().getName()));
}
Log.d(TAG, String.format("prepare book loadChaptContent slept %s for downloading ", slepttime));
@ -1933,7 +1954,7 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
public void onFailure(Call call, IOException e) {
if(e!=null &&
(e.toString().contains("closed")
||e.getMessage().contains("Canceled")))
||e.getMessage()!=null && e.getMessage().contains("Canceled")))
{
Log.d(TAG, "onFailure: prepare book cancled request ,return, " + request.url());
return;
@ -2005,6 +2026,7 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
String chapterContent = title+ "\n" + bodyStr;
char[] buf = chapterContent.toCharArray();
File file = new File(fileChapterName(index));
Log.d( TAG,"prepare book to create file " +fileChapterName(index));
file.createNewFile();
final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(fileChapterName(index)), charachterType);//"UTF-16LE"); // UTF-16LE utf-8 文件小

View File

@ -5,6 +5,7 @@ import com.novelbook.android.R;
import com.novelbook.android.bean.AdSetting;
import com.novelbook.android.bean.ProgressType;
import java.util.ArrayList;
import java.util.List;
public class Constants {
@ -81,6 +82,7 @@ public class Constants {
public static final String REPORT_REX_CHAPTER_CONTENT_ERROR ="EmptyText";//章节内容解析错误
public static final String REPORT_REX_MULU_ERROR ="NovelNotFound";//目录获取错误 或书不存在
public static List<String> REPORT_HIS = new ArrayList<String>();

View File

@ -148,7 +148,10 @@ public class GsonUtil {
while (it.hasNext()) {
JsonElement e = (JsonElement) it.next();
//JsonElement转换为JavaBean对象
list.add((NovelBlock) gson.fromJson(e, NovelBlock.class));
NovelBlock nb = (NovelBlock) gson.fromJson(e, NovelBlock.class);
if(nb.getNs().size()>0) {
list.add(nb);
}
}
return list;
}
@ -184,10 +187,17 @@ public class GsonUtil {
//遍历JsonArray对象
Iterator it = jsonArray.iterator();
// int lastNoveId =0;
List<Integer> ids = new ArrayList<Integer>();
while (it.hasNext()) {
JsonElement e = (JsonElement) it.next();
//JsonElement转换为JavaBean对象
Novel nv = (Novel) gson.fromJson(e, Novel.class);
if(ids.contains(nv.getNovelId())){
continue;
}
ids.add(nv.getNovelId());
// lastNoveId =nv.getNovelId();
if(nv!=null) {
list.add((Novel) gson.fromJson(e, Novel.class));
}

View File

@ -712,7 +712,8 @@ public class PageFactory implements ChangeSource{
SERVERERROR,
CHANGESOURCE ,
LOCALFAIL,
LASTPAGE;
LASTPAGE,
CONTENTPARESERROR;
}
private void hideSysUI(){
if(mAd!=null){
@ -870,17 +871,23 @@ private void hideSysUI(){
//handler.sendEmptyMessage(MSG_SHOW_LOADING);
// showProgressDialog();
break;
case CONTENTPARESERROR:
status = "内容解析错误,请稍后再试";
mAd.showRefresh(View.VISIBLE);
mAd.showReadSetting();
mAd.showLoading(false);
break;
case FAIL:
status = "读取错误,请稍后重试";
mAd.showRefresh(View.VISIBLE);
mAd.showReadSetting();
mAd.showLoading(false);
try {
/* try {
throw new Exception("error on reading");
} catch (Exception e) {
e.printStackTrace();
Log.d(TAG, "prepare book: why fail ",e);
}
}*/
break;
case NETWORKFAILE:
mAd.showLoading(false);
@ -1023,6 +1030,10 @@ private void hideSysUI(){
if(m_lines.size()==0 ){
return;
}
if(trPage.getChapterNo() >0 && trPage.getChapterNo() !=mBookUtil.getChapterNo()){
mBookUtil.setChapterNo(trPage.getChapterNo());
}
/* try {
throw new Exception("who's ad");
}catch (Exception e){
@ -1410,8 +1421,11 @@ private void hideSysUI(){
if(mBookUtil.isBusy()){
return;
}
// Log.d(TAG, "prepare book nextPage:chaptid " +mBookUtil.getChapterNo());
if(currentPage.getChapterNo()>0 && currentPage.getChapterNo() != currentChapter) {
currentChapter = currentPage.getChapterNo();
Log.d(TAG, "getNextPage: prepare book correct current chapterno to " +currentChapter);
}
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));
@ -1425,7 +1439,7 @@ private void hideSysUI(){
@Override
public void run() {
int slepttime = 0; mBookUtil.muluRetryCount=0;
while (slepttime<200 && mBookUtil.getChapters().size()==0 && (mBookUtil.mMuluStatus == BookUtil.MuluStatus.isDownloading || mBookUtil.muluRetryCount < Constants.retryCnt)) {
while (slepttime<300 && mBookUtil.getChapters().size()==0 && (mBookUtil.mMuluStatus == BookUtil.MuluStatus.isDownloading || mBookUtil.muluRetryCount < Constants.retryCnt)) {
try {
sleep(50);
slepttime++;
@ -1445,8 +1459,11 @@ private void hideSysUI(){
currentChapter=mBookUtil.getChapterNo();
handler.sendEmptyMessage(MSG_NEXTPAGE) ;
}else if(mBookUtil.mMuluStatus == BookUtil.MuluStatus.failed || mStatus !=Status.OPENING){
mBookUtil.setChapterNo(mBookUtil.getChapterNo()-1);
currentChapter=mBookUtil.getChapterNo();
handler.sendEmptyMessage(MSG_NEXTPAGE_FAIL) ;
}
mLoadingChaptNo=currentChapter;
}}.start();
@ -1664,8 +1681,12 @@ 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 ,currentpage chaptNo %s"
,currentChapter, getChapters().size(), currentChaptPages.size() , nextPageNo,currentPage.getChapterNo()));
if(currentPage.getChapterNo()>0 && currentPage.getChapterNo() < currentChapter) {
currentChapter = currentPage.getChapterNo();
Log.d(TAG, "getNextPage: prepare book correct current chapterno to " +currentChapter);
}
if(nextPageNo==0){
drawStatus();
}
@ -1691,8 +1712,9 @@ 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("prepare book currentPageno %s,total pagno %s",currentPage.getPageNo(),currentChaptPages.size()));
Log.e(TAG,String.format("prepare book getPrePage() currentChapter %s, chapters().size() %s,currentChaptPages .size() is %s,currentpage pageno is %s"
,currentChapter, getChapters().size(), currentChaptPages.size() , prePageNo));
if(prePageNo <=0){
nextChaptPages =currentChaptPages;

View File

@ -1,17 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:clipToPadding="true"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
style="@style/barLayout"
>
</android.support.design.widget.AppBarLayout>
<com.czp.searchmlist.mSearchLayout
android:layout_marginTop="35dp"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/msearchlayout"
@ -28,5 +36,4 @@
android:id="@+id/banner_container"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -96,7 +96,7 @@
android:layout_height="wrap_content"
android:lines="1"
android:text="上次读到"
android:paddingEnd="10dp"
android:paddingEnd="15dp"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="right"
@ -109,6 +109,15 @@
android:paddingLeft="5dp"
>
<TextView
android:id="@+id/txtLastDomain"
style="@style/TextViewDesc.small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:text=""
/>
<TextView
android:id="@+id/txtLatestReadChapter"
@ -144,7 +153,11 @@
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="6dp"
app:cardElevation="2dp">
<!-- <FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>-->
<ImageView
android:id="@+id/imageG1"
android:layout_width="match_parent"
@ -153,6 +166,17 @@
android:src="@drawable/googleg_standard_color_18"
tools:ignore="ContentDescription" />
<!-- <TextView
android:id="@+id/tvImportTitle"
style="@style/TextViewNovelTitle"
android:layout_gravity="center"
android:layout_width="75dp"
android:gravity="center"
android:text=""
android:layout_weight="1"
android:visibility="gone"
/>-->
<!--</FrameLayout>-->
</android.support.v7.widget.CardView>
</RelativeLayout>

View File

@ -2,19 +2,19 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:padding="0dp"
android:background="@color/white"
android:orientation="vertical">
<Button
android:id="@+id/btnZhengli"
style="@style/buttonCates"
style="@style/buttonCates.bold"
android:text="整理书架"
/>
<LinearLayout style="@style/llGraySplit.2dp"/>
<Button
android:id="@+id/btnImport"
style="@style/buttonCates"
style="@style/buttonCates.bold"
android:text="本地导入"
/>
@ -57,7 +57,7 @@
android:padding="@dimen/_10dp"
>
<TextView
style="@style/buttonCates"
style="@style/buttonCates.bold"
android:layout_marginBottom="5dp"
android:text="@string/title_shelforder"

View File

@ -7,24 +7,26 @@
android:background="@drawable/item_selector"
android:clickable="true"
android:layout_weight="1"
android:layout_margin="0dp"
android:layout_marginTop="3dp"
android:padding="2dp">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/imageView"
style="@style/NovelImage"
android:src="@drawable/googleg_standard_color_18" />
android:src="@drawable/blankcover" />
<ImageView
android:id="@+id/imageUpdated"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_gravity="end"
android:layout_marginTop="2dp"
android:layout_marginRight="6dp"
android:layout_marginRight="0dp"
android:visibility="gone"
android:src="@drawable/ic_book_update_flag" />
<ImageView
@ -45,6 +47,17 @@
android:layout_marginTop="5dp"
android:visibility="gone"
android:text=""/>
<TextView
android:id="@+id/tvImportTitle"
style="@style/TextViewNovelTitle"
android:layout_gravity="center"
android:layout_width="75dp"
android:gravity="center"
android:text=""
android:layout_weight="1"
android:visibility="gone"
/>
</FrameLayout>
<LinearLayout
android:layout_width="90dp"

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="0dp"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:background="@drawable/item_selector"
android:clickable="true"
@ -30,8 +30,9 @@
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="天龙八部天龙八部天龙八部"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:paddingRight="4dp"
android:paddingLeft="4dp"
/>

View File

@ -121,7 +121,10 @@
<item name="android:paddingTop">2dp</item>
</style>
<style name="buttonCates.bold" >
<item name="android:textStyle">bold</item>
</style>
<style name="buttonCates.big">
<item name="android:layout_height">match_parent</item>
</style>
@ -168,16 +171,16 @@
</style>
<style name="NovelImage">
<item name="android:layout_width">80dp</item>
<item name="android:layout_height">100dp</item>
<item name="android:layout_height">115dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:scaleType">fitStart</item>
<item name="android:scaleType">matrix</item>
<item name="android:paddingTop">2dp</item>
</style>
<style name="NovelImage.grid">
<item name="android:layout_width">100dp</item>
<item name="android:layout_height">120dp</item>
<item name="android:layout_width">90dp</item>
<item name="android:layout_height">129dp</item>
</style>
<style name="NovelImage.horizon">

View File

@ -106,6 +106,7 @@
<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/manifest-checker" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged-not-compiled-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/merged_assets" />
@ -125,6 +126,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/signing_config" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/split-apk" />
<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" />