diff --git a/app/src/main/java/com/monke/monkeybook/model/analyzeRule/DefaultContentDelegate.java b/app/src/main/java/com/monke/monkeybook/model/analyzeRule/DefaultContentDelegate.java index 82ee2f7..1ccf3a2 100644 --- a/app/src/main/java/com/monke/monkeybook/model/analyzeRule/DefaultContentDelegate.java +++ b/app/src/main/java/com/monke/monkeybook/model/analyzeRule/DefaultContentDelegate.java @@ -132,7 +132,7 @@ private void matchSearchListRegex(List searchBooks, String res, ruleGroups.add(Assistant.splitRegexRule(rule)); } // 提取书籍列表信息 - do { + while (resM.find()){ // 获取列表规则分组数 int resCount = resM.groupCount(); // 新建规则结果容器 @@ -154,7 +154,7 @@ private void matchSearchListRegex(List searchBooks, String res, } // 保存当前节点的书籍信息 addSearchBook(searchBooks, infoList[0], infoList[1], infoList[2], infoList[3], infoList[4], infoList[5], infoList[6], getConfig().getVariableStore().getVariableMap()); - } while (resM.find()); + } } else { StringBuilder result = new StringBuilder(); while (resM.find()) result.append(resM.group()); diff --git a/app/src/main/java/com/monke/monkeybook/model/analyzeRule/RulePattern.java b/app/src/main/java/com/monke/monkeybook/model/analyzeRule/RulePattern.java index 504c5a3..fd15281 100644 --- a/app/src/main/java/com/monke/monkeybook/model/analyzeRule/RulePattern.java +++ b/app/src/main/java/com/monke/monkeybook/model/analyzeRule/RulePattern.java @@ -33,19 +33,25 @@ final class RulePattern { private RulePattern(@NonNull String rawRule, @Nullable VariableStore variableStore, @Nullable RuleMode ruleMode) { elementsRule = new Rule(); + final boolean regexTrait; + if (ruleMode == null) { Rule rule = RootRule.fromStringRule(rawRule); elementsRule.setMode(rule.getMode()); rawRule = rule.getRule(); + + regexTrait = true; } else { elementsRule.setMode(ruleMode); + + regexTrait = false; } - initRulePattern(rawRule, variableStore, elementsRule.getMode()); + initRulePattern(rawRule, variableStore, elementsRule.getMode(), regexTrait); } - private void initRulePattern(String rawRule, VariableStore variableStore, RuleMode ruleMode) { + private void initRulePattern(String rawRule, VariableStore variableStore, RuleMode ruleMode, boolean regexTrait) { //分离get规则 rawRule = VariablesPattern.fromGetterRule(rawRule, variableStore).rule; @@ -56,7 +62,7 @@ private void initRulePattern(String rawRule, VariableStore variableStore, RuleMo rawRule = ensureRedirectRule(rawRule); //分离正则表达式 - rawRule = ensureRegexRule(rawRule, ruleMode == RuleMode.CSS || ruleMode == RuleMode.XPath); + rawRule = ensureRegexRule(rawRule, regexTrait || ruleMode == RuleMode.CSS || ruleMode == RuleMode.XPath); //分离js int start = ensureJavaScripts(rawRule); diff --git a/app/src/main/java/com/monke/monkeybook/model/analyzeRule/assit/Assistant.java b/app/src/main/java/com/monke/monkeybook/model/analyzeRule/assit/Assistant.java index 5a20e00..688fbbb 100644 --- a/app/src/main/java/com/monke/monkeybook/model/analyzeRule/assit/Assistant.java +++ b/app/src/main/java/com/monke/monkeybook/model/analyzeRule/assit/Assistant.java @@ -52,8 +52,7 @@ public static String[] splitRegexRule(String str) { } } if (start > index) list.add(str.substring(index, start)); - String[] arr = new String[list.size()]; - return list.toArray(arr); + return list.toArray(new String[0]); } public static List evalArrayScript(String jsStr, JavaExecutor java, Object result, String baseUrl) { diff --git a/app/src/main/java/com/monke/monkeybook/presenter/FindBookPresenterImpl.java b/app/src/main/java/com/monke/monkeybook/presenter/FindBookPresenterImpl.java index 8c91963..4bd4e7d 100644 --- a/app/src/main/java/com/monke/monkeybook/presenter/FindBookPresenterImpl.java +++ b/app/src/main/java/com/monke/monkeybook/presenter/FindBookPresenterImpl.java @@ -77,7 +77,7 @@ public void initData() { this.put("java", getJavaExecutor()); }}; String javaScript = findRule.substring(4, sourceBean.getRuleFindUrl().lastIndexOf("<")); - findRule = (String) Assistant.evalObjectScript(javaScript, bindings); + findRule = String.valueOf(Assistant.evalObjectScript(javaScript, bindings)); MemoryCache.INSTANCE.putCache(sourceBean.getBookSourceUrl(), findRule); } } diff --git a/app/src/main/java/com/monke/monkeybook/view/activity/AudioBookPlayActivity.java b/app/src/main/java/com/monke/monkeybook/view/activity/AudioBookPlayActivity.java index c057262..7105145 100644 --- a/app/src/main/java/com/monke/monkeybook/view/activity/AudioBookPlayActivity.java +++ b/app/src/main/java/com/monke/monkeybook/view/activity/AudioBookPlayActivity.java @@ -234,7 +234,7 @@ public void onBackPressed() { } } - if(AppActivityManager.getInstance().isExist(AudioBookActivity.class)){ + if(!AppActivityManager.getInstance().isExist(AudioBookActivity.class)){ finishByAnim(R.anim.anim_alpha_in, R.anim.anim_right_out); }else { supportFinishAfterTransition(); diff --git a/app/src/main/java/com/monke/monkeybook/view/adapter/ChangeSourceAdapter.java b/app/src/main/java/com/monke/monkeybook/view/adapter/ChangeSourceAdapter.java index 8b3c7de..8a1e965 100644 --- a/app/src/main/java/com/monke/monkeybook/view/adapter/ChangeSourceAdapter.java +++ b/app/src/main/java/com/monke/monkeybook/view/adapter/ChangeSourceAdapter.java @@ -116,13 +116,13 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi } final View.OnClickListener clickListener = view -> { - if (selectCover) return; - - if (lastSelectIndex != -1 && lastSelectIndex != holder.getLayoutPosition()) { - notifyItemChanged(lastSelectIndex, 0); - } - if (!myViewHolder.ivChecked.isChecked()) { - myViewHolder.ivChecked.setChecked(true); + if (!selectCover) { + if (lastSelectIndex != -1 && lastSelectIndex != holder.getLayoutPosition()) { + notifyItemChanged(lastSelectIndex, 0); + } + if (!myViewHolder.ivChecked.isChecked()) { + myViewHolder.ivChecked.setChecked(true); + } } if (mOnItemClickListener != null) { mOnItemClickListener.onItemClick(view, item); diff --git a/app/version.properties b/app/version.properties index 5a7b43b..5eb051b 100644 --- a/app/version.properties +++ b/app/version.properties @@ -1,2 +1,2 @@ -#Tue May 21 12:18:06 CST 2019 -VERSION_CODE=3001 +#Sun May 26 09:24:13 CST 2019 +VERSION_CODE=3005