mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 14:32:54 +01:00
Upgrade Settings to androidx
- Extend AbstractSettingsActivityV2 - Replace all checkbox preferences with switch preferences - Add app:useSimpleSummaryProvider to all preferences that were in getPreferenceKeysWithSummary - Add null checks on all prefs to fix crashes in nested preference screens - Replace listeners with lambdas to reduce code indentation - Set input type to number where relevant
This commit is contained in:
parent
f4b059f173
commit
12b5ec8415
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2015-2020 0nse, Andreas Shimokawa, Carsten Pfeiffer,
|
/* Copyright (C) 2015-2023 0nse, Andreas Shimokawa, Carsten Pfeiffer,
|
||||||
Daniel Dakhno, Daniele Gobbetti, Felix Konstantin Maurer, José Rebelo,
|
Daniel Dakhno, Daniele Gobbetti, Felix Konstantin Maurer, José Rebelo,
|
||||||
Martin, Normano64, Pavel Elagin, Sebastian Kranz, vanous
|
Martin, Normano64, Pavel Elagin, Sebastian Kranz, vanous
|
||||||
|
|
||||||
@ -33,11 +33,8 @@ import android.location.LocationListener;
|
|||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.EditTextPreference;
|
|
||||||
import android.preference.ListPreference;
|
|
||||||
import android.preference.Preference;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.provider.DocumentsContract;
|
import android.provider.DocumentsContract;
|
||||||
|
import android.text.InputType;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@ -46,8 +43,12 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.preference.EditTextPreference;
|
||||||
|
import androidx.preference.ListPreference;
|
||||||
|
import androidx.preference.Preference;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -74,493 +75,480 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
|
||||||
public class SettingsActivity extends AbstractSettingsActivity {
|
public class SettingsActivity extends AbstractSettingsActivityV2 {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(SettingsActivity.class);
|
|
||||||
|
|
||||||
public static final String PREF_MEASUREMENT_SYSTEM = "measurement_system";
|
public static final String PREF_MEASUREMENT_SYSTEM = "measurement_system";
|
||||||
|
|
||||||
private static final int FILE_REQUEST_CODE = 4711;
|
|
||||||
private EditText fitnessAppEditText = null;
|
|
||||||
private int fitnessAppSelectionListSpinnerFirstRun = 0;
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected String fragmentTag() {
|
||||||
super.onCreate(savedInstanceState);
|
return SettingsFragment.FRAGMENT_TAG;
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected PreferenceFragmentCompat newFragment() {
|
||||||
super.onPostCreate(savedInstanceState);
|
return new SettingsFragment();
|
||||||
|
}
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
public static class SettingsFragment extends AbstractPreferenceFragment {
|
||||||
Preference pref = findPreference("pref_category_activity_personal");
|
private static final Logger LOG = LoggerFactory.getLogger(SettingsActivity.class);
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
Intent enableIntent = new Intent(SettingsActivity.this, AboutUserPreferencesActivity.class);
|
|
||||||
startActivity(enableIntent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
static final String FRAGMENT_TAG = "SETTINGS_FRAGMENT";
|
||||||
|
|
||||||
pref = findPreference("pref_charts");
|
private static final int FILE_REQUEST_CODE = 4711;
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
private EditText fitnessAppEditText = null;
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
private int fitnessAppSelectionListSpinnerFirstRun = 0;
|
||||||
Intent enableIntent = new Intent(SettingsActivity.this, ChartsPreferencesActivity.class);
|
|
||||||
startActivity(enableIntent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("pref_key_miband");
|
@Override
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
setPreferencesFromResource(R.xml.preferences, rootKey);
|
||||||
Intent enableIntent = new Intent(SettingsActivity.this, MiBandPreferencesActivity.class);
|
|
||||||
startActivity(enableIntent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("pref_key_qhybrid");
|
setInputTypeFor("rtl_max_line_length", InputType.TYPE_CLASS_NUMBER);
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
setInputTypeFor("location_latitude", InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
|
||||||
@Override
|
setInputTypeFor("location_longitude", InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
setInputTypeFor("auto_export_interval", InputType.TYPE_CLASS_NUMBER);
|
||||||
startActivity(new Intent(SettingsActivity.this, ConfigActivity.class));
|
setInputTypeFor("auto_fetch_interval_limit", InputType.TYPE_CLASS_NUMBER);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("pref_key_zetime");
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
Preference pref = findPreference("pref_category_activity_personal");
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
if (pref != null) {
|
||||||
Intent enableIntent = new Intent(SettingsActivity.this, ZeTimePreferenceActivity.class);
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
startActivity(enableIntent);
|
Intent enableIntent = new Intent(requireContext(), AboutUserPreferencesActivity.class);
|
||||||
return true;
|
startActivity(enableIntent);
|
||||||
}
|
return true;
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("pebble_emu_addr");
|
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
Intent refreshIntent = new Intent(DeviceManager.ACTION_REFRESH_DEVICELIST);
|
|
||||||
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(refreshIntent);
|
|
||||||
preference.setSummary(newVal.toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("pebble_emu_port");
|
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
Intent refreshIntent = new Intent(DeviceManager.ACTION_REFRESH_DEVICELIST);
|
|
||||||
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(refreshIntent);
|
|
||||||
preference.setSummary(newVal.toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("log_to_file");
|
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
boolean doEnable = Boolean.TRUE.equals(newVal);
|
|
||||||
try {
|
|
||||||
if (doEnable) {
|
|
||||||
FileUtils.getExternalFilesDir(); // ensures that it is created
|
|
||||||
}
|
|
||||||
GBApplication.setupLogging(doEnable);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
GB.toast(getApplicationContext(),
|
|
||||||
getString(R.string.error_creating_directory_for_logfiles, ex.getLocalizedMessage()),
|
|
||||||
Toast.LENGTH_LONG,
|
|
||||||
GB.ERROR,
|
|
||||||
ex);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("cache_weather");
|
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
boolean doEnable = Boolean.TRUE.equals(newVal);
|
|
||||||
|
|
||||||
Weather.getInstance().setCacheFile(getCacheDir(), doEnable);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// If we didn't manage to initialize file logging, disable the preference
|
|
||||||
if (!GBApplication.getLogging().isFileLoggerInitialized()) {
|
|
||||||
pref.setEnabled(false);
|
|
||||||
pref.setSummary(R.string.pref_write_logfiles_not_available);
|
|
||||||
}
|
|
||||||
|
|
||||||
pref = findPreference("language");
|
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
String newLang = newVal.toString();
|
|
||||||
try {
|
|
||||||
GBApplication.setLanguage(newLang);
|
|
||||||
recreate();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
GB.toast(getApplicationContext(),
|
|
||||||
"Error setting language: " + ex.getLocalizedMessage(),
|
|
||||||
Toast.LENGTH_LONG,
|
|
||||||
GB.ERROR,
|
|
||||||
ex);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
final Preference unit = findPreference(PREF_MEASUREMENT_SYSTEM);
|
|
||||||
unit.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
invokeLater(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
GBApplication.deviceService().onSendConfiguration(PREF_MEASUREMENT_SYSTEM);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
preference.setSummary(newVal.toString());
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("location_aquire");
|
pref = findPreference("pref_charts");
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
if (pref != null) {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
Intent enableIntent = new Intent(requireContext(), ChartsPreferencesActivity.class);
|
||||||
ActivityCompat.requestPermissions(SettingsActivity.this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 0);
|
startActivity(enableIntent);
|
||||||
}
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
pref = findPreference("pref_key_miband");
|
||||||
Criteria criteria = new Criteria();
|
if (pref != null) {
|
||||||
String provider = locationManager.getBestProvider(criteria, false);
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
if (provider != null) {
|
Intent enableIntent = new Intent(requireContext(), MiBandPreferencesActivity.class);
|
||||||
Location location = locationManager.getLastKnownLocation(provider);
|
startActivity(enableIntent);
|
||||||
if (location != null) {
|
return true;
|
||||||
setLocationPreferences(location);
|
});
|
||||||
} else {
|
}
|
||||||
locationManager.requestSingleUpdate(provider, new LocationListener() {
|
|
||||||
@Override
|
|
||||||
public void onLocationChanged(Location location) {
|
|
||||||
setLocationPreferences(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
pref = findPreference("pref_key_qhybrid");
|
||||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
if (pref != null) {
|
||||||
LOG.info("provider status changed to " + status + " (" + provider + ")");
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
}
|
startActivity(new Intent(requireContext(), ConfigActivity.class));
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
pref = findPreference("pref_key_zetime");
|
||||||
public void onProviderEnabled(String provider) {
|
if (pref != null) {
|
||||||
LOG.info("provider enabled (" + provider + ")");
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
}
|
Intent enableIntent = new Intent(requireContext(), ZeTimePreferenceActivity.class);
|
||||||
|
startActivity(enableIntent);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
pref = findPreference("pebble_emu_addr");
|
||||||
public void onProviderDisabled(String provider) {
|
if (pref != null) {
|
||||||
LOG.info("provider disabled (" + provider + ")");
|
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
GB.toast(SettingsActivity.this, getString(R.string.toast_enable_networklocationprovider), 3000, 0);
|
Intent refreshIntent = new Intent(DeviceManager.ACTION_REFRESH_DEVICELIST);
|
||||||
}
|
LocalBroadcastManager.getInstance(requireContext().getApplicationContext()).sendBroadcast(refreshIntent);
|
||||||
}, null);
|
preference.setSummary(newVal.toString());
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pref = findPreference("pebble_emu_port");
|
||||||
|
if (pref != null) {
|
||||||
|
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
|
Intent refreshIntent = new Intent(DeviceManager.ACTION_REFRESH_DEVICELIST);
|
||||||
|
LocalBroadcastManager.getInstance(requireContext().getApplicationContext()).sendBroadcast(refreshIntent);
|
||||||
|
preference.setSummary(newVal.toString());
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pref = findPreference("log_to_file");
|
||||||
|
if (pref != null) {
|
||||||
|
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
|
boolean doEnable = Boolean.TRUE.equals(newVal);
|
||||||
|
try {
|
||||||
|
if (doEnable) {
|
||||||
|
FileUtils.getExternalFilesDir(); // ensures that it is created
|
||||||
|
}
|
||||||
|
GBApplication.setupLogging(doEnable);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
GB.toast(requireContext().getApplicationContext(),
|
||||||
|
getString(R.string.error_creating_directory_for_logfiles, ex.getLocalizedMessage()),
|
||||||
|
Toast.LENGTH_LONG,
|
||||||
|
GB.ERROR,
|
||||||
|
ex);
|
||||||
}
|
}
|
||||||
} else {
|
return true;
|
||||||
LOG.warn("No location provider found, did you deny location permission?");
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pref = findPreference("cache_weather");
|
||||||
|
if (pref != null) {
|
||||||
|
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
|
boolean doEnable = Boolean.TRUE.equals(newVal);
|
||||||
|
|
||||||
|
Weather.getInstance().setCacheFile(requireContext().getCacheDir(), doEnable);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
// If we didn't manage to initialize file logging, disable the preference
|
||||||
|
if (!GBApplication.getLogging().isFileLoggerInitialized()) {
|
||||||
|
pref.setEnabled(false);
|
||||||
|
pref.setSummary(R.string.pref_write_logfiles_not_available);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("weather_city");
|
pref = findPreference("language");
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
if (pref != null) {
|
||||||
@Override
|
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
String newLang = newVal.toString();
|
||||||
// reset city id and force a new lookup
|
try {
|
||||||
GBApplication.getPrefs().getPreferences().edit().putString("weather_cityid", null).apply();
|
GBApplication.setLanguage(newLang);
|
||||||
preference.setSummary(newVal.toString());
|
requireActivity().recreate();
|
||||||
Intent intent = new Intent("GB_UPDATE_WEATHER");
|
} catch (Exception ex) {
|
||||||
intent.setPackage(BuildConfig.APPLICATION_ID);
|
GB.toast(requireContext().getApplicationContext(),
|
||||||
sendBroadcast(intent);
|
"Error setting language: " + ex.getLocalizedMessage(),
|
||||||
return true;
|
Toast.LENGTH_LONG,
|
||||||
|
GB.ERROR,
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
final Preference unit = findPreference(PREF_MEASUREMENT_SYSTEM);
|
||||||
pref = findPreference(GBPrefs.AUTO_EXPORT_LOCATION);
|
if (unit != null) {
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
unit.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
invokeLater(() -> GBApplication.deviceService().onSendConfiguration(PREF_MEASUREMENT_SYSTEM));
|
||||||
Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
return true;
|
||||||
i.setType("application/x-sqlite3");
|
});
|
||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
|
||||||
i.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
|
||||||
String title = getApplicationContext().getString(R.string.choose_auto_export_location);
|
|
||||||
startActivityForResult(Intent.createChooser(i, title), FILE_REQUEST_CODE);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
pref.setSummary(getAutoExportLocationSummary());
|
|
||||||
|
|
||||||
pref = findPreference(GBPrefs.AUTO_EXPORT_INTERVAL);
|
pref = findPreference("location_aquire");
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
if (pref != null) {
|
||||||
@Override
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
public boolean onPreferenceChange(Preference preference, Object autoExportInterval) {
|
if (ActivityCompat.checkSelfPermission(requireContext().getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
String summary = String.format(
|
ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 0);
|
||||||
getApplicationContext().getString(R.string.pref_summary_auto_export_interval),
|
}
|
||||||
Integer.valueOf((String) autoExportInterval));
|
|
||||||
preference.setSummary(summary);
|
LocationManager locationManager = (LocationManager) requireContext().getSystemService(Context.LOCATION_SERVICE);
|
||||||
boolean auto_export_enabled = GBApplication.getPrefs().getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false);
|
Criteria criteria = new Criteria();
|
||||||
PeriodicExporter.scheduleAlarm(getApplicationContext(), Integer.valueOf((String) autoExportInterval), auto_export_enabled);
|
String provider = locationManager.getBestProvider(criteria, false);
|
||||||
return true;
|
if (provider != null) {
|
||||||
|
Location location = locationManager.getLastKnownLocation(provider);
|
||||||
|
if (location != null) {
|
||||||
|
setLocationPreferences(location);
|
||||||
|
} else {
|
||||||
|
locationManager.requestSingleUpdate(provider, new LocationListener() {
|
||||||
|
@Override
|
||||||
|
public void onLocationChanged(Location location) {
|
||||||
|
setLocationPreferences(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||||
|
LOG.info("provider status changed to " + status + " (" + provider + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderEnabled(String provider) {
|
||||||
|
LOG.info("provider enabled (" + provider + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onProviderDisabled(String provider) {
|
||||||
|
LOG.info("provider disabled (" + provider + ")");
|
||||||
|
GB.toast(requireContext(), getString(R.string.toast_enable_networklocationprovider), 3000, 0);
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG.warn("No location provider found, did you deny location permission?");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
int autoExportInterval = GBApplication.getPrefs().getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
|
||||||
String summary = String.format(
|
|
||||||
getApplicationContext().getString(R.string.pref_summary_auto_export_interval),
|
|
||||||
(int) autoExportInterval);
|
|
||||||
pref.setSummary(summary);
|
|
||||||
|
|
||||||
findPreference(GBPrefs.AUTO_EXPORT_ENABLED).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
pref = findPreference("weather_city");
|
||||||
@Override
|
if (pref != null) {
|
||||||
public boolean onPreferenceChange(Preference preference, Object autoExportEnabled) {
|
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||||
|
// reset city id and force a new lookup
|
||||||
|
GBApplication.getPrefs().getPreferences().edit().putString("weather_cityid", null).apply();
|
||||||
|
Intent intent = new Intent("GB_UPDATE_WEATHER");
|
||||||
|
intent.setPackage(BuildConfig.APPLICATION_ID);
|
||||||
|
requireContext().sendBroadcast(intent);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pref = findPreference(GBPrefs.AUTO_EXPORT_LOCATION);
|
||||||
|
if (pref != null) {
|
||||||
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
|
Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
|
i.setType("application/x-sqlite3");
|
||||||
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
i.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
|
String title = requireContext().getApplicationContext().getString(R.string.choose_auto_export_location);
|
||||||
|
startActivityForResult(Intent.createChooser(i, title), FILE_REQUEST_CODE);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
pref.setSummary(getAutoExportLocationSummary());
|
||||||
|
}
|
||||||
|
|
||||||
|
pref = findPreference(GBPrefs.AUTO_EXPORT_INTERVAL);
|
||||||
|
if (pref != null) {
|
||||||
|
pref.setOnPreferenceChangeListener((preference, autoExportInterval) -> {
|
||||||
|
String summary = String.format(
|
||||||
|
requireContext().getApplicationContext().getString(R.string.pref_summary_auto_export_interval),
|
||||||
|
Integer.valueOf((String) autoExportInterval));
|
||||||
|
preference.setSummary(summary);
|
||||||
|
boolean auto_export_enabled = GBApplication.getPrefs().getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false);
|
||||||
|
PeriodicExporter.scheduleAlarm(requireContext().getApplicationContext(), Integer.valueOf((String) autoExportInterval), auto_export_enabled);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
int autoExportInterval = GBApplication.getPrefs().getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
int autoExportInterval = GBApplication.getPrefs().getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
||||||
PeriodicExporter.scheduleAlarm(getApplicationContext(), autoExportInterval, (boolean) autoExportEnabled);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pref = findPreference("auto_fetch_interval_limit");
|
|
||||||
pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object autoFetchInterval) {
|
|
||||||
String summary = String.format(
|
String summary = String.format(
|
||||||
getApplicationContext().getString(R.string.pref_auto_fetch_limit_fetches_summary),
|
requireContext().getApplicationContext().getString(R.string.pref_summary_auto_export_interval),
|
||||||
Integer.valueOf((String) autoFetchInterval));
|
autoExportInterval);
|
||||||
preference.setSummary(summary);
|
pref.setSummary(summary);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
int autoFetchInterval = GBApplication.getPrefs().getInt("auto_fetch_interval_limit", 0);
|
pref = findPreference(GBPrefs.AUTO_EXPORT_ENABLED);
|
||||||
summary = String.format(
|
if (pref != null) {
|
||||||
getApplicationContext().getString(R.string.pref_auto_fetch_limit_fetches_summary),
|
pref.setOnPreferenceChangeListener((preference, autoExportEnabled) -> {
|
||||||
autoFetchInterval);
|
int autoExportInterval = GBApplication.getPrefs().getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
||||||
pref.setSummary(summary);
|
PeriodicExporter.scheduleAlarm(requireContext().getApplicationContext(), autoExportInterval, (boolean) autoExportEnabled);
|
||||||
|
return true;
|
||||||
// Get all receivers of Media Buttons
|
});
|
||||||
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
|
||||||
|
|
||||||
PackageManager pm = getPackageManager();
|
|
||||||
List<ResolveInfo> mediaReceivers = pm.queryBroadcastReceivers(mediaButtonIntent,
|
|
||||||
PackageManager.GET_INTENT_FILTERS | PackageManager.GET_RESOLVED_FILTER);
|
|
||||||
|
|
||||||
|
|
||||||
CharSequence[] newEntries = new CharSequence[mediaReceivers.size() + 1];
|
|
||||||
CharSequence[] newValues = new CharSequence[mediaReceivers.size() + 1];
|
|
||||||
newEntries[0] = getString(R.string.pref_default);
|
|
||||||
newValues[0] = "default";
|
|
||||||
|
|
||||||
int i = 1;
|
|
||||||
Set<String> existingNames = new HashSet<>();
|
|
||||||
for (ResolveInfo resolveInfo : mediaReceivers) {
|
|
||||||
newEntries[i] = resolveInfo.activityInfo.loadLabel(pm) + " (" + resolveInfo.activityInfo.packageName + ")";
|
|
||||||
if (existingNames.contains(newEntries[i].toString().trim())) {
|
|
||||||
newEntries[i] = resolveInfo.activityInfo.loadLabel(pm) + " (" + resolveInfo.activityInfo.name + ")";
|
|
||||||
} else {
|
|
||||||
existingNames.add(newEntries[i].toString().trim());
|
|
||||||
}
|
}
|
||||||
newValues[i] = resolveInfo.activityInfo.packageName;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ListPreference audioPlayer = (ListPreference) findPreference("audio_player");
|
pref = findPreference("auto_fetch_interval_limit");
|
||||||
audioPlayer.setEntries(newEntries);
|
if (pref != null) {
|
||||||
audioPlayer.setEntryValues(newValues);
|
pref.setOnPreferenceChangeListener((preference, autoFetchInterval) -> {
|
||||||
audioPlayer.setDefaultValue(newValues[0]);
|
String summary = String.format(
|
||||||
|
requireContext().getApplicationContext().getString(R.string.pref_auto_fetch_limit_fetches_summary),
|
||||||
|
Integer.valueOf((String) autoFetchInterval));
|
||||||
|
preference.setSummary(summary);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
final Preference theme = (ListPreference) findPreference("pref_key_theme");
|
int autoFetchInterval = GBApplication.getPrefs().getInt("auto_fetch_interval_limit", 0);
|
||||||
final Preference amoled_black = findPreference("pref_key_theme_amoled_black");
|
String summary = String.format(
|
||||||
|
requireContext().getApplicationContext().getString(R.string.pref_auto_fetch_limit_fetches_summary),
|
||||||
|
autoFetchInterval);
|
||||||
|
pref.setSummary(summary);
|
||||||
|
}
|
||||||
|
|
||||||
String selectedTheme = prefs.getString("pref_key_theme", SettingsActivity.this.getString(R.string.pref_theme_value_system));
|
final ListPreference audioPlayer = findPreference("audio_player");
|
||||||
if (selectedTheme.equals("light"))
|
if (audioPlayer != null) {
|
||||||
amoled_black.setEnabled(false);
|
// Get all receivers of Media Buttons
|
||||||
else
|
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
|
||||||
amoled_black.setEnabled(true);
|
|
||||||
|
|
||||||
theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
PackageManager pm = requireContext().getPackageManager();
|
||||||
@Override
|
List<ResolveInfo> mediaReceivers = pm.queryBroadcastReceivers(mediaButtonIntent,
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
PackageManager.GET_INTENT_FILTERS | PackageManager.GET_RESOLVED_FILTER);
|
||||||
final String val = newVal.toString();
|
|
||||||
if (val.equals("light"))
|
CharSequence[] newEntries = new CharSequence[mediaReceivers.size() + 1];
|
||||||
|
CharSequence[] newValues = new CharSequence[mediaReceivers.size() + 1];
|
||||||
|
newEntries[0] = getString(R.string.pref_default);
|
||||||
|
newValues[0] = "default";
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
Set<String> existingNames = new HashSet<>();
|
||||||
|
for (ResolveInfo resolveInfo : mediaReceivers) {
|
||||||
|
newEntries[i] = resolveInfo.activityInfo.loadLabel(pm) + " (" + resolveInfo.activityInfo.packageName + ")";
|
||||||
|
if (existingNames.contains(newEntries[i].toString().trim())) {
|
||||||
|
newEntries[i] = resolveInfo.activityInfo.loadLabel(pm) + " (" + resolveInfo.activityInfo.name + ")";
|
||||||
|
} else {
|
||||||
|
existingNames.add(newEntries[i].toString().trim());
|
||||||
|
}
|
||||||
|
newValues[i] = resolveInfo.activityInfo.packageName;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
audioPlayer.setEntries(newEntries);
|
||||||
|
audioPlayer.setEntryValues(newValues);
|
||||||
|
audioPlayer.setDefaultValue(newValues[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Preference theme = findPreference("pref_key_theme");
|
||||||
|
final Preference amoled_black = findPreference("pref_key_theme_amoled_black");
|
||||||
|
|
||||||
|
if (amoled_black != null) {
|
||||||
|
String selectedTheme = prefs.getString("pref_key_theme", requireContext().getString(R.string.pref_theme_value_system));
|
||||||
|
if (selectedTheme.equals("light"))
|
||||||
amoled_black.setEnabled(false);
|
amoled_black.setEnabled(false);
|
||||||
else
|
else
|
||||||
amoled_black.setEnabled(true);
|
amoled_black.setEnabled(true);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
pref = findPreference("pref_discovery_pairing");
|
if (theme != null) {
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
@Override
|
||||||
Intent enableIntent = new Intent(SettingsActivity.this, DiscoveryPairingPreferenceActivity.class);
|
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
||||||
startActivity(enableIntent);
|
final String val = newVal.toString();
|
||||||
return true;
|
if (amoled_black != null) {
|
||||||
|
if (val.equals("light"))
|
||||||
|
amoled_black.setEnabled(false);
|
||||||
|
else
|
||||||
|
amoled_black.setEnabled(true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
//fitness app (OpenTracks) package name selection for OpenTracks observer
|
pref = findPreference("pref_discovery_pairing");
|
||||||
pref = findPreference("pref_key_opentracks_packagename");
|
if (pref != null) {
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
Intent enableIntent = new Intent(requireContext(), DiscoveryPairingPreferenceActivity.class);
|
||||||
|
startActivity(enableIntent);
|
||||||
final LinearLayout outerLayout = new LinearLayout(SettingsActivity.this);
|
return true;
|
||||||
outerLayout.setOrientation(LinearLayout.VERTICAL);
|
});
|
||||||
final LinearLayout innerLayout = new LinearLayout(SettingsActivity.this);
|
|
||||||
innerLayout.setOrientation(LinearLayout.HORIZONTAL);
|
|
||||||
innerLayout.setPadding(20, 0, 20, 0);
|
|
||||||
final Spinner selectionListSpinner = new Spinner(SettingsActivity.this);
|
|
||||||
String[] appListArray = getResources().getStringArray(R.array.fitness_tracking_apps_package_names);
|
|
||||||
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(SettingsActivity.this,
|
|
||||||
android.R.layout.simple_spinner_dropdown_item, appListArray);
|
|
||||||
selectionListSpinner.setAdapter(spinnerArrayAdapter);
|
|
||||||
fitnessAppSelectionListSpinnerFirstRun = 0;
|
|
||||||
addListenerOnSpinnerDeviceSelection(selectionListSpinner);
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
|
||||||
String packageName = prefs.getString("opentracks_packagename", "de.dennisguse.opentracks");
|
|
||||||
fitnessAppEditText = new EditText(SettingsActivity.this);
|
|
||||||
fitnessAppEditText.setText(packageName);
|
|
||||||
innerLayout.addView(fitnessAppEditText);
|
|
||||||
outerLayout.addView(selectionListSpinner);
|
|
||||||
outerLayout.addView(innerLayout);
|
|
||||||
|
|
||||||
new AlertDialog.Builder(SettingsActivity.this)
|
|
||||||
.setCancelable(true)
|
|
||||||
.setTitle(R.string.pref_title_opentracks_packagename)
|
|
||||||
.setView(outerLayout)
|
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
SharedPreferences.Editor editor = GBApplication.getPrefs().getPreferences().edit();
|
|
||||||
editor.putString("opentracks_packagename", fitnessAppEditText.getText().toString());
|
|
||||||
editor.apply();
|
|
||||||
editor.commit();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addListenerOnSpinnerDeviceSelection(Spinner spinner) {
|
//fitness app (OpenTracks) package name selection for OpenTracks observer
|
||||||
spinner.setOnItemSelectedListener(new SettingsActivity.CustomOnDeviceSelectedListener());
|
pref = findPreference("pref_key_opentracks_packagename");
|
||||||
}
|
if (pref != null) {
|
||||||
|
pref.setOnPreferenceClickListener(preference -> {
|
||||||
|
final LinearLayout outerLayout = new LinearLayout(requireContext());
|
||||||
|
outerLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
final LinearLayout innerLayout = new LinearLayout(requireContext());
|
||||||
|
innerLayout.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
|
innerLayout.setPadding(20, 0, 20, 0);
|
||||||
|
final Spinner selectionListSpinner = new Spinner(requireContext());
|
||||||
|
String[] appListArray = getResources().getStringArray(R.array.fitness_tracking_apps_package_names);
|
||||||
|
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(requireContext(),
|
||||||
|
android.R.layout.simple_spinner_dropdown_item, appListArray);
|
||||||
|
selectionListSpinner.setAdapter(spinnerArrayAdapter);
|
||||||
|
fitnessAppSelectionListSpinnerFirstRun = 0;
|
||||||
|
addListenerOnSpinnerDeviceSelection(selectionListSpinner);
|
||||||
|
Prefs prefs1 = GBApplication.getPrefs();
|
||||||
|
String packageName = prefs1.getString("opentracks_packagename", "de.dennisguse.opentracks");
|
||||||
|
fitnessAppEditText = new EditText(requireContext());
|
||||||
|
fitnessAppEditText.setText(packageName);
|
||||||
|
innerLayout.addView(fitnessAppEditText);
|
||||||
|
outerLayout.addView(selectionListSpinner);
|
||||||
|
outerLayout.addView(innerLayout);
|
||||||
|
|
||||||
public class CustomOnDeviceSelectedListener implements AdapterView.OnItemSelectedListener {
|
new AlertDialog.Builder(requireContext())
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
.setCancelable(true)
|
||||||
if (++fitnessAppSelectionListSpinnerFirstRun > 1) { //this prevents the setText to be set when spinner just is being initialized
|
.setTitle(R.string.pref_title_opentracks_packagename)
|
||||||
fitnessAppEditText.setText(parent.getItemAtPosition(pos).toString());
|
.setView(outerLayout)
|
||||||
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
SharedPreferences.Editor editor = GBApplication.getPrefs().getPreferences().edit();
|
||||||
|
editor.putString("opentracks_packagename", fitnessAppEditText.getText().toString());
|
||||||
|
editor.apply();
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addListenerOnSpinnerDeviceSelection(Spinner spinner) {
|
||||||
|
spinner.setOnItemSelectedListener(new CustomOnDeviceSelectedListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CustomOnDeviceSelectedListener implements AdapterView.OnItemSelectedListener {
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
|
if (++fitnessAppSelectionListSpinnerFirstRun > 1) { //this prevents the setText to be set when spinner just is being initialized
|
||||||
|
fitnessAppEditText.setText(parent.getItemAtPosition(pos).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> arg0) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> arg0) {
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
// TODO Auto-generated method stub
|
if (requestCode == FILE_REQUEST_CODE && intent != null) {
|
||||||
}
|
Uri uri = intent.getData();
|
||||||
}
|
requireContext().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
|
GBApplication.getPrefs().getPreferences()
|
||||||
@Override
|
.edit()
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
.putString(GBPrefs.AUTO_EXPORT_LOCATION, uri.toString())
|
||||||
if (requestCode == FILE_REQUEST_CODE && intent != null) {
|
.apply();
|
||||||
Uri uri = intent.getData();
|
String summary = getAutoExportLocationSummary();
|
||||||
getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
findPreference(GBPrefs.AUTO_EXPORT_LOCATION).setSummary(summary);
|
||||||
PreferenceManager
|
boolean autoExportEnabled = GBApplication
|
||||||
.getDefaultSharedPreferences(this)
|
.getPrefs().getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false);
|
||||||
.edit()
|
int autoExportPeriod = GBApplication
|
||||||
.putString(GBPrefs.AUTO_EXPORT_LOCATION, uri.toString())
|
.getPrefs().getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
||||||
.apply();
|
PeriodicExporter.scheduleAlarm(requireContext().getApplicationContext(), autoExportPeriod, autoExportEnabled);
|
||||||
String summary = getAutoExportLocationSummary();
|
|
||||||
findPreference(GBPrefs.AUTO_EXPORT_LOCATION).setSummary(summary);
|
|
||||||
boolean autoExportEnabled = GBApplication
|
|
||||||
.getPrefs().getBoolean(GBPrefs.AUTO_EXPORT_ENABLED, false);
|
|
||||||
int autoExportPeriod = GBApplication
|
|
||||||
.getPrefs().getInt(GBPrefs.AUTO_EXPORT_INTERVAL, 0);
|
|
||||||
PeriodicExporter.scheduleAlarm(getApplicationContext(), autoExportPeriod, autoExportEnabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Either returns the file path of the selected document, or the display name, or an empty string
|
|
||||||
*/
|
|
||||||
public String getAutoExportLocationSummary() {
|
|
||||||
String autoExportLocation = GBApplication.getPrefs().getString(GBPrefs.AUTO_EXPORT_LOCATION, null);
|
|
||||||
if (autoExportLocation == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
Uri uri = Uri.parse(autoExportLocation);
|
|
||||||
try {
|
|
||||||
return AndroidUtils.getFilePath(getApplicationContext(), uri);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
try {
|
|
||||||
Cursor cursor = getContentResolver().query(
|
|
||||||
uri,
|
|
||||||
new String[]{DocumentsContract.Document.COLUMN_DISPLAY_NAME},
|
|
||||||
null, null, null, null
|
|
||||||
);
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
|
||||||
return cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_DISPLAY_NAME));
|
|
||||||
}
|
|
||||||
} catch (Exception fdfsdfds) {
|
|
||||||
LOG.warn("fuck");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* delayed execution so that the preferences are applied first
|
Either returns the file path of the selected document, or the display name, or an empty string
|
||||||
*/
|
*/
|
||||||
private void invokeLater(Runnable runnable) {
|
public String getAutoExportLocationSummary() {
|
||||||
getListView().post(runnable);
|
String autoExportLocation = GBApplication.getPrefs().getString(GBPrefs.AUTO_EXPORT_LOCATION, null);
|
||||||
}
|
if (autoExportLocation == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Uri uri = Uri.parse(autoExportLocation);
|
||||||
|
try {
|
||||||
|
return AndroidUtils.getFilePath(requireContext().getApplicationContext(), uri);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
try {
|
||||||
|
Cursor cursor = requireContext().getContentResolver().query(
|
||||||
|
uri,
|
||||||
|
new String[]{DocumentsContract.Document.COLUMN_DISPLAY_NAME},
|
||||||
|
null, null, null, null
|
||||||
|
);
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
return cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_DISPLAY_NAME));
|
||||||
|
}
|
||||||
|
} catch (Exception fdfsdfds) {
|
||||||
|
LOG.warn("fuck");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
/*
|
||||||
protected String[] getPreferenceKeysWithSummary() {
|
* delayed execution so that the preferences are applied first
|
||||||
return new String[]{
|
*/
|
||||||
"pebble_emu_addr",
|
private void invokeLater(Runnable runnable) {
|
||||||
"pebble_emu_port",
|
getListView().post(runnable);
|
||||||
"pebble_reconnect_attempts",
|
}
|
||||||
"location_latitude",
|
|
||||||
"location_longitude",
|
|
||||||
"weather_city",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setLocationPreferences(Location location) {
|
private void setLocationPreferences(Location location) {
|
||||||
String latitude = String.format(Locale.US, "%.6g", location.getLatitude());
|
String latitude = String.format(Locale.US, "%.6g", location.getLatitude());
|
||||||
String longitude = String.format(Locale.US, "%.6g", location.getLongitude());
|
String longitude = String.format(Locale.US, "%.6g", location.getLongitude());
|
||||||
LOG.info("got location. Lat: " + latitude + " Lng: " + longitude);
|
LOG.info("got location. Lat: " + latitude + " Lng: " + longitude);
|
||||||
GB.toast(SettingsActivity.this, getString(R.string.toast_aqurired_networklocation), 2000, 0);
|
GB.toast(requireContext(), getString(R.string.toast_aqurired_networklocation), 2000, 0);
|
||||||
EditTextPreference pref_latitude = (EditTextPreference) findPreference("location_latitude");
|
EditTextPreference pref_latitude = findPreference("location_latitude");
|
||||||
EditTextPreference pref_longitude = (EditTextPreference) findPreference("location_longitude");
|
EditTextPreference pref_longitude = findPreference("location_longitude");
|
||||||
pref_latitude.setText(latitude);
|
pref_latitude.setText(latitude);
|
||||||
pref_longitude.setText(longitude);
|
pref_longitude.setText(longitude);
|
||||||
pref_latitude.setSummary(latitude);
|
pref_latitude.setSummary(latitude);
|
||||||
pref_longitude.setSummary(longitude);
|
pref_longitude.setSummary(longitude);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_key_general"
|
android:key="pref_key_general"
|
||||||
android:title="@string/pref_header_general">
|
android:title="@string/pref_header_general">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="general_autostartonboot"
|
android:key="general_autostartonboot"
|
||||||
android:title="@string/pref_title_general_autostartonboot" />
|
android:title="@string/pref_title_general_autostartonboot" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="general_autoconnectonbluetooth"
|
android:key="general_autoconnectonbluetooth"
|
||||||
android:title="@string/pref_title_general_autoconnectonbluetooth" />
|
android:title="@string/pref_title_general_autoconnectonbluetooth" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="general_autocreconnect"
|
android:key="general_autocreconnect"
|
||||||
android:title="@string/pref_title_general_autoreconnect"
|
android:title="@string/pref_title_general_autoreconnect"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:summary="setting has been moved to device specific settings"/>
|
android:summary="setting has been moved to device specific settings"/>
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="display_add_device_fab"
|
android:key="display_add_device_fab"
|
||||||
@ -28,7 +29,7 @@
|
|||||||
android:summaryOn="@string/pref_display_add_device_fab_on"
|
android:summaryOn="@string/pref_display_add_device_fab_on"
|
||||||
android:title="@string/pref_display_add_device_fab" />
|
android:title="@string/pref_display_add_device_fab" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="mb_intents"
|
android:key="mb_intents"
|
||||||
@ -42,7 +43,7 @@
|
|||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:dependency="mb_intents" />
|
android:dependency="mb_intents" />
|
||||||
|
|
||||||
<PreferenceScreen android:title="@string/pref_title_theme">
|
<PreferenceScreen android:key="pref_screen_theme" android:title="@string/pref_title_theme">
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="@string/pref_theme_value_light"
|
android:defaultValue="@string/pref_theme_value_light"
|
||||||
android:entries="@array/pref_theme_options"
|
android:entries="@array/pref_theme_options"
|
||||||
@ -50,7 +51,7 @@
|
|||||||
android:key="pref_key_theme"
|
android:key="pref_key_theme"
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/pref_title_theme" />
|
android:title="@string/pref_title_theme" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pref_key_theme_amoled_black"
|
android:key="pref_key_theme_amoled_black"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
@ -75,14 +76,15 @@
|
|||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/pref_title_unit_system" />
|
android:title="@string/pref_title_unit_system" />
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
|
android:key="pref_screen_rtl"
|
||||||
android:title="@string/preferences_rtl_settings">
|
android:title="@string/preferences_rtl_settings">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="rtl"
|
android:key="rtl"
|
||||||
android:summary="@string/pref_summary_rtl"
|
android:summary="@string/pref_summary_rtl"
|
||||||
android:title="@string/pref_title_rtl" />
|
android:title="@string/pref_title_rtl" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="contextualArabic"
|
android:key="contextualArabic"
|
||||||
@ -99,13 +101,15 @@
|
|||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
|
android:key="pref_screen_weather"
|
||||||
android:title="@string/pref_title_weather"
|
android:title="@string/pref_title_weather"
|
||||||
android:summary="@string/pref_title_weather_summary">
|
android:summary="@string/pref_title_weather_summary">
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:inputType="text"
|
android:inputType="text"
|
||||||
android:key="weather_city"
|
android:key="weather_city"
|
||||||
android:title="@string/pref_title_weather_location" />
|
android:title="@string/pref_title_weather_location"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
@ -121,7 +125,7 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_key_datetime"
|
android:key="pref_key_datetime"
|
||||||
android:title="@string/pref_header_datetime">
|
android:title="@string/pref_header_datetime">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="datetime_synconconnect"
|
android:key="datetime_synconconnect"
|
||||||
@ -137,14 +141,16 @@
|
|||||||
android:inputType="numberDecimal|numberSigned"
|
android:inputType="numberDecimal|numberSigned"
|
||||||
android:key="location_latitude"
|
android:key="location_latitude"
|
||||||
android:maxLength="7"
|
android:maxLength="7"
|
||||||
android:title="@string/pref_title_location_latitude" />
|
android:title="@string/pref_title_location_latitude"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:inputType="numberDecimal|numberSigned"
|
android:inputType="numberDecimal|numberSigned"
|
||||||
android:key="location_longitude"
|
android:key="location_longitude"
|
||||||
android:maxLength="7"
|
android:maxLength="7"
|
||||||
android:title="@string/pref_title_location_longitude" />
|
android:title="@string/pref_title_location_longitude"
|
||||||
<CheckBoxPreference
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:dependency="location_aquire"
|
android:dependency="location_aquire"
|
||||||
android:key="use_updated_location_if_available"
|
android:key="use_updated_location_if_available"
|
||||||
@ -157,13 +163,13 @@
|
|||||||
android:title="@string/pref_title_opentracks_packagename" />
|
android:title="@string/pref_title_opentracks_packagename" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/pref_header_navigation">
|
<PreferenceCategory android:title="@string/pref_header_navigation">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="navigation_forward"
|
android:key="navigation_forward"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_summary_navigation_forward"
|
android:summary="@string/pref_summary_navigation_forward"
|
||||||
android:title="@string/pref_title_navigation_forward" />
|
android:title="@string/pref_title_navigation_forward" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:dependency="navigation_forward"
|
android:dependency="navigation_forward"
|
||||||
android:key="nagivation_screen_on"
|
android:key="nagivation_screen_on"
|
||||||
@ -188,13 +194,13 @@
|
|||||||
android:title="@string/pref_title_pebble_settings">
|
android:title="@string/pref_title_pebble_settings">
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/pref_header_general">
|
android:title="@string/pref_header_general">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pebble_enable_outgoing_call"
|
android:key="pebble_enable_outgoing_call"
|
||||||
android:summary="@string/pref_summary_enable_outgoing_call"
|
android:summary="@string/pref_summary_enable_outgoing_call"
|
||||||
android:title="@string/pref_title_enable_outgoing_call" />
|
android:title="@string/pref_title_enable_outgoing_call" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_enable_pebblekit"
|
android:key="pebble_enable_pebblekit"
|
||||||
@ -205,7 +211,8 @@
|
|||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:key="pebble_reconnect_attempts"
|
android:key="pebble_reconnect_attempts"
|
||||||
android:maxLength="4"
|
android:maxLength="4"
|
||||||
android:title="@string/pref_title_pebble_reconnect_attempts" />
|
android:title="@string/pref_title_pebble_reconnect_attempts"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="pebble_pref_privacy_mode"
|
android:key="pebble_pref_privacy_mode"
|
||||||
android:title="@string/pref_title_pebble_privacy_mode"
|
android:title="@string/pref_title_pebble_privacy_mode"
|
||||||
@ -215,7 +222,7 @@
|
|||||||
android:summary="%s" />
|
android:summary="%s" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/pref_header_pebble_timeline">
|
<PreferenceCategory android:title="@string/pref_header_pebble_timeline">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:key="send_sunrise_sunset"
|
android:key="send_sunrise_sunset"
|
||||||
android:summary="@string/pref_summary_sunrise_sunset"
|
android:summary="@string/pref_summary_sunrise_sunset"
|
||||||
@ -229,24 +236,24 @@
|
|||||||
android:key="pebble_activitytracker"
|
android:key="pebble_activitytracker"
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/pref_title_pebble_activitytracker" />
|
android:title="@string/pref_title_pebble_activitytracker" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pebble_sync_health"
|
android:key="pebble_sync_health"
|
||||||
android:title="@string/pref_title_pebble_sync_health" />
|
android:title="@string/pref_title_pebble_sync_health" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pebble_health_store_raw"
|
android:key="pebble_health_store_raw"
|
||||||
android:dependency="pebble_sync_health"
|
android:dependency="pebble_sync_health"
|
||||||
android:title="@string/pref_title_pebble_health_store_raw"
|
android:title="@string/pref_title_pebble_health_store_raw"
|
||||||
android:summary="@string/pref_summary_pebble_health_store_raw" />
|
android:summary="@string/pref_summary_pebble_health_store_raw" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pebble_sync_misfit"
|
android:key="pebble_sync_misfit"
|
||||||
android:title="@string/pref_title_pebble_sync_misfit" />>
|
android:title="@string/pref_title_pebble_sync_misfit" />>
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pebble_sync_morpheuz"
|
android:key="pebble_sync_morpheuz"
|
||||||
@ -254,19 +261,19 @@
|
|||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/pref_header_development">
|
android:title="@string/pref_header_development">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_force_protocol"
|
android:key="pebble_force_protocol"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_summary_pebble_forceprotocol"
|
android:summary="@string/pref_summary_pebble_forceprotocol"
|
||||||
android:title="@string/pref_title_pebble_forceprotocol" />
|
android:title="@string/pref_title_pebble_forceprotocol" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_force_untested"
|
android:key="pebble_force_untested"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_summary_pebble_forceuntested"
|
android:summary="@string/pref_summary_pebble_forceuntested"
|
||||||
android:title="@string/pref_title_pebble_forceuntested" />
|
android:title="@string/pref_title_pebble_forceuntested" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_force_le"
|
android:key="pebble_force_le"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
@ -279,25 +286,25 @@
|
|||||||
android:defaultValue="512"
|
android:defaultValue="512"
|
||||||
android:title="@string/pref_title_pebble_mtu_limit"
|
android:title="@string/pref_title_pebble_mtu_limit"
|
||||||
android:summary="@string/pref_summary_pebble_mtu_limit" />
|
android:summary="@string/pref_summary_pebble_mtu_limit" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_gatt_clientonly"
|
android:key="pebble_gatt_clientonly"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_summary_pebble_gatt_clientonly"
|
android:summary="@string/pref_summary_pebble_gatt_clientonly"
|
||||||
android:title="@string/pref_title_pebble_gatt_clientonly" />
|
android:title="@string/pref_title_pebble_gatt_clientonly" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_enable_applogs"
|
android:key="pebble_enable_applogs"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_summary_pebble_enable_applogs"
|
android:summary="@string/pref_summary_pebble_enable_applogs"
|
||||||
android:title="@string/pref_title_pebble_enable_applogs" />
|
android:title="@string/pref_title_pebble_enable_applogs" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="pebble_always_ack_pebblekit"
|
android:key="pebble_always_ack_pebblekit"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_summary_pebble_always_ack_pebblekit"
|
android:summary="@string/pref_summary_pebble_always_ack_pebblekit"
|
||||||
android:title="@string/pref_title_pebble_always_ack_pebblekit" />
|
android:title="@string/pref_title_pebble_always_ack_pebblekit" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:dependency="pebble_force_untested"
|
android:dependency="pebble_force_untested"
|
||||||
android:key="pebble_enable_background_javascript"
|
android:key="pebble_enable_background_javascript"
|
||||||
@ -308,12 +315,14 @@
|
|||||||
android:digits="0123456789."
|
android:digits="0123456789."
|
||||||
android:key="pebble_emu_addr"
|
android:key="pebble_emu_addr"
|
||||||
android:maxLength="15"
|
android:maxLength="15"
|
||||||
android:title="Emulator IP" />
|
android:title="Emulator IP"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:key="pebble_emu_port"
|
android:key="pebble_emu_port"
|
||||||
android:maxLength="5"
|
android:maxLength="5"
|
||||||
android:title="Emulator Port" />
|
android:title="Emulator Port"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
@ -329,7 +338,7 @@
|
|||||||
android:key="hplus_screentime"
|
android:key="hplus_screentime"
|
||||||
android:title="@string/pref_title_screentime"/>
|
android:title="@string/pref_title_screentime"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="hplus_alldayhr"
|
android:key="hplus_alldayhr"
|
||||||
@ -350,7 +359,7 @@
|
|||||||
android:key="auto_export_location"
|
android:key="auto_export_location"
|
||||||
android:title="@string/pref_title_auto_export_location"
|
android:title="@string/pref_title_auto_export_location"
|
||||||
android:summary="%s" />
|
android:summary="%s" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="auto_export_enabled"
|
android:key="auto_export_enabled"
|
||||||
@ -367,7 +376,7 @@
|
|||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/pref_header_auto_fetch">
|
android:title="@string/pref_header_auto_fetch">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="auto_fetch_enabled"
|
android:key="auto_fetch_enabled"
|
||||||
@ -386,18 +395,18 @@
|
|||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_key_development"
|
android:key="pref_key_development"
|
||||||
android:title="@string/pref_header_development">
|
android:title="@string/pref_header_development">
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="log_to_file"
|
android:key="log_to_file"
|
||||||
android:title="@string/pref_write_logfiles" />
|
android:title="@string/pref_write_logfiles" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="permission_pestering"
|
android:key="permission_pestering"
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:summary="@string/pref_check_permission_status_summary"
|
android:summary="@string/pref_check_permission_status_summary"
|
||||||
android:title="@string/pref_check_permission_status" />
|
android:title="@string/pref_check_permission_status" />
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:layout="@layout/preference_checkbox"
|
android:layout="@layout/preference_checkbox"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="cache_weather"
|
android:key="cache_weather"
|
||||||
@ -416,27 +425,27 @@
|
|||||||
android:key="pref_key_intent_api"
|
android:key="pref_key_intent_api"
|
||||||
android:title="@string/pref_header_intent_api">
|
android:title="@string/pref_header_intent_api">
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:key="prefs_key_allow_bluetooth_intent_api"
|
android:key="prefs_key_allow_bluetooth_intent_api"
|
||||||
android:title="@string/activity_prefs_allow_bluetooth_intent_api"
|
android:title="@string/activity_prefs_allow_bluetooth_intent_api"
|
||||||
android:summary="@string/activity_prefs_summary_allow_bluetooth_intent_api" />
|
android:summary="@string/activity_prefs_summary_allow_bluetooth_intent_api" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:key="intent_api_allow_activity_sync"
|
android:key="intent_api_allow_activity_sync"
|
||||||
android:title="@string/intent_api_allow_activity_sync_title"
|
android:title="@string/intent_api_allow_activity_sync_title"
|
||||||
android:summary="@string/intent_api_allow_activity_sync_summary" />
|
android:summary="@string/intent_api_allow_activity_sync_summary" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:key="intent_api_allow_trigger_export"
|
android:key="intent_api_allow_trigger_export"
|
||||||
android:title="@string/intent_api_allow_trigger_export_title"
|
android:title="@string/intent_api_allow_trigger_export_title"
|
||||||
android:summary="@string/intent_api_allow_trigger_export_summary" />
|
android:summary="@string/intent_api_allow_trigger_export_summary" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:key="intent_api_broadcast_export"
|
android:key="intent_api_broadcast_export"
|
||||||
android:title="@string/intent_api_broadcast_export_title"
|
android:title="@string/intent_api_broadcast_export_title"
|
||||||
android:summary="@string/intent_api_broadcast_export_summary" />
|
android:summary="@string/intent_api_broadcast_export_summary" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<SwitchPreference
|
||||||
android:key="intent_api_allow_debug_commands"
|
android:key="intent_api_allow_debug_commands"
|
||||||
android:title="@string/intent_api_allow_debug_commands_title"
|
android:title="@string/intent_api_allow_debug_commands_title"
|
||||||
android:summary="@string/intent_api_allow_debug_commands_summary" />
|
android:summary="@string/intent_api_allow_debug_commands_summary" />
|
||||||
|
Loading…
Reference in New Issue
Block a user