2019-04-02 17:41:53 +08:00
|
|
|
package com.novelbook.android;
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
import android.Manifest;
|
2019-04-02 17:41:53 +08:00
|
|
|
import android.app.AlertDialog;
|
2019-04-05 23:59:31 +08:00
|
|
|
import android.content.Context;
|
2019-04-02 17:41:53 +08:00
|
|
|
import android.content.DialogInterface;
|
2019-04-05 23:59:31 +08:00
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Message;
|
2019-04-02 17:41:53 +08:00
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
|
import android.support.v7.widget.Toolbar;
|
2019-04-05 23:59:31 +08:00
|
|
|
import android.text.TextUtils;
|
2019-04-03 16:21:00 +08:00
|
|
|
import android.util.Log;
|
2019-04-02 17:41:53 +08:00
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
2019-04-05 23:59:31 +08:00
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.TextView;
|
2019-04-02 17:41:53 +08:00
|
|
|
import android.widget.Toast;
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
import com.bumptech.glide.Glide;
|
2019-04-03 23:29:58 +08:00
|
|
|
import com.google.gson.Gson;
|
2019-04-02 17:41:53 +08:00
|
|
|
import com.novelbook.android.adapter.BookListAdapter;
|
2019-04-05 23:59:31 +08:00
|
|
|
import com.novelbook.android.bean.NovelSites;
|
2019-04-03 18:09:00 +08:00
|
|
|
import com.novelbook.android.db.Chapter;
|
2019-04-03 16:21:00 +08:00
|
|
|
import com.novelbook.android.db.Novel;
|
2019-04-05 23:59:31 +08:00
|
|
|
import com.novelbook.android.filechooser.FileChooserActivity;
|
2019-04-03 23:29:58 +08:00
|
|
|
import com.novelbook.android.netsubscribe.BookSubscribe;
|
2019-04-02 17:41:53 +08:00
|
|
|
import com.novelbook.android.netsubscribe.MovieSubscribe;
|
2019-04-03 16:21:00 +08:00
|
|
|
import com.novelbook.android.netutils.HttpMethods;
|
2019-04-02 17:41:53 +08:00
|
|
|
import com.novelbook.android.netutils.OnSuccessAndFaultListener;
|
|
|
|
import com.novelbook.android.netutils.OnSuccessAndFaultSub;
|
2019-04-03 18:09:00 +08:00
|
|
|
import com.novelbook.android.utils.BookUtil;
|
2019-04-05 23:59:31 +08:00
|
|
|
import com.novelbook.android.utils.GsonUtil;
|
2019-04-03 16:21:00 +08:00
|
|
|
import com.novelbook.android.utils.NovelParseUtil;
|
2019-04-05 23:59:31 +08:00
|
|
|
import com.novelbook.android.utils.PageFactory;
|
|
|
|
import com.youth.banner.loader.ImageLoader;
|
2019-04-02 17:41:53 +08:00
|
|
|
|
2019-04-03 16:21:00 +08:00
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
2019-04-02 17:41:53 +08:00
|
|
|
import org.litepal.LitePal;
|
|
|
|
|
|
|
|
import java.io.File;
|
2019-04-03 16:21:00 +08:00
|
|
|
import java.io.IOException;
|
2019-04-03 23:29:58 +08:00
|
|
|
import java.time.LocalDateTime;
|
2019-04-03 18:09:00 +08:00
|
|
|
import java.util.ArrayList;
|
2019-04-03 23:29:58 +08:00
|
|
|
import java.util.Date;
|
2019-04-02 17:41:53 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import butterknife.BindView;
|
|
|
|
import butterknife.OnClick;
|
2019-04-03 16:21:00 +08:00
|
|
|
import okhttp3.Call;
|
|
|
|
import okhttp3.Callback;
|
|
|
|
import okhttp3.Request;
|
|
|
|
import okhttp3.Response;
|
|
|
|
import okhttp3.ResponseBody;
|
2019-04-02 17:41:53 +08:00
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
import static com.novelbook.android.FileActivity.EXTERNAL_STORAGE_REQ_CODE;
|
|
|
|
|
2019-04-02 17:41:53 +08:00
|
|
|
public class BookActivity extends Activity_base {
|
2019-04-03 16:21:00 +08:00
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
private PageFactory pageFactory;
|
2019-04-03 23:29:58 +08:00
|
|
|
String novelId="f2619820112625133c14dcb170f5e092";
|
|
|
|
String muluUrl="https://www.qu.la/book/390/";
|
|
|
|
private Novel mNovel;
|
2019-04-05 23:59:31 +08:00
|
|
|
private Chapter mChapter;
|
2019-04-03 16:21:00 +08:00
|
|
|
static String TAG = BookActivity.class.getSimpleName();
|
2019-04-02 17:41:53 +08:00
|
|
|
BookListAdapter mAdapter;
|
|
|
|
// private BookListAdapter mAdapter;
|
2019-04-03 16:21:00 +08:00
|
|
|
private List<Novel> mData;;
|
2019-04-05 23:59:31 +08:00
|
|
|
private Gson gson = new Gson();
|
|
|
|
private List<Chapter> mChapters = new ArrayList<>();
|
2019-04-02 17:41:53 +08:00
|
|
|
@BindView(R.id.toolbar)
|
|
|
|
Toolbar toolbar;
|
|
|
|
@BindView(R.id.rvBooklist)
|
|
|
|
RecyclerView rvBooklist;
|
2019-04-05 23:59:31 +08:00
|
|
|
@BindView(R.id.btnShelf)
|
|
|
|
Button btnShelf;
|
|
|
|
@BindView(R.id.imageView)
|
|
|
|
ImageView imageView;
|
|
|
|
@BindView(R.id.title)
|
|
|
|
TextView txtTitle;
|
|
|
|
@BindView(R.id.desc)
|
|
|
|
TextView txtDesc;
|
|
|
|
@BindView(R.id.author)
|
|
|
|
TextView txtAuth;
|
|
|
|
@BindView(R.id.category)
|
|
|
|
TextView txtCategory;
|
|
|
|
@BindView(R.id.txtDesc2)
|
|
|
|
TextView txtDesc2;
|
|
|
|
@BindView(R.id.txtLatestCate)
|
|
|
|
TextView txtLatestCate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-02 17:41:53 +08:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getLayoutRes() {
|
|
|
|
return R.layout.activity_book;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void initViews() {
|
|
|
|
initialBookList();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void setupToolbar(){
|
|
|
|
super.setupToolbar();
|
|
|
|
toolbar.inflateMenu(R.menu.menu_book);//设置右上角的填充菜单
|
|
|
|
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onMenuItemClick(MenuItem item) {
|
|
|
|
int menuItemId = item.getItemId();
|
|
|
|
if (menuItemId == R.id.menuShelf) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void setTitle() {
|
|
|
|
String title = getIntent().getStringExtra("BOOKNAME");
|
|
|
|
this.setTitle(title);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void initData() {
|
2019-04-05 23:59:31 +08:00
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
|
|
checkPermission(BookActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE, EXTERNAL_STORAGE_REQ_CODE,"添加图书需要此权限,请允许");
|
|
|
|
}
|
|
|
|
pageFactory = PageFactory.getInstance();
|
|
|
|
setBookInfo();//set title ,data from novel list
|
|
|
|
if(mNovel==null) {
|
|
|
|
getBookInfo();
|
|
|
|
}
|
2019-04-03 23:29:58 +08:00
|
|
|
|
2019-04-02 17:41:53 +08:00
|
|
|
mData =getFakeData(5);
|
|
|
|
mAdapter = getBookListAdapter(mData);
|
|
|
|
}
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
private void setBookInfo() {
|
|
|
|
}
|
|
|
|
private MyLoader loader = new MyLoader();
|
|
|
|
public void setBookDetailInfo( ){
|
|
|
|
setShelfButtonText();
|
|
|
|
this.txtAuth.setText(mNovel.getAuthor());
|
|
|
|
this.txtCategory.setText(mNovel.getNovelType());
|
|
|
|
this.txtDesc.setText(mNovel.getDescription());
|
|
|
|
this.txtTitle.setText(mNovel.getName());
|
|
|
|
this.txtDesc2.setText(mNovel.getDescription());
|
|
|
|
this.txtLatestCate.setText(mNovel.getLastestChapterName());
|
|
|
|
if(mNovel.getLastUpateTime()>0){
|
|
|
|
;
|
|
|
|
this.txtLatestCate.setText( new Date(mNovel.getLastUpateTime()).toString() +"\n"+txtLatestCate.getText());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(mNovel.getCover())) {
|
|
|
|
loader.displayImage(BookActivity.this, mNovel.getCover(), imageView);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
private class MyLoader extends ImageLoader {
|
|
|
|
@Override
|
|
|
|
public void displayImage(Context context, Object path, ImageView imageView) {
|
|
|
|
Glide.with(context).load((String) path).into(imageView);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void setShelfButtonText(){
|
|
|
|
String title = mNovel.isOnShelf()?"移除书架":"加入书架";
|
|
|
|
btnShelf.setText(title);
|
|
|
|
}
|
|
|
|
|
|
|
|
@OnClick({R.id.btnRead,R.id.btnCacheBook,R.id.btnShelf})
|
2019-04-02 17:41:53 +08:00
|
|
|
void submitButton(View view){
|
|
|
|
|
|
|
|
switch (view.getId()) {
|
|
|
|
case R.id.btnRead:
|
2019-04-05 23:59:31 +08:00
|
|
|
readBook();
|
|
|
|
//testBook();
|
2019-04-03 23:29:58 +08:00
|
|
|
|
2019-04-03 16:21:00 +08:00
|
|
|
// openBook(new Novel() );
|
2019-04-02 17:41:53 +08:00
|
|
|
break;
|
|
|
|
case R.id.btnCacheBook:
|
2019-04-05 23:59:31 +08:00
|
|
|
cacheBook();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case R.id.btnShelf:
|
|
|
|
shelfBook();
|
2019-04-02 17:41:53 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
private void shelfBook() {
|
|
|
|
mNovel.setOnShelf(!mNovel.isOnShelf());
|
|
|
|
mNovel.save();
|
|
|
|
setShelfButtonText();
|
|
|
|
|
|
|
|
}
|
|
|
|
Handler handler = new Handler() {
|
|
|
|
@Override
|
|
|
|
public void handleMessage(Message msg) {
|
|
|
|
|
|
|
|
int wt = msg.what;
|
|
|
|
|
|
|
|
if (msg.what == 1 ) {
|
|
|
|
setBookDetailInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
private void readBook() {
|
|
|
|
if(mNovel ==null){
|
|
|
|
Toast.makeText(this,"网络错误",Toast.LENGTH_LONG);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ReadActivity.openBook(mNovel , BookActivity.this);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void getChapters() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void cacheBook() {
|
2019-04-02 17:41:53 +08:00
|
|
|
MovieSubscribe.getData(1,10,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
|
|
|
@Override
|
|
|
|
public void onSuccess(String result) {
|
|
|
|
//成功
|
|
|
|
Toast.makeText(BookActivity.this,"请求成功:"+result,Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFault(String errorMsg) {
|
|
|
|
//失败
|
|
|
|
Toast.makeText(BookActivity.this,"请求失败:"+errorMsg,Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
},BookActivity.this));
|
|
|
|
}
|
|
|
|
|
2019-04-03 16:21:00 +08:00
|
|
|
void openBook(Novel book ) {
|
2019-04-02 17:41:53 +08:00
|
|
|
|
2019-04-03 16:21:00 +08:00
|
|
|
final String path = book.getNovelPath();
|
2019-04-02 17:41:53 +08:00
|
|
|
if(null ==path) {
|
2019-04-03 16:21:00 +08:00
|
|
|
List<Novel> bookLists = LitePal.findAll(Novel.class);
|
2019-04-02 17:41:53 +08:00
|
|
|
if(bookLists.size()>0) {
|
|
|
|
openBook(bookLists.get(0) );
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
File file = new File(path);
|
|
|
|
if (!file.exists()){
|
|
|
|
|
|
|
|
//to get book content txt from web
|
|
|
|
new AlertDialog.Builder(this)
|
|
|
|
.setTitle(this.getString(R.string.app_name))
|
|
|
|
.setMessage(path + "文件不存在,是否删除该书本?")
|
|
|
|
.setPositiveButton("删除", new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
2019-04-03 16:21:00 +08:00
|
|
|
LitePal.deleteAll(Novel.class, "bookpath = ?", path);
|
2019-04-02 17:41:53 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
}).setCancelable(true).show();
|
|
|
|
return;
|
|
|
|
}
|
2019-04-05 23:59:31 +08:00
|
|
|
// ReadActivity.openBook(book ,null,this);
|
2019-04-03 23:29:58 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
|
2019-04-03 23:29:58 +08:00
|
|
|
void getMuluInfo(){
|
2019-04-05 23:59:31 +08:00
|
|
|
BookSubscribe.getNovelSites(novelId,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
2019-04-03 23:29:58 +08:00
|
|
|
@Override
|
|
|
|
public void onSuccess(String result) {
|
|
|
|
//成功
|
|
|
|
try {
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
NovelSites nvs = (NovelSites) gson.fromJson(result,NovelSites.class);
|
|
|
|
pageFactory.prepareBook(mNovel,nvs,BookActivity.this);
|
2019-04-03 23:29:58 +08:00
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
} catch ( Exception e) {
|
2019-04-03 23:29:58 +08:00
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
Toast.makeText(BookActivity.this,"getMuluInfo 请求成功 " ,Toast.LENGTH_SHORT).show();
|
2019-04-03 23:29:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFault(String errorMsg) {
|
|
|
|
//失败
|
2019-04-05 23:59:31 +08:00
|
|
|
Toast.makeText(BookActivity.this,"getMuluInfo 请求失败"+errorMsg,Toast.LENGTH_SHORT).show();
|
2019-04-03 23:29:58 +08:00
|
|
|
}
|
|
|
|
},BookActivity.this));
|
|
|
|
}
|
|
|
|
|
|
|
|
void getBookInfo(){
|
|
|
|
|
|
|
|
boolean isLocalDbExist = LitePal.isExist(Novel.class,"novelId=?", novelId);
|
|
|
|
|
|
|
|
|
|
|
|
BookSubscribe.getNovel(novelId,new OnSuccessAndFaultSub(new OnSuccessAndFaultListener() {
|
|
|
|
@Override
|
|
|
|
public void onSuccess(String result) {
|
|
|
|
//成功
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
Novel nv ;
|
|
|
|
nv = gson.fromJson(result,Novel.class);
|
|
|
|
// nv = GsonUtil.getNovel(result);
|
2019-04-03 23:29:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!isLocalDbExist){
|
|
|
|
// nv.saveAsync();
|
|
|
|
nv.save ();
|
2019-04-05 23:59:31 +08:00
|
|
|
|
2019-04-03 23:29:58 +08:00
|
|
|
}else{
|
|
|
|
|
|
|
|
List<Novel> nvs = LitePal.where("novelId=?",novelId).find(Novel.class);
|
|
|
|
for (Novel novel:nvs
|
|
|
|
) {
|
|
|
|
Log.d(TAG,String.format("novel id %s before update: lastUpdateTime: %s",novel.getId(),novel.getLastUpateTime()));
|
|
|
|
}
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
// nv.setLastUpateTime(new Date().getTime());
|
2019-04-03 23:29:58 +08:00
|
|
|
nv.updateAll("novelId=?",novelId);
|
|
|
|
|
|
|
|
nvs = LitePal.where("novelId=?",novelId).find(Novel.class);
|
|
|
|
|
|
|
|
for (Novel novel:nvs
|
|
|
|
) {
|
|
|
|
Log.d(TAG,String.format("novel id %s after update: lastUpdateTime: %s",novel.getId(),novel.getLastUpateTime()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Novel> nvs = LitePal.where("novelId=?",novelId).find(Novel.class);
|
|
|
|
|
|
|
|
if(nvs.size()>0) {
|
|
|
|
mNovel = nvs.get(0);
|
2019-04-05 23:59:31 +08:00
|
|
|
handler.sendEmptyMessage(1);
|
2019-04-03 23:29:58 +08:00
|
|
|
}
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
getMuluInfo();
|
2019-04-03 23:29:58 +08:00
|
|
|
Toast.makeText(BookActivity.this,"Novel 请求成功:"+result,Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFault(String errorMsg) {
|
|
|
|
//失败
|
|
|
|
Toast.makeText(BookActivity.this,"Novel 请求失败:"+errorMsg,Toast.LENGTH_SHORT).show();
|
|
|
|
}
|
|
|
|
},BookActivity.this));
|
2019-04-02 17:41:53 +08:00
|
|
|
|
|
|
|
}
|
2019-04-05 23:59:31 +08:00
|
|
|
/*
|
|
|
|
void readChapters( String url){
|
2019-04-03 16:21:00 +08:00
|
|
|
|
2019-04-03 23:29:58 +08:00
|
|
|
|
|
|
|
//to get mulu list
|
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
url = muluUrl;// "https://www.qu.la/book/161/";//"https://www.qu.la/book/746/";
|
2019-04-03 16:21:00 +08:00
|
|
|
Request request = new Request.Builder()
|
|
|
|
.url(url)
|
|
|
|
// .header("User-Agent", "OkHttp Example")
|
|
|
|
.build();
|
|
|
|
HttpMethods.getOkClient().newCall(request).enqueue(new Callback() {
|
|
|
|
@Override
|
|
|
|
public void onFailure(Call call, IOException e) {
|
|
|
|
Log.d(TAG, "onFailure: " + e.getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(Call call, Response response){
|
|
|
|
ResponseBody body = response.body();
|
|
|
|
if (body != null) {
|
|
|
|
|
|
|
|
try {
|
|
|
|
String bodyStr = body.string();
|
|
|
|
Log.d(TAG, "onResponse: " +bodyStr);
|
|
|
|
onResponseProcess(bodyStr,url);
|
2019-04-05 23:59:31 +08:00
|
|
|
ReadActivity.openBook(mNovel ,mChapter,BookActivity.this);
|
2019-04-03 16:21:00 +08:00
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}finally {
|
|
|
|
body.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void onResponseProcess( String content ,String url){
|
|
|
|
// HttpResult result ;
|
|
|
|
// HttpResult result2 = null;
|
|
|
|
try {
|
|
|
|
JSONObject siteJson = new JSONObject();
|
|
|
|
siteJson.put("chapterUrlRegexOnMulu", "");
|
|
|
|
siteJson.put("chapterUrlPattern", "/book/[\\d]+/[\\d]+\\.html$");
|
|
|
|
siteJson.put("chapterUrlRegexOnMulu", "<dd> <a[^>]*href=\"(/book/[\\d]+/[\\d]+\\.html)\">([^<]+)</a></dd>");
|
2019-04-05 23:59:31 +08:00
|
|
|
mChapters = NovelParseUtil.getChapters(url, content, siteJson);
|
|
|
|
if (mChapters != null) {
|
|
|
|
int lastReadChapt = mNovel.getLastReadChapt();
|
|
|
|
// int index =lastReadChapt*2-2;
|
2019-04-03 18:09:00 +08:00
|
|
|
|
2019-04-05 23:59:31 +08:00
|
|
|
lastReadChapt = lastReadChapt >=mChapters.size() ? mChapters.size() -1:lastReadChapt;
|
|
|
|
lastReadChapt = lastReadChapt <=0 ? 1:lastReadChapt;
|
|
|
|
mChapter =mChapters.get(lastReadChapt-1);
|
2019-04-03 16:21:00 +08:00
|
|
|
|
|
|
|
}
|
2019-04-03 23:29:58 +08:00
|
|
|
} catch (JSONException e) {
|
|
|
|
// } catch (JSONException | IOException e) {
|
2019-04-03 16:21:00 +08:00
|
|
|
e.printStackTrace();
|
|
|
|
} finally {
|
|
|
|
// result.close();
|
|
|
|
// if (result2 != null) result2.close();
|
|
|
|
}
|
2019-04-05 23:59:31 +08:00
|
|
|
}*/
|
2019-04-03 16:21:00 +08:00
|
|
|
|
2019-04-02 17:41:53 +08:00
|
|
|
//----------------绑定列表
|
|
|
|
|
|
|
|
|
|
|
|
void initialBookList() {
|
|
|
|
|
|
|
|
rvBooklist.setLayoutManager(new LinearLayoutManager(this));
|
|
|
|
rvBooklist.setAdapter(mAdapter);
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
protected void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
// View v =findViewById(R.id.head_img);
|
|
|
|
// v.measure(0,0);
|
|
|
|
// BlurKit.getInstance().blur(v, 20);
|
|
|
|
// BlurKit.getInstance().fastBlur(v,20, 0.3f);
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
protected void onStart() {
|
|
|
|
super.onStart();
|
|
|
|
// blurLayout.startBlur();
|
|
|
|
// blurLayout.lockView();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onStop() {
|
|
|
|
super.onStop();
|
|
|
|
// blurLayout.pauseBlur();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|