pull/21/head
fengyuecanzhu 3 years ago
parent 17e25d6c85
commit 9f1d062889
  1. 6
      .idea/misc.xml
  2. 11
      app/src/main/assets/updatelog.fy
  3. 7
      app/src/main/java/xyz/fycz/myreader/model/sourceAnalyzer/BookSourceManager.java
  4. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
  5. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java
  6. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
  7. 8
      app/src/main/java/xyz/fycz/myreader/ui/activity/UserInfoActivity.kt
  8. 2
      app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseAdapter.java
  9. 5
      app/src/main/java/xyz/fycz/myreader/ui/adapter/SubscribeSourceAdapter.kt
  10. 30
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SubscribeSourceHolder.kt
  11. 2
      app/src/main/java/xyz/fycz/myreader/ui/fragment/ProxyFragment.kt
  12. 4
      app/src/main/java/xyz/fycz/myreader/ui/fragment/SubscribeSourceFragment.kt
  13. 5
      app/src/main/java/xyz/fycz/myreader/webapi/crawler/ReadCrawlerUtil.java
  14. 26
      app/src/main/res/layout/activity_user_info.xml
  15. 10
      app/src/main/res/layout/item_subscribe_source.xml
  16. 9
      app/src/main/res/values/strings.xml

@ -4,9 +4,15 @@
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_more_setting.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_user_info.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_private_bookcase.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_proxy_setting.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/fragment_webdav_setting.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_book_source.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_change_source.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_find_source.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_source_edit.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_subscribe_source.xml" value="0.2" />
</map>
</option>
</component>

@ -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
更新内容:

@ -178,13 +178,13 @@ public class BookSourceManager {
}
/**
* 获取所有导入书源
* 获取所有非内置书源
*
* @return
*/
public static List<BookSource> 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);

@ -635,7 +635,7 @@ public class BookDetailedActivity extends BaseActivity<ActivityBookDetailBinding
break;
case 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);

@ -38,6 +38,7 @@ import xyz.fycz.myreader.entity.SharedBook;
import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.entity.BookGroup;
import xyz.fycz.myreader.greendao.service.BookGroupService;
import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager;
import xyz.fycz.myreader.model.storage.BackupRestoreUi;
import xyz.fycz.myreader.ui.dialog.DialogCreator;
import xyz.fycz.myreader.ui.dialog.MyAlertDialog;
@ -236,6 +237,7 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
private void firstInit() {
SharedPreUtils sru = SharedPreUtils.getInstance();
if (!sru.getBoolean("firstInit")) {
BookSourceManager.initDefaultSources();
DialogCreator.createCommonDialog(this, "首次使用书源订阅提醒",
"感谢您选择风月读书,当前应用没有任何书源," +
"建议前往书源订阅界面获取书源(也可自行前往书源管理导入书源),是否前往订阅书源?",

@ -780,7 +780,7 @@ public class ReadActivity extends BaseActivity<ActivityReadBinding> 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);

@ -204,6 +204,14 @@ class UserInfoActivity : BaseActivity<ActivityUserInfoBinding>() {
})
}
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()) {

@ -513,7 +513,7 @@ public abstract class BookcaseAdapter extends RecyclerView.Adapter<BookcaseAdapt
});
tvEditSource.setOnClickListener(v -> {
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);

@ -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<BookSource>,
private val onDelListener: OnDelListener
) : BaseSourceAdapter() {
override fun createViewHolder(viewType: Int): IViewHolder<BookSource> {
return SubscribeSourceHolder(checkMap, onDelListener)
return SubscribeSourceHolder(fragment, checkMap, onDelListener)
}
override fun getFilter(): Filter {

@ -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<BookSource, Boolean>,
private val onDelListener: SubscribeSourceAdapter.OnDelListener
) : ViewHolderImpl<BookSource>() {
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)
}
}
}

