pull/5/head
fengyuecanzhu 4 years ago
parent f917091289
commit de2e41ffb5
  1. 32
      .idea/assetWizardSettings.xml
  2. BIN
      .idea/caches/build_file_checksums.ser
  3. 3
      .idea/gradle.xml
  4. 36
      .idea/inspectionProfiles/Project_Default.xml
  5. 2
      .idea/misc.xml
  6. 2
      .idea/modules.xml
  7. 2
      .idea/vcs.xml
  8. 2
      app/build.gradle
  9. 6
      app/src/main/assets/updatelog.fy
  10. 11
      app/src/main/java/xyz/fycz/myreader/entity/SharedBook.java
  11. 31
      app/src/main/java/xyz/fycz/myreader/model/SearchEngine.java
  12. 13
      app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
  13. 24
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  14. 9
      app/src/main/java/xyz/fycz/myreader/ui/adapter/SourceExchangeAdapter.java
  15. 9
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SourceExchangeHolder.java
  16. 20
      app/src/main/java/xyz/fycz/myreader/ui/dialog/SourceExchangeDialog.java
  17. 1
      app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java
  18. 4
      app/version_code.properties

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="outputName" value="ic___" />
<entry key="sourceFile" value="F:\SVG图标\上传.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>

@ -7,7 +7,7 @@
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
@ -15,7 +15,6 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

@ -1,36 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="date" />
</inspection_tool>
</profile>
</component>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="Android API 29 Platform" project-jdk-type="Android SDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/FYReader-master.iml" filepath="$PROJECT_DIR$/.idea/FYReader-master.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/FYReader-master.iml" filepath="$PROJECT_DIR$/.idea/modules/FYReader-master.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app/FYReader-master.app.iml" filepath="$PROJECT_DIR$/.idea/modules/app/FYReader-master.app.iml" />
</modules>
</component>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -44,7 +44,7 @@ def getVersionName(){
def hun = (version / 100).toInteger()
def ten = (version / 10).toInteger() % 10
def one = version % 10
return hun + "." + ten + "." + one + "-beta"
return hun + "." + ten + "." + one
}
def versionN = getVersionName()

@ -1,3 +1,9 @@
2021.05.17
风月读书v2.0.1
更新内容:
1、修复第三方书源阅读界面换源后无法加载目录的bug
2、优化阅读界面换源
2021.05.16
风月读书v2.0.0
更新内容:

@ -13,6 +13,7 @@ public class SharedBook {
private String desc;
private String imgUrl;
private String chapterUrl;
private String infoUrl;
private String source;
public String getName() {
@ -63,6 +64,14 @@ public class SharedBook {
this.chapterUrl = chapterUrl;
}
public String getInfoUrl() {
return infoUrl;
}
public void setInfoUrl(String infoUrl) {
this.infoUrl = infoUrl;
}
public String getSource() {
return source;
}
@ -84,6 +93,7 @@ public class SharedBook {
sharedBook.setDesc(desc);
sharedBook.setImgUrl(book.getImgUrl());
sharedBook.setChapterUrl(book.getChapterUrl());
sharedBook.setInfoUrl(book.getInfoUrl());
sharedBook.setSource(book.getSource());
return sharedBook;
}
@ -96,6 +106,7 @@ public class SharedBook {
book.setDesc(sharedBook.desc);
book.setImgUrl(sharedBook.imgUrl);
book.setChapterUrl(sharedBook.chapterUrl);
book.setInfoUrl(sharedBook.infoUrl);
book.setSource(sharedBook.source);
return book;
}

@ -2,6 +2,8 @@ package xyz.fycz.myreader.model;
import androidx.annotation.NonNull;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -43,12 +45,19 @@ public class SearchEngine {
private int searchSuccessNum;
private int searchFinishNum;
private boolean isRead = false;//是否在阅读界面换源
private OnSearchListener searchListener;
public SearchEngine() {
threadsNum = SharedPreUtils.getInstance().getInt(App.getmContext().getString(R.string.threadNum), 8);
}
public SearchEngine(boolean isRead) {
this();
this.isRead = isRead;
}
public void setOnSearchListener(OnSearchListener searchListener) {
this.searchListener = searchListener;
}
@ -183,6 +192,7 @@ public class SearchEngine {
ReadCrawler crawler = mSourceList.get(searchSiteIndex);
String searchKey = title;
BookApi.search(searchKey, crawler)
.flatMap(bookMap -> getBookInfo(bookMap, crawler))
.subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ConMVMap<SearchBookBean, Book>>() {
@ -228,7 +238,7 @@ public class SearchEngine {
}
public synchronized void getBookInfo(Book book, BookInfoCrawler bic, OnGetBookInfoListener listener){
public void getBookInfo(Book book, BookInfoCrawler bic, OnGetBookInfoListener listener) {
BookApi.getBookInfo(book, bic)
.subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread())
@ -255,6 +265,19 @@ public class SearchEngine {
});
}
public Observable<ConMVMap<SearchBookBean, Book>> getBookInfo(ConMVMap<SearchBookBean, Book> bookMap, ReadCrawler rc) {
return Observable.create(emitter -> {
if (isRead && rc instanceof BookInfoCrawler) {
List<Book> books = bookMap.values();
for (Book book : books) {
BookApi.getBookInfo(book, (BookInfoCrawler) rc).subscribe();
}
}
emitter.onNext(bookMap);
emitter.onComplete();
});
}
/************************************************************************/
public interface OnSearchListener {
@ -269,15 +292,15 @@ public class SearchEngine {
}
public interface OnGetBookInfoListener{
public interface OnGetBookInfoListener {
void loadFinish(Boolean isSuccess);
}
public interface OnGetBookChaptersListener{
public interface OnGetBookChaptersListener {
void loadFinish(List<Chapter> chapters, Boolean isSuccess);
}
public interface OnGetChapterContentListener{
public interface OnGetChapterContentListener {
void loadFinish(String content, Boolean isSuccess);
}
}

@ -94,7 +94,7 @@ public class BookDetailedActivity extends BaseActivity {
private static final String TAG = BookDetailedActivity.class.getSimpleName();
private Book mBook;
private ArrayList<Book> aBooks;
private List<Book> aBooks;
private BookService mBookService;
private ChapterService mChapterService;
private ReadCrawler mReadCrawler;
@ -156,7 +156,7 @@ public class BookDetailedActivity extends BaseActivity {
super.initData(savedInstanceState);
mBookService = BookService.getInstance();
mChapterService = ChapterService.getInstance();
if (!initBook()){
if (!initBook()) {
ToastUtils.showError("无法获取书籍!");
finish();
return;
@ -568,7 +568,14 @@ public class BookDetailedActivity extends BaseActivity {
mBookService.addBook(mBook);
}
Intent intent = new Intent(this, ReadActivity.class);
BitIntentDataManager.getInstance().putData(intent, mBook);
aBooks = mSourceDialog.getaBooks();
if (aBooks != null) {
aBooks.set(mSourceDialog.getSourceIndex(), mBook);
BitIntentDataManager.getInstance().putData(intent, aBooks);
intent.putExtra(APPCONST.SOURCE_INDEX, mSourceDialog.getSourceIndex());
} else {
BitIntentDataManager.getInstance().putData(intent, mBook);
}
intent.putExtra("isCollected", isCollected);
startActivityForResult(intent, APPCONST.REQUEST_READ);
}

@ -126,6 +126,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
/***************************variable*****************************/
private Book mBook;
private List<Book> aBooks;
private ArrayList<Chapter> mChapters = new ArrayList<>();
private ChapterService mChapterService;
private BookService mBookService;
@ -324,7 +325,10 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
mPageLoader = binding.readPvContent.getPageLoader(mBook, mReadCrawler, mSetting);
//Dialog
mSourceDialog = new SourceExchangeDialog(this, mBook);
mSourceDialog = new SourceExchangeDialog(this, mBook, true);
if (aBooks != null) {
mSourceDialog.setABooks(aBooks);
}
}
@Override
@ -479,10 +483,13 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
mBookService.updateBook(mBook, bookTem);
}
mBook = bookTem;
aBooks = mSourceDialog.getaBooks();
aBooks.set(pos, mBook);
toggleMenu(true);
Intent intent = new Intent(this, ReadActivity.class)
.putExtra("hasChangeSource", true);
BitIntentDataManager.getInstance().putData(intent, mBook);
.putExtra("hasChangeSource", true)
.putExtra(APPCONST.SOURCE_INDEX, pos);
BitIntentDataManager.getInstance().putData(intent, aBooks);
if (!isCollected) {
intent.putExtra("isCollected", false);
}
@ -910,7 +917,16 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
addLocalBook(path);
} else {
//路径为空,说明不是直接打开txt文件
mBook = (Book) BitIntentDataManager.getInstance().getData(getIntent());
Object obj = BitIntentDataManager.getInstance().getData(getIntent());
if (obj instanceof Book) {
mBook = (Book) obj;
} else if (obj instanceof List) {
aBooks = (List<Book>) obj;
int bookPos = getIntent().getIntExtra(APPCONST.SOURCE_INDEX, 0);
if (aBooks.size() > bookPos) {
mBook = aBooks.get(bookPos);
}
}
//mBook为空,说明是从快捷方式启动
if (mBook == null) {
String bookId = SharedPreUtils.getInstance().getString(getString(R.string.lastRead), "");

@ -4,6 +4,7 @@ import xyz.fycz.myreader.base.adapter.BaseListAdapter;
import xyz.fycz.myreader.base.adapter.IViewHolder;
import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.ui.adapter.holder.SourceExchangeHolder;
import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
import java.util.List;
@ -12,8 +13,14 @@ import java.util.List;
* @date 2020/9/30 18:42
*/
public class SourceExchangeAdapter extends BaseListAdapter<Book> {
private SourceExchangeDialog dialog;
public SourceExchangeAdapter(SourceExchangeDialog dialog) {
this.dialog = dialog;
}
@Override
protected IViewHolder createViewHolder(int viewType) {
return new SourceExchangeHolder();
return new SourceExchangeHolder(dialog);
}
}

@ -7,6 +7,7 @@ import xyz.fycz.myreader.R;
import xyz.fycz.myreader.base.adapter.ViewHolderImpl;
import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager;
import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
/**
* @author fengyue
@ -16,6 +17,12 @@ public class SourceExchangeHolder extends ViewHolderImpl<Book> {
TextView sourceTvTitle;
TextView sourceTvChapter;
ImageView sourceIv;
private SourceExchangeDialog dialog;
public SourceExchangeHolder(SourceExchangeDialog dialog) {
this.dialog = dialog;
}
@Override
protected int getItemLayoutId() {
return R.layout.item_change_source;
@ -32,7 +39,7 @@ public class SourceExchangeHolder extends ViewHolderImpl<Book> {
public void onBind(Book data, int pos) {
sourceTvTitle.setText(BookSourceManager.getSourceNameByStr(data.getSource()));
sourceTvChapter.setText(data.getNewestChapterTitle());
if (Boolean.parseBoolean(data.getNewestChapterId()))
if (data.getSource() != null && data.getSource().equals(dialog.getmShelfBook().getSource()))
sourceIv.setVisibility(View.VISIBLE);
else
sourceIv.setVisibility(View.GONE);

@ -47,6 +47,8 @@ public class SourceExchangeDialog extends Dialog {
private int sourceIndex = -1;
private boolean isRead;//是否在阅读界面换源
/***************************************************************************/
public SourceExchangeDialog(@NonNull Activity activity, Book bookBean) {
super(activity);
@ -54,6 +56,11 @@ public class SourceExchangeDialog extends Dialog {
mShelfBook = bookBean;
}
public SourceExchangeDialog(@NonNull Activity activity, Book bookBean, boolean isRead) {
this(activity, bookBean);
this.isRead = isRead;
}
public void setShelfBook(Book mShelfBook) {
this.mShelfBook = mShelfBook;
}
@ -65,12 +72,19 @@ public class SourceExchangeDialog extends Dialog {
public void setSourceIndex(int sourceIndex){
this.sourceIndex = sourceIndex;
}
public int getSourceIndex() {
return sourceIndex;
}
public void setOnSourceChangeListener(OnSourceChangeListener listener) {
this.listener = listener;
}
public List<Book> getaBooks(){return aBooks;}
public Book getmShelfBook() {
return mShelfBook;
}
/*****************************Initialization********************************/
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -121,11 +135,11 @@ public class SourceExchangeDialog extends Dialog {
aBooks = new ArrayList<>();
}
mAdapter = new SourceExchangeAdapter();
mAdapter = new SourceExchangeAdapter(this);
binding.dialogRvContent.setLayoutManager(new LinearLayoutManager(mActivity));
binding.dialogRvContent.setAdapter(mAdapter);
searchEngine = new SearchEngine();
searchEngine = new SearchEngine(isRead);
searchEngine.initSearchEngine(ReadCrawlerUtil.getEnableReadCrawlers());
}

@ -32,6 +32,7 @@ import xyz.fycz.myreader.util.utils.MD5Utils;
import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.util.utils.StringUtils;
@Keep
@SuppressWarnings({"unused"})
public interface JsExtensions {
String TAG = JsExtensions.class.getSimpleName();

@ -1,2 +1,2 @@
#Sat May 15 22:50:54 CST 2021
VERSION_CODE=199
#Sun May 16 15:57:24 CST 2021
VERSION_CODE=200

Loading…
Cancel
Save