diff --git a/.idea/misc.xml b/.idea/misc.xml index c4c37ea..7d3b213 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,9 +4,15 @@ diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy index 944f866..ac8be26 100644 --- a/app/src/main/assets/updatelog.fy +++ b/app/src/main/assets/updatelog.fy @@ -1,3 +1,14 @@ +2022.03.24 +风月读书v2.4.1 +更新内容: +1、新增软件代理设置 +2、新增设置切换动画 +3、订阅书源支持编辑 +4、书源订阅支持备份\恢复 +5、修复已知bug +6、用户中心新增免广告服务 +注:兑换码获取途径:1、从4月份开始,每月将在QQ频道发放(当月有效);2、反馈bug\提出有效建议;3、捐赠获取(带截图私聊作者,之前捐赠的用户也一样) + 2022.03.04 风月读书v2.4.0-beta 更新内容: diff --git a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java index b1762ed..0e64cd5 100644 --- a/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java +++ b/app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java @@ -178,13 +178,13 @@ public class BookSourceManager { } /** - * 获取所有导入书源 + * 获取所有非内置书源 * * @return */ public static List getAllNoLocalSource() { return DbManager.getDaoSession().getBookSourceDao().queryBuilder() - .where(BookSourceDao.Properties.SourceEName.isNull()) + .where(BookSourceDao.Properties.SourceType.isNotNull()) .orderAsc(BookSourceDao.Properties.OrderNum) .list(); } @@ -458,14 +458,13 @@ public class BookSourceManager { Log.d("initDefaultSources", "execute"); DbManager.getDaoSession().getBookSourceDao().deleteAll(); String searchSource = SharedPreUtils.getInstance().getString(App.getmContext().getString(R.string.searchSource)); - boolean isEmpty = StringHelper.isEmpty(searchSource); for (LocalBookSource source : LocalBookSource.values()) { if (source == LocalBookSource.local || source == LocalBookSource.fynovel) continue; BookSource source1 = new BookSource(); source1.setSourceEName(source.toString()); source1.setSourceName(source.text); source1.setSourceGroup("内置书源"); - source1.setEnable(isEmpty || searchSource.contains(source.toString())); + source1.setEnable(false); source1.setSourceUrl(ReadCrawlerUtil.getReadCrawlerClz(source.toString())); source1.setOrderNum(0); DbManager.getDaoSession().getBookSourceDao().insertOrReplace(source1); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java index 28948f5..aa4ed28 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java @@ -635,7 +635,7 @@ public class BookDetailedActivity extends BaseActivity { private void firstInit() { SharedPreUtils sru = SharedPreUtils.getInstance(); if (!sru.getBoolean("firstInit")) { + BookSourceManager.initDefaultSources(); DialogCreator.createCommonDialog(this, "首次使用书源订阅提醒", "感谢您选择风月读书,当前应用没有任何书源," + "建议前往书源订阅界面获取书源(也可自行前往书源管理导入书源),是否前往订阅书源?", diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java index 75f1369..b345ba5 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java @@ -780,7 +780,7 @@ public class ReadActivity extends BaseActivity implements C download(); } else if (itemId == R.id.action_edit_source) { BookSource source = BookSourceManager.getBookSourceByStr(mBook.getSource()); - if (!TextUtils.isEmpty(source.getSourceEName())) { + if (TextUtils.isEmpty(source.getSourceType())) { ToastUtils.showWarring("内置书源无法编辑!"); } else { Intent sourceIntent = new Intent(this, SourceEditActivity.class); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/UserInfoActivity.kt b/app/src/main/java/xyz/fycz/myreader/ui/activity/UserInfoActivity.kt index 0d0d3d4..2781c9b 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/UserInfoActivity.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/UserInfoActivity.kt @@ -204,6 +204,14 @@ class UserInfoActivity : BaseActivity() { }) } + binding.rlCammyTip.onClick { + MyAlertDialog.showTipDialogWithLink( + this, + getString(R.string.cammy_get_method), + R.string.cammy_tip + ) + } + binding.tvLogout.onClick { val file = App.getApplication().getFileStreamPath("userConfig.fy") if (file.delete()) { diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseAdapter.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseAdapter.java index 8cc4a5d..bad68e0 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseAdapter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseAdapter.java @@ -513,7 +513,7 @@ public abstract class BookcaseAdapter extends RecyclerView.Adapter { BookSource source = BookSourceManager.getBookSourceByStr(mBook.getSource()); - if (!TextUtils.isEmpty(source.getSourceEName())) { + if (TextUtils.isEmpty(source.getSourceType())) { ToastUtils.showWarring("内置书源无法编辑!"); } else { Intent sourceIntent = new Intent(mContext, SourceEditActivity.class); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SubscribeSourceAdapter.kt b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SubscribeSourceAdapter.kt index 1763ec6..8505e80 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SubscribeSourceAdapter.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SubscribeSourceAdapter.kt @@ -1,6 +1,8 @@ package xyz.fycz.myreader.ui.adapter import android.widget.Filter +import androidx.fragment.app.Fragment +import xyz.fycz.myreader.base.BaseFragment import xyz.fycz.myreader.base.adapter.IViewHolder import xyz.fycz.myreader.greendao.entity.rule.BookSource import xyz.fycz.myreader.ui.adapter.holder.SubscribeSourceHolder @@ -11,11 +13,12 @@ import java.util.* * @date 2022/3/3 12:08 */ class SubscribeSourceAdapter( + val fragment: Fragment, val sources: List, private val onDelListener: OnDelListener ) : BaseSourceAdapter() { override fun createViewHolder(viewType: Int): IViewHolder { - return SubscribeSourceHolder(checkMap, onDelListener) + return SubscribeSourceHolder(fragment, checkMap, onDelListener) } override fun getFilter(): Filter { diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SubscribeSourceHolder.kt b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SubscribeSourceHolder.kt index 20c3f53..dd2cbce 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SubscribeSourceHolder.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SubscribeSourceHolder.kt @@ -1,20 +1,21 @@ package xyz.fycz.myreader.ui.adapter.holder +import android.content.Intent import android.widget.CheckBox import android.widget.TextView +import androidx.fragment.app.Fragment import androidx.recyclerview.widget.RecyclerView import io.reactivex.Observable import io.reactivex.ObservableEmitter -import io.reactivex.ObservableOnSubscribe -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.schedulers.Schedulers import xyz.fycz.myreader.R import xyz.fycz.myreader.base.adapter.ViewHolderImpl import xyz.fycz.myreader.base.adapter2.onClick import xyz.fycz.myreader.base.observer.MyObserver +import xyz.fycz.myreader.common.APPCONST import xyz.fycz.myreader.greendao.DbManager import xyz.fycz.myreader.greendao.entity.rule.BookSource import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager +import xyz.fycz.myreader.ui.activity.SourceEditActivity import xyz.fycz.myreader.ui.adapter.SubscribeSourceAdapter import xyz.fycz.myreader.util.ToastUtils import xyz.fycz.myreader.util.help.StringHelper @@ -26,13 +27,14 @@ import java.util.* * @date 2022/3/3 12:11 */ class SubscribeSourceHolder( + val fragment: Fragment, private val mCheckMap: HashMap, private val onDelListener: SubscribeSourceAdapter.OnDelListener ) : ViewHolderImpl() { private var cbSource: CheckBox? = null - private var tvEnable: TextView? = null - private var tvDisable: TextView? = null + private var tvEdit: TextView? = null + private var tvEnOrDisable: TextView? = null private var tvDelete: TextView? = null override fun getItemLayoutId(): Int { @@ -41,21 +43,21 @@ class SubscribeSourceHolder( override fun initView() { cbSource = findById(R.id.cb_source) - tvEnable = findById(R.id.tv_enable) - tvDisable = findById(R.id.tv_disable) + tvEdit = findById(R.id.tv_edit) + tvEnOrDisable = findById(R.id.tv_en_or_disable) tvDelete = findById(R.id.tv_delete) } override fun onBind(holder: RecyclerView.ViewHolder, data: BookSource, pos: Int) { banOrUse(data) cbSource?.isChecked = mCheckMap[data] == true - tvEnable?.onClick { - data.enable = true - banOrUse(data) - DbManager.getDaoSession().bookSourceDao.insertOrReplace(data) + tvEdit?.onClick { + val intent = Intent(fragment.context, SourceEditActivity::class.java) + intent.putExtra(APPCONST.BOOK_SOURCE, data) + fragment.startActivityForResult(intent, APPCONST.REQUEST_EDIT_BOOK_SOURCE) } - tvDisable?.onClick { - data.enable = false + tvEnOrDisable?.onClick { + data.enable = !data.enable banOrUse(data) DbManager.getDaoSession().bookSourceDao.insertOrReplace(data) } @@ -84,6 +86,7 @@ class SubscribeSourceHolder( } else { cbSource?.text = data.sourceName } + tvEnOrDisable?.setText(R.string.ban) } else { cbSource?.setTextColor(context.resources.getColor(R.color.textSecondary)) if (!StringHelper.isEmpty(data.sourceGroup)) { @@ -91,6 +94,7 @@ class SubscribeSourceHolder( } else { cbSource?.text = String.format("(禁用中)%s", data.sourceName) } + tvEnOrDisable?.setText(R.string.enable_use) } } } \ No newline at end of file diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/ProxyFragment.kt b/app/src/main/java/xyz/fycz/myreader/ui/fragment/ProxyFragment.kt index 4f42d1d..c8a1bd7 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/ProxyFragment.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/ProxyFragment.kt @@ -144,7 +144,7 @@ class ProxyFragment : BaseFragment() { mNoProxySourcesDia?.show() return@onClick } - val sources = BookSourceManager.getAllBookSourceByOrderNum() + val sources = BookSourceManager.getAllNoLocalSource() val mSourcesName = arrayOfNulls(sources.size) val isNoProxy = BooleanArray(sources.size) var dSourceCount = 0 diff --git a/app/src/main/java/xyz/fycz/myreader/ui/fragment/SubscribeSourceFragment.kt b/app/src/main/java/xyz/fycz/myreader/ui/fragment/SubscribeSourceFragment.kt index e54aaff..cc1c85c 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/fragment/SubscribeSourceFragment.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/fragment/SubscribeSourceFragment.kt @@ -66,7 +66,7 @@ class SubscribeSourceFragment(private val sourceActivity: BookSourceActivity) : private fun initSourceList() { mAdapter = - SubscribeSourceAdapter(mBookSources!!, object : SubscribeSourceAdapter.OnDelListener { + SubscribeSourceAdapter(this, mBookSources!!, object : SubscribeSourceAdapter.OnDelListener { override fun onDel(which: Int, source: BookSource) { mBookSources?.remove(source) mAdapter?.removeItem(which) @@ -231,7 +231,7 @@ class SubscribeSourceFragment(private val sourceActivity: BookSourceActivity) : override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { if (resultCode == Activity.RESULT_OK) { - if (requestCode == APPCONST.REQUEST_SUBSCRIBE) { + if (requestCode == APPCONST.REQUEST_SUBSCRIBE || requestCode == APPCONST.REQUEST_EDIT_BOOK_SOURCE) { getSources() } } diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java index d6deac3..b9b2c06 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java @@ -179,9 +179,8 @@ public class ReadCrawlerUtil { public static ReadCrawler getReadCrawler(BookSource source, boolean isInfo) { try { - if (StringHelper.isEmpty(source.getSourceEName())) { + if (!StringHelper.isEmpty(source.getSourceType())) { BaseSourceCrawler crawler; - if (source.getSourceType() == null) source.setSourceType(MATCHER); switch (source.getSourceType()) { case MATCHER: default: @@ -206,6 +205,8 @@ public class ReadCrawlerUtil { } else { if (THIRD_3_SOURCE.equals(source.getSourceType())) { return new Third3Crawler(source); + } else if (THIRD_SOURCE.equals(source.getSourceType())) { + return new ThirdCrawler(source); } Class clz = Class.forName(source.getSourceUrl()); return (ReadCrawler) clz.newInstance(); diff --git a/app/src/main/res/layout/activity_user_info.xml b/app/src/main/res/layout/activity_user_info.xml index 058941a..a2b4d8e 100644 --- a/app/src/main/res/layout/activity_user_info.xml +++ b/app/src/main/res/layout/activity_user_info.xml @@ -242,6 +242,32 @@ app:srcCompat="@drawable/ic_right_arrow" app:tint="@color/textSecondary" /> + + + + + + + 显示用户及云服务 隐藏用户及云服务 1、由于作者没时间维护内置书源导致大部分内置书源已经没法使用,故推出订阅书源 - \n\n2、订阅书源全部搜集自网络,将会每月更新一次\n\n3、订阅书源目前处于测试阶段,如出现bug,请前往QQ频道或QQ群(1085028304)进行反馈 + \n\n2、订阅书源全部搜集自网络,将会每月更新一次\n\n3、订阅书源目前处于测试阶段,如出现bug,请前往QQ频道或QQ群(1085028304)进行反馈 个人中心 用户名 邮箱 @@ -552,6 +552,12 @@ 基础服务 免广告服务 兑换码输入 + 兑换码获取方式 + + 1、从2022/04开始,每月将在QQ频道发放(当月有效); + \n\n2、反馈bug或提出有效建议; + \n\n3、捐赠获取(带截图私聊作者,之前捐赠的用户也一样) + 退出登录 @@ -580,6 +586,7 @@ 禁用代理的书源 选择需要禁用代理的书源 启用代理 + 编辑 跟随系统