mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Bangle.js: Update preferences to use sub-screens
This commit is contained in:
parent
9db60f16d1
commit
d9ec993d14
@ -27,6 +27,7 @@ public enum DeviceSpecificSettingsScreen {
|
|||||||
CONNECTION("pref_screen_connection", R.xml.devicesettings_root_connection),
|
CONNECTION("pref_screen_connection", R.xml.devicesettings_root_connection),
|
||||||
DEVELOPER("pref_screen_developer", R.xml.devicesettings_root_developer),
|
DEVELOPER("pref_screen_developer", R.xml.devicesettings_root_developer),
|
||||||
DISPLAY("pref_screen_display", R.xml.devicesettings_root_display),
|
DISPLAY("pref_screen_display", R.xml.devicesettings_root_display),
|
||||||
|
LOCATION("pref_screen_location", R.xml.devicesettings_root_location),
|
||||||
NOTIFICATIONS("pref_screen_notifications", R.xml.devicesettings_root_notifications),
|
NOTIFICATIONS("pref_screen_notifications", R.xml.devicesettings_root_notifications),
|
||||||
DATE_TIME("pref_screen_date_time", R.xml.devicesettings_root_date_time),
|
DATE_TIME("pref_screen_date_time", R.xml.devicesettings_root_date_time),
|
||||||
WORKOUT("pref_screen_workout", R.xml.devicesettings_root_workout),
|
WORKOUT("pref_screen_workout", R.xml.devicesettings_root_workout),
|
||||||
|
@ -36,7 +36,9 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||||
@ -172,33 +174,47 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getSupportedDeviceSpecificSettings(final GBDevice device) {
|
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||||
final List<Integer> settings = new ArrayList<>();
|
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_banglejs_location);
|
deviceSpecificSettings.addRootScreen(
|
||||||
|
DeviceSpecificSettingsScreen.LOCATION,
|
||||||
|
R.xml.devicesettings_banglejs_location
|
||||||
|
);
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_header_notifications);
|
deviceSpecificSettings.addRootScreen(
|
||||||
settings.add(R.xml.devicesettings_text_bitmaps);
|
DeviceSpecificSettingsScreen.NOTIFICATIONS,
|
||||||
settings.add(R.xml.devicesettings_transliteration);
|
R.xml.devicesettings_text_bitmaps,
|
||||||
|
R.xml.devicesettings_transliteration
|
||||||
|
);
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_header_calendar);
|
deviceSpecificSettings.addRootScreen(
|
||||||
settings.add(R.xml.devicesettings_sync_calendar);
|
DeviceSpecificSettingsScreen.CALENDAR,
|
||||||
|
R.xml.devicesettings_sync_calendar
|
||||||
|
);
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_header_connection);
|
final List<Integer> connection = deviceSpecificSettings.addRootScreen(
|
||||||
settings.add(R.xml.devicesettings_high_mtu);
|
DeviceSpecificSettingsScreen.CONNECTION,
|
||||||
if (BuildConfig.INTERNET_ACCESS)
|
R.xml.devicesettings_high_mtu
|
||||||
settings.add(R.xml.devicesettings_device_internet_access);
|
);
|
||||||
|
if (BuildConfig.INTERNET_ACCESS) {
|
||||||
|
connection.add(R.xml.devicesettings_device_internet_access);
|
||||||
|
}
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_banglejs_activity);
|
deviceSpecificSettings.addRootScreen(
|
||||||
|
DeviceSpecificSettingsScreen.ACTIVITY_INFO,
|
||||||
|
R.xml.devicesettings_banglejs_activity
|
||||||
|
);
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_header_apps);
|
deviceSpecificSettings.addRootScreen(R.xml.devicesettings_loyalty_cards);
|
||||||
settings.add(R.xml.devicesettings_loyalty_cards);
|
|
||||||
|
|
||||||
settings.add(R.xml.devicesettings_header_developer);
|
deviceSpecificSettings.addRootScreen(
|
||||||
settings.add(R.xml.devicesettings_banglejs_apploader);
|
DeviceSpecificSettingsScreen.DEVELOPER,
|
||||||
settings.add(R.xml.devicesettings_device_intents);
|
R.xml.devicesettings_banglejs_apploader,
|
||||||
|
R.xml.devicesettings_device_intents
|
||||||
|
);
|
||||||
|
|
||||||
return ArrayUtils.toPrimitive(settings.toArray(new Integer[0]));
|
return deviceSpecificSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<PreferenceCategory
|
|
||||||
android:key="pref_key_header_banglejs_activity"
|
|
||||||
android:title="@string/Activity">
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:icon="@drawable/ic_refresh"
|
android:icon="@drawable/ic_refresh"
|
||||||
@ -19,5 +16,4 @@
|
|||||||
android:shouldDisableView="false"
|
android:shouldDisableView="false"
|
||||||
android:title="pref_banglejs_activity_full_sync_status"
|
android:title="pref_banglejs_activity_full_sync_status"
|
||||||
app:isPreferenceVisible="false" />
|
app:isPreferenceVisible="false" />
|
||||||
</PreferenceCategory>
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<PreferenceCategory
|
|
||||||
android:key="pref_header_location"
|
|
||||||
android:title="@string/pref_header_location">
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:icon="@drawable/ic_gps_location"
|
android:icon="@drawable/ic_gps_location"
|
||||||
@ -24,5 +21,4 @@
|
|||||||
android:key="banglejs_gps_use_network_only"
|
android:key="banglejs_gps_use_network_only"
|
||||||
android:summary="@string/pref_summary_banglejs_phone_gps_network_only"
|
android:summary="@string/pref_summary_banglejs_phone_gps_network_only"
|
||||||
android:title="@string/pref_title_banglejs_phone_gps_network_only" />
|
android:title="@string/pref_title_banglejs_phone_gps_network_only" />
|
||||||
</PreferenceCategory>
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
9
app/src/main/res/xml/devicesettings_root_location.xml
Normal file
9
app/src/main/res/xml/devicesettings_root_location.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceScreen
|
||||||
|
android:icon="@drawable/ic_gps_location"
|
||||||
|
android:key="pref_screen_location"
|
||||||
|
android:persistent="false"
|
||||||
|
android:title="@string/pref_header_location">
|
||||||
|
</PreferenceScreen>
|
||||||
|
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user