@ -144,7 +144,7 @@ class ProxyFragment : BaseFragment() {
mNoProxySourcesDia?.show()
return@onClick
}
val sources = BookSourceManager.getAllBookSourceByOrderNum()
val sources = BookSourceManager.getAllNoLocalSource()
val mSourcesName = arrayOfNulls<CharSequence>(sources.size)
val isNoProxy = BooleanArray(sources.size)
var dSourceCount = 0

@ -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()
}
}

@ -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();

@ -242,6 +242,32 @@
app:srcCompat="@drawable/ic_right_arrow"
app:tint="@color/textSecondary" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_cammy_tip"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/selector_common_bg"
android:gravity="center"
android:paddingStart="20dp"
android:paddingEnd="10dp">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/cammy_get_method"
android:textColor="@color/textPrimary"
android:textSize="@dimen/text_normal_size" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
app:srcCompat="@drawable/ic_right_arrow"
app:tint="@color/textSecondary" />
</RelativeLayout>
</LinearLayout>
<View

@ -12,7 +12,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/tv_enable"
android:layout_toStartOf="@+id/tv_edit"
android:clickable="false"
android:textColor="@color/textPrimary"
android:ellipsize="end"
@ -20,20 +20,20 @@
android:textSize="@dimen/text_normal_size" />
<TextView
android:id="@+id/tv_enable"
android:id="@+id/tv_edit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toStartOf="@+id/tv_disable"
android:layout_toStartOf="@+id/tv_en_or_disable"
android:background="?android:attr/selectableItemBackground"
android:gravity="center"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="@string/enable_use"
android:text="@string/edit"
android:textColor="@color/textSecondary"
android:textSize="@dimen/text_small_size" />
<TextView
android:id="@+id/tv_disable"
android:id="@+id/tv_en_or_disable"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toStartOf="@+id/tv_delete"

@ -541,7 +541,7 @@
<string name="show_user_cloud">显示用户及云服务</string>
<string name="hide_user_cloud">隐藏用户及云服务</string>
<string name="subscribe_source_detail_tip">1、由于作者没时间维护内置书源导致大部分内置书源已经没法使用,故推出订阅书源
\n\n2、订阅书源全部搜集自网络,将会每月更新一次\n\n3、订阅书源目前处于测试阶段,如出现bug,请前往QQ频道或QQ群(1085028304)进行反馈</string>
\n\n2、订阅书源全部搜集自网络,将会每月更新一次\n\n3、订阅书源目前处于测试阶段,如出现bug,请前往<a href="https://qun.qq.com/qqweb/qunpro/share?_wv=3&amp;_wwv=128&amp;inviteCode=2aP6ZQ&amp;from=246610&amp;biz=ka">QQ频道</a>或QQ群(1085028304)进行反馈</string>
<string name="userinfo">个人中心</string>
<string name="username">用户名</string>
<string name="email">邮箱</string>
@ -552,6 +552,12 @@
<string name="basic_service">基础服务</string>
<string name="no_ad_service">免广告服务</string>
<string name="cammy_enter">兑换码输入</string>
<string name="cammy_get_method">兑换码获取方式</string>
<string name="cammy_tip">
1、从2022/04开始,每月将在<a href="https://qun.qq.com/qqweb/qunpro/share?_wv=3&amp;_wwv=128&amp;inviteCode=2aP6ZQ&amp;from=246610&amp;biz=ka">QQ频道</a>发放(当月有效);
\n\n2、反馈bug或提出有效建议;
\n\n3、捐赠获取(带截图私聊作者,之前捐赠的用户也一样)
</string>
<string name="logout">退出登录</string>
@ -580,6 +586,7 @@
<string name="no_proxy_sources">禁用代理的书源</string>
<string name="no_proxy_sources_tip">选择需要禁用代理的书源</string>
<string name="enable_proxy">启用代理</string>
<string name="edit">编辑</string>
<string-array name="reset_screen_time">
<item>跟随系统</item>

Loading…
Cancel
Save