From bbfe58c1db9d46b24eeb83ddfe08ccab77a4220d Mon Sep 17 00:00:00 2001 From: fengyuecanzhu <1021300691@qq.com> Date: Sun, 24 Jan 2021 19:56:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=BF=E6=8D=A2=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=88=A0=E9=99=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/caches/build_file_checksums.ser | Bin 536 -> 536 bytes .../xyz/fycz/myreader/common/URLCONST.java | 19 --- .../myreader/ui/dialog/BookGroupDialog.java | 5 +- .../ui/presenter/BookcasePresenter.java | 138 ------------------ .../xyz/fycz/myreader/webapi/CommonApi.java | 3 - gradle.properties | 3 +- 6 files changed, 4 insertions(+), 164 deletions(-) diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index a36d6b9f00efe5b2e9d8f20342baa7bf1fa151cf..9f5a09b5d4aee2799da61b86e88746aefd39b8de 100644 GIT binary patch delta 36 ucmV+<0NekV1egSnm;^K!*~YP)J^>IO=e$d<`=}ZaJ1Hpem?_$m>H#hgLk~6p delta 36 ucmV+<0NekV1egSnm;^F}jQX*hJ^>K(`w#5H#h`aS 0 && editText.getText().length() <= 10 && !text.equals(oldName)) { + if (editText.getText().length() > 0 && editText.getText().length() <= maxLen && !text.equals(oldName)) { posBtn.setEnabled(true); } else { posBtn.setEnabled(false); diff --git a/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java b/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java index bcfd7ef..a8d4acb 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java @@ -281,26 +281,6 @@ public class BookcasePresenter implements BasePresenter { mBookcaseFragment.getmBtnAddGroup().performClick(); } }); - /*initBookGroups(true); - showSelectGroupDia((dialog, which) -> { - if (which < mBookGroups.size()) { - BookGroup bookGroup = mBookGroups.get(which); - ArrayList mSelectBooks = (ArrayList) 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(); } - - /** - * 添加/重命名分组对话框 - */ - 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){ this.ogcl = ogcl; diff --git a/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java b/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java index b48db7f..eadde6a 100644 --- a/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java +++ b/app/src/main/java/xyz/fycz/myreader/webapi/CommonApi.java @@ -233,9 +233,6 @@ public class CommonApi extends BaseApi { }); } - public static void getNewestAppVersion(final ResultCallback callback) { - getCommonReturnStringApi(URLCONST.method_getCurAppVersion, null, callback); - } /** * 通过api获取蓝奏云可下载直链 diff --git a/gradle.properties b/gradle.properties index 01ac58d..af6dcbe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,5 +16,4 @@ org.gradle.jvmargs=-Xmx1536m # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true android.useAndroidX=true -android.enableJetifier=true -android.overridePathCheck=true \ No newline at end of file +android.enableJetifier=true \ No newline at end of file