mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 09:17:29 +01:00
Add preference for hiding bottom navigation bar
This commit is contained in:
parent
4059566a25
commit
a2c861f66c
@ -194,7 +194,11 @@ public class ControlCenterv2 extends AppCompatActivity
|
||||
|
||||
// Initialize bottom navigation
|
||||
BottomNavigationView navigationView = findViewById(R.id.bottom_nav_bar);
|
||||
navigationView.setVisibility(activityTrackerAvailable ? View.VISIBLE : View.GONE);
|
||||
if (activityTrackerAvailable && prefs.getBoolean("display_bottom_navigation_bar", true)) {
|
||||
navigationView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
navigationView.setVisibility(View.GONE);
|
||||
}
|
||||
navigationView.setOnItemSelectedListener(menuItem -> {
|
||||
switch (menuItem.getItemId()) {
|
||||
case R.id.bottom_nav_dashboard:
|
||||
|
@ -45,7 +45,6 @@ import android.widget.Toast;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.MultiSelectListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
@ -56,8 +55,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -75,7 +72,6 @@ import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleSettingsActivit
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.ConfigActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimePreferenceActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.externalevents.TimeChangeReceiver;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Weather;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
@ -244,6 +240,21 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
|
||||
});
|
||||
}
|
||||
|
||||
pref = findPreference("display_add_device_fab");
|
||||
if (pref != null) {
|
||||
pref.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
sendThemeChangeIntent();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
pref = findPreference("display_bottom_navigation_bar");
|
||||
if (pref != null) {
|
||||
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||
sendThemeChangeIntent();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
final Preference unit = findPreference(PREF_MEASUREMENT_SYSTEM);
|
||||
if (unit != null) {
|
||||
unit.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||
|
@ -2791,4 +2791,7 @@
|
||||
<string name="pref_speak_notifications_aloud_summary">Notifications will be read aloud through the headphones</string>
|
||||
<string name="pref_speak_notifications_aloud_title">Speak Notifications Aloud</string>
|
||||
<string name="pref_header_calls_and_notifications">Calls and notifications</string>
|
||||
<string name="pref_title_bottom_navigation_bar">Bottom navigation bar</string>
|
||||
<string name="pref_summary_bottom_navigation_bar_on">Switch between main screens using the navigation bar or horizontal swiping</string>
|
||||
<string name="pref_summary_bottom_navigation_bar_off">Switch between main screens only using horizontal swiping</string>
|
||||
</resources>
|
||||
|
@ -33,6 +33,14 @@
|
||||
android:summaryOn="@string/pref_display_add_device_fab_on"
|
||||
android:title="@string/pref_display_add_device_fab"
|
||||
app:iconSpaceReserved="false" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="display_bottom_navigation_bar"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:summaryOff="@string/pref_summary_bottom_navigation_bar_off"
|
||||
android:summaryOn="@string/pref_summary_bottom_navigation_bar_on"
|
||||
android:title="@string/pref_title_bottom_navigation_bar"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
|
Loading…
Reference in New Issue
Block a user