修复关闭分组后私密书架无法退出的bug

master
fengyuecanzhu 3 years ago
parent f18c906aeb
commit 0f133b99b0
  1. 3
      app/src/main/java/xyz/fycz/myreader/application/SysManager.java
  2. 2
      app/src/main/java/xyz/fycz/myreader/common/APPCONST.java
  3. 4
      app/src/main/java/xyz/fycz/myreader/ui/activity/GroupManagerActivity.kt
  4. 29
      app/src/main/java/xyz/fycz/myreader/ui/activity/MainActivity.java
  5. 9
      app/src/main/java/xyz/fycz/myreader/ui/adapter/BookGroupAdapter.kt
  6. 4
      app/src/main/java/xyz/fycz/myreader/ui/dialog/BookGroupDialog.java
  7. 2
      app/src/main/res/values/strings.xml

@ -99,9 +99,6 @@ public class SysManager {
setting.setSharedLayout(true); setting.setSharedLayout(true);
Log.d("SettingVersion", "" + 10); Log.d("SettingVersion", "" + 10);
case 11: case 11:
if (BookGroupService.getInstance().countBookGroup() > 0) {
SharedPreUtils.getInstance().putBoolean("openGroup", true);
}
Log.d("SettingVersion", "" + 11); Log.d("SettingVersion", "" + 11);
case 12: case 12:
Log.d("SettingVersion", "" + 12); Log.d("SettingVersion", "" + 12);

@ -102,7 +102,7 @@ public class APPCONST {
public static final int SELECT_FILE_CODE = 10000; 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; public static final int SOURCE_VERSION = 7;

@ -34,7 +34,7 @@ class GroupManagerActivity : BaseActivity() {
private lateinit var itemTouchHelper: ItemTouchHelper private lateinit var itemTouchHelper: ItemTouchHelper
private var openGroup = false private var openGroup = true
private lateinit var curBookGroupId: String private lateinit var curBookGroupId: String
@ -53,7 +53,7 @@ class GroupManagerActivity : BaseActivity() {
super.initData(savedInstanceState) super.initData(savedInstanceState)
groupDialog = BookGroupDialog(this) groupDialog = BookGroupDialog(this)
groupDialog.initBookGroups(false) groupDialog.initBookGroups(false)
openGroup = SharedPreUtils.getInstance().getBoolean("openGroup") openGroup = SharedPreUtils.getInstance().getBoolean("openGroup", true)
curBookGroupId = SharedPreUtils.getInstance().getString(getString(R.string.curBookGroupId), "") curBookGroupId = SharedPreUtils.getInstance().getString(getString(R.string.curBookGroupId), "")
} }

@ -144,11 +144,14 @@ public class MainActivity extends BaseActivity {
super.initClick(); super.initClick();
mToolbar.setOnLongClickListener(v -> { mToolbar.setOnLongClickListener(v -> {
if (binding.viewPagerMain.getCurrentItem() == 0 && if (binding.viewPagerMain.getCurrentItem() == 0
!BookGroupService.getInstance().curGroupIsPrivate() && && (mBookcaseFragment.getmBookcasePresenter() != null
(mBookcaseFragment.getmBookcasePresenter() != null && && !mBookcaseFragment.getmBookcasePresenter().ismEditState())) {
!mBookcaseFragment.getmBookcasePresenter().ismEditState())) { if (BookGroupService.getInstance().curGroupIsPrivate()) {
goPrivateBookcase(); goBackNormalBookcase();
} else {
goPrivateBookcase();
}
return true; return true;
} }
return false; return false;
@ -263,7 +266,7 @@ public class MainActivity extends BaseActivity {
menu.setGroupVisible(R.id.bookcase_menu, true); menu.setGroupVisible(R.id.bookcase_menu, true);
menu.findItem(R.id.action_finish).setVisible(false); menu.findItem(R.id.action_finish).setVisible(false);
menu.findItem(R.id.action_change_group).setVisible(SharedPreUtils menu.findItem(R.id.action_change_group).setVisible(SharedPreUtils
.getInstance().getBoolean("openGroup")); .getInstance().getBoolean("openGroup"));
} }
} else { } else {
menu.setGroupVisible(R.id.bookcase_menu, false); 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);
}
/** /**
* 显示私密书架 * 显示私密书架
*/ */

@ -59,8 +59,7 @@ class BookGroupAdapter(
val item = getItem(holder.layoutPosition) val item = getItem(holder.layoutPosition)
DialogCreator.createCommonDialog( DialogCreator.createCommonDialog(
context, "确定删除分组[" + item?.name + "]?", context, "确定删除分组[" + item?.name + "]?",
"删除后,该书籍分组将永久不再显示,是否继续删除?", true, "删除后,该书籍分组将永久不再显示,是否继续删除?", true, { _, _ ->
"确定", "取消", { _, _ ->
BookGroupService.getInstance() BookGroupService.getInstance()
.deleteBookGroup(item) .deleteBookGroup(item)
removeItem(holder.layoutPosition) removeItem(holder.layoutPosition)
@ -82,9 +81,13 @@ class BookGroupAdapter(
ToastUtils.showWarring("分组数量不能超过50") ToastUtils.showWarring("分组数量不能超过50")
return@setOnClickListener return@setOnClickListener
} }
groupDialog.showAddOrRenameGroupDia(true, false, groupDialog.showAddOrRenameGroupDia(true, true,
holder.layoutPosition, object : BookGroupDialog.OnGroup() { holder.layoutPosition, object : BookGroupDialog.OnGroup() {
override fun change() { override fun change() {
}
override fun addGroup(group: BookGroup?) {
App.getHandler().postDelayed( App.getHandler().postDelayed(
{ notifyItemChanged(holder.layoutPosition) }, 300 { notifyItemChanged(holder.layoutPosition) }, 300
) )

@ -141,7 +141,7 @@ public class BookGroupDialog {
mBookGroupService.updateEntity(bookGroup); mBookGroupService.updateEntity(bookGroup);
SharedPreUtils spu = SharedPreUtils.getInstance(); SharedPreUtils spu = SharedPreUtils.getInstance();
if (spu.getString(mContext.getString(R.string.curBookGroupName), "").equals(oldName)) { 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(); if (onGroup != null) onGroup.change();
} }
} }
@ -198,8 +198,10 @@ public class BookGroupDialog {
} }
public abstract static class OnGroup { public abstract static class OnGroup {
//当前正使用分组名称改变回调
public abstract void change(); public abstract void change();
//回调
public void addGroup(BookGroup group) { public void addGroup(BookGroup group) {
} }

@ -306,7 +306,7 @@
<string name="verify_has_fingerprint">请验证已有指纹</string> <string name="verify_has_fingerprint">请验证已有指纹</string>
<string name="private_bookcase_tip">1、什么是私密书架?\n私密书架是设置隐私密码后自动创建的书籍分组, <string name="private_bookcase_tip">1、什么是私密书架?\n私密书架是设置隐私密码后自动创建的书籍分组,
此书架的书籍仅能在该分组内阅读、查看及其他操作,且阅读后不会保存上次阅读记录。\n\n2、如何进入私密书架?\n在书架页面长按左上角书架标题正确验证隐私密码即可进入私密书架。 此书架的书籍仅能在该分组内阅读、查看及其他操作,且阅读后不会保存上次阅读记录。\n\n2、如何进入私密书架?\n在书架页面长按左上角书架标题正确验证隐私密码即可进入私密书架。
\n\n3、如何退出私密书架?\n点击书架菜单栏切换分组按钮切换至其他分组即可退出私密书架。\n\n4、忘记隐私密码怎么办?\n隐私密码不支持找回,忘记密码后可强制关闭私密书架,并删除私密书架内所有书籍。\n\n \n\n3、如何退出私密书架?\n在私密书架页面长按左上角书架(或点击书架菜单栏切换分组按钮切换至其他分组)即可退出私密书架。\n\n4、忘记隐私密码怎么办?\n隐私密码不支持找回,忘记密码后可强制关闭私密书架,并删除私密书架内所有书籍。\n\n
5、此功能处于测试阶段,如发现问题,请到我的-建议反馈里进行反馈。</string> 5、此功能处于测试阶段,如发现问题,请到我的-建议反馈里进行反馈。</string>
<string name="long_press">长按选择文字</string> <string name="long_press">长按选择文字</string>
<string name="search">搜索</string> <string name="search">搜索</string>

Loading…
Cancel
Save