修复替换规则删除bug

pull/5/head
fengyuecanzhu 4 years ago
parent a8ea58753e
commit bbfe58c1db
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 19
      app/src/main/java/xyz/fycz/myreader/common/URLCONST.java
  3. 5
      app/src/main/java/xyz/fycz/myreader/ui/dialog/BookGroupDialog.java
  4. 138
      app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java
  5. 3
      app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java
  6. 1
      gradle.properties

@ -5,27 +5,8 @@ public class URLCONST {
// 命名空间 // 命名空间
public static String nameSpace_FY = "https://novel.fycz.xyz"; public static String nameSpace_FY = "https://novel.fycz.xyz";
public static String nameSpace_biquge = "https://www.52bqg.com/";
public static String nameSpace_qb5 = "https://www.qb5.tw";
public static String qidian_rank = "https://www.qidian.com/rank";
public static String nameSpace_system = "https://novel.fycz.xyz";
public static boolean isRSA = false; public static boolean isRSA = false;
// 搜索小说
public static String method_fengyue_search = "https://novel.fycz.xyz/search.html";
public static String method_buxiu_search = "https://www.23txt.com/search.php";
// 获取最新版本号
public static String method_getCurAppVersion = nameSpace_system + "/mReaderController.do?getCurAppVersion";
// app下载
public static String method_downloadApp = nameSpace_system + "/app/FYReader.apk";
public static String APP_DIR_UR = "https://www.lanzous.com/b00ngso7e"; public static String APP_DIR_UR = "https://www.lanzous.com/b00ngso7e";
public static String LAN_ZOUS_URL = "https://fycz.lanzous.com"; public static String LAN_ZOUS_URL = "https://fycz.lanzous.com";

@ -114,7 +114,8 @@ public class BookGroupDialog {
public void showAddOrRenameGroupDia(boolean isRename, boolean isAddGroup, int groupNum, OnGroup onGroup){ public void showAddOrRenameGroupDia(boolean isRename, boolean isAddGroup, int groupNum, OnGroup onGroup){
View view = LayoutInflater.from(mContext).inflate(R.layout.edit_dialog, null); View view = LayoutInflater.from(mContext).inflate(R.layout.edit_dialog, null);
TextInputLayout textInputLayout = view.findViewById(R.id.text_input_lay); TextInputLayout textInputLayout = view.findViewById(R.id.text_input_lay);
textInputLayout.setCounterMaxLength(10); int maxLen = 20;
textInputLayout.setCounterMaxLength(maxLen);
EditText editText = textInputLayout.getEditText(); EditText editText = textInputLayout.getEditText();
editText.setHint("请输入分组名"); editText.setHint("请输入分组名");
BookGroup bookGroup = !isRename ? new BookGroup() : mBookGroups.get(groupNum); BookGroup bookGroup = !isRename ? new BookGroup() : mBookGroups.get(groupNum);
@ -178,7 +179,7 @@ public class BookGroupDialog {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
String text = editText.getText().toString(); String text = editText.getText().toString();
if (editText.getText().length() > 0 && editText.getText().length() <= 10 && !text.equals(oldName)) { if (editText.getText().length() > 0 && editText.getText().length() <= maxLen && !text.equals(oldName)) {
posBtn.setEnabled(true); posBtn.setEnabled(true);
} else { } else {
posBtn.setEnabled(false); posBtn.setEnabled(false);

@ -281,26 +281,6 @@ public class BookcasePresenter implements BasePresenter {
mBookcaseFragment.getmBtnAddGroup().performClick(); mBookcaseFragment.getmBtnAddGroup().performClick();
} }
}); });
/*initBookGroups(true);
showSelectGroupDia((dialog, which) -> {
if (which < mBookGroups.size()) {
BookGroup bookGroup = mBookGroups.get(which);
ArrayList<Book> mSelectBooks = (ArrayList<Book>) mBookcaseAdapter.getSelectBooks();
for (Book book : mSelectBooks) {
if (!bookGroup.getId().equals(book.getGroupId())) {
book.setGroupId(bookGroup.getId());
book.setGroupSort(0);
}
}
mBookService.updateBooks(mSelectBooks);
ToastUtils.showSuccess("成功将《" + mSelectBooks.get(0).getName() + "》"
+ (mSelectBooks.size() > 1 ? "等" : "")
+ "加入[" + bookGroup.getName() + "]分组");
init();
} else if (which == mBookGroups.size()) {
showAddOrRenameGroupDia(false, true, 0);
}
});*/
}); });
} }
@ -646,124 +626,6 @@ public class BookcasePresenter implements BasePresenter {
}).show(); }).show();
} }
/**
* 添加/重命名分组对话框
*/
private void showAddOrRenameGroupDia(boolean isRename, boolean isAddGroup, int groupNum){
View view = LayoutInflater.from(mMainActivity).inflate(R.layout.edit_dialog, null);
TextInputLayout textInputLayout = view.findViewById(R.id.text_input_lay);
textInputLayout.setCounterMaxLength(10);
EditText editText = textInputLayout.getEditText();
editText.setHint("请输入分组名");
BookGroup bookGroup = !isRename ? new BookGroup() : mBookGroups.get(groupNum);
String oldName = bookGroup.getName();
if (isRename) {
editText.setText(oldName);
}
editText.requestFocus();
InputMethodManager imm = (InputMethodManager) mMainActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
mHandler.postDelayed(() ->{
imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
}, 220);
AlertDialog newGroupDia = MyAlertDialog.build(mMainActivity)
.setTitle(!isRename ? "新建分组" : "重命名分组")
.setView(view)
.setCancelable(false)
.setPositiveButton("确认", null)
.setNegativeButton("取消", null)
.show();
Button posBtn = newGroupDia.getButton(AlertDialog.BUTTON_POSITIVE);
posBtn.setEnabled(false);
posBtn.setOnClickListener(v1 -> {
CharSequence newGroupName = editText.getText().toString();
for (CharSequence oldGroupName : mGroupNames){
if (oldGroupName.equals(newGroupName)){
ToastUtils.showWarring("分组[" + newGroupName + "]已存在,无法" + (!isRename ? "添加!" : "重命名!"));
return;
}
}
bookGroup.setName(newGroupName.toString());
if (!isRename) {
mBookGroupService.addBookGroup(bookGroup);
}else {
mBookGroupService.updateEntity(bookGroup);
SharedPreUtils spu = SharedPreUtils.getInstance();
if (spu.getString(mMainActivity.getString(R.string.curBookGroupName), "").equals(oldName)){
spu.putString(mMainActivity.getString(R.string.curBookGroupName), newGroupName.toString());
ogcl.onChange();
}
}
ToastUtils.showSuccess("成功" +
(!isRename ? "添加分组[" : "成功将[" + oldName + "]重命名为[")
+ bookGroup.getName() + "]");
imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
newGroupDia.dismiss();
if (isAddGroup){
mBookcaseFragment.getmBtnAddGroup().performClick();
}
});
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String text = editText.getText().toString();
if (editText.getText().length() > 0 && editText.getText().length() <= 10 && !text.equals(oldName)) {
posBtn.setEnabled(true);
} else {
posBtn.setEnabled(false);
}
}
});
}
/**
* 删除分组对话框
*/
private void showDeleteGroupDia() {
boolean[] checkedItems = new boolean[mGroupNames.length];
new MultiChoiceDialog().create(mMainActivity, "删除分组", mGroupNames
, checkedItems, 0, (dialog, which) -> {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < checkedItems.length; i++) {
if (checkedItems[i]) {
mBookGroupService.deleteEntity(mBookGroups.get(i));
sb.append(mBookGroups.get(i).getName()).append("、");
}
}
if (sb.length() > 0){
sb.deleteCharAt(sb.lastIndexOf("、"));
}
SharedPreUtils spu = SharedPreUtils.getInstance();
if (mBookGroupService.getGroupById(spu.getString(mMainActivity.getString(R.string.curBookGroupId), "")) == null){
spu.putString(mMainActivity.getString(R.string.curBookGroupId), "");
spu.putString(mMainActivity.getString(R.string.curBookGroupName), "");
ogcl.onChange();
init();
}
ToastUtils.showSuccess("分组[" + sb.toString() + "]删除成功!");
}, null, null);
}
//显示选择书籍对话框
private void showSelectGroupDia(DialogInterface.OnClickListener onClickListener){
MyAlertDialog.build(mMainActivity)
.setTitle("选择分组")
.setItems(mGroupNames, onClickListener)
.setCancelable(false)
.setPositiveButton("取消", null)
.show();
}
//分组切换监听器 //分组切换监听器
public void addOnGroupChangeListener(MainActivity.OnGroupChangeListener ogcl){ public void addOnGroupChangeListener(MainActivity.OnGroupChangeListener ogcl){
this.ogcl = ogcl; this.ogcl = ogcl;

@ -233,9 +233,6 @@ public class CommonApi extends BaseApi {
}); });
} }
public static void getNewestAppVersion(final ResultCallback callback) {
getCommonReturnStringApi(URLCONST.method_getCurAppVersion, null, callback);
}
/** /**
* 通过api获取蓝奏云可下载直链 * 通过api获取蓝奏云可下载直链

@ -17,4 +17,3 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true # org.gradle.parallel=true
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.overridePathCheck=true
Loading…
Cancel
Save