mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 19:36:50 +01:00
Bangle.js: Reorganize device settings
This commit is contained in:
parent
b1160c994a
commit
48ee259d89
@ -819,6 +819,8 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_DEVICE_GPS_UPDATE_INTERVAL, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_BANGLEJS_TEXT_BITMAP_SIZE, InputType.TYPE_CLASS_NUMBER);
|
||||
|
||||
new PasswordCapabilityImpl().registerPreferences(getContext(), coordinator.getPasswordCapability(), this);
|
||||
new HeartRateCapability().registerPreferences(getContext(), coordinator.getHeartRateMeasurementIntervals(), this);
|
||||
|
@ -17,27 +17,23 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.banglejs;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DEVICE_GPS_UPDATE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DEVICE_INTENTS;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.bluetooth.le.ScanFilter;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.ParcelUuid;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
@ -47,7 +43,6 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
|
||||
public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
|
||||
@ -193,19 +188,28 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
Vector<Integer> settings = new Vector<Integer>();
|
||||
settings.add(R.xml.devicesettings_banglejs);
|
||||
public int[] getSupportedDeviceSpecificSettings(final GBDevice device) {
|
||||
final List<Integer> settings = new ArrayList<>();
|
||||
|
||||
settings.add(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);
|
||||
|
||||
settings.add(R.xml.devicesettings_header_calendar);
|
||||
settings.add(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);
|
||||
|
||||
settings.add(R.xml.devicesettings_header_developer);
|
||||
settings.add(R.xml.devicesettings_banglejs_apploader);
|
||||
settings.add(R.xml.devicesettings_device_intents);
|
||||
settings.add(R.xml.devicesettings_sync_calendar);
|
||||
// must be a better way of doing this?
|
||||
int[] settingsInt = new int[settings.size()];
|
||||
for (int i=0; i<settings.size(); i++) settingsInt[i] = settings.get(i);
|
||||
return settingsInt;
|
||||
|
||||
return ArrayUtils.toPrimitive(settings.toArray(new Integer[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -266,13 +266,13 @@
|
||||
<string name="pref_title_banglejs_text_bitmap">Text as Bitmaps</string>
|
||||
<string name="pref_summary_banglejs_text_bitmap">If a word cannot be rendered with the watch\'s font, render it to a bitmap in Gadgetbridge and display the bitmap on the watch</string>
|
||||
<string name="pref_title_banglejs_txt_bitmap_size">Text Bitmaps Size</string>
|
||||
<string name="pref_summary_banglejs_txt_bitmap_size">If \'Text as Bitmaps\' enabled, what size should text be rendered?</string>
|
||||
<string name="pref_summary_banglejs_txt_bitmap_size">Size to use for bitmap text rendering</string>
|
||||
<string name="pref_title_banglejs_phone_gps_enbale">Use phone gps data</string>
|
||||
<string name="pref_summary_banglejs_phone_gps_enbale">Use the gps data of the phone to overwrite the gps data of the bangle device</string>
|
||||
<string name="pref_title_banglejs_phone_gps_network_only">Only use network to determine location</string>
|
||||
<string name="pref_summary_banglejs_phone_gps_network_only">This option is only active, if the gps data of the phone is being used. This option can be used to use only the network provider to determine the location. This reduces the power consumption for the cost of accuracy. A reconnection of the device is needed.</string>
|
||||
<string name="pref_title_banglejs_phone_gps_update_interval">GPS data update interval in ms</string>
|
||||
<string name="pref_summary_banglejs_phone_gps_update_interval">This option is only active, if the gps data of the phone is being used. This option sets the interval in ms how often the gps position is being updated</string>
|
||||
<string name="pref_summary_banglejs_phone_gps_network_only">Use only the network provider to determine the location. This reduces the power consumption at the cost of accuracy. A reconnection is needed.</string>
|
||||
<string name="pref_title_banglejs_phone_gps_update_interval">GPS data update interval</string>
|
||||
<string name="pref_summary_banglejs_phone_gps_update_interval">The interval for how often the gps position is being updated, in ms</string>
|
||||
<string name="pref_title_banglejs_webview_url">App loader URL</string>
|
||||
<string name="pref_summary_banglejs_webview_url">If you want a custom app loader put your https://…/android.html URL here. Otherwise leave blank for https://banglejs.com/apps</string>
|
||||
<string name="pref_title_rtl">Right-To-Left</string>
|
||||
|
@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<SwitchPreference
|
||||
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:inputType="number"
|
||||
android:icon="@drawable/ic_access_time"
|
||||
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" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
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" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_translate"
|
||||
android:key="banglejs_text_bitmap"
|
||||
android:summary="@string/pref_summary_banglejs_text_bitmap"
|
||||
android:title="@string/pref_title_banglejs_text_bitmap" />
|
||||
<EditTextPreference
|
||||
android:defaultValue="18"
|
||||
android:inputType="number"
|
||||
android:icon="@drawable/ic_font_size"
|
||||
android:key="banglejs_txt_bitmap_size"
|
||||
android:summary="@string/pref_summary_banglejs_txt_bitmap_size"
|
||||
android:title="@string/pref_title_banglejs_txt_bitmap_size" />
|
||||
<EditTextPreference
|
||||
android:defaultValue=""
|
||||
android:icon="@drawable/ic_link"
|
||||
android:key="banglejs_webview_url"
|
||||
android:summary="@string/pref_summary_banglejs_webview_url"
|
||||
android:title="@string/pref_title_banglejs_webview_url" />
|
||||
</androidx.preference.PreferenceScreen>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<EditTextPreference
|
||||
android:defaultValue=""
|
||||
android:icon="@drawable/ic_link"
|
||||
android:key="banglejs_webview_url"
|
||||
android:summary="@string/pref_summary_banglejs_webview_url"
|
||||
android:title="@string/pref_title_banglejs_webview_url" />
|
||||
</androidx.preference.PreferenceScreen>
|
28
app/src/main/res/xml/devicesettings_banglejs_location.xml
Normal file
28
app/src/main/res/xml/devicesettings_banglejs_location.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<?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">
|
||||
<SwitchPreference
|
||||
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" />
|
||||
<SwitchPreference
|
||||
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>
|
||||
</androidx.preference.PreferenceScreen>
|
17
app/src/main/res/xml/devicesettings_text_bitmaps.xml
Normal file
17
app/src/main/res/xml/devicesettings_text_bitmaps.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_translate"
|
||||
android:key="banglejs_text_bitmap"
|
||||
android:summary="@string/pref_summary_banglejs_text_bitmap"
|
||||
android:title="@string/pref_title_banglejs_text_bitmap" />
|
||||
<EditTextPreference
|
||||
android:dependency="banglejs_text_bitmap"
|
||||
android:defaultValue="18"
|
||||
android:inputType="number"
|
||||
android:icon="@drawable/ic_font_size"
|
||||
android:key="banglejs_txt_bitmap_size"
|
||||
android:summary="@string/pref_summary_banglejs_txt_bitmap_size"
|
||||
android:title="@string/pref_title_banglejs_txt_bitmap_size" />
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user