准备加入广告

准备发布新版
This commit is contained in:
mwang 2019-05-28 23:57:05 +08:00
parent b2e85bbc9b
commit c3f6a7bc13
35 changed files with 347 additions and 270 deletions

View File

@ -31,7 +31,7 @@ android {
multiDexEnabled true //65535
manifestPlaceholders = [UMENG_CHANNEL_CALUE: "umeng"] //uMeng
// flavorDimensions "default" //debug时注销
// flavorDimensions "default" //debug时注销
}
buildTypes {
debug {
@ -56,11 +56,11 @@ android {
// resource文件
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
/* applicationVariants.all { variant ->
/* applicationVariants.all { variant ->
variant.outputs.all { output ->
def outFile = output.outputFile
if (outFile != null && outFile.name.endsWith(".apk")) {
def fileName = "${defaultConfig.versionName}-" + "${releaseTime()}" + "-${variant.productFlavors[0].name}" +".apk"
def fileName = "${defaultConfig.versionName}-" + "${releaseTime()}" + "-${variant.productFlavors[0].name}" + ".apk"
outputFileName = fileName;
}
@ -71,36 +71,36 @@ android {
}
}
//
/*productFlavors {
/* productFlavors {
// googleplay {}
qxs {
qxs {
applicationId "com.novelbook.android.qxs"
versionName "vn-qxs-5.0"
versionName "v-qxs-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chqxs.xiaoshuofenxiang.com/api/"'
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/qxs.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
//buildConfigField "String", "API_HOST", '""'
//buildConfigField "String", "API_HOST", '""'
}
wzzw {
wzzw {
applicationId "com.novelbook.android.wzzw"
versionName "vn-wzzw-5.0"
versionName "v-wzzw-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chwzzw.xiaoshuofenxiang.com/api/"'
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
// buildConfigField "String", "API_HOST", '""'
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/wzzw.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
// buildConfigField "String", "API_HOST", '""'
}
bo {
applicationId "com.novelbook.android.bo"
versionName "vn-bo-5.0"
versionName "v-bo-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chbo.xiaoshuofenxiang.com/api/"'
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/bo.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
// buildConfigField "String", "API_HOST", '""'
// buildConfigField "String", "API_HOST", '""'
}
g {
applicationId "com.novelbook.android.g"
versionName "vn-g-5.0"
versionName "v-g-5.0"
buildConfigField "String", "MAIN_HOST", '"http://chg.xiaoshuofenxiang.com/api/"'
buildConfigField "String", "API_HOST", '"{\\"master\\":[\\"http:\\\\/\\\\/g.xiaoshuofenxiang.com\\"],\\"page\\":[\\"http:\\\\/\\\\/p.xiaoshuofenxiang.com\\"],\\"report\\":[\\"http:\\\\/\\\\/r.xiaoshuofenxiang.com\\"],\\"search\\":[\\"http:\\\\/\\\\/s.xiaoshuofenxiang.com\\"],\\"novel\\":[\\"http:\\\\/\\\\/n.xiaoshuofenxiang.com\\"],\\"novelsbydot\\":[\\"http:\\\\/\\\\/nbd.xiaoshuofenxiang.com\\"],\\"user\\":[\\"http:\\\\/\\\\/u.xiaoshuofenxiang.com\\"]}"'
// buildConfigField "String", "API_HOST", '""'
// buildConfigField "String", "API_HOST", '""'
}
//
productFlavors.all { flavor ->

View File

@ -271,3 +271,7 @@
# }
# 嵌入广点通sdk时必须添加
-keep class com.qq.e.** {
public protected *;
}

View File

@ -3,8 +3,7 @@
package="com.novelbook.android">
<!-- To access Google+ APIs: -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" /> <!-- <uses-permission android:name="android.permission.VIBRATE" /> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
@ -17,11 +16,11 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/ToolBarTheme"
android:usesCleartextTraffic="true">
<activity android:name=".ActivityAnounce" android:label="@string/title_annouce"></activity>
<activity
android:name=".Activity_cate_books"
android:label="@string/title_activity_cate_books"
@ -45,6 +44,7 @@
<activity
android:name=".BookActivity"
android:label="@string/title_activity_book"
android:launchMode="singleTask"
android:theme="@style/ToolBarTheme.NoActionBar" />
<activity
android:name=".ReadActivity"
@ -86,11 +86,41 @@
android:name=".ActivitySetup"
android:label="@string/title_setup"
android:theme="@style/ToolBarTheme.NoActionBar" />
<service
android:name=".service.ServiceDownload"
android:exported="false" /> <!-- qq ad -->
<service
android:name="com.qq.e.comm.DownloadService"
android:exported="false" />
<activity
android:name="com.qq.e.ads.ADActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" />
<activity
android:name="com.qq.e.ads.PortraitADActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" />
<activity
android:name="com.qq.e.ads.LandscapeADActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape" />
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/gdt_file_path" />
</provider> <!-- qq ad end -->
<!--
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
@ -98,13 +128,14 @@
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider> <!-- UMENG -->
</provider>
-->
<!-- UMENG -->
<meta-data
android:name="UMENG_APPKEY"
android:value="5cd6238a570df375c3000cc9" /> <!-- <meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}"/> -->
<meta-data
android:name="UMENG_CHANNEL"
android:value="debug" />
<meta-data android:name="UMENG_CHANNEL" android:value="debug" />
<!--<meta-data android:name="UMENG_CHANNEL" android:value="${UMENG_CHANNEL_VALUE}" />-->
</application>
</manifest>

View File

@ -0,0 +1,34 @@
package com.novelbook.android;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class ActivityAnounce extends Activity_base {
@Override
public int getLayoutRes() {
return R.layout.activity_anounce;
}
@Override
protected void initViews() {
}
@Override
protected void setTitle() {
}
@Override
protected void initData() {
}
@Override
public void fillData() {
}
}

View File

@ -72,7 +72,8 @@ static final String TAG = ActivitySetup.class.getSimpleName();
switch (view.getId()) {
case R.id.llAnouncement:
Intent intent = new Intent(ActivitySetup.this, ActivityAnounce.class);
startActivity(intent);
break;
case R.id.llCache:
final AlertDialog.Builder normalDialog =

View File

@ -43,7 +43,8 @@ import butterknife.ButterKnife;
public abstract class Activity_base extends AppCompatActivity {
private ProgressDialog mProgressDialog;
private MyApp application;
private Activity_base oContext;
protected Gson gson = new Gson();
@Nullable
@BindView(R.id.toolbar)
@ -67,6 +68,13 @@ public abstract class Activity_base extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (application == null) {
// 得到Application对象
application = (MyApp) getApplication();
}
oContext = this;// 把当前的上下文对象赋值给BaseActivity
addActivity();// 调用添加方法
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(getLayoutRes());
ButterKnife.bind(this);
@ -100,7 +108,7 @@ public abstract class Activity_base extends AppCompatActivity {
}
protected void closeCurrentActitivty(){
if( this instanceof BookActivity ) {
// return;
return;
}
finish();
}
@ -262,109 +270,27 @@ public abstract class Activity_base extends AppCompatActivity {
else
manager.checkUpdate();
}
/*
class BookListAdapter extends RecyclerView.Adapter<MyViewHolder> {
private final int EMPTY_VIEW = 1;
private final int PROGRESS_VIEW = 2;
private final int IMAGE_VIEW = 3;
private Context context;
private List<String> mDatas = new ArrayList<String>();
private OnItemClickListener mOnItemClickListener;
private int listItemID;
public BookListAdapter(Context context, List<String> mDatas, int listItemID, OnItemClickListener clicklistener) {
this.context = context;
this.mDatas = mDatas;
this.mOnItemClickListener = clicklistener;
this.listItemID = listItemID;
}
public BookListAdapter(Context context, OnItemClickListener clickLitener) {
this.context = context;
this.mOnItemClickListener = clickLitener;
}
@Override
public int getItemViewType(int position) {
if (mDatas.size() == 0) {
return EMPTY_VIEW;
} else if (mDatas.get(position) == null) {
return PROGRESS_VIEW;
} else {
return super.getItemViewType(position);
}
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
context).inflate(listItemID, parent,
false));
return holder;
}
public void setParameters(List<String> mDatas, int listItemID) {
this.mDatas = mDatas;
this.listItemID = listItemID;
}
public void setOnItemClickLitener(OnItemClickListener mOnItemClickListener) {
this.mOnItemClickListener = mOnItemClickListener;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
holder.tvTitle.setText(mDatas.get(position));
holder.tvAuthor.setText("金庸" + position);
holder.tvCate.setText("cate" + position);
holder.tvDesc.setText("this is desc " + position);
// 如果设置了回调则设置点击事件
if (mOnItemClickListener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() //show more cate paihang
{
@Override
public void onClick(View v) {
int pos = holder.getLayoutPosition();
mOnItemClickListener.onItemClick(holder.itemView, pos);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
int pos = holder.getLayoutPosition();
mOnItemClickListener.onItemLongClick(holder.itemView, pos);
return false;
}
});
}
}
@Override
public int getItemCount() {
return mDatas.size();
}
public void addData(int position) {
mDatas.add(position, "Insert One");
notifyItemInserted(position);
}
public void removeData(int position) {
mDatas.remove(position);
notifyItemRemoved(position);
notifyDataSetChanged();
}
// 添加Activity方法
public void addActivity() {
application.addActivity_(oContext);// 调用myApplication的添加Activity方法
}
*/
//销毁当个Activity方法
public void removeActivity() {
application.removeActivity_(oContext);// 调用myApplication的销毁单个Activity方法
}
//销毁所有Activity方法
public void removeALLActivity() {
application.removeALLActivity_();// 调用myApplication的销毁所有Activity方法
}
@Override
public void finish() {
removeActivity();
super.finish();
}
}

View File

@ -158,6 +158,7 @@ public class BookActivity extends Activity_base {
rvBooklistAuthor.setVisibility(View.GONE);
tvTonglei.setVisibility(View.GONE);
tvAuthorMore.setText( "");
initiDownloadReceiver();
}
@Override
@ -183,15 +184,13 @@ public class BookActivity extends Activity_base {
@Override
protected void setTitle() {
mNovel = (Novel) getIntent().getSerializableExtra(EXTRA_BOOK);
novelId = mNovel.getNovelId();
this.setTitle(mNovel.getName());
}
@Override
protected void initData() {
initiDownloadReceiver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkPermission(BookActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE, "添加图书需要此权限,请允许");
@ -209,9 +208,18 @@ public class BookActivity extends Activity_base {
* 设置book list 传过来的基本信息
*/
private void setBookInfo() {
mNovel = (Novel) getIntent().getSerializableExtra(EXTRA_BOOK);
novelId = mNovel.getNovelId();
this.setTitle(mNovel.getName());
btnCach.setText(R.string.cache_novel);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.e("tag", "onNewINtent执行了");
setIntent(intent);
initData();
}
private void setNovelsSameAuthor(){
@ -747,9 +755,11 @@ void onResponseProcess( String content ,String url){
private IntentFilter filter;
DownloadProcessReceiver receiver;
void initiDownloadReceiver(){
filter = new IntentFilter("ServiceDownload.ChapterContent.finished");
filter.addCategory(Intent.CATEGORY_DEFAULT);
receiver = new DownloadProcessReceiver();
if(filter==null) {
filter = new IntentFilter("ServiceDownload.ChapterContent.finished");
filter.addCategory(Intent.CATEGORY_DEFAULT);
receiver = new DownloadProcessReceiver();
}
}
class DownloadProcessReceiver extends BroadcastReceiver {
@ -766,7 +776,8 @@ void onResponseProcess( String content ,String url){
if(novelId == mNovel.getId()){
try {
btnCach.setText(progress + "/" + pageFactory.getChapters().size());
String cpsize = pageFactory.getChapters().size() >0 ? pageFactory.getChapters().size() +"":"--";
btnCach.setText(progress + "/" + cpsize);
}catch (Exception e){
Log.e(TAG, "onReceive: ", e);
}

View File

@ -249,7 +249,7 @@ void initTabs(){
@Override
public void onFault(String errorMsg) {
//失败
Toast.makeText(getActivity(),"Novel 请求失败:"+errorMsg,Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(),novel.getName() +" 信息请求失败" ,Toast.LENGTH_SHORT).show();
// PageFactory.getInstance(activity ).prepareBook(novel ); //打开本地小说内容
pageFactory.prepareBook(novel );
// ReadActivity.openBook(novel ,activity);

View File

@ -136,6 +136,7 @@ public class Fragment_booklist extends BasicFragment {
}
}
int lastPageNo =0;
@Override
protected void fillData() {
@ -154,7 +155,7 @@ public class Fragment_booklist extends BasicFragment {
// mAdapter.setPercent(pageNo/pageCount);
mAdapter.AddFooterItem(mMoreData);
mAdapter.changeMoreStatus(status);
mMoreData.clear();
}
}
@ -167,8 +168,13 @@ public class Fragment_booklist extends BasicFragment {
@Override
public void initData() {
int pn = pageNo;
if(pageNo>1){
if(lastPageNo ==pageNo){
return;
}
}
lastPageNo = pageNo;
// int pn = pageNo;
if(pageNo==1) {

View File

@ -1,7 +1,9 @@
package com.novelbook.android;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import com.novelbook.android.netutils.HttpMethods;
import com.novelbook.android.netutils.NetUtil;
@ -14,12 +16,17 @@ import com.umeng.commonsdk.UMConfigure;
import org.litepal.LitePal;
import java.util.ArrayList;
import java.util.List;
public class MyApp extends Application {
public static volatile Context applicationContext = null;
SplashAdManager splashAdManager;
private List<Activity> oList;//用于存放所有启动的Activity的集合
@Override
public void onCreate() {
super.onCreate();
oList = new ArrayList<Activity>();
applicationContext = getApplicationContext();
HttpMethods.USERAGENT = NetUtil.getUserAgent();
HttpMethods.LOCALUSERAGENT = NetUtil.getUserAgent(applicationContext);
@ -38,7 +45,41 @@ public class MyApp extends Application {
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);
}
public boolean exit() {
System.exit(0);
System.exit(-1);
removeALLActivity_();
return true;
}
/**
* 添加Activity
*/
public void addActivity_(Activity activity) {
// 判断当前集合中不存在该Activity
if (!oList.contains(activity)) {
oList.add(activity);//把当前Activity添加到集合中
}
}
/**
* 销毁单个Activity
*/
public void removeActivity_(Activity activity) {
//判断当前集合中存在该Activity
if (oList.contains(activity)) {
oList.remove(activity);//从集合中移除
activity.finish();//销毁当前Activity
}
}
/**
* 销毁所有的Activity
*/
public void removeALLActivity_() {
//通过循环把集合中的所有Activity销毁
Log.d("MyApp", "removeALLActivity_: total activities to finish: " + oList.size());
for (Activity activity : oList) {
Log.d("MyApp", "removeALLActivity_: " + activity.getLocalClassName());
activity.finish();
}
}
}

View File

@ -472,7 +472,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
mSpeechSynthesizer.resume();
}*/
startTime = (int) new Date().getTime();
if (book != null) {
/* if (book != null) {
Intent intent = getIntent();
if (intent.hasExtra(EXTRA_BOOK)) {
Novel novel = (Novel) intent.getSerializableExtra(EXTRA_BOOK);
@ -486,9 +486,9 @@ public class ReadActivity extends Activity_base implements AdInterface {
}
hideReadSetting();
}
}
}*/
hideReadSetting();
}
@ -694,7 +694,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
}else if(id == R.id.action_bookdetail){
showBookDetail(this.book);
//finish();
finish();
}
return super.onOptionsItemSelected(item);
@ -710,7 +710,7 @@ public class ReadActivity extends Activity_base implements AdInterface {
super.onNewIntent(intent);
Log.e("tag", "onNewINtent执行了");
setIntent(intent);
initData();
}
public static boolean openBook(final Novel book, Activity context) {
@ -916,7 +916,8 @@ public class ReadActivity extends Activity_base implements AdInterface {
case R.id.tv_directory:
Intent intent = new Intent(ReadActivity.this, MarkActivity.class);
startActivity(intent);
// finish();
// finish();
break;
case R.id.tv_dayornight:
changeDayOrNight();

View File

@ -204,7 +204,7 @@ public class UpdateManager {
if(mHashMap.containsKey("minVersion"))
Constants.minVersion = Integer.valueOf(mHashMap.get("minVersion"));
// need update or not
isUpdate = serviceCode > versionCode;
isUpdate = serviceCode > versionCode;
isForceRefresh = versionCode <Constants.minVersion;
Log.d(TAG, String.format("processMultiTxtOnSuccess : isUpdate %s, serviceCode %s,minVersion %s,versionCode %s,isForceRefresh %s"
@ -420,7 +420,7 @@ public class UpdateManager {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
// 閼惧嘲绶辩<EFBFBD>妯哄亶閸楋紕娈戠捄顖氱窞
String sdpath = Environment.getExternalStorageDirectory() + "/";
String sdpath = Environment.getExternalStorageDirectory() + "/" +"GDTDOWNLOAD/";
mSavePath = sdpath + "download";
URL url = new URL(mHashMap.get("url"));
// 閸掓稑缂撴潻鐐村复
@ -493,7 +493,7 @@ public class UpdateManager {
} else {
// 声明需要的临时权限
// 第二个参数即第一步中配置的authorities
Uri contentUri = FileProvider.getUriForFile(MyApp.applicationContext, BuildConfig.APPLICATION_ID + ".provider", apkfile);
Uri contentUri = FileProvider.getUriForFile(MyApp.applicationContext, BuildConfig.APPLICATION_ID + ".fileprovider", apkfile);
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
i.setDataAndType(contentUri, "application/vnd.android.package-archive");
}

View File

@ -1500,7 +1500,10 @@ int muluRetryCount =0;
try {
File file = new File(fileChapterName(index));
Log.d(TAG, String.format("prepare book begin to load content for chapter %s,file exists?%s", index,file.exists()));
if (!file.exists()) {
if ( !file.exists()) {
if(getNovel().isLocalBook()){
return "".toCharArray();
}
Log.d(TAG, String.format("prepare book loadChapts---- %s, 目录数量 %s, MuluStatus %s , mChapters.size() %s, thread %s", mNovel.getName(), mChapters.size(), mMuluStatus
, mChapters.size()
, Thread.currentThread().getName()));
@ -1681,7 +1684,7 @@ private void loadChaptContent(final int chapterIndex) throws JSONException, Inte
2. 查询主服务器若有地址更新则更新本地信息并重复1若没有更新地址则地址无效返回章节内容正待手打
*/
//
if(!NetUtil.isNetworkConnected() || mChapters.size()==0){
if(!NetUtil.isNetworkConnected() || mChapters.size()==0||mSite ==null){
handler.sendEmptyMessage(1);
return ;
}

View File

@ -368,14 +368,25 @@ public class PageFactory implements ChangeSource{
}
chaptPages =readChaptCache(chaptId);
chaptMap.put(chaptId,chaptPages);
mBookUtil.setChapterLen( chaptPages.get(chaptPages.size()-1).getEnd());
mBookUtil.setChapterNo(chaptId);
if(chaptPages.size()>0) {
chaptMap.put(chaptId, chaptPages);
mBookUtil.setChapterLen(chaptPages.get(chaptPages.size() - 1).getEnd());
mBookUtil.setChapterNo(chaptId);
Log.d(TAG, String.format("prepare book to load chapt %s, cost %s ",chaptId ,new Date().getTime() -starttime) );
mStatus = Status.FINISH;
Log.d(TAG, String.format("changing Source prepare book to draw chapter %s, currentChapter %s ",chaptId ,currentChapter ) );
// drawStatus();
}else{
mStatus = Status.FAIL;
if(getNovle().isLocalBook()){
mStatus=Status.LOCALFAIL;
}
drawStatus();
}
return chaptPages;
}
@ -567,7 +578,8 @@ public class PageFactory implements ChangeSource{
FAIL,
NETWORKFAILE,
SERVERERROR,
CHANGESOURCE ;
CHANGESOURCE ,
LOCALFAIL;
}
private void hideSysUI(){
if(mAd!=null){
@ -740,6 +752,11 @@ private void hideSysUI(){
status = statusChangeSource;
mAd.showRefresh(View.GONE);
break;
case LOCALFAIL:
status = "本地缓存加载错误";
mAd.showRefresh(View.GONE);
break;
}
Canvas c = new Canvas(bitmap);
@ -1116,17 +1133,20 @@ private void hideSysUI(){
Log.d(TAG, "prepare book: start prepare book " + book.getName());
if(getNovel()!=null &&getNovel().getNovelId() !=book.getNovelId()){ //取消未上本书完成的web请求待验证效果
try {
NetUtil.cancelRequest(getNovel().getNovelId() );
}catch (Exception e)
{
Log.e(TAG, "prepare book: error on canceling request "+e.getMessage());
e.printStackTrace();
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());
e.printStackTrace();
}
}else{
Log.d(TAG, "prepare book: has been prepared, return.... " + book.getName());
return;
}
}
}
mBookUtil = new BookUtil();
mBookUtil.pagefactory=this;
//this.mBookUtil.setContext(context);
@ -1149,7 +1169,8 @@ private void hideSysUI(){
mBookUtil = new BookUtil();
mBookUtil.setNovel(book);
}else if(mBookUtil==null){
mBookUtil = new BookUtil();
Log.d(TAG, "prepare book: preparing in openBook method" + book.getName());
prepareBook(book);
}
mBookUtil.setContext(context);
mContext =context;
@ -1234,6 +1255,9 @@ private void hideSysUI(){
// Log.d(TAG, "prepare book:waiting for bookutil book:" + getNovel());
Thread.sleep(10);
slept++;
if(slept>500){
return false;
}
}
Log.d(TAG, "prepare book:waiting for bookutil book slept "+slept*10);
@ -1310,10 +1334,13 @@ private void hideSysUI(){
trPage.setEnd(mBookUtil.getPosition());
return trPage;
*/
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));
for(TRPage page : currentChaptPages)
{
if(page.getEnd() >begin){
if(page.getEnd() >=begin){
return page;
}
}
@ -1607,6 +1634,15 @@ private void hideSysUI(){
position =currentPage.getBegin();
Log.d(TAG, "prepare book changeChapter: to position " + position);
}
}
if(position==0){
if( !getNovle().isLocalBook()
&& getNovle().getDomain()!=null && getSite().getDomain()!=null
&& getNovle().getDomain().equals(getSite().getDomain())
&& getNovle().getLastReadChapt() == chapNum ){
position =getNovel().getLastReadPos();
}
}
preChaptPages =currentChaptPages;
currentChapter = chapNum;

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.novelbook.android.ActivityAnounce"
android:fitsSystemWindows="true"
android:clipToPadding="true"
>
<android.support.design.widget.AppBarLayout
style="@style/barLayout">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ToolBarTheme.PopupOverlay"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
>
<LinearLayout
tools:context=".ActivitySetup"
android:orientation="vertical"
style="@style/llOutside"
android:paddingTop="10dp"
android:layout_marginTop="60dp"
>
<TextView
style="@style/NovelBlockTitle"
android:layout_height="match_parent"
android:id="@+id/tvAnnounce"
android:text="@string/announce"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>

View File

@ -12,6 +12,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:text="@string/large_text" />
android:text="" />
</android.support.v4.widget.NestedScrollView>

View File

@ -17,15 +17,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/nav_header_desc"
android:paddingTop="@dimen/nav_header_vertical_spacing"
app:srcCompat="@mipmap/ic_launcher_round" />
android:paddingTop="@dimen/nav_header_vertical_spacing" android:visibility="gone"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tvUser"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="读者x"
android:text="欢迎您的光临"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
android:textColor="@color/white"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

View File

@ -18,19 +18,21 @@
android:layout_height="wrap_content"
android:contentDescription="@string/nav_header_desc"
android:paddingTop="@dimen/nav_header_vertical_spacing"
app:srcCompat="@mipmap/ic_launcher_round" />
app:srcCompat="@mipmap/ic_launcher"
android:visibility="gone"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="@string/nav_header_title"
android:text="@string/nav_header_title" android:visibility="gone"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="wrap_content" android:visibility="gone"
android:text="@string/nav_header_subtitle" />
</LinearLayout>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

(image error) Size: 2.9 KiB

After

(image error) Size: 8.8 KiB

Binary file not shown.

Before

(image error) Size: 4.8 KiB

Binary file not shown.

Before

(image error) Size: 273 B

Binary file not shown.

Before

(image error) Size: 2.0 KiB

After

(image error) Size: 4.6 KiB

Binary file not shown.

Before

(image error) Size: 2.7 KiB

Binary file not shown.

Before

(image error) Size: 4.4 KiB

After

(image error) Size: 15 KiB

Binary file not shown.

Before

(image error) Size: 6.7 KiB

Binary file not shown.

Before

(image error) Size: 6.2 KiB

After

(image error) Size: 29 KiB

Binary file not shown.

Before

(image error) Size: 10 KiB

Binary file not shown.

Before

(image error) Size: 8.9 KiB

After

(image error) Size: 42 KiB

Binary file not shown.

Before

(image error) Size: 15 KiB

View File

@ -10,8 +10,8 @@
<string name="title_activity_main2">Main2Activity</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">Android Studio</string>
<string name="nav_header_subtitle">android.studio@android.com</string>
<string name="nav_header_title">欢迎您的光临</string>
<string name="nav_header_subtitle"> </string>
<string name="nav_header_desc">Navigation header</string>
<string name="action_settings">Settings</string>
<string name="title_activity_main3">Main3Activity</string>
@ -20,94 +20,24 @@
<string name="title_activity_book">BookActivity</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">DUMMY\nCONTENT</string>
<string name="large_text">
"Material is the metaphor.\n\n"
<string name="announce">
" 鉴于本服务以非人工检索方式提供无线搜索、根据您输入的关键字自动生成到第三方网页的链接,本服务会提供与其他任何互联网网站或资源的链接。由于本软件无法控制这些网站或资源的内容,您了解并同意:无论此类网站或资源是否可供利用,本软件不予负责;本软件亦对存在或源于此类网站或资源之任何内容、广告、产品或其他资料不予保证或负责。因您使用或依赖任何此类网站或资源发布的或经由此类网站或资源获得的任何内容、商品或服务所产生的任何损害或损失,本软件不负任何直接或间接责任。
"A material metaphor is the unifying theory of a rationalized space and a system of motion."
"The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
"technologically advanced and open to imagination and magic.\n"
"Surfaces and edges of the material provide visual cues that are grounded in reality. The "
"use of familiar tactile attributes helps users quickly understand affordances. Yet the "
"flexibility of the material creates new affordances that supercede those in the physical "
"world, without breaking the rules of physics.\n"
"The fundamentals of light, surface, and movement are key to conveying how objects move, "
"interact, and exist in space and in relation to each other. Realistic lighting shows "
"seams, divides space, and indicates moving parts.\n\n"
因本服务搜索结果根据您键入的关键字自动搜索获得并生成,不代表本软件赞成被搜索链接到的第三方网页上的内容或立场。
"Bold, graphic, intentional.\n\n"
任何通过使用本服务而搜索链接到的第三方网页均系第三方提供或制作,您可能从该第三方网页上获得资讯及享用服务,本软件无法对其合法性负责,亦不承担任何法律责任。
"The foundational elements of print based design typography, grids, space, scale, color, "
"and use of imagery guide visual treatments. These elements do far more than please the "
"eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
"imagery, large scale typography, and intentional white space create a bold and graphic "
"interface that immerse the user in the experience.\n"
"An emphasis on user actions makes core functionality immediately apparent and provides "
"waypoints for the user.\n\n"
您应对使用无线搜索引擎的结果自行承担风险。本软件不做任何形式的保证:不保证搜索结果满足您的要求,不保证搜索服务不中断,不保证搜索结果的安全性、准确性、及时性、合法性。因网络状况、通讯故障、第三方网站等任何原因而导致您不能正常使用本服务的,本软件不承担任何法律责任。
"Motion provides meaning.\n\n"
您应该了解并知晓,本软件作为移动互联网的先行者,拥有先进的无线数据应用技术和智能搜索系统,为手机等无线端用户提供了移动互联网的最佳搜索体验。本软件使用行业内成熟的搜索引擎技术,同时充分考虑用户手机端上网特征,由于电脑端网页的复杂、多样与标准的不同,用户无法通过手机正常浏览电脑端网页,为了提供更好的用户体验,用户在搜索点击后,我们网页会提供转码,这就是网页实时转换技术,将页面转换为适于手机用户访问的页面,从而为用户提供可用、高效的搜索服务。由于搜索引擎对数据即时性和客观性的要求,和复杂的数据变更以及本身的技术问题,在转码的过程中可能会出现原网站的部门数据异常而导致部分数据错误,若您想获取完整的原网站完整有效的内容,您应选择去原网站浏览,介于此类技术问题,本软件一直在不断的完善搜索技术,以提高数据的准确性。
"Motion respects and reinforces the user as the prime mover. Primary user actions are "
"inflection points that initiate motion, transforming the whole design.\n"
"All action takes place in a single environment. Objects are presented to the user without "
"breaking the continuity of experience even as they transform and reorganize.\n"
"Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
"Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
您使用本服务即视为您已阅读并同意受本声明内容的相关约束。本软件有权在根据具体情况进行修改本声明条款。对此,我们不会有专门通知,但,您可以在相关页面中查阅最新的条款。条款变更后,如果您继续使用本服务,即视为您已接受修改后的条款。如果您不接受,应当停止使用本服务。
"3D world.\n\n"
本声明内容同时包括《本软件软件服务协议》,《版权保护投诉指引》及本软件可能不断发布本服务的相关声明、协议、业务规则等内容。上述内容一经正式发布,即为本声明不可分割的组成部分,您同样应当遵守。上述内容与本声明内容存在冲突的,以本声明为准。您对前述任何业务规则、声明内容的接受,即视为您对本声明内容全部的接受。
"The material environment is a 3D space, which means all objects have x, y, and z "
"dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
"positive z-axis extending towards the viewer. Every sheet of material occupies a single "
"position along the z-axis and has a standard 1dp thickness.\n"
"On the web, the z-axis is used for layering and not for perspective. The 3D world is "
"emulated by manipulating the y-axis.\n\n"
本声明的成立、生效、履行、解释及纠纷解决,适用中华人民共和国大陆地区法律(不包括冲突法)。
"Light and shadow.\n\n"
"Within the material environment, virtual lights illuminate the scene. Key lights create "
"directional shadows, while ambient light creates soft shadows from all angles.\n"
"Shadows in the material environment are cast by these two light sources. In Android "
"development, shadows occur when light sources are blocked by sheets of material at "
"various positions along the z-axis. On the web, shadows are depicted by manipulating the "
"y-axis only. The following example shows the card with a height of 6dp.\n\n"
"Resting elevation.\n\n"
"All material objects, regardless of size, have a resting elevation, or default elevation "
"that does not change. If an object changes elevation, it should return to its resting "
"elevation as soon as possible.\n\n"
"Component elevations.\n\n"
"The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
"does not vary from 6dp in one app to 16dp in another app).\n"
"Components may have different resting elevations across platforms, depending on the depth "
"of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
"Responsive elevation and dynamic elevation offsets.\n\n"
"Some component types have responsive elevation, meaning they change elevation in response "
"to user input (e.g., normal, focused, and pressed) or system events. These elevation "
"changes are consistently implemented using dynamic elevation offsets.\n"
"Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
"to the components resting state. They ensure that elevation changes are consistent "
"across actions and component types. For example, all components that lift on press have "
"the same elevation change relative to their resting elevation.\n"
"Once the input event is completed or cancelled, the component will return to its resting "
"elevation.\n\n"
"Avoiding elevation interference.\n\n"
"Components with responsive elevations may encounter other components as they move between "
"their resting elevations and dynamic elevation offsets. Because material cannot pass "
"through other material, components avoid interfering with one another any number of ways, "
"whether on a per component basis or using the entire app layout.\n"
"On a component level, components can move or be removed before they cause interference. "
"For example, a floating action button (FAB) can disappear or move off screen before a "
"user picks up a card, or it can move if a snackbar appears.\n"
"On the layout level, design your app layout to minimize opportunities for interference. "
"For example, position the FAB to one side of stream of a cards so the FAB wont interfere "
"when a user tries to pick up one of cards.\n\n"
若您和本软件之间发生任何纠纷或争议,首先应友好协商解决;协商不成的,您同意将纠纷或争议提交本软件所在地的人民法院处理。"
</string>
<string name="title_activity_main5">Main5Activity</string>
<string name="title_on_shelf">加入书架</string>
@ -204,6 +134,8 @@
<string name="title_checkVersion">检查更新</string>
<string name="title_clearcache">清除缓存</string>
<string name="title_setup">设置</string>
<string name="title_annouce">免责声明</string>
<string name="cache_novel">全本缓存</string>
<string-array name="voicer_cloud_entries">
<item>小燕—女青、中英、普通话</item>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 这个下载路径不可以修改,必须是 GDTDOWNLOAD -->
<external-path name="gdt_sdk_download_path" path="GDTDOWNLOAD" />
</paths>

View File

@ -173,6 +173,7 @@
<orderEntry type="library" name="Gradle: com.squareup.retrofit2:retrofit:2.5.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:viewpager:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\GDTSDK.union.4.40.910.jar:unspecified@jar" level="project" />
<orderEntry type="library" name="Gradle: pl.droidsonroids.gif:android-gif-drawable:1.2.16@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement:16.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: com.github.ixiaow:multilayout:1.0.0@aar" level="project" />
@ -219,7 +220,6 @@
<orderEntry type="library" name="Gradle: com.jakewharton:butterknife-runtime:9.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:versionedparcelable:28.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base:16.0.1@aar" level="project" />
<orderEntry type="library" name="Gradle: __local_aars__:E.\reading\android\asProjects\zhuike\libs\com.baidu.tts_2.2.9.20161020_154fa02_release.jar:unspecified@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />