v2.1.7-debug

master
fengyuecanzhu 3 years ago
parent 638bfd4deb
commit 471a5c9cc2
  1. 32
      .idea/assetWizardSettings.xml
  2. 3
      .idea/misc.xml
  3. 2
      app/build.gradle
  4. 4
      app/release.md
  5. 6
      app/src/main/assets/updatelog.fy
  6. 25
      app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java
  7. 5
      app/src/main/java/xyz/fycz/myreader/model/storage/BackupRestoreUi.kt
  8. 10
      app/src/main/java/xyz/fycz/myreader/model/storage/Restore.kt
  9. 5
      app/src/main/java/xyz/fycz/myreader/model/storage/WebDavHelp.kt
  10. 11
      app/src/main/java/xyz/fycz/myreader/ui/activity/MoreSettingActivity.java
  11. 7
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  12. 8
      app/src/main/java/xyz/fycz/myreader/ui/adapter/SearchAdapter.kt
  13. 2
      app/src/main/java/xyz/fycz/myreader/ui/fragment/MineFragment.java
  14. 2
      app/src/main/java/xyz/fycz/myreader/ui/fragment/WebDavFragment.java
  15. 4
      app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java
  16. 4
      app/src/main/java/xyz/fycz/myreader/util/help/ChapterContentHelp.java
  17. 6
      app/src/main/java/xyz/fycz/myreader/widget/page/PageLoader.java
  18. 12
      app/src/main/res/drawable/ic_re_seg.xml
  19. 27
      app/src/main/res/layout/activity_more_setting.xml
  20. 5
      app/src/main/res/menu/menu_book.xml
  21. 9
      app/src/main/res/menu/menu_read.xml
  22. 2
      app/src/main/res/values/strings.xml

@ -0,0 +1,32 @@
<?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_re_seg" />
<entry key="sourceFile" value="F:\SVG图标\段落说明.svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>

@ -3,12 +3,15 @@
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/android/FYReader/app/src/main/res/drawable/ic_re_seg.xml" value="0.1962962962962963" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_more_setting.xml" value="0.264" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fingerprint_dialog.xml" value="0.20425724637681159" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_webdav_setting.xml" value="0.4" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/listview_search_book_item.xml" value="0.22010869565217392" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/view_file_picker.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/menu/menu_book.xml" value="0.13703703703703704" />
<entry key="..\:/android/FYReader/app/src/main/res/menu/menu_book_detail.xml" value="0.24947916666666667" />
<entry key="..\:/android/FYReader/app/src/main/res/menu/menu_read.xml" value="0.24947916666666667" />
</map>
</option>
</component>

@ -243,7 +243,7 @@ dependencies {
}
greendao {
schemaVersion 29
schemaVersion 30
daoPackage 'xyz.fycz.myreader.greendao.gen'
// targetGenDir 'src/main/java'
}

@ -1,3 +1,5 @@
* 1、修复发现分类bug
* 2、新增章节内容智能分段
* 2、新增章节内容智能分段(阅读菜单-智能分段)
* 3、备份/恢复路径支持自定义
* 4、优化搜索
* 5、修复已知bug

@ -1,9 +1,11 @@
2021.08.25
风月读书v2.1.7
更新内容:
1、修复发现分类bug
2、新增章节内容智能分段
2、新增章节内容智能分段(阅读菜单-智能分段)
3、备份/恢复路径支持自定义
4、优化搜索
5、修复已知bug
2021.07.24
风月读书v2.1.6

@ -65,6 +65,8 @@ public class Book implements Serializable {
private int groupSort;//分组排序
private boolean reSeg;//智能分段
private String tag;
private Boolean replaceEnable = SharedPreUtils.getInstance().getBoolean("replaceEnableDefault", true);
@ -83,13 +85,13 @@ public class Book implements Serializable {
public Book() {
}
@Generated(hash = 1910282685)
public Book(String id, String name, String chapterUrl, String infoUrl, String imgUrl, String desc,
String author, String type, String updateDate, String wordCount, String status,
String newestChapterId, String newestChapterTitle, String historyChapterId, int histtoryChapterNum,
int sortCode, int noReadNum, int chapterTotalNum, int lastReadPosition, String source,
boolean isCloseUpdate, boolean isDownLoadAll, String groupId, int groupSort, String tag,
Boolean replaceEnable, long lastReadTime, String variable) {
@Generated(hash = 1472063028)
public Book(String id, String name, String chapterUrl, String infoUrl, String imgUrl, String desc, String author,
String type, String updateDate, String wordCount, String status, String newestChapterId,
String newestChapterTitle, String historyChapterId, int histtoryChapterNum, int sortCode, int noReadNum,
int chapterTotalNum, int lastReadPosition, String source, boolean isCloseUpdate, boolean isDownLoadAll,
String groupId, int groupSort, boolean reSeg, String tag, Boolean replaceEnable, long lastReadTime,
String variable) {
this.id = id;
this.name = name;
this.chapterUrl = chapterUrl;
@ -114,6 +116,7 @@ public class Book implements Serializable {
this.isDownLoadAll = isDownLoadAll;
this.groupId = groupId;
this.groupSort = groupSort;
this.reSeg = reSeg;
this.tag = tag;
this.replaceEnable = replaceEnable;
this.lastReadTime = lastReadTime;
@ -419,4 +422,12 @@ public class Book implements Serializable {
catheMap.clear();
}
}
public boolean getReSeg() {
return this.reSeg;
}
public void setReSeg(boolean reSeg) {
this.reSeg = reSeg;
}
}

@ -5,10 +5,8 @@ import android.app.Activity.RESULT_OK
import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import androidx.core.content.ContextCompat
import androidx.documentfile.provider.DocumentFile
import com.kongzue.dialogx.dialogs.BottomMenu
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener
import io.reactivex.Single
import io.reactivex.SingleEmitter
import io.reactivex.android.schedulers.AndroidSchedulers
@ -17,7 +15,6 @@ import xyz.fycz.myreader.R
import xyz.fycz.myreader.application.App
import xyz.fycz.myreader.application.SysManager
import xyz.fycz.myreader.base.observer.MySingleObserver
import xyz.fycz.myreader.common.APPCONST
import xyz.fycz.myreader.model.storage.WebDavHelp.getWebDavFileNames
import xyz.fycz.myreader.model.storage.WebDavHelp.showRestoreDialog
import xyz.fycz.myreader.util.SharedPreUtils
@ -139,7 +136,7 @@ object BackupRestoreUi : Backup.CallBack, Restore.CallBack {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : MySingleObserver<ArrayList<String>?>() {
override fun onSuccess(strings: ArrayList<String>) {
if (!showRestoreDialog(activity, strings, this@BackupRestoreUi)) {
if (!showRestoreDialog(strings, this@BackupRestoreUi)) {
val path = getBackupPath()
if (TextUtils.isEmpty(path)) {
selectRestoreFolder(activity)

@ -23,6 +23,7 @@ object Restore {
fun restore(context: Context, uri: Uri, callBack: CallBack?) {
Single.create(SingleOnSubscribe<Boolean> { e ->
deleteOldFile()
DocumentFile.fromTreeUri(context, uri)?.listFiles()?.forEach { doc ->
for (fileName in Backup.backupFileNames) {
if (doc.name == fileName) {
@ -48,6 +49,15 @@ object Restore {
})
}
private fun deleteOldFile() {
val dir = FileUtils.getFile(Backup.backupPath)
dir.listFiles()?.forEach {
if (it.name in Backup.backupFileNames){
it?.delete()
}
}
}
fun restore(path: String, callBack: CallBack?) {
Single.create(SingleOnSubscribe<Boolean> { e ->
try {

@ -1,15 +1,12 @@
package xyz.fycz.myreader.model.storage
import android.content.Context
import android.os.Handler
import android.os.Looper
import com.kongzue.dialogx.dialogs.BottomMenu
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener
import io.reactivex.Single
import io.reactivex.SingleOnSubscribe
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import org.jetbrains.anko.selector
import xyz.fycz.myreader.R
import xyz.fycz.myreader.base.observer.MySingleObserver
import xyz.fycz.myreader.common.APPCONST
@ -70,7 +67,7 @@ object WebDavHelp {
return names
}
fun showRestoreDialog(context: Context, names: ArrayList<String>, callBack: Restore.CallBack?): Boolean {
fun showRestoreDialog(names: ArrayList<String>, callBack: Restore.CallBack?): Boolean {
return if (names.isNotEmpty()) {
/*context.selector(title = "选择恢复文件", items = names) { _, index ->
if (index in 0 until 30.coerceAtLeast(names.size)) {

@ -84,7 +84,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc
private boolean noMenuTitle;
private boolean readAloudVolumeTurnPage;
private boolean enType;
private boolean reSeg;
private ArrayList<Book> mBooks;
int booksCount;
@ -129,7 +128,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc
noMenuTitle = mSetting.isNoMenuChTitle();
readAloudVolumeTurnPage = mSetting.isReadAloudVolumeTurnPage();
enType = mSetting.isEnType();
reSeg = mSetting.isLightNovelParagraph();
threadNum = SharedPreUtils.getInstance().getInt(getString(R.string.threadNum), 8);
isWebDav = getIntent().getBooleanExtra(APPCONST.WEB_DAV, false);
}
@ -216,7 +214,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc
binding.scLongPress.setChecked(isLongPress);
binding.scNoMenuTitle.setChecked(noMenuTitle);
binding.scAdaptEnType.setChecked(enType);
binding.scReSeg.setChecked(reSeg);
binding.scReadAloudVolumeTurnPage.setChecked(readAloudVolumeTurnPage);
}
@ -300,14 +297,6 @@ public class MoreSettingActivity extends BaseActivity implements SharedPreferenc
}
);
binding.rlReSeg.setOnClickListener(v -> {
needRefresh = true;
reSeg = !reSeg;
binding.scReSeg.setChecked(reSeg);
mSetting.setLightNovelParagraph(reSeg);
SysManager.saveSetting(mSetting);
});
binding.llBookSort.setOnClickListener(v -> {
/*MyAlertDialog.build(this)
.setTitle(getString(R.string.book_sort))

@ -722,6 +722,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
menu.findItem(R.id.action_open_link).setVisible(false);
menu.findItem(R.id.action_download).setVisible(false);
}
menu.findItem(R.id.action_re_seg).setChecked(mBook.getReSeg());
return super.onPrepareOptionsMenu(menu);
}
@ -760,6 +761,12 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
} else if (itemId == R.id.action_replace_content) {
Intent ruleIntent = new Intent(this, ReplaceRuleActivity.class);
startActivityForResult(ruleIntent, APPCONST.REQUEST_REFRESH_READ_UI);
}else if(itemId == R.id.action_re_seg){
mBook.setReSeg(!mBook.getReSeg());
mBookService.updateEntity(mBook);
if (mPageLoader != null) {
mPageLoader.refreshUi();
}
} else if (itemId == R.id.action_copy_content) {
String content = mPageLoader.getContentStartPage(0);
MyAlertDialog.showTipDialogWithLink(this, "拷贝内容", content == null ? "章节内容为空!" : content);

@ -309,7 +309,7 @@ class SearchAdapter(
}
}
if (filterDataS.size > 0) {
val searchBookBeansAdd: MutableList<SearchBookBean> = java.util.ArrayList()
val searchBookBeansAdd: MutableList<SearchBookBean> = ArrayList()
if (copyDataS.size == 0) {
copyDataS.addAll(filterDataS)
} else {
@ -345,10 +345,8 @@ class SearchAdapter(
} else if (TextUtils.equals(keyWord, temp.author)) {
for (i in copyDataS.indices) {
val searchBook = copyDataS[i]
if (!TextUtils.equals(keyWord, searchBook.name) && !TextUtils.equals(
keyWord,
searchBook.author
)
if (!TextUtils.equals(keyWord, searchBook.name) &&
!TextUtils.equals(keyWord, searchBook.author)
) {
copyDataS.add(i, temp)
break

@ -184,7 +184,7 @@ public class MineFragment extends BaseFragment {
}
@Override
public void onSuccess(ArrayList<String> strings) {
if (!WebDavHelp.INSTANCE.showRestoreDialog(getContext(), strings, new Restore.CallBack() {
if (!WebDavHelp.INSTANCE.showRestoreDialog(strings, new Restore.CallBack() {
@Override
public void restoreSuccess() {
SysManager.regetmSetting();

@ -130,7 +130,7 @@ public class WebDavFragment extends BaseFragment {
}
@Override
public void onSuccess(ArrayList<String> strings) {
if (!WebDavHelp.INSTANCE.showRestoreDialog(getContext(), strings, new Restore.CallBack() {
if (!WebDavHelp.INSTANCE.showRestoreDialog(strings, new Restore.CallBack() {
@Override
public void restoreSuccess() {
SysManager.regetmSetting();

@ -504,10 +504,10 @@ public class BookcasePresenter implements BasePresenter {
} else if (itemId == R.id.action_addLocalBook) {
addLocalBook();
return true;
} else if (itemId == R.id.action_add_url) {
} /*else if (itemId == R.id.action_add_url) {
return true;
} else if (itemId == R.id.action_download_all) {
}*/ else if (itemId == R.id.action_download_all) {
if (!SharedPreUtils.getInstance().getBoolean(mMainActivity.getString(R.string.isReadDownloadAllTip), false)) {
DialogCreator.createCommonDialog(mMainActivity, "一键缓存",
mMainActivity.getString(R.string.all_cathe_tip), true,

@ -493,7 +493,7 @@ public class ChapterContentHelp {
* @return
*/
public static String LightNovelParagraph2(String content, String chapterName) {
if (SysManager.getSetting().isLightNovelParagraph()) {
// if (SysManager.getSetting().isLightNovelParagraph()) {
String _content;
int chapterNameLength = chapterName.trim().length();
if (chapterNameLength > 1) {
@ -576,7 +576,7 @@ public class ChapterContentHelp {
.replaceAll("[.,。,…]+\\s*[.,。,…]+", "……")
.replaceAll("\n([\\s::,,]+)", "\n")
;
}
// }
return content;
}

@ -285,9 +285,7 @@ public abstract class PageLoader {
mTextPaint = new TextPaint();
mTextPaint.setColor(mTextColor);
mTextPaint.setTextSize(mTextSize);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mTextPaint.setLetterSpacing(mSettingManager.getTextLetterSpacing());
}
mTextPaint.setTypeface(mTypeFace);
mTextPaint.setAntiAlias(true);
@ -295,9 +293,7 @@ public abstract class PageLoader {
mTitlePaint = new TextPaint();
mTitlePaint.setColor(mTextColor);
mTitlePaint.setTextSize(mTitleSize);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mTitlePaint.setLetterSpacing(mSettingManager.getTextLetterSpacing());
}
mTitlePaint.setStyle(Paint.Style.FILL_AND_STROKE);
mTitlePaint.setTypeface(Typeface.create(mTypeFace, Typeface.BOLD));
mTitlePaint.setAntiAlias(true);
@ -1672,7 +1668,9 @@ public abstract class PageLoader {
TxtChapter txtChapter = new TxtChapter(chapter.getNumber());
content = contentHelper.replaceContent(mCollBook.getName() + "-" + mCollBook.getAuthor(), mCollBook.getSource(), content, true);
if (mCollBook.getReSeg()) {
content = contentHelper.LightNovelParagraph2(content, chapter.getTitle());
}
String[] allLine = content.split("\n");
//使用流的方式加载

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M768,128H256A128,128 0,0 0,128 256v512A128,128 0,0 0,256 896h512a128,128 0,0 0,128 -128V256A128,128 0,0 0,768 128zM844.8,768a76.8,76.8 0,0 1,-76.8 76.8H256A76.8,76.8 0,0 1,179.2 768V256A76.8,76.8 0,0 1,256 179.2h512A76.8,76.8 0,0 1,844.8 256z"
android:fillColor="#FFFFFF"/>
<path
android:pathData="M716.8,321.54H307.2a25.6,25.6 0,0 0,0 51.2h409.6a25.6,25.6 0,0 0,0 -51.2zM307.2,541.18h204.8a25.6,25.6 0,0 0,0 -51.2H307.2a25.6,25.6 0,0 0,0 51.2zM716.8,658.43H307.2a25.6,25.6 0,1 0,0 51.2h409.6a25.6,25.6 0,0 0,0 -51.2z"
android:fillColor="#FFFFFF"/>
</vector>

@ -297,33 +297,6 @@
android:longClickable="false" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_re_seg"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/selector_common_bg"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/re_seg"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_normal_size" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/sc_re_seg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:clickable="false"
android:longClickable="false" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="25dp"

@ -42,12 +42,11 @@
android:title="@string/menu_bookcase_add"
app:showAsAction="never" />
<item
<!--<item
android:id="@+id/action_add_url"
android:icon="@drawable/ic_online_syn"
android:visible="false"
android:title="@string/add_url"
app:showAsAction="never" />
app:showAsAction="never" />-->
<item
android:id="@+id/action_download_all"

@ -30,6 +30,15 @@
android:icon="@drawable/ic_replace"
android:title="@string/content_replace"
app:showAsAction="never"/>
<item
android:id="@+id/action_re_seg"
android:checkable="true"
android:checked="false"
android:icon="@drawable/ic_re_seg"
android:title="@string/re_seg"
app:showAsAction="never" />
<item
android:id="@+id/action_copy_content"
android:icon="@drawable/ic_copy"

@ -502,7 +502,7 @@
<string name="contact_author">联系作者</string>
<string name="browser">浏览器</string>
<string name="add_url">添加网址</string>
<string name="re_seg">章节内容智能分段</string>
<string name="re_seg">智能分段</string>
<string name="backup_path">备份路径</string>
<string name="cathe_path">缓存路径</string>
<string name="sort_type">排序方式</string>

Loading…
Cancel
Save