From 4761e6b9f4312bc844bc304763b4d28d16aa9171 Mon Sep 17 00:00:00 2001 From: GKF Date: Mon, 14 Jan 2019 11:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/activity/ReadBookActivity.java | 5 ++++ .../view/popupwindow/MoreSettingPop.java | 18 +++++++++++++- app/src/main/res/layout/pop_more_setting.xml | 24 ++++++++++++++++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/kunfei/bookshelf/view/activity/ReadBookActivity.java b/app/src/main/java/com/kunfei/bookshelf/view/activity/ReadBookActivity.java index 856f712fe4..b0c9da0afa 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/activity/ReadBookActivity.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/activity/ReadBookActivity.java @@ -565,6 +565,11 @@ public void refresh() { */ private void initMoreSettingPop() { moreSettingPop.setListener(new MoreSettingPop.OnChangeProListener() { + @Override + public void upBar() { + initImmersionBar(); + } + @Override public void keepScreenOnChange(int keepScreenOn) { screenTimeOut = getResources().getIntArray(R.array.screen_time_out_value)[keepScreenOn]; diff --git a/app/src/main/java/com/kunfei/bookshelf/view/popupwindow/MoreSettingPop.java b/app/src/main/java/com/kunfei/bookshelf/view/popupwindow/MoreSettingPop.java index 7e144dfcce..13a2698420 100644 --- a/app/src/main/java/com/kunfei/bookshelf/view/popupwindow/MoreSettingPop.java +++ b/app/src/main/java/com/kunfei/bookshelf/view/popupwindow/MoreSettingPop.java @@ -11,9 +11,12 @@ import android.widget.Switch; import android.widget.TextView; +import com.hwangjr.rxbus.RxBus; import com.kunfei.bookshelf.R; import com.kunfei.bookshelf.help.ReadBookControl; +import com.kunfei.bookshelf.help.RxBusTag; import com.kunfei.bookshelf.utils.Theme.ATH; +import com.kunfei.bookshelf.widget.views.ATESwitch; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; @@ -71,6 +74,10 @@ public class MoreSettingPop extends FrameLayout { TextView reNavbarcolorVal; @BindView(R.id.llNavigationBarColor) LinearLayout llNavigationBarColor; + @BindView(R.id.sbImmersionStatusBar) + ATESwitch sbImmersionStatusBar; + @BindView(R.id.llImmersionStatusBar) + LinearLayout llImmersionStatusBar; private Context context; private ReadBookControl readBookControl = ReadBookControl.getInstance(); @@ -110,11 +117,17 @@ public void setListener(@NonNull OnChangeProListener changeProListener) { private void bindEvent() { this.setOnClickListener(view -> this.setVisibility(GONE)); + sbImmersionStatusBar.setOnCheckedChangeListener(((compoundButton, b) -> { + if (compoundButton.isPressed()) { + readBookControl.setImmersionStatusBar(b); + changeProListener.upBar(); + RxBus.get().post(RxBusTag.RECREATE, true); + } + })); sbHideStatusBar.setOnCheckedChangeListener((buttonView, isChecked) -> { if (buttonView.isPressed()) { readBookControl.setHideStatusBar(isChecked); changeProListener.recreate(); - upView(); } }); sbHideNavigationBar.setOnCheckedChangeListener((buttonView, isChecked) -> { @@ -230,6 +243,7 @@ private void initData() { upScreenTimeOut(readBookControl.getScreenTimeOut()); upFConvert(readBookControl.getTextConvert()); upNavbarColor(readBookControl.getNavbarColor()); + sbImmersionStatusBar.setChecked(readBookControl.getImmersionStatusBar()); swVolumeNextPage.setChecked(readBookControl.getCanKeyTurn()); swReadAloudKey.setChecked(readBookControl.getAloudCanKeyTurn()); sbHideStatusBar.setChecked(readBookControl.getHideStatusBar()); @@ -290,6 +304,8 @@ private void upNavbarColor(int nColor) { } public interface OnChangeProListener { + void upBar(); + void keepScreenOnChange(int keepScreenOn); void recreate(); diff --git a/app/src/main/res/layout/pop_more_setting.xml b/app/src/main/res/layout/pop_more_setting.xml index faff928f3e..086ef4b80a 100644 --- a/app/src/main/res/layout/pop_more_setting.xml +++ b/app/src/main/res/layout/pop_more_setting.xml @@ -136,6 +136,28 @@ + + + + + + + + + android:text="@string/pt_hide_status_bar" />