diff --git a/app/src/main/java/xyz/fycz/myreader/application/SysManager.java b/app/src/main/java/xyz/fycz/myreader/application/SysManager.java index 9d6c75b..d6ea789 100644 --- a/app/src/main/java/xyz/fycz/myreader/application/SysManager.java +++ b/app/src/main/java/xyz/fycz/myreader/application/SysManager.java @@ -99,9 +99,6 @@ public class SysManager { setting.setSharedLayout(true); Log.d("SettingVersion", "" + 10); case 11: - if (BookGroupService.getInstance().countBookGroup() > 0) { - SharedPreUtils.getInstance().putBoolean("openGroup", true); - } Log.d("SettingVersion", "" + 11); case 12: Log.d("SettingVersion", "" + 12); diff --git a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java index 2388d68..d9cf936 100644 --- a/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java +++ b/app/src/main/java/xyz/fycz/myreader/common/APPCONST.java @@ -102,7 +102,7 @@ public class APPCONST { public static final int SELECT_FILE_CODE = 10000; //设置版本号 - public static final int SETTING_VERSION = 12; + public static final int SETTING_VERSION = 11; public static final int SOURCE_VERSION = 7; diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/GroupManagerActivity.kt b/app/src/main/java/xyz/fycz/myreader/ui/activity/GroupManagerActivity.kt index 52c610d..a514379 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/GroupManagerActivity.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/GroupManagerActivity.kt @@ -34,7 +34,7 @@ class GroupManagerActivity : BaseActivity() { private lateinit var itemTouchHelper: ItemTouchHelper - private var openGroup = false + private var openGroup = true private lateinit var curBookGroupId: String @@ -53,7 +53,7 @@ class GroupManagerActivity : BaseActivity() { super.initData(savedInstanceState) groupDialog = BookGroupDialog(this) groupDialog.initBookGroups(false) - openGroup = SharedPreUtils.getInstance().getBoolean("openGroup") + openGroup = SharedPreUtils.getInstance().getBoolean("openGroup", true) curBookGroupId = SharedPreUtils.getInstance().getString(getString(R.string.curBookGroupId), "") } diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java index fbed282..91b925c 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java @@ -144,11 +144,14 @@ public class MainActivity extends BaseActivity { super.initClick(); mToolbar.setOnLongClickListener(v -> { - if (binding.viewPagerMain.getCurrentItem() == 0 && - !BookGroupService.getInstance().curGroupIsPrivate() && - (mBookcaseFragment.getmBookcasePresenter() != null && - !mBookcaseFragment.getmBookcasePresenter().ismEditState())) { - goPrivateBookcase(); + if (binding.viewPagerMain.getCurrentItem() == 0 + && (mBookcaseFragment.getmBookcasePresenter() != null + && !mBookcaseFragment.getmBookcasePresenter().ismEditState())) { + if (BookGroupService.getInstance().curGroupIsPrivate()) { + goBackNormalBookcase(); + } else { + goPrivateBookcase(); + } return true; } return false; @@ -263,7 +266,7 @@ public class MainActivity extends BaseActivity { menu.setGroupVisible(R.id.bookcase_menu, true); menu.findItem(R.id.action_finish).setVisible(false); menu.findItem(R.id.action_change_group).setVisible(SharedPreUtils - .getInstance().getBoolean("openGroup")); + .getInstance().getBoolean("openGroup")); } } else { menu.setGroupVisible(R.id.bookcase_menu, false); @@ -467,6 +470,20 @@ public class MainActivity extends BaseActivity { }); } + private void goBackNormalBookcase() { + DialogCreator.createCommonDialog(this, "退出私密书架", + "确定要退出私密书架吗?", true, (dialog, which) -> { + groupName = ""; + SharedPreUtils.getInstance().putString(getString(R.string.curBookGroupId), ""); + SharedPreUtils.getInstance().putString(getString(R.string.curBookGroupName), groupName); + getSupportActionBar().setSubtitle(""); + if (mBookcaseFragment.isRecreate()) { + reLoadFragment(); + } + mBookcaseFragment.init(); + }, null); + } + /** * 显示私密书架 */ diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookGroupAdapter.kt b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookGroupAdapter.kt index 51cfa36..03cea28 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookGroupAdapter.kt +++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/BookGroupAdapter.kt @@ -59,8 +59,7 @@ class BookGroupAdapter( val item = getItem(holder.layoutPosition) DialogCreator.createCommonDialog( context, "确定删除分组[" + item?.name + "]?", - "删除后,该书籍分组将永久不再显示,是否继续删除?", true, - "确定", "取消", { _, _ -> + "删除后,该书籍分组将永久不再显示,是否继续删除?", true, { _, _ -> BookGroupService.getInstance() .deleteBookGroup(item) removeItem(holder.layoutPosition) @@ -82,9 +81,13 @@ class BookGroupAdapter( ToastUtils.showWarring("分组数量不能超过50") return@setOnClickListener } - groupDialog.showAddOrRenameGroupDia(true, false, + groupDialog.showAddOrRenameGroupDia(true, true, holder.layoutPosition, object : BookGroupDialog.OnGroup() { override fun change() { + + } + + override fun addGroup(group: BookGroup?) { App.getHandler().postDelayed( { notifyItemChanged(holder.layoutPosition) }, 300 ) diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/BookGroupDialog.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/BookGroupDialog.java index c266def..ad9bc3d 100644 --- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/BookGroupDialog.java +++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/BookGroupDialog.java @@ -141,7 +141,7 @@ public class BookGroupDialog { mBookGroupService.updateEntity(bookGroup); SharedPreUtils spu = SharedPreUtils.getInstance(); if (spu.getString(mContext.getString(R.string.curBookGroupName), "").equals(oldName)) { - spu.putString(mContext.getString(R.string.curBookGroupName), newGroupName.toString()); + spu.putString(mContext.getString(R.string.curBookGroupName), newGroupName); if (onGroup != null) onGroup.change(); } } @@ -198,8 +198,10 @@ public class BookGroupDialog { } public abstract static class OnGroup { + //当前正使用分组名称改变回调 public abstract void change(); + //回调 public void addGroup(BookGroup group) { } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3c8dedd..9dc94e8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -306,7 +306,7 @@ 请验证已有指纹 1、什么是私密书架?\n私密书架是设置隐私密码后自动创建的书籍分组, 此书架的书籍仅能在该分组内阅读、查看及其他操作,且阅读后不会保存上次阅读记录。\n\n2、如何进入私密书架?\n在书架页面长按左上角书架标题正确验证隐私密码即可进入私密书架。 - \n\n3、如何退出私密书架?\n点击书架菜单栏切换分组按钮切换至其他分组即可退出私密书架。\n\n4、忘记隐私密码怎么办?\n隐私密码不支持找回,忘记密码后可强制关闭私密书架,并删除私密书架内所有书籍。\n\n + \n\n3、如何退出私密书架?\n在私密书架页面长按左上角书架(或点击书架菜单栏切换分组按钮切换至其他分组)即可退出私密书架。\n\n4、忘记隐私密码怎么办?\n隐私密码不支持找回,忘记密码后可强制关闭私密书架,并删除私密书架内所有书籍。\n\n 5、此功能处于测试阶段,如发现问题,请到我的-建议反馈里进行反馈。 长按选择文字 搜索