add top to shelf

This commit is contained in:
mwang 2019-05-04 23:17:28 +08:00
parent ef85074f05
commit 664ff9b491
24 changed files with 475 additions and 162 deletions

View File

@ -178,9 +178,13 @@ public class Activity_ChgSource extends Activity_base {
if(TextUtils.isEmpty(title)) { if(TextUtils.isEmpty(title)) {
title = mDatas.get(position).getDomain(); title = mDatas.get(position).getDomain();
} }
// title += mDatas.get(position).getDomain();
Log.d(TAG, String.format("onBindViewHolder: domain is '%s', title is '%s'",domain ,title)); Log.d(TAG, String.format("onBindViewHolder: domain is '%s', title is '%s'",domain ,title));
if(mDatas.get(position).getDomain().equals(domain)){ if(mDatas.get(position).getDomain().equals(domain)){
title +=" (当前源)"; // title +=" (当前源)";
holder.tvTitle.setTextColor(getResources().getColor( R.color.colorPrimaryDark));
}else{
holder.tvTitle.setTextColor(getResources().getColor( R.color.blacktitle));
} }
holder.tvTitle.setText(title); //.getName() holder.tvTitle.setText(title); //.getName()

View File

@ -280,7 +280,7 @@ public class BookActivity extends Activity_base {
.load( Uri.decode(NetUtil.getCoverUrl(mNovel.getCover()))) .load( Uri.decode(NetUtil.getCoverUrl(mNovel.getCover())))
.dontAnimate() .dontAnimate()
// .error(R.mipmap.side_bg2) // .error(R.mipmap.side_bg2)
.transform(new GaoSiTransForm(this, 100, 3)) // "14":模糊度"3":图片缩放3倍后再进行模糊 .transform(new GaoSiTransForm(this, 150, 5)) // "14":模糊度"3":图片缩放3倍后再进行模糊
.into(imageViewHead); .into(imageViewHead);
@ -291,7 +291,7 @@ public class BookActivity extends Activity_base {
} }
void setShelfButtonText() { void setShelfButtonText() {
String title = mNovel.isOnShelf() ? "书架" : "加入书架"; String title = mNovel.isOnShelf() ? "书架" : "加入书架";
btnShelf.setText(title); btnShelf.setText(title);
} }

View File

@ -22,6 +22,7 @@ import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.novelbook.android.Main2Activity; import com.novelbook.android.Main2Activity;
import com.novelbook.android.R; import com.novelbook.android.R;
@ -33,7 +34,9 @@ import com.novelbook.android.netutils.HttpMethods;
import com.novelbook.android.netutils.NetUtil; import com.novelbook.android.netutils.NetUtil;
import com.novelbook.android.netutils.OnSuccessAndFaultListener; import com.novelbook.android.netutils.OnSuccessAndFaultListener;
import com.novelbook.android.netutils.OnSuccessAndFaultSub; import com.novelbook.android.netutils.OnSuccessAndFaultSub;
import com.novelbook.android.utils.CommonUtil;
import com.novelbook.android.utils.Constants; import com.novelbook.android.utils.Constants;
import com.novelbook.android.utils.FileUtils;
import com.novelbook.android.utils.GsonUtil; import com.novelbook.android.utils.GsonUtil;
import com.novelbook.android.utils.ImageUtil; import com.novelbook.android.utils.ImageUtil;
import com.novelbook.android.utils.MyImageLoader; import com.novelbook.android.utils.MyImageLoader;
@ -338,6 +341,10 @@ void test(int maxAge){
tvTitle.setText(bookLists.get(position).getName()); tvTitle.setText(bookLists.get(position).getName());
TextView tvAuthor =(TextView) bottomSheetDialog.findViewById(R.id.tvAuthor); TextView tvAuthor =(TextView) bottomSheetDialog.findViewById(R.id.tvAuthor);
tvAuthor.setText(bookLists.get(position).getAuthor()); tvAuthor.setText(bookLists.get(position).getAuthor());
TextView tvLatest =(TextView) bottomSheetDialog.findViewById(R.id.txtLatestUpdate);
TextView tvLatestChapt =(TextView) bottomSheetDialog.findViewById(R.id.txtLatestCate);
tvLatestChapt.setText(bookLists.get(position).getChapterName());
tvLatest.setText(CommonUtil.getDateString( bookLists.get(position).getLastUpdateTime()) );
ImageView imageView = (ImageView) bottomSheetDialog.findViewById(R.id.imageG1); ImageView imageView = (ImageView) bottomSheetDialog.findViewById(R.id.imageG1);
ImageUtil.loadImage(activity,bookLists.get(position).getCover(),imageView); ImageUtil.loadImage(activity,bookLists.get(position).getCover(),imageView);
@ -348,6 +355,58 @@ void test(int maxAge){
showBookDetail(bookLists.get(position)); showBookDetail(bookLists.get(position));
} }
}); });
TextView tvCache =(TextView) bottomSheetDialog.findViewById(R.id.tvCache);
long size = FileUtils.getCacheSize(bookLists.get(position).getId());
size = size/1024;
tvCache.setText(String.format("%sK",size));
LinearLayout llClearCache =(LinearLayout) bottomSheetDialog.findViewById(R.id.llClearCache);
llClearCache.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
FileUtils.clearChapterCache(bookLists.get(position).getId());
long size = FileUtils.getCacheSize(bookLists.get(position).getId());
size = size/1024;
tvCache.setText(String.format("%sK",size));
Toast.makeText(activity,"缓存清除成功",Toast.LENGTH_SHORT);
}
});
LinearLayout lltop =(LinearLayout) bottomSheetDialog.findViewById(R.id.llTop);
TextView tvTop =(TextView) bottomSheetDialog.findViewById(R.id.tvTop);
ImageView imgTop =(ImageView) bottomSheetDialog.findViewById(R.id.imageTop);
if( bookLists.get(position).isTop()){
tvTop.setText("取消置顶");
imgTop.setImageResource(R.mipmap.star_inactive);
}else{
tvTop.setText("置顶显示");
imgTop.setImageResource(R.mipmap.star_active);
}
lltop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if( bookLists.get(position).isTop()){
bookLists.get(position).setToDefault("isTop");
tvTop.setText("置顶显示");
imgTop.setImageResource(R.mipmap.star_active);
}else{
bookLists.get(position).setTop(true);
tvTop.setText("取消置顶");
imgTop.setImageResource(R.mipmap.star_inactive);
}
bookLists.get(position).update( bookLists.get(position).getId());
loadNovelsOnShelf();
mAdapter.setData(bookLists);
Toast.makeText(activity,"缓存清除成功",Toast.LENGTH_SHORT);
}
});
@ -533,7 +592,11 @@ void test(int maxAge){
if(holder.checkBox!=null) holder.checkBox.setVisibility(View.VISIBLE); if(holder.checkBox!=null) holder.checkBox.setVisibility(View.VISIBLE);
if (holder.imageView != null && !TextUtils.isEmpty(mDatas.get(position).getCover())) { if (holder.imageView != null && !TextUtils.isEmpty(mDatas.get(position).getCover())) {
loader.displayImage(context, NetUtil.getCoverUrl(mDatas.get(position).getCover()) ,holder.imageView); loader.displayImage(context, NetUtil.getCoverUrl(mDatas.get(position).getCover()) ,holder.imageView);
}
if( mDatas.get(position).isTop()){
holder.imageTop.setVisibility(View.VISIBLE);
}else{
holder.imageTop.setVisibility(View.GONE);
} }
// 如果设置了回调则设置点击事件 // 如果设置了回调则设置点击事件
if (mOnItemClickListener != null) if (mOnItemClickListener != null)
@ -592,6 +655,9 @@ void test(int maxAge){
CheckBox checkBox; CheckBox checkBox;
@BindView(R.id.imageView) @BindView(R.id.imageView)
ImageView imageView; ImageView imageView;
@BindView(R.id.imageTop)
ImageView imageTop;
@BindView(R.id.title) @BindView(R.id.title)
TextView tvTitle; TextView tvTitle;
@Nullable @Nullable

View File

@ -70,7 +70,7 @@ public class Fragment_bookStore extends BasicFragment {
@Override @Override
public void initData() { public void initData() {
mTitle = new String[]{"精选", "榜单","分类"}; mTitle = new String[]{"精选","分类", "榜单"};
} }
public void onSexSwitch(){ public void onSexSwitch(){
@ -96,8 +96,8 @@ public class Fragment_bookStore extends BasicFragment {
// mTitle = new String[]{"精选", "榜单", "书单"}; // mTitle = new String[]{"精选", "榜单", "书单"};
mFragments = new ArrayList<>(); mFragments = new ArrayList<>();
mFragments.add(new Fragment_jingxuan()); mFragments.add(new Fragment_jingxuan());
mFragments.add(new Fragment_bangdan());
mFragments.add(FragmentCates.newInstance()); mFragments.add(FragmentCates.newInstance());
mFragments.add(new Fragment_bangdan());
// mFragments.add(new Fragment_shudan()); // mFragments.add(new Fragment_shudan());
Log.d(TAG,"initial fragments in tabs "); Log.d(TAG,"initial fragments in tabs ");

View File

@ -123,6 +123,7 @@ public class Fragment_booklist extends BasicFragment {
if(!TextUtils.isEmpty(history)){ if(!TextUtils.isEmpty(history)){
listItem = listItem =R.layout.recycle_list_item_history; listItem = listItem =R.layout.recycle_list_item_history;
} }
} }
} }
@ -231,6 +232,7 @@ public class Fragment_booklist extends BasicFragment {
if(!TextUtils.isEmpty(bangdan) && !TextUtils.isEmpty(fn)){ //榜单 if(!TextUtils.isEmpty(bangdan) && !TextUtils.isEmpty(fn)){ //榜单
// showProgressDialog(true, "正在加载榜单"); // showProgressDialog(true, "正在加载榜单");
mAdapter.setShowTop(true);
BookSubscribe.getSiteRankDetail(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() { BookSubscribe.getSiteRankDetail(fn,pageNo,Constants.SEX,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
@Override @Override
public void onSuccess(String result) { public void onSuccess(String result) {
@ -260,16 +262,19 @@ public class Fragment_booklist extends BasicFragment {
}else if(!TextUtils.isEmpty(fn)){ //首页 更多 }else if(!TextUtils.isEmpty(fn)){ //首页 更多
mAdapter.setShowTop(true);
// showProgressDialog(true, "正在加载更多"); // showProgressDialog(true, "正在加载更多");
BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity())); BookSubscribe.getNovelPaihang(fn,Constants.SEX,new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
} }
else if(!TextUtils.isEmpty((cate))) { //分类 else if(!TextUtils.isEmpty((cate))) { //分类
mAdapter.setShowTop(true);
// showProgressDialog(true, "正在加载分类"); // showProgressDialog(true, "正在加载分类");
BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, progress, new OnSuccessAndFaultSub(successAndFaultListener, getActivity())); BookSubscribe.getCateNovelList(cate, pageNo, Constants.SEX, progress, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
}else if(!TextUtils.isEmpty(keyWord)){ //搜索 }else if(!TextUtils.isEmpty(keyWord)){ //搜索
// showProgressDialog(true, "正在加载搜索"); // showProgressDialog(true, "正在加载搜索");
mAdapter.setShowTop(true);
BookSubscribe.getSearchNovelList( keyWord,pageNo, Constants.SEX, new OnSuccessAndFaultSub(successAndFaultListener, getActivity())); BookSubscribe.getSearchNovelList( keyWord,pageNo, Constants.SEX, new OnSuccessAndFaultSub(successAndFaultListener, getActivity()));
}else if(!TextUtils.isEmpty(history)){ }else if(!TextUtils.isEmpty(history)){
loadHistory(); loadHistory();
@ -350,7 +355,7 @@ public class Fragment_booklist extends BasicFragment {
@Override @Override
public void onResume(){ public void onResume(){
super.onResume(); super.onResume();
pageNo=1; // pageNo=1;
if(!TextUtils.isEmpty(history)){ if(!TextUtils.isEmpty(history)){
if(isFirstLoad) { if(isFirstLoad) {

View File

@ -175,6 +175,7 @@ final String TAG = Fragment_paihang.class.getSimpleName();
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
} }
}); });
mAdapter.setShowTop(true);
mAdapter.setShowFootView(true); mAdapter.setShowFootView(true);
rvPaihang.setLayoutManager(new LinearLayoutManager(activity)); rvPaihang.setLayoutManager(new LinearLayoutManager(activity));
rvPaihang.setAdapter(mAdapter); rvPaihang.setAdapter(mAdapter);

View File

@ -132,6 +132,8 @@ public class ReadActivity extends Activity_base implements SpeechSynthesizerLis
if (intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED)) { if (intent.getAction().equals(Intent.ACTION_BATTERY_CHANGED)) {
Log.e(TAG,Intent.ACTION_BATTERY_CHANGED); Log.e(TAG,Intent.ACTION_BATTERY_CHANGED);
int level = intent.getIntExtra("level", 0); int level = intent.getIntExtra("level", 0);
Log.d(TAG, String.format("updateBattery onReceive: Intent.ACTION_BATTERY_CHANGED level %s ",level));
pageFactory.updateBattery(level); pageFactory.updateBattery(level);
}else if (intent.getAction().equals(Intent.ACTION_TIME_TICK)){ }else if (intent.getAction().equals(Intent.ACTION_TIME_TICK)){
Log.e(TAG,Intent.ACTION_TIME_TICK); Log.e(TAG,Intent.ACTION_TIME_TICK);

View File

@ -58,6 +58,17 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
private float percent =0; private float percent =0;
private int norecord =R.string.noRecord; private int norecord =R.string.noRecord;
private boolean isShowTop=false;
public boolean isShowTop() {
return isShowTop;
}
public void setShowTop(boolean showTop) {
isShowTop = showTop;
}
public void setNorecord(int norecord) { public void setNorecord(int norecord) {
this.norecord = norecord; this.norecord = norecord;
} }
@ -67,6 +78,7 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
} }
public void setShowFootView(boolean showFootView) { public void setShowFootView(boolean showFootView) {
this.showFootView = showFootView; this.showFootView = showFootView;
} }
@ -211,6 +223,38 @@ public class BookListAdapter extends RecyclerView.Adapter< RecyclerView.ViewHol
if (holder.imageView != null && !TextUtils.isEmpty(mDatas.get(position).getCover())) { if (holder.imageView != null && !TextUtils.isEmpty(mDatas.get(position).getCover())) {
ImageUtil.loadImage(context, mDatas.get(position).getCover(), holder.imageView); ImageUtil.loadImage(context, mDatas.get(position).getCover(), holder.imageView);
} }
if (holder.imageTop != null) {
if( mDatas.get(position).isTop()){
holder.imageTop.setVisibility(View.VISIBLE);
}else{
holder.imageTop.setVisibility(View.GONE);
}
}
if(isShowTop) {
if (holder.imageTop1 != null) {
if (position == 0) {
holder.imageTop1.setVisibility(View.VISIBLE);
} else {
holder.imageTop1.setVisibility(View.GONE);
}
}
if (holder.imageTop2 != null) {
if (position == 1) {
holder.imageTop2.setVisibility(View.VISIBLE);
} else {
holder.imageTop2.setVisibility(View.GONE);
}
}
if (holder.imageTop3 != null) {
if (position == 2) {
holder.imageTop3.setVisibility(View.VISIBLE);
} else {
holder.imageTop3.setVisibility(View.GONE);
}
}
}
if (holder.imageUpdate != null) { if (holder.imageUpdate != null) {
if( mDatas.get(position).isUpdated()){ if( mDatas.get(position).isUpdated()){
holder.imageUpdate.setVisibility(View.VISIBLE); holder.imageUpdate.setVisibility(View.VISIBLE);

View File

@ -17,6 +17,21 @@ public class MyViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.imageUpdated) @BindView(R.id.imageUpdated)
@Nullable @Nullable
ImageView imageUpdate; ImageView imageUpdate;
@BindView(R.id.imageTop)
@Nullable
ImageView imageTop;
@BindView(R.id.imageTop1)
@Nullable
ImageView imageTop1;
@BindView(R.id.imageTop2)
@Nullable
ImageView imageTop2;
@BindView(R.id.imageTop3)
@Nullable
ImageView imageTop3;
@BindView(R.id.title) @BindView(R.id.title)
TextView tvTitle; TextView tvTitle;
@Nullable @Nullable

View File

@ -15,9 +15,18 @@ import com.novelbook.android.utils.FileUtils;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.observers.DisposableObserver; import io.reactivex.observers.DisposableObserver;
@ -197,6 +206,34 @@ public class HttpMethods {
okHttpBuilder.writeTimeout(DEFAULT_READ_TIMEOUT, TimeUnit.SECONDS); okHttpBuilder.writeTimeout(DEFAULT_READ_TIMEOUT, TimeUnit.SECONDS);
//错误重连 //错误重连
okHttpBuilder.retryOnConnectionFailure(true); okHttpBuilder.retryOnConnectionFailure(true);
// Install the all-trusting trust manager
final SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts,
new java.security.SecureRandom());
// Create an ssl socket factory with our all-trusting manager
final javax.net.ssl.SSLSocketFactory sslSocketFactory = sslContext
.getSocketFactory();
// okHttpBuilder.sslSocketFactory(sslSocketFactory);
/* okHttpBuilder.hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
// TODO Auto-generated method stub
return true;
}
});*/
} catch (NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace();
}
return okHttpBuilder.build(); return okHttpBuilder.build();
} }
@ -271,6 +308,25 @@ public class HttpMethods {
return userAgent; return userAgent;
} }
final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
@Override
public void checkClientTrusted(
java.security.cert.X509Certificate[] chain,
String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(
java.security.cert.X509Certificate[] chain,
String authType) throws CertificateException {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
}};
} }

View File

@ -41,12 +41,21 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.Request; import okhttp3.Request;
@ -122,6 +131,7 @@ public class BookUtil {
DownloadStatus downloadStatus = DownloadStatus.notStart; DownloadStatus downloadStatus = DownloadStatus.notStart;
public Chapter getChapter(int chapId){ public Chapter getChapter(int chapId){
chapId = chapId >0 ?chapId : 1;
if(chapId > mChapters.size() || mChapters.size() ==0){ if(chapId > mChapters.size() || mChapters.size() ==0){
return Chapter.getChapter(mNovel.getId(), mNovel.getDomain(),chapId); return Chapter.getChapter(mNovel.getId(), mNovel.getDomain(),chapId);
}else{ }else{
@ -391,7 +401,7 @@ public class BookUtil {
public int getChapterNo() { public int getChapterNo() {
if(chapterNo > mChapters.size()){ 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){ if(mChangeChapId>0){
return mChangeChapId; return mChangeChapId;
} }
@ -399,7 +409,7 @@ public class BookUtil {
} }
chapterNo = chapterNo<=0 ?1 :chapterNo; 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; return chapterNo;
} }
@ -473,6 +483,45 @@ public class BookUtil {
return f.exists(); return f.exists();
} }
public boolean retryDownLoadContent(int chaptId) {
if(chaptDownStatus.containsKey(chaptId)){
if( chaptDownStatus.get(chaptId) == DownloadStatus.failure){
if(fileRetryCnt.containsKey(chaptId)){
if(fileRetryCnt.get(chaptId) < Constants.retryCnt){
fileRetryCnt.put(chaptId,fileRetryCnt.get(chaptId)+1 );
}else{
return false;
}
}else {
fileRetryCnt.put(chaptId, 1 );
}
}else{
return false;
}
}else{
chaptDownStatus.put(chaptId,DownloadStatus.downloading);
fileRetryCnt.put(chaptId,11 );
}
if(fileRetryCnt.get(chaptId) < Constants.retryCnt) {
try {
loadChaptContent(chaptId);
chaptDownStatus.put(chaptId,DownloadStatus.downloading);
} catch (JSONException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return true;
}
return false;
}
private class BookTask extends AsyncTask<String,Void,Boolean> { private class BookTask extends AsyncTask<String,Void,Boolean> {
private String domain; private String domain;
@ -489,7 +538,7 @@ public class BookUtil {
Log.d(TAG, String.format("changing Source: target domain %s chaptId %s, chapt title %s,mChangeChapId %s " Log.d(TAG, String.format("changing Source: target domain %s chaptId %s, chapt title %s,mChangeChapId %s "
,domain,chapId,chapTitle,mChangeChapId) ); ,domain,chapId,chapTitle,mChangeChapId) );
int chId=chapterNo; int chId=chapId;//chapterNo;
String title =""; String title ="";
mChangeChapId = mChangeChapId >=1 ?mChangeChapId :1;//TODO: mChangeChapId 换源时不要变 mChangeChapId = mChangeChapId >=1 ?mChangeChapId :1;//TODO: mChangeChapId 换源时不要变
if( mChapters.size() >= mChangeChapId && mChapters.get(mChangeChapId-1)!=null ){ if( mChapters.size() >= mChangeChapId && mChapters.get(mChangeChapId-1)!=null ){
@ -517,17 +566,36 @@ public class BookUtil {
i = 1; i = 1;
for (Chapter chapter : mChapters) { for (Chapter chapter : mChapters) {
// Log.d(TAG, "changing Source: finding chapter " + i + ":" + chapter.getChapterName()); // Log.d(TAG, "changing Source: finding chapter " + i + ":" + chapter.getChapterName());
if (chapter.getChapterName().contains(mChangeTitle)) { if ( mChangeTitle.contains(chapter.getChapterName())
||chapter.getChapterName().contains(mChangeTitle)
){
Log.d(TAG, "changing Source:successed find chapter by original title " + i + ":" + mChangeTitle); Log.d(TAG, "changing Source:successed find chapter by original title " + i + ":" + mChangeTitle);
chId = i; chId = i;
title = chapter.getChapterName(); title = chapter.getChapterName();
break; break;
} }
i++;
}
i = 1;
for (Chapter chapter : mChapters) {
// Log.d(TAG, "changing Source: finding chapter " + i + ":" + chapter.getChapterName());
if ( chapter.getChapterName().startsWith(mChangeTitle)
||mChangeTitle.startsWith(chapter.getChapterName() )
){
Log.d(TAG, "changing Source:successed find chapter by original title " + i + ":" + mChangeTitle);
chId = i;
title = chapter.getChapterName();
break;
}
i++; i++;
} }
} }
if (!title.contains(mChangeTitle)) { /* if (!title.contains(mChangeTitle)) {
i = 1; i = 1;
for (Chapter chapter : mChapters) { for (Chapter chapter : mChapters) {
// Log.d(TAG, "changing Source: finding chapter " + i + ":" + chapter.getChapterName()); // Log.d(TAG, "changing Source: finding chapter " + i + ":" + chapter.getChapterName());
@ -539,14 +607,14 @@ public class BookUtil {
} }
i++; i++;
} }
} }*/
} }
chId = chId <= mChapters.size() ? chId: mChapters.size(); chId = chId <= mChapters.size() ? chId: mChapters.size();
Log.d(TAG, "changing Source: to open chapter with new site source " + chId + " : "+ mChangeTitle ); Log.d(TAG, "changing Source: to open chapter with new site source " + chId + " : "+ mChangeTitle );
pagefactory.changeChapter(chId); pagefactory.changeChapter(chId);
mChangeChapId=0; // mChangeChapId=0;
Toast.makeText(mContext,"换源成功",Toast.LENGTH_LONG).show(); Toast.makeText(mContext,"换源成功",Toast.LENGTH_LONG).show();
}else{ }else{
Log.d(TAG, "changing Source: failed " ); Log.d(TAG, "changing Source: failed " );
@ -591,9 +659,7 @@ public class BookUtil {
/** /**
* 新线程换源 handler 有问题 * 新线程换源 handler 有问题
* @param domain
* @param chapId
* @param chapTitle
*/ */
/* public void changeSourceNewThread(String domain,int chapId,String chapTitle) { /* public void changeSourceNewThread(String domain,int chapId,String chapTitle) {
Log.d(TAG, String.format("changing Source: target domain %s chaptId %s, chapt title %s ",domain,chapId,chapTitle) ); Log.d(TAG, String.format("changing Source: target domain %s chaptId %s, chapt title %s ",domain,chapId,chapTitle) );
@ -1387,7 +1453,7 @@ int muluRetryCount =0;
// getTargetSites(); // getTargetSites();
} }
if( mChapters.size() ==0) { if( mChapters.size() ==0) {
if (mMuluStatus == MuluStatus.isDone){ if (mMuluStatus != MuluStatus.isDownloading){
getSiteRule(); getSiteRule();
} }
} }
@ -1462,7 +1528,7 @@ int muluRetryCount =0;
error = "连不上网络"; error = "连不上网络";
} }
loadChaptContent(index); // loadChaptContent(index);
chaptDownStatus.put( index , DownloadStatus.failure); chaptDownStatus.put( index , DownloadStatus.failure);
Log.d(TAG, String.format("prepare book loadChaptContent retrying " )); Log.d(TAG, String.format("prepare book loadChaptContent retrying " ));
@ -1588,7 +1654,7 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
chaptDownStatus.put(index,DownloadStatus.failure); chaptDownStatus.put(index,DownloadStatus.failure);
// setDownloadFlag(true); // setDownloadFlag(true);
Log.d( TAG,String.format("prepare book loadChaptContent fail, isDownloadChapt: %s",false)); Log.d( TAG,String.format("prepare book loadChaptContent %s fail, isDownloadChapt: %s",index,false));
e.printStackTrace(); e.printStackTrace();
// throw new RuntimeException("Error during writing " + fileChapterName( index)); // throw new RuntimeException("Error during writing " + fileChapterName( index));
} }
@ -1609,6 +1675,9 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
try { try {
if(mSiteRule==null){
return;
}
/* Charset charset = body.contentType().charset(); /* Charset charset = body.contentType().charset();
if(charset!=null){ if(charset!=null){
String name = charset.displayName(); String name = charset.displayName();
@ -1679,24 +1748,28 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
.url(url) .url(url)
.removeHeader("Pragma"); .removeHeader("Pragma");
for(int i=0;i<mSiteRule.getHeaders().length;i+=2){ for (int i = 0; i < mSiteRule.getHeaders().length; i += 2) {
builder.header(mSiteRule.getHeaders()[i],mSiteRule.getHeaders()[i+1]); builder.header(mSiteRule.getHeaders()[i], mSiteRule.getHeaders()[i + 1]);
} }
// .header( "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") // .header( "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
// .header( "Upgrade-Insecure-Requests", "1") // .header( "Upgrade-Insecure-Requests", "1")
// .header("content-type", "text/html; charset=utf-8") // .header("content-type", "text/html; charset=utf-8")
// .header("Content-Type", "text/plain; charset=utf-8") // .header("Content-Type", "text/plain; charset=utf-8")
// .header( "Accept", "*/*") // .header( "Accept", "*/*")
; ;
/* if(mSiteRule!=null && !TextUtils.isEmpty(mSiteRule.getEncoding()) ){ /* if(mSiteRule!=null && !TextUtils.isEmpty(mSiteRule.getEncoding()) ){
builder.header("Accept-Encoding",mSiteRule.getEncoding()); builder.header("Accept-Encoding",mSiteRule.getEncoding());
} }
*/ if(maxAge>0) { */
builder. header("Cache-Control", "public, max-age=" + maxAge); if (maxAge > 0) {
builder.header("Cache-Control", "public, max-age=" + maxAge);
} }
return builder.build(); return builder.build();
} }

View File

@ -101,5 +101,16 @@ public class FileUtils {
} }
return cachePath; return cachePath;
} }
public static File getNovelDir(int noveId){
File f = new File(BookUtil.chapterPath+noveId);
return f;
}
public static void clearChapterCache(int novelId) {
Fileutil.deleteDir(getNovelDir(novelId));
}
public static long getCacheSize(int noveId) {
return Fileutil.getDirSize(getNovelDir(noveId));
}
} }

View File

@ -48,7 +48,7 @@ public class Fileutil {
if (file.isFile()) { if (file.isFile()) {
dirSize += file.length(); dirSize += file.length();
} else if (file.isDirectory()) { } else if (file.isDirectory()) {
dirSize += file.length(); // dirSize += file.length();
// 递归调用 // 递归调用
dirSize += getDirSize(file); dirSize += getDirSize(file);
} }

View File

@ -353,14 +353,20 @@ public class PageFactory implements ChangeSource{
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
super.run();
Log.d(TAG, String.format("prepare book to preRead chapter %s ,thread.name %s",chaptId,Thread.currentThread().getName() ) ); Log.d(TAG, String.format("prepare book to preRead chapter %s ,thread.name %s",chaptId,Thread.currentThread().getName() ) );
File file = new File(getChapterFileName(chaptId)); File file = new File(getChapterFileName(chaptId));
if(file.exists()) { if(file.exists()) {
chaptMap.put(chaptId, readChaptCache(chaptId)); chaptMap.put(chaptId, readChaptCache(chaptId));
Log.d(TAG, String.format("prepare book to preLoad success " ) );
Log.d(TAG, String.format("prepare book to preLoad %s done <-----",chaptId ) );
}else{
Log.d(TAG, String.format("prepare book to trying download the chapt %s again........... ",chaptId ) );
mBookUtil.retryDownLoadContent(chaptId) ;
} }
Log.d(TAG, String.format("prepare book to preLoad done <-----" ) );
super.run();
}}.start(); }}.start();
} }
@ -555,7 +561,7 @@ public static boolean busy(){
mBatterryPaint.setColor(m_textColor); mBatterryPaint.setColor(m_textColor);
batteryInfoIntent = context.getApplicationContext().registerReceiver(null, batteryInfoIntent = context.getApplicationContext().registerReceiver(null,
new IntentFilter(Intent.ACTION_BATTERY_CHANGED)) ;//注册广播,随时获取到电池电量信息 new IntentFilter(Intent.ACTION_BATTERY_CHANGED)) ;//注册广播,随时获取到电池电量信息
level = batteryInfoIntent.getIntExtra( "level" , 0 );
initBg(config.getDayOrNight()); initBg(config.getDayOrNight());
measureMarginWidth(); measureMarginWidth();
} }
@ -615,7 +621,7 @@ public static boolean busy(){
String status = ""; String status = "";
switch (mStatus){ switch (mStatus){
case OPENING: case OPENING:
status = "正在拼命加载"+loadingTxt; status = loadingTxt+ "正在拼命加载" ;
mAd.showRefresh(View.GONE); mAd.showRefresh(View.GONE);
break; break;
case FAIL: case FAIL:
@ -694,7 +700,7 @@ public static boolean busy(){
} }
if(lastPageTime>0) { if(lastPageTime>0) {
long time = new Date().getTime() - lastPageTime; long time = new Date().getTime() - lastPageTime;
Log.d(TAG, String.format("prepare book read time last %s,current %s,spent %s",lastPageTime,new Date().getTime(), time)); // Log.d(TAG, String.format("prepare book read time last %s,current %s,spent %s",lastPageTime,new Date().getTime(), time));
if (time > 1000) { if (time > 1000) {
getNovel().setReadtime(getNovel().getReadtime() + time); getNovel().setReadtime(getNovel().getReadtime() + time);
} }
@ -705,11 +711,11 @@ public static boolean busy(){
// * column won't be updated. // * column won't be updated.
// getNovel().save(); // getNovel().save();
Novel nv = LitePal.find(Novel.class,getNovel().getId()); /* Novel nv = LitePal.find(Novel.class,getNovel().getId());
Log.d(TAG,String.format("prepare book %s ,%s isUpdated %s,saved isUpdated %s, saved lastchapt %s,lastpos %s, db lastchapt %s last pos %s", Log.d(TAG,String.format("prepare book %s ,%s isUpdated %s,saved isUpdated %s, saved lastchapt %s,lastpos %s, db lastchapt %s last pos %s",
getNovel().getId(), getNovel().getId(),
getNovel().getName(),getNovel().isUpdated(),nv.isUpdated(), getNovel().getName(),getNovel().isUpdated(),nv.isUpdated(),
currentChapter,currentPage.getBegin(),nv.getLastReadChapt(),nv.getLastReadPos())); currentChapter,currentPage.getBegin(),nv.getLastReadChapt(),nv.getLastReadPos()));*/
lastPageTime = new Date().getTime(); lastPageTime = new Date().getTime();
@ -785,9 +791,12 @@ public static boolean busy(){
c.drawText(strPercent, mWidth - nPercentWidth, botoomY, mBatterryPaint);//x y为坐标值 c.drawText(strPercent, mWidth - nPercentWidth, botoomY, mBatterryPaint);//x y为坐标值
c.drawText(date, marginWidth ,botoomY, mBatterryPaint); c.drawText(date, marginWidth ,botoomY, mBatterryPaint);
// 画电池 // 画电池
level = batteryInfoIntent.getIntExtra( "level" , 0 ); Log.d(TAG, String.format("updateBattery to draw: level1 %s ",level));
// level = batteryInfoIntent.getIntExtra( "level" , 0 );
int scale = batteryInfoIntent.getIntExtra("scale", 100); int scale = batteryInfoIntent.getIntExtra("scale", 100);
mBatteryPercentage = (float) level / scale; mBatteryPercentage = (float) level / scale;
Log.d(TAG, String.format("updateBattery to draw: level2 %s ",level));
float rect1Left = marginWidth + dateWith + statusMarginBottom;//电池外框left位置 float rect1Left = marginWidth + dateWith + statusMarginBottom;//电池外框left位置
//画电池外框 //画电池外框
float width = CommonUtil.convertDpToPixel(mContext,20) - mBorderWidth; float width = CommonUtil.convertDpToPixel(mContext,20) - mBorderWidth;
@ -1343,6 +1352,8 @@ if(book==null){
public void updateBattery(int mLevel){ public void updateBattery(int mLevel){
mAd.hideSystemUI(); mAd.hideSystemUI();
if (currentPage != null && mBookPageWidget != null && !mBookPageWidget.isRunning()) { if (currentPage != null && mBookPageWidget != null && !mBookPageWidget.isRunning()) {
Log.d(TAG, String.format("updateBattery: level old %s, new %s",level,mLevel));
if (level != mLevel) { if (level != mLevel) {
level = mLevel; level = mLevel;
currentPage(false); currentPage(false);
@ -1404,6 +1415,7 @@ if(book==null){
mPaint.setTextSize(m_fontSize); mPaint.setTextSize(m_fontSize);
calculateLineCount(); calculateLineCount();
measureMarginWidth(); measureMarginWidth();
chaptMap.clear();
currentChaptPages = loadCurrentChapt(currentChapter ); currentChaptPages = loadCurrentChapt(currentChapter );
currentPage = getPageForBegin(currentPage.getBegin()); currentPage = getPageForBegin(currentPage.getBegin());
currentPage(true); currentPage(true);
@ -1415,6 +1427,7 @@ if(book==null){
mPaint.setTextSize(m_fontSize); mPaint.setTextSize(m_fontSize);
calculateLineCount(); calculateLineCount();
measureMarginWidth(); measureMarginWidth();
chaptMap.clear();
currentChaptPages = loadCurrentChapt(currentChapter ); currentChaptPages = loadCurrentChapt(currentChapter );
currentPage = getPageForBegin(currentPage.getBegin()); currentPage = getPageForBegin(currentPage.getBegin());
currentPage(true); currentPage(true);
@ -1427,7 +1440,7 @@ if(book==null){
mBatterryPaint.setTypeface(typeface); mBatterryPaint.setTypeface(typeface);
calculateLineCount(); calculateLineCount();
measureMarginWidth(); measureMarginWidth();
chaptMap.clear();
currentPage = getPageForBegin(currentPage.getBegin()); currentPage = getPageForBegin(currentPage.getBegin());
currentPage(true); currentPage(true);
} }
@ -1499,7 +1512,9 @@ if(book==null){
Log.d(TAG, String .format("prepare Book: clearing book info %s" , getNovle().getName())); Log.d(TAG, String .format("prepare Book: clearing book info %s" , getNovle().getName()));
fileRetryCnt.clear(); fileRetryCnt.clear();
lastPageTime=0; lastPageTime=0;
chaptMap.clear(); if(chaptMap!=null){
chaptMap.clear();
}
//mBookUtil=null; //mBookUtil=null;
currentChapter = 0; currentChapter = 0;
bookPath = ""; bookPath = "";

View File

@ -6,14 +6,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:clipToPadding="true"
tools:context=".Activity_ChgSource"> tools:context=".Activity_ChgSource">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appbar" android:id="@+id/appbar"
android:layout_width="match_parent" style="@style/barLayout">
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/ToolBarTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
@ -30,7 +28,7 @@
android:id="@+id/recycleView" android:id="@+id/recycleView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="60dp" android:layout_marginTop="50dp"
android:divider="@color/list_item_divider" android:divider="@color/list_item_divider"
> >
</android.support.v7.widget.RecyclerView> </android.support.v7.widget.RecyclerView>

View File

@ -17,7 +17,7 @@
app:tl_indicator_width="45dp" app:tl_indicator_width="45dp"
app:tl_textSelectColor="@color/tabSelected" app:tl_textSelectColor="@color/tabSelected"
app:tl_textUnselectColor="@color/grey" app:tl_textUnselectColor="@color/grey"
app:tl_textsize="17sp" app:tl_textsize="16sp"
app:tl_textBold="SELECT" app:tl_textBold="SELECT"
app:tl_tab_space_equal ="true" app:tl_tab_space_equal ="true"
app:tl_indicator_bounce_enable ="true" app:tl_indicator_bounce_enable ="true"

View File

@ -12,25 +12,30 @@
<RelativeLayout <RelativeLayout
android:id="@+id/top_layout" android:id="@+id/top_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="90dp" android:layout_height="120dp"
android:elevation="1dp" android:elevation="1dp"
tools:ignore="UnusedAttribute"> tools:ignore="UnusedAttribute">
<FrameLayout <LinearLayout
android:clickable="true"
android:id="@+id/llBookdetail"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="100dp"
android:background="@color/white" android:background="@color/white"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:paddingStart="120dp" android:paddingStart="100dp"
android:paddingLeft="120dp" android:paddingLeft="120dp"
android:orientation="horizontal"
> >
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:paddingBottom="15dp" android:paddingStart="15dp"
android:paddingRight="10dp"
android:layout_weight="1"
android:background="@drawable/item_selector"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -41,6 +46,7 @@
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
android:textSize="16sp" android:textSize="16sp"
android:textStyle="bold" android:textStyle="bold"
android:ellipsize="marquee"
tools:ignore="HardcodedText,TextViewEdits" /> tools:ignore="HardcodedText,TextViewEdits" />
@ -52,15 +58,38 @@
android:text="金庸" android:text="金庸"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
<TextView
android:layout_marginTop="2dp"
android:id="@+id/txtLatestCate"
style="@style/TextViewDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:ellipsize="end"
android:text=""
/>
<TextView
android:id="@+id/txtLatestUpdate"
style="@style/TextViewDesc.small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:text=""
/>
</LinearLayout> </LinearLayout>
</FrameLayout> </LinearLayout>
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/cardView" android:id="@+id/cardView"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="150dp" android:layout_height="130dp"
android:layout_marginEnd="14dp" android:layout_marginEnd="14dp"
android:layout_marginRight="14dp" android:layout_marginRight="14dp"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
@ -85,129 +114,74 @@
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" android:layout_height="wrap_content"
android:gravity="center" android:gravity="bottom"
android:background="@color/white" android:background="@color/white"
android:padding="10dp"
android:paddingBottom="5dp"
> >
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="70dp" android:layout_height="wrap_content"
android:id="@+id/llBookdetail" android:id="@+id/llClearCache"
android:gravity="center" android:gravity="bottom"
android:background="@drawable/item_selector" android:background="@drawable/item_selector"
android:clickable="true" android:clickable="true"
android:layout_weight="1"> >
<ImageView <TextView
android:id="@+id/tvCache"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="20dp"
android:layout_weight="1"
android:gravity="center" android:layout_gravity="center"
android:src="@drawable/googleg_standard_color_18" /> android:text=""
android:textColor="#212121" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="20dp"
android:gravity="center" android:layout_gravity="center"
android:text="书籍详情" android:text="清除缓存"
android:textColor="#212121" /> android:textColor="#212121" />
</LinearLayout>. </LinearLayout>.
<LinearLayout <LinearLayout
android:id="@+id/llTop"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="60dp" android:layout_width="wrap_content"
android:layout_height="70dp" android:layout_height="wrap_content"
android:gravity="bottom|center_horizontal"
android:gravity="center"
android:background="@drawable/item_selector"
android:clickable="true"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:src="@drawable/googleg_standard_color_18" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center"
android:text="目录书摘"
android:textColor="#212121" />
</LinearLayout>.
<LinearLayout
android:orientation="vertical"
android:layout_width="60dp"
android:layout_height="70dp"
android:gravity="center"
android:background="@drawable/item_selector" android:background="@drawable/item_selector"
android:clickable="true" android:clickable="true"
android:layout_weight="1"> android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
>
<ImageView <ImageView
android:id="@+id/imageTop"
android:layout_width="wrap_content" android:layout_width="30dp"
android:layout_height="wrap_content" android:layout_height="30dp"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:src="@drawable/googleg_standard_color_18" /> android:src="@mipmap/star_active" />
<TextView <TextView
android:id="@+id/tvTop"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="20dp"
android:gravity="center" android:gravity="center"
android:text="查看书评" android:text="置顶显示"
android:textColor="#212121" />
</LinearLayout>.
<LinearLayout
android:orientation="vertical"
android:layout_width="60dp"
android:layout_height="70dp"
android:gravity="center"
android:background="@drawable/item_selector"
android:clickable="true"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:src="@drawable/googleg_standard_color_18" />
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:gravity="center"
android:text="下载本书"
android:textColor="#212121" /> android:textColor="#212121" />

View File

@ -20,13 +20,23 @@
android:src="@drawable/googleg_standard_color_18" /> android:src="@drawable/googleg_standard_color_18" />
<ImageView <ImageView
android:id="@+id/imageUpdated" android:id="@+id/imageUpdated"
android:layout_width="38dp" android:layout_width="35dp"
android:layout_height="38dp" android:layout_height="35dp"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:layout_marginRight="6dp" android:layout_marginRight="6dp"
android:visibility="gone" android:visibility="gone"
android:src="@drawable/ic_book_update_flag" /> android:src="@drawable/ic_book_update_flag" />
<ImageView
android:id="@+id/imageTop"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="start"
android:layout_marginTop="2dp"
android:layout_marginRight="6dp"
android:visibility="gone"
android:src="@mipmap/star_active" />
<CheckBox <CheckBox
android:id="@+id/id_check_box" android:id="@+id/id_check_box"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -10,10 +10,47 @@
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingTop="4dp" android:paddingTop="4dp"
android:layout_weight="1"> android:layout_weight="1">
<ImageView
android:id="@+id/imageView"
style="@style/NovelImage.horizon" <FrameLayout
android:src="@drawable/googleg_standard_color_18" /> android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
style="@style/NovelImage.horizon"
android:src="@drawable/googleg_standard_color_18" />
<ImageView
android:id="@+id/imageTop1"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="start"
android:layout_marginTop="2dp"
android:layout_marginRight="6dp"
android:visibility="gone"
android:src="@drawable/sc_top_one" />
<ImageView
android:id="@+id/imageTop2"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="start"
android:layout_marginTop="2dp"
android:layout_marginRight="6dp"
android:visibility="gone"
android:src="@drawable/sc_top_two" />
<ImageView
android:id="@+id/imageTop3"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="start"
android:layout_marginTop="2dp"
android:layout_marginRight="6dp"
android:visibility="gone"
android:src="@drawable/sc_top_three" />
</FrameLayout>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -10,13 +10,14 @@
<TextView <TextView
style="@style/TextViewNovelTitle.horizon.bold" style="@style/NovelBlockTitle"
android:id="@+id/tvText" android:id="@+id/tvText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:textSize="18sp"
android:text="@string/noRecord" android:text="@string/noRecord"
/> />
<!-- <LinearLayout style="@style/llGraySplit.2dp"/>-->
</LinearLayout> </LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -8,6 +8,7 @@
<color name="black">#000000</color> <color name="black">#000000</color>
<color name="gray">#000000</color> <color name="gray">#000000</color>
<color name="white">#ffffff</color> <color name="white">#ffffff</color>
<color name="blacktitle">#212121</color>
<color name="ivory">#FFFFF0</color> <!--象牙色 --> <color name="ivory">#FFFFF0</color> <!--象牙色 -->
<color name="lightyellow">#FFFFE0</color><!--亮黄色--> <color name="lightyellow">#FFFFE0</color><!--亮黄色-->
<color name="yellow">#FFFF00</color><!--黄色 --> <color name="yellow">#FFFF00</color><!--黄色 -->

View File

@ -180,7 +180,7 @@
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">30dp</item> <item name="android:layout_height">30dp</item>
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:textColor">#212121</item> <item name="android:textColor">@color/blacktitle</item>
<item name="android:maxLines">1</item> <item name="android:maxLines">1</item>
</style> </style>
@ -301,19 +301,19 @@
<style name="TextViewNovelTitle"> <style name="TextViewNovelTitle">
<item name="android:layout_marginLeft">0dp</item> <item name="android:layout_marginLeft">0dp</item>
<item name="android:textColor">#212121</item> <item name="android:textColor">@color/blacktitle</item>
<item name="android:layout_height">25dp</item> <item name="android:layout_height">25dp</item>
<item name="android:layout_gravity">left</item> <item name="android:layout_gravity">left</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:lines">1</item> <item name="android:lines">1</item>
<item name="android:textSize">14dp</item> <item name="android:textSize">14dp</item>
<!--<item name="android:ellipsize">end</item>--> <item name="android:ellipsize">end</item>
<item name="android:ellipsize">marquee</item> <!--<item name="android:ellipsize">marquee</item>-->
</style> </style>
<style name="TextViewNovelAuthor"> <style name="TextViewNovelAuthor">
<item name="android:layout_marginLeft">10dp</item> <item name="android:layout_marginLeft">10dp</item>
<item name="android:textColor">#212121</item> <item name="android:textColor">@color/blacktitle</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
@ -322,7 +322,7 @@
<style name="TextViewNovelType"> <style name="TextViewNovelType">
<item name="android:layout_marginLeft">10dp</item> <item name="android:layout_marginLeft">10dp</item>
<item name="android:textColor">@color/colorAccent</item> <item name="android:textColor">@color/colorPrimaryDark</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
@ -371,7 +371,7 @@
<style name="NovelBlockTitle"> <style name="NovelBlockTitle">
<item name="android:layout_marginLeft">4dp</item> <item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_gravity">left|center_vertical</item> <item name="android:layout_gravity">left|center_vertical</item>
<item name="android:textColor">#212121</item> <item name="android:textColor">@color/blacktitle</item>
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">20dp</item> <item name="android:layout_height">20dp</item>
<item name="android:layout_weight">1</item> <item name="android:layout_weight">1</item>
@ -389,7 +389,7 @@
</style> </style>
<style name="TextViewCateTitle"> <style name="TextViewCateTitle">
<item name="android:textColor">#212121</item> <item name="android:textColor">@color/blacktitle</item>
<item name="android:lines">1</item> <item name="android:lines">1</item>
<item name="android:ellipsize">end</item> <item name="android:ellipsize">end</item>
</style> </style>
@ -417,7 +417,7 @@
<style name="TextViewNovelType.Status"> <style name="TextViewNovelType.Status">
<item name="android:textColor">@color/mediumturquoise</item> <item name="android:textColor">@color/colorPrimary</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
</style> </style>