Skip to content

Commit

Permalink
Change 'hide status bar' position, add dependency for 'status bar color'
Browse files Browse the repository at this point in the history
  • Loading branch information
italankin committed Jun 6, 2022
1 parent cec83f6 commit 58b09a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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");
Expand Down
10 changes: 5 additions & 5 deletions launcher/src/main/res/xml/prefs_look_and_feel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
android:key="item_width"
android:summary="%s"
android:title="@string/settings_home_laf_other_width" />
<CheckBoxPreference
android:defaultValue="false"
android:key="hide_status_bar"
android:summary="@string/settings_home_laf_other_hide_status_bar_summary"
android:title="@string/settings_home_laf_other_hide_status_bar" />
<CheckBoxPreference
android:defaultValue="true"
android:key="apps_list_animate"
Expand Down Expand Up @@ -85,6 +80,11 @@
android:key="large_search_bar"
android:summary="@string/settings_home_laf_other_large_search_bar_summary"
android:title="@string/settings_home_laf_other_large_search_bar" />
<CheckBoxPreference
android:defaultValue="false"
android:key="hide_status_bar"
android:summary="@string/settings_home_laf_other_hide_status_bar_summary"
android:title="@string/settings_home_laf_other_hide_status_bar" />
<com.italankin.lnch.util.widget.ColorPreference
android:key="status_bar_color"
android:title="@string/settings_home_laf_other_status_bar_color"
Expand Down

0 comments on commit 58b09a2

Please sign in to comment.