From 58b09a2c66508f519a41ed80bfdc529e47ae9ac0 Mon Sep 17 00:00:00 2001 From: Igor Talankin Date: Mon, 6 Jun 2022 10:09:51 +0500 Subject: [PATCH] Change 'hide status bar' position, add dependency for 'status bar color' --- .../settings/lookfeel/LookAndFeelFragment.java | 15 ++++++++++++--- launcher/src/main/res/xml/prefs_look_and_feel.xml | 10 +++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/launcher/src/main/java/com/italankin/lnch/feature/settings/lookfeel/LookAndFeelFragment.java b/launcher/src/main/java/com/italankin/lnch/feature/settings/lookfeel/LookAndFeelFragment.java index 91eebda2..27895b9c 100644 --- a/launcher/src/main/java/com/italankin/lnch/feature/settings/lookfeel/LookAndFeelFragment.java +++ b/launcher/src/main/java/com/italankin/lnch/feature/settings/lookfeel/LookAndFeelFragment.java @@ -5,6 +5,9 @@ import android.os.Bundle; import android.view.View; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.arellomobile.mvp.MvpView; import com.arellomobile.mvp.presenter.InjectPresenter; import com.arellomobile.mvp.presenter.ProvidePresenter; @@ -15,9 +18,6 @@ import com.italankin.lnch.feature.settings.base.AppPreferenceFragment; import com.italankin.lnch.model.repository.prefs.Preferences; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - public class LookAndFeelFragment extends AppPreferenceFragment implements MvpView, SettingsToolbarTitle { public static LookAndFeelFragment newInstance(String requestKey) { @@ -71,9 +71,18 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat .setEnabled(preferences.get(Preferences.NOTIFICATION_DOT)); findPreference(Preferences.APPS_LIST_ANIMATE) .setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O); + findPreference(Preferences.HIDE_STATUS_BAR).setOnPreferenceChangeListener((preference, newValue) -> { + updateStatusBarColorDependency(((Boolean) newValue)); + return true; + }); + updateStatusBarColorDependency(preferences.get(Preferences.HIDE_STATUS_BAR)); scrollToTarget(); } + private void updateStatusBarColorDependency(Boolean hideStatusBar) { + findPreference(Preferences.STATUS_BAR_COLOR).setEnabled(!hideStatusBar); + } + public static class ShowItemLookPreferencesContract extends SignalFragmentResultContract { public ShowItemLookPreferencesContract() { super("show_item_look_preferences"); diff --git a/launcher/src/main/res/xml/prefs_look_and_feel.xml b/launcher/src/main/res/xml/prefs_look_and_feel.xml index 01f88eb6..7cd0346d 100644 --- a/launcher/src/main/res/xml/prefs_look_and_feel.xml +++ b/launcher/src/main/res/xml/prefs_look_and_feel.xml @@ -44,11 +44,6 @@ android:key="item_width" android:summary="%s" android:title="@string/settings_home_laf_other_width" /> - +