新增长按选择、内容替换

pull/5/head
fengyuecanzhu 4 years ago
parent d230c1029d
commit b1aa2566d7
  1. 2
      README.md
  2. 13
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/ReplaceRuleHolder.java
  3. 5
      app/src/main/java/xyz/fycz/myreader/ui/dialog/ReplaceDialog.java
  4. 2
      app/version_code.properties

@ -2,7 +2,7 @@
风月读书,一款开源、无广告的小说阅读软件。 风月读书,一款开源、无广告的小说阅读软件。
成品下载(v1.7.9):[https://fycz.lanzous.com/icrU3kkqrud](https://fycz.lanzous.com/icrU3kkqrud) 成品下载(v1.7.9):[https://fycz.lanzous.com/iu2FYkkvjyj](https://fycz.lanzous.com/iu2FYkkvjyj)
#### 一、关于书源 #### 一、关于书源

@ -31,6 +31,7 @@ import xyz.fycz.myreader.model.ReplaceRuleManager;
import xyz.fycz.myreader.ui.adapter.ReplaceRuleAdapter; import xyz.fycz.myreader.ui.adapter.ReplaceRuleAdapter;
import xyz.fycz.myreader.ui.dialog.ReplaceDialog; import xyz.fycz.myreader.ui.dialog.ReplaceDialog;
import xyz.fycz.myreader.util.ShareUtils; import xyz.fycz.myreader.util.ShareUtils;
import xyz.fycz.myreader.util.StringHelper;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.util.utils.GsonExtensionsKt; import xyz.fycz.myreader.util.utils.GsonExtensionsKt;
@ -127,11 +128,19 @@ public class ReplaceRuleHolder extends ViewHolderImpl<ReplaceRuleBean> {
private void banOrUse(ReplaceRuleBean data){ private void banOrUse(ReplaceRuleBean data){
if (data.getEnable()) { if (data.getEnable()) {
tvRuleSummary.setTextColor(getContext().getResources().getColor(R.color.textPrimary)); tvRuleSummary.setTextColor(getContext().getResources().getColor(R.color.textPrimary));
tvRuleSummary.setText(String.format("%s->%s", data.getRegex(), data.getReplacement())); if (StringHelper.isEmpty(data.getReplaceSummary())) {
tvRuleSummary.setText(String.format("%s->%s", data.getRegex(), data.getReplacement()));
}else {
tvRuleSummary.setText(data.getReplaceSummary());
}
btBan.setText(getContext().getString(R.string.ban)); btBan.setText(getContext().getString(R.string.ban));
} else { } else {
tvRuleSummary.setTextColor(getContext().getResources().getColor(R.color.textSecondary)); tvRuleSummary.setTextColor(getContext().getResources().getColor(R.color.textSecondary));
tvRuleSummary.setText(String.format("(禁用中)%s->%s", data.getRegex(), data.getReplacement())); if (StringHelper.isEmpty(data.getReplaceSummary())) {
tvRuleSummary.setText(String.format("(禁用中)%s->%s", data.getRegex(), data.getReplacement()));
}else {
tvRuleSummary.setText(String.format("(禁用中)%s", data.getReplaceSummary()));
}
btBan.setText(R.string.enable_use); btBan.setText(R.string.enable_use);
} }
} }

@ -28,6 +28,7 @@ import xyz.fycz.myreader.greendao.entity.ReplaceRuleBean;
import xyz.fycz.myreader.greendao.service.BookService; import xyz.fycz.myreader.greendao.service.BookService;
import xyz.fycz.myreader.model.ReplaceRuleManager; import xyz.fycz.myreader.model.ReplaceRuleManager;
import xyz.fycz.myreader.util.SharedPreUtils; import xyz.fycz.myreader.util.SharedPreUtils;
import xyz.fycz.myreader.util.StringHelper;
import xyz.fycz.myreader.util.ToastUtils; import xyz.fycz.myreader.util.ToastUtils;
import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil; import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil;
@ -88,6 +89,10 @@ public class ReplaceDialog extends DialogFragment {
btSelectBook.setOnClickListener(v1 -> selectBook()); btSelectBook.setOnClickListener(v1 -> selectBook());
tvConfirm.setOnClickListener(v1 -> { tvConfirm.setOnClickListener(v1 -> {
if (StringHelper.isEmpty(etRuleOld.getText().toString())) {
ToastUtils.showWarring("替换规则不能为空");
return;
}
replaceRule.setReplaceSummary(etRuleDesc.getText().toString()); replaceRule.setReplaceSummary(etRuleDesc.getText().toString());
replaceRule.setRegex(etRuleOld.getText().toString()); replaceRule.setRegex(etRuleOld.getText().toString());
replaceRule.setIsRegex(cbUseRegex.isChecked()); replaceRule.setIsRegex(cbUseRegex.isChecked());

@ -1,2 +1,2 @@
#Tue Jan 19 16:58:48 CST 2021 #Tue Jan 19 18:24:22 CST 2021
VERSION_CODE=179 VERSION_CODE=179

Loading…
Cancel
Save