mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 09:01:55 +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),
|
||||
DEVELOPER("pref_screen_developer", R.xml.devicesettings_root_developer),
|
||||
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),
|
||||
DATE_TIME("pref_screen_date_time", R.xml.devicesettings_root_date_time),
|
||||
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.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
|
||||
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.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
@ -172,33 +174,47 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(final GBDevice device) {
|
||||
final List<Integer> settings = new ArrayList<>();
|
||||
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||
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);
|
||||
settings.add(R.xml.devicesettings_text_bitmaps);
|
||||
settings.add(R.xml.devicesettings_transliteration);
|
||||
deviceSpecificSettings.addRootScreen(
|
||||
DeviceSpecificSettingsScreen.NOTIFICATIONS,
|
||||
R.xml.devicesettings_text_bitmaps,
|
||||
R.xml.devicesettings_transliteration
|
||||
);
|
||||
|
||||
settings.add(R.xml.devicesettings_header_calendar);
|
||||
settings.add(R.xml.devicesettings_sync_calendar);
|
||||
deviceSpecificSettings.addRootScreen(
|
||||
DeviceSpecificSettingsScreen.CALENDAR,
|
||||
R.xml.devicesettings_sync_calendar
|
||||
);
|
||||
|
||||
settings.add(R.xml.devicesettings_header_connection);
|
||||
settings.add(R.xml.devicesettings_high_mtu);
|
||||
if (BuildConfig.INTERNET_ACCESS)
|
||||
settings.add(R.xml.devicesettings_device_internet_access);
|
||||
final List<Integer> connection = deviceSpecificSettings.addRootScreen(
|
||||
DeviceSpecificSettingsScreen.CONNECTION,
|
||||
R.xml.devicesettings_high_mtu
|
||||
);
|
||||
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);
|
||||
settings.add(R.xml.devicesettings_loyalty_cards);
|
||||
deviceSpecificSettings.addRootScreen(R.xml.devicesettings_loyalty_cards);
|
||||
|
||||
settings.add(R.xml.devicesettings_header_developer);
|
||||
settings.add(R.xml.devicesettings_banglejs_apploader);
|
||||
settings.add(R.xml.devicesettings_device_intents);
|
||||
deviceSpecificSettings.addRootScreen(
|
||||
DeviceSpecificSettingsScreen.DEVELOPER,
|
||||
R.xml.devicesettings_banglejs_apploader,
|
||||
R.xml.devicesettings_device_intents
|
||||
);
|
||||
|
||||
return ArrayUtils.toPrimitive(settings.toArray(new Integer[0]));
|
||||
return deviceSpecificSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,23 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
android:key="pref_key_header_banglejs_activity"
|
||||
android:title="@string/Activity">
|
||||
|
||||
<Preference
|
||||
android:icon="@drawable/ic_refresh"
|
||||
android:key="pref_banglejs_activity_full_sync_trigger"
|
||||
android:summary="@string/pref_activity_full_sync_trigger_summary"
|
||||
android:title="@string/pref_activity_full_sync_trigger_title" />
|
||||
<Preference
|
||||
android:icon="@drawable/ic_refresh"
|
||||
android:key="pref_banglejs_activity_full_sync_trigger"
|
||||
android:summary="@string/pref_activity_full_sync_trigger_summary"
|
||||
android:title="@string/pref_activity_full_sync_trigger_title" />
|
||||
|
||||
<!-- dummy preference, just to trigger customizer notifications -->
|
||||
<EditTextPreference
|
||||
android:defaultValue="NOT_RUNNING"
|
||||
android:enabled="false"
|
||||
android:key="pref_banglejs_activity_full_sync_status"
|
||||
android:shouldDisableView="false"
|
||||
android:title="pref_banglejs_activity_full_sync_status"
|
||||
app:isPreferenceVisible="false" />
|
||||
</PreferenceCategory>
|
||||
<!-- dummy preference, just to trigger customizer notifications -->
|
||||
<EditTextPreference
|
||||
android:defaultValue="NOT_RUNNING"
|
||||
android:enabled="false"
|
||||
android:key="pref_banglejs_activity_full_sync_status"
|
||||
android:shouldDisableView="false"
|
||||
android:title="pref_banglejs_activity_full_sync_status"
|
||||
app:isPreferenceVisible="false" />
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
@ -1,28 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_gps_location"
|
||||
android:key="banglejs_gps_update"
|
||||
android:summary="@string/pref_summary_banglejs_phone_gps_enbale"
|
||||
android:title="@string/pref_title_banglejs_phone_gps_enbale" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="1000"
|
||||
android:dependency="banglejs_gps_update"
|
||||
android:icon="@drawable/ic_access_time"
|
||||
android:inputType="number"
|
||||
android:key="banglejs_gps_update_interval"
|
||||
android:summary="@string/pref_summary_banglejs_phone_gps_update_interval"
|
||||
android:title="@string/pref_title_banglejs_phone_gps_update_interval" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:dependency="banglejs_gps_update"
|
||||
android:icon="@drawable/ic_gps_location"
|
||||
android:key="banglejs_gps_use_network_only"
|
||||
android:summary="@string/pref_summary_banglejs_phone_gps_network_only"
|
||||
android:title="@string/pref_title_banglejs_phone_gps_network_only" />
|
||||
</PreferenceCategory>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_gps_location"
|
||||
android:key="banglejs_gps_update"
|
||||
android:summary="@string/pref_summary_banglejs_phone_gps_enbale"
|
||||
android:title="@string/pref_title_banglejs_phone_gps_enbale" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="1000"
|
||||
android:dependency="banglejs_gps_update"
|
||||
android:icon="@drawable/ic_access_time"
|
||||
android:inputType="number"
|
||||
android:key="banglejs_gps_update_interval"
|
||||
android:summary="@string/pref_summary_banglejs_phone_gps_update_interval"
|
||||
android:title="@string/pref_title_banglejs_phone_gps_update_interval" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:dependency="banglejs_gps_update"
|
||||
android:icon="@drawable/ic_gps_location"
|
||||
android:key="banglejs_gps_use_network_only"
|
||||
android:summary="@string/pref_summary_banglejs_phone_gps_network_only"
|
||||
android:title="@string/pref_title_banglejs_phone_gps_network_only" />
|
||||
</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