diff --git a/README.md b/README.md
index a4d99b2cd..711730282 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@ vendor's servers.
* Gadgetbridge is licensed under the AGPLv3
* Files in app/src/main/java/net/osmand/ and app/src/main/aidl/net/osmand/ are licensed under the GPLv3 by OsmAnd BV
* Files in app/src/main/java/org/bouncycastle are licensed under the MIT license by The Legion of the Bouncy Castle Inc.
+* File app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/SearchPreferenceHighlighter.java is licensed under the MIT license by ByteHamster
## Download
diff --git a/app/build.gradle b/app/build.gradle
index a2ed9cf6d..937220e0e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -246,6 +246,7 @@ dependencies {
implementation 'com.github.wax911.android-emojify:gson:1.9.3'
implementation 'com.google.protobuf:protobuf-javalite:4.27.3'
implementation 'com.android.volley:volley:1.2.1'
+ implementation 'com.github.ByteHamster:SearchPreference:v2.5.1'
// Bouncy Castle is included directly in GB, to avoid pulling the entire dependency
// It's included in the org.bouncycastle.shaded package, to fix conflicts with roboelectric
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutUserPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutUserPreferencesActivity.java
index ca6dea58f..2dcf310f2 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutUserPreferencesActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutUserPreferencesActivity.java
@@ -39,15 +39,15 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
public class AboutUserPreferencesActivity extends AbstractSettingsActivityV2 {
- @Override
- protected String fragmentTag() {
- return AboutUserPreferencesFragment.FRAGMENT_TAG;
- }
+ private static final Logger LOG = LoggerFactory.getLogger(AboutUserPreferencesActivity.class);
@Override
protected PreferenceFragmentCompat newFragment() {
@@ -55,8 +55,6 @@ public class AboutUserPreferencesActivity extends AbstractSettingsActivityV2 {
}
public static class AboutUserPreferencesFragment extends AbstractPreferenceFragment {
- static final String FRAGMENT_TAG = "ABOUT_USER_PREFERENCES_FRAGMENT";
-
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
setPreferencesFromResource(R.xml.about_user, rootKey);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java
index d35aeb9e3..56b5f63bb 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractPreferenceFragment.java
@@ -19,8 +19,15 @@ package nodomain.freeyourgadget.gadgetbridge.activities;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.annotation.XmlRes;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.view.MenuProvider;
import androidx.fragment.app.DialogFragment;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
@@ -33,6 +40,8 @@ import androidx.preference.PreferenceScreen;
import androidx.preference.SeekBarPreference;
import androidx.preference.SwitchPreferenceCompat;
+import com.bytehamster.lib.preferencesearch.SearchConfiguration;
+import com.bytehamster.lib.preferencesearch.SearchPreference;
import com.mobeta.android.dslv.DragSortListPreference;
import com.mobeta.android.dslv.DragSortListPreferenceFragment;
@@ -54,11 +63,59 @@ import nodomain.freeyourgadget.gadgetbridge.util.dialogs.MaterialEditTextPrefere
import nodomain.freeyourgadget.gadgetbridge.util.dialogs.MaterialListPreferenceDialogFragment;
import nodomain.freeyourgadget.gadgetbridge.util.dialogs.MaterialMultiSelectListPreferenceDialogFragment;
-public abstract class AbstractPreferenceFragment extends PreferenceFragmentCompat {
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractPreferenceFragment.class);
+public abstract class AbstractPreferenceFragment extends PreferenceFragmentCompat implements MenuProvider {
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractPreferenceFragment.class);
+
+ public static final String FRAGMENT_TAG = "preference_fragment";
private final SharedPreferencesChangeHandler sharedPreferencesChangeHandler = new SharedPreferencesChangeHandler();
+ private SearchConfiguration mSearchConfiguration;
+
+ @Override
+ public void onCreate(@Nullable final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ requireActivity().addMenuProvider(this);
+
+ ensureSearchConfiguration();
+ }
+
+ private SearchConfiguration ensureSearchConfiguration() {
+ if (mSearchConfiguration == null) {
+ final SearchPreference searchPreference = findPreference("searchPreference");
+ if (searchPreference != null) {
+ mSearchConfiguration = searchPreference.getSearchConfiguration();
+ mSearchConfiguration.setActivity((AppCompatActivity) requireActivity());
+ mSearchConfiguration.setHistoryId(requireActivity().getClass().getName());
+ mSearchConfiguration.setBreadcrumbsEnabled(true);
+ }
+ }
+
+ return mSearchConfiguration;
+ }
+
+ @Override
+ public void onCreateMenu(@NonNull final Menu menu, @NonNull final MenuInflater inflater) {
+ if (mSearchConfiguration != null) {
+ inflater.inflate(R.menu.menu_preferences, menu);
+ }
+ }
+
+ @Override
+ public boolean onMenuItemSelected(@NonNull final MenuItem item) {
+ final int itemId = item.getItemId();
+ if (itemId == R.id.preferences_search) {
+ final SearchPreference searchPreference = findPreference("searchPreference");
+ if (searchPreference != null) {
+ mSearchConfiguration.showSearchFragment();
+ return true;
+ }
+ }
+
+ return false;
+ }
+
@Override
public void onStart() {
super.onStart();
@@ -142,6 +199,29 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragmentCompa
}
}
+ protected void index(@XmlRes final int preferencesResId) {
+ index(preferencesResId, 0);
+ }
+
+ protected void index(final Preference preference) {
+ ensureSearchConfiguration();
+
+ if (mSearchConfiguration != null) {
+ mSearchConfiguration.indexItem(preference);
+ }
+ }
+
+ protected void index(@XmlRes final int preferencesResId, final int breadcrumb) {
+ ensureSearchConfiguration();
+
+ if (mSearchConfiguration != null) {
+ final SearchConfiguration.SearchIndexItem indexItem = mSearchConfiguration.index(preferencesResId);
+ if (breadcrumb != 0) {
+ indexItem.addBreadcrumb(breadcrumb);
+ }
+ }
+ }
+
/**
* Reload the preferences in the current screen. This is needed when the user enters or exists a PreferenceScreen,
* otherwise the settings won't be reloaded by the {@link SharedPreferencesChangeHandler}, as the preferences return
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractSettingsActivityV2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractSettingsActivityV2.java
index 5ea4b9d42..bfc1bad49 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractSettingsActivityV2.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractSettingsActivityV2.java
@@ -16,41 +16,67 @@
along with this program. If not, see . */
package nodomain.freeyourgadget.gadgetbridge.activities;
+import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
-import nodomain.freeyourgadget.gadgetbridge.R;
+import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
+import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener;
+
+import nodomain.freeyourgadget.gadgetbridge.util.SearchPreferenceHighlighter;
public abstract class AbstractSettingsActivityV2 extends AbstractGBActivity implements
- PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
+ PreferenceFragmentCompat.OnPreferenceStartScreenCallback,
+ SearchPreferenceResultListener {
+
+ public static final String EXTRA_PREF_SCREEN = "preferenceScreen";
+ public static final String EXTRA_PREF_HIGHLIGHT = "preferenceToHighlight";
- protected abstract String fragmentTag();
protected abstract PreferenceFragmentCompat newFragment();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_device_settings);
if (savedInstanceState == null) {
- Fragment fragment = getSupportFragmentManager().findFragmentByTag(fragmentTag());
+ PreferenceFragmentCompat fragment = (PreferenceFragmentCompat) getSupportFragmentManager().findFragmentByTag(AbstractPreferenceFragment.FRAGMENT_TAG);
if (fragment == null) {
fragment = newFragment();
}
+ final String prefScreen = getIntent().getStringExtra(EXTRA_PREF_SCREEN);
+ if (prefScreen != null) {
+ final Bundle args;
+ if (fragment.getArguments() != null) {
+ args = fragment.getArguments();
+ } else {
+ args = new Bundle();
+ fragment.setArguments(args);
+ }
+ args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, prefScreen);
+ }
+
getSupportFragmentManager()
.beginTransaction()
- .replace(R.id.settings_container, fragment, fragmentTag())
+ .replace(android.R.id.content, fragment, AbstractPreferenceFragment.FRAGMENT_TAG)
.commit();
+
+ final String highlightKey = getIntent().getStringExtra(EXTRA_PREF_HIGHLIGHT);
+ if (highlightKey != null) {
+ SearchPreferenceHighlighter.highlight(fragment, highlightKey);
+ }
}
}
@Override
- public boolean onPreferenceStartScreen(final PreferenceFragmentCompat caller, final PreferenceScreen preferenceScreen) {
+ public boolean onPreferenceStartScreen(@NonNull final PreferenceFragmentCompat caller,
+ @NonNull final PreferenceScreen preferenceScreen) {
final PreferenceFragmentCompat fragment = newFragment();
final Bundle args;
if (fragment.getArguments() != null) {
@@ -63,7 +89,7 @@ public abstract class AbstractSettingsActivityV2 extends AbstractGBActivity impl
getSupportFragmentManager()
.beginTransaction()
- .replace(R.id.settings_container, fragment, preferenceScreen.getKey())
+ .replace(android.R.id.content, fragment, preferenceScreen.getKey())
.addToBackStack(preferenceScreen.getKey())
.commit();
@@ -83,6 +109,57 @@ public abstract class AbstractSettingsActivityV2 extends AbstractGBActivity impl
return super.onOptionsItemSelected(item);
}
+ @Override
+ public void onSearchResultClicked(final SearchPreferenceResult result) {
+ //result.closeSearchPage(this);
+ //// FIXME not sure why we need this, but the search fragment stays in the back stack otherwise
+ //getSupportFragmentManager().popBackStack(SearchPreferenceFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE);
+
+ final FragmentManager fragmentManager = getSupportFragmentManager();
+ final Fragment currentFragment = fragmentManager.findFragmentByTag(AbstractPreferenceFragment.FRAGMENT_TAG);
+ if (currentFragment == null) {
+ return;
+ }
+
+ if (!(currentFragment instanceof PreferenceFragmentCompat)) {
+ return;
+ }
+
+ final PreferenceFragmentCompat currentPreferenceFragment = (PreferenceFragmentCompat) currentFragment;
+ final String currentScreen = currentPreferenceFragment.getPreferenceScreen().getKey();
+
+ if (result.getScreen() != null && !result.getScreen().equals(currentScreen)) {
+ final PreferenceFragmentCompat newFragmentForScreen = newFragment();
+ final Bundle args;
+ if (newFragmentForScreen.getArguments() != null) {
+ args = newFragmentForScreen.getArguments();
+ } else {
+ args = new Bundle();
+ }
+ args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, result.getScreen());
+ newFragmentForScreen.setArguments(args);
+
+ fragmentManager.beginTransaction()
+ .replace(android.R.id.content, newFragmentForScreen)
+ .addToBackStack(null)
+ .commit();
+ result.highlight(newFragmentForScreen);
+ } else {
+ final Preference preference = currentPreferenceFragment.findPreference(result.getKey());
+ if (preference != null) {
+ result.highlight(currentPreferenceFragment);
+ }
+ }
+ }
+
+ protected void openActivityAndHighlight(final Class extends AbstractSettingsActivityV2> clazz,
+ final SearchPreferenceResult result) {
+ final Intent intent = new Intent(this, clazz);
+ intent.putExtra(EXTRA_PREF_SCREEN, result.getScreen());
+ intent.putExtra(EXTRA_PREF_HIGHLIGHT, result.getKey());
+ startActivity(intent);
+ }
+
public void setActionBarTitle(final CharSequence title) {
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardPreferencesActivity.java
index cf2744761..12f0df11e 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardPreferencesActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/DashboardPreferencesActivity.java
@@ -34,19 +34,17 @@ import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
public class DashboardPreferencesActivity extends AbstractSettingsActivityV2 {
- @Override
- protected String fragmentTag() {
- return DashboardPreferencesFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new DashboardPreferencesFragment();
}
- public static class DashboardPreferencesFragment extends AbstractPreferenceFragment {
- static final String FRAGMENT_TAG = "DASHBOARD_PREFERENCES_FRAGMENT";
+ @Override
+ protected void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+ public static class DashboardPreferencesFragment extends AbstractPreferenceFragment {
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
setPreferencesFromResource(R.xml.dashboard_preferences, rootKey);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/NotificationManagementActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/NotificationManagementActivity.java
index fd04ebd45..0f1dd9382 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/NotificationManagementActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/NotificationManagementActivity.java
@@ -38,11 +38,6 @@ public class NotificationManagementActivity extends AbstractSettingsActivityV2 {
private static final int RINGTONE_REQUEST_CODE = 4712;
private static final String DEFAULT_RINGTONE_URI = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE).toString();
- @Override
- protected String fragmentTag() {
- return NotificationPreferencesFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new NotificationPreferencesFragment();
@@ -51,8 +46,6 @@ public class NotificationManagementActivity extends AbstractSettingsActivityV2 {
public static class NotificationPreferencesFragment extends AbstractPreferenceFragment {
private static final Logger LOG = LoggerFactory.getLogger(NotificationPreferencesFragment.class);
- static final String FRAGMENT_TAG = "NOTIFICATION_PREFERENCES_FRAGMENT";
-
@Override
protected void onSharedPreferenceChanged(final Preference preference) {
if (GBPrefs.PING_TONE.equals(preference.getKey())) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java
index 4483dc172..63d7ca785 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SettingsActivity.java
@@ -34,6 +34,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.provider.DocumentsContract;
import android.text.InputType;
+import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@@ -48,6 +49,7 @@ import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
+import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
import com.google.android.material.color.DynamicColors;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@@ -77,21 +79,33 @@ import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
public class SettingsActivity extends AbstractSettingsActivityV2 {
public static final String PREF_MEASUREMENT_SYSTEM = "measurement_system";
- @Override
- protected String fragmentTag() {
- return SettingsFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new SettingsFragment();
}
+ @Override
+ public void onSearchResultClicked(final SearchPreferenceResult result) {
+ if (result.getResourceFile() == R.xml.about_user) {
+ openActivityAndHighlight(AboutUserPreferencesActivity.class, result);
+ } else if (result.getResourceFile() == R.xml.notifications_preferences) {
+ openActivityAndHighlight(NotificationManagementActivity.class, result);
+ } else if (result.getResourceFile() == R.xml.dashboard_preferences) {
+ openActivityAndHighlight(DashboardPreferencesActivity.class, result);
+ } else if (result.getResourceFile() == R.xml.charts_preferences) {
+ openActivityAndHighlight(ChartsPreferencesActivity.class, result);
+ } else if (result.getResourceFile() == R.xml.sleepasandroid_preferences) {
+ openActivityAndHighlight(SleepAsAndroidPreferencesActivity.class, result);
+ } else if (result.getResourceFile() == R.xml.discovery_pairing_preferences) {
+ openActivityAndHighlight(DiscoveryPairingPreferenceActivity.class, result);
+ } else {
+ super.onSearchResultClicked(result);
+ }
+ }
+
public static class SettingsFragment extends AbstractPreferenceFragment {
private static final Logger LOG = LoggerFactory.getLogger(SettingsActivity.class);
- static final String FRAGMENT_TAG = "SETTINGS_FRAGMENT";
-
private static final int EXPORT_LOCATION_FILE_REQUEST_CODE = 4711;
private EditText fitnessAppEditText = null;
private int fitnessAppSelectionListSpinnerFirstRun = 0;
@@ -99,6 +113,13 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
setPreferencesFromResource(R.xml.preferences, rootKey);
+ index(R.xml.preferences);
+ index(R.xml.about_user, R.string.activity_prefs_about_you);
+ index(R.xml.notifications_preferences, R.string.title_activity_notification_management);
+ index(R.xml.dashboard_preferences, R.string.bottom_nav_dashboard);
+ index(R.xml.charts_preferences, R.string.activity_prefs_charts);
+ index(R.xml.sleepasandroid_preferences, R.string.sleepasandroid_settings);
+ index(R.xml.discovery_pairing_preferences, R.string.activity_prefs_discovery_pairing);
setInputTypeFor("rtl_max_line_length", InputType.TYPE_CLASS_NUMBER);
setInputTypeFor("location_latitude", InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
@@ -486,7 +507,8 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
editor.putString("opentracks_packagename", fitnessAppEditText.getText().toString());
editor.apply();
})
- .setNegativeButton(R.string.Cancel, (dialog, which) -> {})
+ .setNegativeButton(R.string.Cancel, (dialog, which) -> {
+ })
.show();
return false;
});
@@ -585,4 +607,13 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
LocalBroadcastManager.getInstance(requireContext()).sendBroadcast(intent);
}
}
+
+ @Override
+ public boolean onOptionsItemSelected(final MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ onBackPressed();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SleepAsAndroidPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SleepAsAndroidPreferencesActivity.java
index 438f9181d..6a3a4c405 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SleepAsAndroidPreferencesActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/SleepAsAndroidPreferencesActivity.java
@@ -22,19 +22,12 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.devices.SleepAsAndroidFeature;
public class SleepAsAndroidPreferencesActivity extends AbstractSettingsActivityV2 {
- @Override
- protected String fragmentTag() {
- return SleepAsAndroidPreferencesFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new SleepAsAndroidPreferencesFragment();
}
public static class SleepAsAndroidPreferencesFragment extends AbstractPreferenceFragment {
- static final String FRAGMENT_TAG = "SLEEPASANDROID_PREFERENCES_FRAGMENT";
-
@Override
public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
setPreferencesFromResource(R.xml.sleepasandroid_preferences, rootKey);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsPreferencesActivity.java
index 9addbe151..a37a72af2 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsPreferencesActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/ChartsPreferencesActivity.java
@@ -39,11 +39,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.preferences.DevicePrefs;
public class ChartsPreferencesActivity extends AbstractSettingsActivityV2 {
private GBDevice device;
- @Override
- protected String fragmentTag() {
- return ChartsPreferencesFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return ChartsPreferencesFragment.newInstance(device);
@@ -57,8 +52,6 @@ public class ChartsPreferencesActivity extends AbstractSettingsActivityV2 {
}
public static class ChartsPreferencesFragment extends AbstractPreferenceFragment {
- static final String FRAGMENT_TAG = "CHARTS_PREFERENCES_FRAGMENT";
-
private GBDevice device;
static ChartsPreferencesFragment newInstance(final GBDevice device) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java
index 49fe217da..56af4b0ef 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsActivity.java
@@ -16,9 +16,14 @@
along with this program. If not, see . */
package nodomain.freeyourgadget.gadgetbridge.activities.devicesettings;
+import android.content.Intent;
+
import androidx.preference.PreferenceFragmentCompat;
+import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
+
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractSettingsActivityV2;
+import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
public class DeviceSettingsActivity extends AbstractSettingsActivityV2 {
@@ -30,11 +35,6 @@ public class DeviceSettingsActivity extends AbstractSettingsActivityV2 {
APPLICATION_SETTINGS
}
- @Override
- protected String fragmentTag() {
- return DeviceSpecificSettingsFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
final GBDevice device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
@@ -42,4 +42,20 @@ public class DeviceSettingsActivity extends AbstractSettingsActivityV2 {
return DeviceSpecificSettingsFragment.newInstance(device, menu_entry);
}
+
+ @Override
+ public void onSearchResultClicked(final SearchPreferenceResult result) {
+ final GBDevice device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
+ DeviceCoordinator coordinator = device.getDeviceCoordinator();
+ DeviceSpecificSettings deviceSpecificSettings = coordinator.getDeviceSpecificSettings(device);
+
+ String rootScreenForSubScreen = deviceSpecificSettings.getRootScreenForSubScreen(result.getResourceFile());
+
+ if (rootScreenForSubScreen != null) {
+ final Intent intent = getIntent(); // FIXME new Intent(this, DeviceSettingsActivity.class);
+ intent.putExtra(EXTRA_PREF_SCREEN, rootScreenForSubScreen);
+ intent.putExtra(EXTRA_PREF_HIGHLIGHT, result.getKey());
+ startActivity(intent);
+ }
+ }
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettings.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettings.java
index 5cd514f96..0415b1012 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettings.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettings.java
@@ -29,6 +29,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
+import nodomain.freeyourgadget.gadgetbridge.R;
+
/**
* A class that contains the device-specific settings screens for a device. All the integers in this
* class correspond to xml resources for preferences.
@@ -115,6 +117,25 @@ public class DeviceSpecificSettings implements Parcelable {
Objects.requireNonNull(subScreens.get(e.getKey())).add(screen);
}
}
+
+ // Ensure search is always at the start
+ final int searchIndex = rootScreens.indexOf(R.xml.devicesettings_search);
+ if (searchIndex >= 0) {
+ rootScreens.remove(searchIndex);
+ rootScreens.add(0, R.xml.devicesettings_search);
+ }
+ }
+
+ public String getRootScreenForSubScreen(final int subScreen) {
+ for (final Map.Entry> e : subScreens.entrySet()) {
+ for (final Integer ss : e.getValue()) {
+ if (ss == subScreen) {
+ return e.getKey();
+ }
+ }
+ }
+
+ return null;
}
public List getRootScreens() {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
index 3632d57bc..25de8878a 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java
@@ -50,6 +50,8 @@ import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreferenceCompat;
+import com.bytehamster.lib.preferencesearch.SearchPreferenceResult;
+
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,8 +91,6 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
private static final Logger LOG = LoggerFactory.getLogger(DeviceSpecificSettingsFragment.class);
- static final String FRAGMENT_TAG = "DEVICE_SPECIFIC_SETTINGS_FRAGMENT";
-
private DeviceSpecificSettingsCustomizer deviceSpecificSettingsCustomizer;
private GBDevice device;
@@ -149,6 +149,22 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
addPreferencesFromResource(setting);
}
}
+
+ for (final Integer rootId : deviceSpecificSettings.getRootScreens()) {
+ index(rootId);
+ DeviceSpecificSettingsScreen rootScreen = DeviceSpecificSettingsScreen.fromXml(rootId);
+
+ if (rootScreen != null) {
+ if (deviceSpecificSettings.getScreen(rootScreen.getKey()) != null) {
+ for (final Integer screen : deviceSpecificSettings.getScreen(rootScreen.getKey())) {
+ index(screen);
+ }
+ }
+ }
+
+ }
+
+ getBatterySettings().forEach(this::index);
} else {
// First attempt to find a known screen for this key
final List screenSettings = deviceSpecificSettings.getScreen(rootKey);
@@ -197,16 +213,19 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
private void addDynamicSettings(final String rootKey) {
if (rootKey.equals(DeviceSpecificSettingsScreen.BATTERY.getKey())) {
- addBatterySettings();
+ final PreferenceScreen batteryScreen = getPreferenceScreen();
+ if (batteryScreen == null) {
+ return;
+ }
+ getBatterySettings().forEach(batteryScreen::addPreference);
}
}
- private void addBatterySettings() {
+ private List getBatterySettings() {
+ final List preferences = new ArrayList<>();
+
final DeviceCoordinator coordinator = device.getDeviceCoordinator();
- final PreferenceScreen batteryScreen = getPreferenceScreen();
- if (batteryScreen == null) {
- return;
- }
+
final BatteryConfig[] batteryConfigs = coordinator.getBatteryConfig(device);
for (final BatteryConfig batteryConfig : batteryConfigs) {
if (batteryConfigs.length > 1 || coordinator.addBatteryPollingSettings()) {
@@ -218,7 +237,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
} else {
prefHeader.setTitle(requireContext().getString(R.string.battery_i, batteryConfig.getBatteryIndex()));
}
- batteryScreen.addPreference(prefHeader);
+ preferences.add(prefHeader);
}
final SwitchPreferenceCompat showInNotification = new SwitchPreferenceCompat(requireContext());
@@ -227,7 +246,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
showInNotification.setTitle(R.string.show_in_notification);
showInNotification.setIconSpaceReserved(false);
showInNotification.setDefaultValue(true);
- batteryScreen.addPreference(showInNotification);
+ preferences.add(showInNotification);
final SwitchPreferenceCompat notifyLowEnabled = new SwitchPreferenceCompat(requireContext());
notifyLowEnabled.setLayoutResource(R.layout.preference_checkbox);
@@ -235,7 +254,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
notifyLowEnabled.setTitle(R.string.battery_low_notify_enabled);
notifyLowEnabled.setDefaultValue(true);
notifyLowEnabled.setIconSpaceReserved(false);
- batteryScreen.addPreference(notifyLowEnabled);
+ preferences.add(notifyLowEnabled);
final EditTextPreference notifyLowThreshold = new EditTextPreference(requireContext());
notifyLowThreshold.setKey(PREF_BATTERY_NOTIFY_LOW_THRESHOLD + batteryConfig.getBatteryIndex());
@@ -252,7 +271,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
R.string.battery_percentage_str
));
- batteryScreen.addPreference(notifyLowThreshold);
+ preferences.add(notifyLowThreshold);
final SwitchPreferenceCompat notifyFullEnabled = new SwitchPreferenceCompat(requireContext());
notifyFullEnabled.setLayoutResource(R.layout.preference_checkbox);
@@ -260,7 +279,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
notifyFullEnabled.setTitle(R.string.battery_full_notify_enabled);
notifyFullEnabled.setDefaultValue(true);
notifyFullEnabled.setIconSpaceReserved(false);
- batteryScreen.addPreference(notifyFullEnabled);
+ preferences.add(notifyFullEnabled);
final EditTextPreference notifyFullThreshold = new EditTextPreference(requireContext());
notifyFullThreshold.setKey(PREF_BATTERY_NOTIFY_FULL_THRESHOLD + batteryConfig.getBatteryIndex());
@@ -276,7 +295,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
requireContext().getString(R.string.default_percentage, batteryConfig.getDefaultFullThreshold()),
R.string.battery_percentage_str
));
- batteryScreen.addPreference(notifyFullThreshold);
+ preferences.add(notifyFullThreshold);
}
if (coordinator.addBatteryPollingSettings()) {
@@ -285,7 +304,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
prefHeader.setIconSpaceReserved(false);
prefHeader.setTitle(R.string.pref_battery_polling_configuration);
prefHeader.setSummary(R.string.pref_battery_polling_summary);
- batteryScreen.addPreference(prefHeader);
+ preferences.add(prefHeader);
final SwitchPreferenceCompat pollingToggle = new SwitchPreferenceCompat(requireContext());
pollingToggle.setLayoutResource(R.layout.preference_checkbox);
@@ -293,7 +312,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
pollingToggle.setTitle(R.string.pref_battery_polling_enable);
pollingToggle.setDefaultValue(true);
pollingToggle.setIconSpaceReserved(false);
- batteryScreen.addPreference(pollingToggle);
+ preferences.add(pollingToggle);
final EditTextPreference pollingInterval = new EditTextPreference(requireContext());
pollingInterval.setKey(PREF_BATTERY_POLLING_INTERVAL);
@@ -310,8 +329,10 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
getString(R.string.interval_fifteen_minutes),
R.string.pref_battery_polling_interval_format
));
- batteryScreen.addPreference(pollingInterval);
+ preferences.add(pollingInterval);
}
+
+ return preferences;
}
/*
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsScreen.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsScreen.java
index bd041bf65..ea30368d8 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsScreen.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsScreen.java
@@ -56,4 +56,14 @@ public enum DeviceSpecificSettingsScreen {
public int getXml() {
return xml;
}
+
+ public static DeviceSpecificSettingsScreen fromXml(final int xml) {
+ for (final DeviceSpecificSettingsScreen screen : DeviceSpecificSettingsScreen.values()) {
+ if (screen.xml == xml) {
+ return screen;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/discovery/DiscoveryPairingPreferenceActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/discovery/DiscoveryPairingPreferenceActivity.java
index 11c933f91..dc4cacf36 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/discovery/DiscoveryPairingPreferenceActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/discovery/DiscoveryPairingPreferenceActivity.java
@@ -28,19 +28,12 @@ import nodomain.freeyourgadget.gadgetbridge.activities.AbstractSettingsActivityV
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class DiscoveryPairingPreferenceActivity extends AbstractSettingsActivityV2 {
- @Override
- protected String fragmentTag() {
- return DiscoveryPairingPreferenceFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new DiscoveryPairingPreferenceFragment();
}
public static class DiscoveryPairingPreferenceFragment extends AbstractPreferenceFragment {
- static final String FRAGMENT_TAG = "DISCOVERY_PAIRING_PREFERENCES_FRAGMENT";
-
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
setPreferencesFromResource(R.xml.discovery_pairing_preferences, rootKey);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsActivity.java
index 4b84a450d..b3271ac62 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsActivity.java
@@ -41,11 +41,6 @@ public class LoyaltyCardsSettingsActivity extends AbstractSettingsActivityV2 imp
private GBDevice device;
- @Override
- protected String fragmentTag() {
- return LoyaltyCardsSettingsFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return LoyaltyCardsSettingsFragment.newInstance(device);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsFragment.java
index 87659ae2b..58adff626 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/loyaltycards/LoyaltyCardsSettingsFragment.java
@@ -61,8 +61,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
public class LoyaltyCardsSettingsFragment extends AbstractPreferenceFragment {
private static final Logger LOG = LoggerFactory.getLogger(LoyaltyCardsSettingsFragment.class);
- static final String FRAGMENT_TAG = "LOYALTY_CARDS_SETTINGS_FRAGMENT";
-
private GBDevice device;
private void setSettingsFileSuffix(final String settingsFileSuffix) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminCoordinator.java
index b0cfcfbf7..e7110fc00 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminCoordinator.java
@@ -140,6 +140,8 @@ public abstract class GarminCoordinator extends AbstractBLEDeviceCoordinator {
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
+ deviceSpecificSettings.addRootScreen(R.xml.devicesettings_search);
+
if (supports(device, GarminCapability.REALTIME_SETTINGS)) {
deviceSpecificSettings.addRootScreen(R.xml.devicesettings_garmin_realtime_settings);
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsActivity.java
index eb8c041eb..a534453a8 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsActivity.java
@@ -26,11 +26,6 @@ public class GarminRealtimeSettingsActivity extends AbstractSettingsActivityV2 {
public static final String EXTRA_SCREEN_ID = "screenId";
- @Override
- protected String fragmentTag() {
- return GarminRealtimeSettingsFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return GarminRealtimeSettingsFragment.newInstance(device, screenId);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java
index 89b447664..2d4d30ea7 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java
@@ -77,8 +77,6 @@ public class GarminRealtimeSettingsFragment extends AbstractPreferenceFragment {
public static final int ROOT_SCREEN_ID = 36352;
- static final String FRAGMENT_TAG = "GARMIN_REALTIME_SETTINGS_FRAGMENT";
-
private GBDevice device;
private int screenId = ROOT_SCREEN_ID;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppos/ZeppOsCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppos/ZeppOsCoordinator.java
index 8c149bfcc..7bd8e8fd5 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppos/ZeppOsCoordinator.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/zeppos/ZeppOsCoordinator.java
@@ -353,6 +353,8 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
+ deviceSpecificSettings.addRootScreen(R.xml.devicesettings_search);
+
//
// Apps
// TODO: These should go somewhere else
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java
index 65b096f4b..73158ec86 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java
@@ -35,11 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.activities.AbstractSettingsActivityV
public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivityV2 {
static HybridHRWatchfaceSettings settings;
- @Override
- protected String fragmentTag() {
- return HybridHRWatchfaceSettingsFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new HybridHRWatchfaceSettingsFragment();
@@ -82,8 +77,6 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivityV
}
public static class HybridHRWatchfaceSettingsFragment extends AbstractPreferenceFragment implements Preference.OnPreferenceChangeListener {
- static final String FRAGMENT_TAG = "HYBRID_HR_WATCHFACE_SETTINGS_FRAGMENT";
-
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
setPreferencesFromResource(R.xml.fossil_hr_watchface_settings, rootKey);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java
index 6fcdf5f4a..487c33822 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceWidgetActivity.java
@@ -49,11 +49,6 @@ public class HybridHRWatchfaceWidgetActivity extends AbstractSettingsActivityV2
private static final Boolean WIDGET_CUSTOM_DEFAULT_HIDE_TEXT = true;
private static final Boolean WIDGET_CUSTOM_DEFAULT_SHOW_CIRCLE = true;
- @Override
- protected String fragmentTag() {
- return HybridHRWatchfaceWidgetFragment.FRAGMENT_TAG;
- }
-
@Override
protected PreferenceFragmentCompat newFragment() {
return new HybridHRWatchfaceWidgetFragment();
@@ -99,8 +94,6 @@ public class HybridHRWatchfaceWidgetActivity extends AbstractSettingsActivityV2
}
public static class HybridHRWatchfaceWidgetFragment extends AbstractPreferenceFragment implements Preference.OnPreferenceChangeListener {
- static final String FRAGMENT_TAG = "HYBRID_HR_WATCHFACE_WIDGET_FRAGMENT";
-
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
setPreferencesFromResource(R.xml.fossil_hr_widget_settings, rootKey);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/SearchPreferenceHighlighter.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/SearchPreferenceHighlighter.java
new file mode 100644
index 000000000..a23b0a688
--- /dev/null
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/SearchPreferenceHighlighter.java
@@ -0,0 +1,85 @@
+package nodomain.freeyourgadget.gadgetbridge.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
+import android.os.Handler;
+import android.util.Log;
+import android.util.TypedValue;
+
+import androidx.appcompat.content.res.AppCompatResources;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.PreferenceGroup;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * Copied as-is from SearchPreferenceResult, since the constructor is protected, and
+ * we need a way to highlight preferences in a different activity due to the way Gadgetbridge is built.
+ */
+public class SearchPreferenceHighlighter {
+ public static void highlight(final PreferenceFragmentCompat prefsFragment, final String key) {
+ new Handler().post(() -> doHighlight(prefsFragment, key));
+ }
+
+ private static void doHighlight(final PreferenceFragmentCompat prefsFragment, final String key) {
+ final Preference prefResult = prefsFragment.findPreference(key);
+
+ if (prefResult == null) {
+ Log.e("doHighlight", "Preference not found on given screen");
+ return;
+ }
+ final RecyclerView recyclerView = prefsFragment.getListView();
+ final RecyclerView.Adapter> adapter = recyclerView.getAdapter();
+ if (adapter instanceof PreferenceGroup.PreferencePositionCallback) {
+ PreferenceGroup.PreferencePositionCallback callback = (PreferenceGroup.PreferencePositionCallback) adapter;
+ final int position = callback.getPreferenceAdapterPosition(prefResult);
+ if (position != RecyclerView.NO_POSITION) {
+ recyclerView.scrollToPosition(position);
+ recyclerView.postDelayed(() -> {
+ RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(position);
+ if (holder != null) {
+ Drawable oldBackground = holder.itemView.getBackground();
+ int color = getColorFromAttr(prefsFragment.getContext(), android.R.attr.textColorPrimary);
+ holder.itemView.setBackgroundColor(color & 0xffffff | 0x33000000);
+ new Handler().postDelayed(() -> holder.itemView.setBackgroundDrawable(oldBackground), 1000);
+ return;
+ }
+ highlightFallback(prefsFragment, prefResult);
+ }, 200);
+ return;
+ }
+ }
+ highlightFallback(prefsFragment, prefResult);
+ }
+
+ /**
+ * Alternative highlight method if accessing the view did not work
+ */
+ private static void highlightFallback(PreferenceFragmentCompat prefsFragment, final Preference prefResult) {
+ final Drawable oldIcon = prefResult.getIcon();
+ final boolean oldSpaceReserved = prefResult.isIconSpaceReserved();
+ Drawable arrow = AppCompatResources.getDrawable(prefsFragment.getContext(), com.bytehamster.lib.preferencesearch.R.drawable.searchpreference_ic_arrow_right);
+ int color = getColorFromAttr(prefsFragment.getContext(), android.R.attr.textColorPrimary);
+ arrow.setColorFilter(color, PorterDuff.Mode.SRC_IN);
+ prefResult.setIcon(arrow);
+ prefsFragment.scrollToPreference(prefResult);
+ new Handler().postDelayed(() -> {
+ prefResult.setIcon(oldIcon);
+ prefResult.setIconSpaceReserved(oldSpaceReserved);
+ }, 1000);
+ }
+
+ private static int getColorFromAttr(Context context, int attr) {
+ TypedValue typedValue = new TypedValue();
+ Resources.Theme theme = context.getTheme();
+ theme.resolveAttribute(attr, typedValue, true);
+ TypedArray arr = context.obtainStyledAttributes(typedValue.data, new int[]{
+ android.R.attr.textColorPrimary});
+ int color = arr.getColor(0, 0xff3F51B5);
+ arr.recycle();
+ return color;
+ }
+}
diff --git a/app/src/main/res/layout/activity_device_settings.xml b/app/src/main/res/layout/activity_device_settings.xml
deleted file mode 100644
index c2e4426cd..000000000
--- a/app/src/main/res/layout/activity_device_settings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_preferences.xml b/app/src/main/res/menu/menu_preferences.xml
new file mode 100644
index 000000000..c67fd1adf
--- /dev/null
+++ b/app/src/main/res/menu/menu_preferences.xml
@@ -0,0 +1,12 @@
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c56ac7e43..1c3129c75 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2091,6 +2091,8 @@
Failed to start background service
Starting the background service failed becauseā¦
+ %1s has crashed
+ Share error
ALREADY BONDED
KEY REQUIRED, LONG PRESS TO ENTER
UNSUPPORTED
diff --git a/app/src/main/res/xml/about_user.xml b/app/src/main/res/xml/about_user.xml
index 08d3f626a..7db2e0ae5 100644
--- a/app/src/main/res/xml/about_user.xml
+++ b/app/src/main/res/xml/about_user.xml
@@ -24,7 +24,7 @@
android:entries="@array/gender"
android:entryValues="@array/gender_values"
android:key="activity_user_gender"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/activity_prefs_gender" />
diff --git a/app/src/main/res/xml/devicesettings_always_on_display.xml b/app/src/main/res/xml/devicesettings_always_on_display.xml
index 8c4574ccd..ed0fe6e43 100644
--- a/app/src/main/res/xml/devicesettings_always_on_display.xml
+++ b/app/src/main/res/xml/devicesettings_always_on_display.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_autoheartrate.xml b/app/src/main/res/xml/devicesettings_autoheartrate.xml
index 96bbc609c..240b90e12 100644
--- a/app/src/main/res/xml/devicesettings_autoheartrate.xml
+++ b/app/src/main/res/xml/devicesettings_autoheartrate.xml
@@ -1,5 +1,6 @@
-
+
-
+
diff --git a/app/src/main/res/xml/devicesettings_automatic_power_off_when_taken_off.xml b/app/src/main/res/xml/devicesettings_automatic_power_off_when_taken_off.xml
index f7f98ec4b..e3858c8e5 100644
--- a/app/src/main/res/xml/devicesettings_automatic_power_off_when_taken_off.xml
+++ b/app/src/main/res/xml/devicesettings_automatic_power_off_when_taken_off.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_buttonactions.xml b/app/src/main/res/xml/devicesettings_buttonactions.xml
index 7eb826aa6..b514f59a5 100644
--- a/app/src/main/res/xml/devicesettings_buttonactions.xml
+++ b/app/src/main/res/xml/devicesettings_buttonactions.xml
@@ -1,5 +1,6 @@
-
+
@@ -55,7 +56,7 @@
android:entries="@array/button_action_options"
android:entryValues="@array/button_action_values"
android:key="button_triple_press_action_selection"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:defaultValue="@string/pref_button_action_disabled_value"
android:title="@string/prefs_button_triple_press_action_selection_title" />
diff --git a/app/src/main/res/xml/devicesettings_buttonactions_lower_short.xml b/app/src/main/res/xml/devicesettings_buttonactions_lower_short.xml
index 56f28bd9f..49f52eaf1 100644
--- a/app/src/main/res/xml/devicesettings_buttonactions_lower_short.xml
+++ b/app/src/main/res/xml/devicesettings_buttonactions_lower_short.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_buttonactions_upper_long.xml b/app/src/main/res/xml/devicesettings_buttonactions_upper_long.xml
index 9287a5b50..aa85fe2c5 100644
--- a/app/src/main/res/xml/devicesettings_buttonactions_upper_long.xml
+++ b/app/src/main/res/xml/devicesettings_buttonactions_upper_long.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_buttonactions_with_longpress.xml b/app/src/main/res/xml/devicesettings_buttonactions_with_longpress.xml
index 74edea932..03e5129f6 100644
--- a/app/src/main/res/xml/devicesettings_buttonactions_with_longpress.xml
+++ b/app/src/main/res/xml/devicesettings_buttonactions_with_longpress.xml
@@ -1,5 +1,6 @@
-
+
@@ -55,7 +56,7 @@
android:entries="@array/button_action_options"
android:entryValues="@array/button_action_values"
android:key="button_triple_press_action_selection"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:defaultValue="@string/pref_button_action_disabled_value"
android:title="@string/prefs_button_triple_press_action_selection_title" />
@@ -66,7 +67,7 @@
android:entryValues="@array/button_action_values"
android:key="button_long_press_action_selection"
android:defaultValue="@string/pref_button_action_disabled_value"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_button_long_press_action_selection_title" />
diff --git a/app/src/main/res/xml/devicesettings_casio_connection_duration.xml b/app/src/main/res/xml/devicesettings_casio_connection_duration.xml
index f72ff893e..6680cd302 100644
--- a/app/src/main/res/xml/devicesettings_casio_connection_duration.xml
+++ b/app/src/main/res/xml/devicesettings_casio_connection_duration.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_colmi_r0x.xml b/app/src/main/res/xml/devicesettings_colmi_r0x.xml
index dd9de0758..9ebf007e3 100644
--- a/app/src/main/res/xml/devicesettings_colmi_r0x.xml
+++ b/app/src/main/res/xml/devicesettings_colmi_r0x.xml
@@ -1,12 +1,13 @@
-
+
-
+
diff --git a/app/src/main/res/xml/devicesettings_dateformat_2.xml b/app/src/main/res/xml/devicesettings_dateformat_2.xml
index 148547a37..8d1ca95fb 100644
--- a/app/src/main/res/xml/devicesettings_dateformat_2.xml
+++ b/app/src/main/res/xml/devicesettings_dateformat_2.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_dateformat_day_month_order.xml b/app/src/main/res/xml/devicesettings_dateformat_day_month_order.xml
index 4b10ca3e9..8bbefddb3 100644
--- a/app/src/main/res/xml/devicesettings_dateformat_day_month_order.xml
+++ b/app/src/main/res/xml/devicesettings_dateformat_day_month_order.xml
@@ -1,12 +1,13 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_device_actions.xml b/app/src/main/res/xml/devicesettings_device_actions.xml
index db353cfc6..0e57de190 100644
--- a/app/src/main/res/xml/devicesettings_device_actions.xml
+++ b/app/src/main/res/xml/devicesettings_device_actions.xml
@@ -50,7 +50,7 @@
android:entries="@array/device_action_options"
android:entryValues="@array/device_action_values"
android:key="events_forwarding_startnonwear_action_selections"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:defaultValue="@array/empty_array"
android:title="@string/prefs_events_forwarding_action_title" />
-
+
-
+
-
+
-
+
-
+
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/devicesettings_fitpro.xml b/app/src/main/res/xml/devicesettings_fitpro.xml
index 739f281e3..c0c838ffd 100644
--- a/app/src/main/res/xml/devicesettings_fitpro.xml
+++ b/app/src/main/res/xml/devicesettings_fitpro.xml
@@ -1,12 +1,13 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_fossilhybridhr_post_fw300.xml b/app/src/main/res/xml/devicesettings_fossilhybridhr_post_fw300.xml
index d5156ec7f..b5e7a7324 100644
--- a/app/src/main/res/xml/devicesettings_fossilhybridhr_post_fw300.xml
+++ b/app/src/main/res/xml/devicesettings_fossilhybridhr_post_fw300.xml
@@ -12,42 +12,42 @@
android:entries="@array/pref_hybridhr_buttonfunctions"
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
android:key="button_1_function_short"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_upper_button_function_short" />
@@ -87,7 +87,7 @@
android:entryValues="@array/galaxy_touch_options_values"
android:icon="@drawable/ic_touch"
android:key="pref_galaxy_buds_touch_left"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_left" />
diff --git a/app/src/main/res/xml/devicesettings_galaxy_buds_2.xml b/app/src/main/res/xml/devicesettings_galaxy_buds_2.xml
index 540e11f87..8b3a983c8 100644
--- a/app/src/main/res/xml/devicesettings_galaxy_buds_2.xml
+++ b/app/src/main/res/xml/devicesettings_galaxy_buds_2.xml
@@ -15,7 +15,7 @@
android:entryValues="@array/galaxy_pro_noise_controls_options_values"
android:icon="@drawable/ic_surround"
android:key="pref_galaxy_buds_2_noise_control"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_noise_control" />
@@ -90,7 +90,7 @@
android:entryValues="@array/galaxy_buds_live_equalizer_values"
android:icon="@drawable/ic_equalizer"
android:key="pref_galaxy_buds_equalizer_mode"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_equalizer_preset" />
-
+
diff --git a/app/src/main/res/xml/devicesettings_galaxy_buds_pro.xml b/app/src/main/res/xml/devicesettings_galaxy_buds_pro.xml
index 8b564a274..8fe376a15 100644
--- a/app/src/main/res/xml/devicesettings_galaxy_buds_pro.xml
+++ b/app/src/main/res/xml/devicesettings_galaxy_buds_pro.xml
@@ -14,7 +14,7 @@
android:entryValues="@array/galaxy_pro_noise_controls_options_values"
android:icon="@drawable/ic_surround"
android:key="pref_galaxy_buds_pro_noise_control"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_noise_control" />
@@ -60,7 +60,7 @@
android:entryValues="@array/galaxy_pro_voice_detect_duration_values"
android:icon="@drawable/ic_timer"
android:key="pref_galaxy_buds_pro_voice_detect_duration"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_voice_detect_duration" />
@@ -121,7 +121,7 @@
android:entryValues="@array/galaxy_buds_live_equalizer_values"
android:icon="@drawable/ic_equalizer"
android:key="pref_galaxy_buds_equalizer_mode"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_equalizer_preset" />
-
+
diff --git a/app/src/main/res/xml/devicesettings_heartrate_sleep.xml b/app/src/main/res/xml/devicesettings_heartrate_sleep.xml
index 1df7f2121..092057aa6 100644
--- a/app/src/main/res/xml/devicesettings_heartrate_sleep.xml
+++ b/app/src/main/res/xml/devicesettings_heartrate_sleep.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_heartrate_sleep_activity.xml b/app/src/main/res/xml/devicesettings_heartrate_sleep_activity.xml
index 14c92fb0a..b484b2e38 100644
--- a/app/src/main/res/xml/devicesettings_heartrate_sleep_activity.xml
+++ b/app/src/main/res/xml/devicesettings_heartrate_sleep_activity.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress.xml b/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress.xml
index ae2048faf..eabd3aa19 100644
--- a/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress.xml
+++ b/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress.xml
@@ -1,5 +1,6 @@
-
+
@@ -50,7 +51,7 @@
android:entryValues="@array/prefs_miband_heartrate_alert_threshold_values"
android:icon="@drawable/ic_heartrate"
android:key="heartrate_alert_threshold"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_heartrate_alert_threshold" />
diff --git a/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress_spo2.xml b/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress_spo2.xml
index d9faee3b2..a2a4771db 100644
--- a/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress_spo2.xml
+++ b/app/src/main/res/xml/devicesettings_heartrate_sleep_alert_activity_stress_spo2.xml
@@ -1,5 +1,6 @@
-
+
@@ -62,7 +63,7 @@
android:entryValues="@array/prefs_miband_heartrate_high_alert_threshold_with_off_values"
android:icon="@drawable/ic_heartrate"
android:key="heartrate_alert_threshold"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_heartrate_alert_high_threshold" />
@@ -125,7 +126,7 @@
android:entries="@array/prefs_spo2_alert_threshold"
android:entryValues="@array/prefs_spo2_alert_threshold_values"
android:key="spo2_low_alert_threshold"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_spo2_alert_threshold" />
diff --git a/app/src/main/res/xml/devicesettings_huami2021_alexa.xml b/app/src/main/res/xml/devicesettings_huami2021_alexa.xml
index ce18936c3..b876dbea3 100644
--- a/app/src/main/res/xml/devicesettings_huami2021_alexa.xml
+++ b/app/src/main/res/xml/devicesettings_huami2021_alexa.xml
@@ -13,7 +13,7 @@
android:entryValues="@array/pref_language_all_values"
android:icon="@drawable/ic_language"
android:key="voice_service_language"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_language" />
-
+
diff --git a/app/src/main/res/xml/devicesettings_lefun_interface_language.xml b/app/src/main/res/xml/devicesettings_lefun_interface_language.xml
index 6c821baba..129c7fe5b 100644
--- a/app/src/main/res/xml/devicesettings_lefun_interface_language.xml
+++ b/app/src/main/res/xml/devicesettings_lefun_interface_language.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_liftwrist_display.xml b/app/src/main/res/xml/devicesettings_liftwrist_display.xml
index c703c8eac..1d3cb21ee 100644
--- a/app/src/main/res/xml/devicesettings_liftwrist_display.xml
+++ b/app/src/main/res/xml/devicesettings_liftwrist_display.xml
@@ -1,5 +1,6 @@
-
+
-
+
-
+
-
+
-
+
diff --git a/app/src/main/res/xml/devicesettings_moondrop_space_travel_equalizer.xml b/app/src/main/res/xml/devicesettings_moondrop_space_travel_equalizer.xml
index 34e04bba6..f79e332c9 100644
--- a/app/src/main/res/xml/devicesettings_moondrop_space_travel_equalizer.xml
+++ b/app/src/main/res/xml/devicesettings_moondrop_space_travel_equalizer.xml
@@ -1,10 +1,11 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_moondrop_space_travel_touch.xml b/app/src/main/res/xml/devicesettings_moondrop_space_travel_touch.xml
index cceaab567..e98f96940 100644
--- a/app/src/main/res/xml/devicesettings_moondrop_space_travel_touch.xml
+++ b/app/src/main/res/xml/devicesettings_moondrop_space_travel_touch.xml
@@ -1,19 +1,20 @@
-
+
@@ -22,14 +23,14 @@
android:entryValues="@array/moondrop_touch_earbud_values"
android:icon="@drawable/ic_hearing"
android:key="pref_moondrop_touch_media_prev_earbud"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/moondrop_touch_earbud" />
@@ -38,14 +39,14 @@
android:entryValues="@array/moondrop_touch_earbud_values"
android:icon="@drawable/ic_hearing"
android:key="pref_moondrop_touch_media_next_earbud"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/moondrop_touch_earbud" />
@@ -54,14 +55,14 @@
android:entryValues="@array/moondrop_touch_earbud_values"
android:icon="@drawable/ic_hearing"
android:key="pref_moondrop_touch_call_pick_hang_earbud"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/moondrop_touch_earbud" />
@@ -70,14 +71,14 @@
android:entryValues="@array/moondrop_touch_earbud_values"
android:icon="@drawable/ic_hearing"
android:key="pref_moondrop_touch_call_start_earbud"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/moondrop_touch_earbud" />
@@ -86,14 +87,14 @@
android:entryValues="@array/moondrop_touch_earbud_values"
android:icon="@drawable/ic_hearing"
android:key="pref_moondrop_touch_assistant_earbud"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/moondrop_touch_earbud" />
@@ -102,14 +103,14 @@
android:entryValues="@array/moondrop_touch_earbud_values"
android:icon="@drawable/ic_hearing"
android:key="pref_moondrop_touch_anc_mode_earbud"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/moondrop_touch_earbud" />
diff --git a/app/src/main/res/xml/devicesettings_nightmode.xml b/app/src/main/res/xml/devicesettings_nightmode.xml
index 01b00995d..2499ac35a 100644
--- a/app/src/main/res/xml/devicesettings_nightmode.xml
+++ b/app/src/main/res/xml/devicesettings_nightmode.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_offline_voice.xml b/app/src/main/res/xml/devicesettings_offline_voice.xml
index 0cf86a8df..114b37ff1 100644
--- a/app/src/main/res/xml/devicesettings_offline_voice.xml
+++ b/app/src/main/res/xml/devicesettings_offline_voice.xml
@@ -1,5 +1,6 @@
-
+
-
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/devicesettings_screen_timeout.xml b/app/src/main/res/xml/devicesettings_screen_timeout.xml
index bb7f87467..771ce82f1 100644
--- a/app/src/main/res/xml/devicesettings_screen_timeout.xml
+++ b/app/src/main/res/xml/devicesettings_screen_timeout.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_screenorientation.xml b/app/src/main/res/xml/devicesettings_screenorientation.xml
index 7cc696586..9437a2169 100644
--- a/app/src/main/res/xml/devicesettings_screenorientation.xml
+++ b/app/src/main/res/xml/devicesettings_screenorientation.xml
@@ -1,12 +1,13 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_search.xml b/app/src/main/res/xml/devicesettings_search.xml
new file mode 100644
index 000000000..ab0172263
--- /dev/null
+++ b/app/src/main/res/xml/devicesettings_search.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/app/src/main/res/xml/devicesettings_sleep_time.xml b/app/src/main/res/xml/devicesettings_sleep_time.xml
index bacfc6691..4753d4087 100644
--- a/app/src/main/res/xml/devicesettings_sleep_time.xml
+++ b/app/src/main/res/xml/devicesettings_sleep_time.xml
@@ -1,5 +1,6 @@
-
+
-
+
@@ -10,7 +11,7 @@
android:entryValues="@array/sony_ambient_sound_control_values"
android:icon="@drawable/ic_hearing"
android:key="pref_sony_ambient_sound_control"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/sony_ambient_sound" />
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_button_modes.xml b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_button_modes.xml
index a62c7d777..37bd41f6b 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_button_modes.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_button_modes.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_wind_noise_reduction.xml b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_wind_noise_reduction.xml
index f532d99ed..f280bf114 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_wind_noise_reduction.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_ambient_sound_control_wind_noise_reduction.xml
@@ -1,5 +1,6 @@
-
+
@@ -10,7 +11,7 @@
android:entryValues="@array/sony_ambient_sound_control_wind_noise_reduction_values"
android:icon="@drawable/ic_hearing"
android:key="pref_sony_ambient_sound_control"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/sony_ambient_sound" />
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_button_modes_left_right.xml b/app/src/main/res/xml/devicesettings_sony_headphones_button_modes_left_right.xml
index 83b7aa32a..da150843b 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_button_modes_left_right.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_button_modes_left_right.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml b/app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml
index bf9e6b8da..7caa74a08 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_equalizer.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_equalizer_with_custom_bands.xml b/app/src/main/res/xml/devicesettings_sony_headphones_equalizer_with_custom_bands.xml
index f223aeb96..679e3fde9 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_equalizer_with_custom_bands.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_equalizer_with_custom_bands.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_quick_access.xml b/app/src/main/res/xml/devicesettings_sony_headphones_quick_access.xml
index ed543e6b6..461ba1237 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_quick_access.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_quick_access.xml
@@ -1,12 +1,13 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_sound_position.xml b/app/src/main/res/xml/devicesettings_sony_headphones_sound_position.xml
index 5e3bb41dc..234e0057c 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_sound_position.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_sound_position.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_speak_to_chat_with_settings.xml b/app/src/main/res/xml/devicesettings_sony_headphones_speak_to_chat_with_settings.xml
index b13a60a93..179861f2e 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_speak_to_chat_with_settings.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_speak_to_chat_with_settings.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_sony_headphones_surround_mode.xml b/app/src/main/res/xml/devicesettings_sony_headphones_surround_mode.xml
index 0b8244cf5..06fe2e393 100644
--- a/app/src/main/res/xml/devicesettings_sony_headphones_surround_mode.xml
+++ b/app/src/main/res/xml/devicesettings_sony_headphones_surround_mode.xml
@@ -1,11 +1,12 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_soundcore_headphones.xml b/app/src/main/res/xml/devicesettings_soundcore_headphones.xml
index 6a280e922..8a1e0c9b7 100644
--- a/app/src/main/res/xml/devicesettings_soundcore_headphones.xml
+++ b/app/src/main/res/xml/devicesettings_soundcore_headphones.xml
@@ -1,5 +1,6 @@
-
+
@@ -10,7 +11,7 @@
android:entryValues="@array/sony_ambient_sound_control_values"
android:icon="@drawable/ic_hearing"
android:key="pref_soundcore_ambient_sound_control"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/sony_ambient_sound" />
-
+
diff --git a/app/src/main/res/xml/devicesettings_soundcore_motion300_audio.xml b/app/src/main/res/xml/devicesettings_soundcore_motion300_audio.xml
index 5f89b042f..a5cf3bfb8 100644
--- a/app/src/main/res/xml/devicesettings_soundcore_motion300_audio.xml
+++ b/app/src/main/res/xml/devicesettings_soundcore_motion300_audio.xml
@@ -22,7 +22,7 @@
android:entryValues="@array/soundcore_equalizer_preset_values"
android:icon="@drawable/ic_equalizer"
android:key="pref_soundcore_equalizer_preset"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/soundcore_equalizer_preset" />
-
+
@@ -41,7 +42,7 @@
android:entryValues="@array/soundcore_button_function_values"
android:icon="@drawable/ic_touch"
android:key="pref_soundcore_control_double_tap_action_left"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_left" />
@@ -67,7 +68,7 @@
android:entryValues="@array/soundcore_button_function_values"
android:icon="@drawable/ic_touch"
android:key="pref_soundcore_control_triple_tap_action_left"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_left" />
@@ -93,7 +94,7 @@
android:entryValues="@array/soundcore_button_function_values"
android:icon="@drawable/ic_touch"
android:key="pref_soundcore_control_long_press_action_left"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_left" />
diff --git a/app/src/main/res/xml/devicesettings_timeformat.xml b/app/src/main/res/xml/devicesettings_timeformat.xml
index b733bf040..9016d752d 100644
--- a/app/src/main/res/xml/devicesettings_timeformat.xml
+++ b/app/src/main/res/xml/devicesettings_timeformat.xml
@@ -1,12 +1,13 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_vibrationpatterns.xml b/app/src/main/res/xml/devicesettings_vibrationpatterns.xml
index ec0acaa6d..9eaa65c28 100644
--- a/app/src/main/res/xml/devicesettings_vibrationpatterns.xml
+++ b/app/src/main/res/xml/devicesettings_vibrationpatterns.xml
@@ -24,7 +24,7 @@
android:entries="@array/vibration_profile"
android:entryValues="@array/vibration_profile_values"
android:key="huami_vibration_profile_app_alerts"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/miband_prefs_vibration" />
+ app:useSimpleSummaryProvider="true" />
-
+
diff --git a/app/src/main/res/xml/devicesettings_wearlocation.xml b/app/src/main/res/xml/devicesettings_wearlocation.xml
index 8452ffc63..acad482bb 100644
--- a/app/src/main/res/xml/devicesettings_wearlocation.xml
+++ b/app/src/main/res/xml/devicesettings_wearlocation.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/devicesettings_wena3.xml b/app/src/main/res/xml/devicesettings_wena3.xml
index 3bdf62462..b6e6d0228 100644
--- a/app/src/main/res/xml/devicesettings_wena3.xml
+++ b/app/src/main/res/xml/devicesettings_wena3.xml
@@ -1,5 +1,6 @@
-
+
@@ -16,7 +17,7 @@
android:entryValues="@array/prefs_wena3_day_start_values_list"
android:key="pref_wena3_day_start_hour"
android:icon="@drawable/ic_wb_twilight"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/prefs_wena3_day_start_hour_item" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true" />
@@ -195,7 +196,7 @@
android:defaultValue="normal"
android:entries="@array/prefs_wena3_vibration_strength_names_list"
android:entryValues="@array/prefs_wena3_vibration_strength_values_list"
- android:summary="%s" />
+ app:useSimpleSummaryProvider="true" />
+ app:useSimpleSummaryProvider="true"/>
+ app:useSimpleSummaryProvider="true"/>
\ No newline at end of file
diff --git a/app/src/main/res/xml/devicesettings_wena3_auto_power_off.xml b/app/src/main/res/xml/devicesettings_wena3_auto_power_off.xml
index a966fdfe4..b6b9b8bbc 100644
--- a/app/src/main/res/xml/devicesettings_wena3_auto_power_off.xml
+++ b/app/src/main/res/xml/devicesettings_wena3_auto_power_off.xml
@@ -1,5 +1,6 @@
-
+
-
+
diff --git a/app/src/main/res/xml/devicesettings_workout_detection.xml b/app/src/main/res/xml/devicesettings_workout_detection.xml
index bb5aa1a66..af8e15962 100644
--- a/app/src/main/res/xml/devicesettings_workout_detection.xml
+++ b/app/src/main/res/xml/devicesettings_workout_detection.xml
@@ -1,5 +1,6 @@
-
+
diff --git a/app/src/main/res/xml/loyalty_cards.xml b/app/src/main/res/xml/loyalty_cards.xml
index 715553ba8..bcab4c0be 100644
--- a/app/src/main/res/xml/loyalty_cards.xml
+++ b/app/src/main/res/xml/loyalty_cards.xml
@@ -1,5 +1,6 @@
-
+
@@ -9,7 +10,7 @@
android:entries="@array/pref_huami2021_empty_array"
android:entryValues="@array/pref_huami2021_empty_array"
android:key="loyalty_cards_catima_package"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/loyalty_cards_catima_package" />
@@ -101,7 +101,7 @@
android:entries="@array/notification_mode"
android:entryValues="@array/notification_mode_values"
android:key="notification_mode_sms"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_notifications_sms"
app:iconSpaceReserved="false" />
@@ -119,7 +119,7 @@
android:entries="@array/notifications_timeout"
android:entryValues="@array/notifications_timeout_values"
android:key="notifications_timeout"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_notifications_timeout"
app:iconSpaceReserved="false" />
@@ -169,7 +169,7 @@
android:entries="@array/notification_list_is_blacklist_names"
android:entryValues="@array/notification_list_is_blacklist_values"
android:key="notification_list_is_blacklist"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_notification_use_as"
app:iconSpaceReserved="false" />
@@ -196,7 +196,7 @@
android:entries="@array/pref_call_privacy_mode"
android:entryValues="@array/pref_call_privacy_mode_values"
android:key="pref_call_privacy_mode"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_call_privacy_mode"
app:iconSpaceReserved="false" />
@@ -205,7 +205,7 @@
android:entries="@array/pref_message_privacy_mode"
android:entryValues="@array/pref_message_privacy_mode_values"
android:key="pref_message_privacy_mode"
- android:summary="%s"
+ app:useSimpleSummaryProvider="true"
android:title="@string/pref_title_message_privacy_mode"
app:iconSpaceReserved="false" />
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index ec661038e..80bc85c3a 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -3,6 +3,10 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
app:iconSpaceReserved="false">
+
+