diff --git a/res/layout/preference_widget_arrow.xml b/res/layout/preference_widget_arrow.xml
new file mode 100644
index 00000000000..ddeb669142e
--- /dev/null
+++ b/res/layout/preference_widget_arrow.xml
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 73a3b557ede..a9b7a58ed5c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -152,10 +152,10 @@
Pair left ear
For all available hearing devices
-
- Hearing device settings
-
- Shortcut, hearing aid compatibility
+
+ More hearing device settings
+
+ Change cross-device settings like shortcut, and telecoil controls
For this device
diff --git a/src/com/android/settings/accessibility/ArrowPreference.java b/src/com/android/settings/accessibility/ArrowPreference.java
index 32e2bcb9ed6..ccee50df7ed 100644
--- a/src/com/android/settings/accessibility/ArrowPreference.java
+++ b/src/com/android/settings/accessibility/ArrowPreference.java
@@ -22,17 +22,25 @@ import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.res.TypedArrayUtils;
-import androidx.preference.Preference;
import com.android.settings.R;
/**
- * A settings preference with colored rounded rectangle background and an arrow icon on the right
+ * A settings preference with colored rounded rectangle background and an arrow icon on the right.
*/
-public class ArrowPreference extends Preference {
+public class ArrowPreference extends BackgroundPreference {
- public ArrowPreference(@NonNull Context context) {
- this(context, null);
+ public ArrowPreference(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
+ int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ setBackground(
+ com.android.settingslib.widget.mainswitch.R.drawable.settingslib_switch_bar_bg_on);
+ setWidgetLayoutResource(R.layout.preference_widget_arrow);
+ }
+
+ public ArrowPreference(@NonNull Context context, @Nullable AttributeSet attrs,
+ int defStyleAttr) {
+ this(context, attrs, defStyleAttr, 0);
}
public ArrowPreference(@NonNull Context context, @Nullable AttributeSet attrs) {
@@ -41,18 +49,7 @@ public class ArrowPreference extends Preference {
android.R.attr.preferenceStyle));
}
- public ArrowPreference(@NonNull Context context, @Nullable AttributeSet attrs,
- int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public ArrowPreference(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- init();
- }
-
- private void init() {
- setLayoutResource(R.layout.arrow_preference);
+ public ArrowPreference(@NonNull Context context) {
+ this(context, null);
}
}
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java
index 3d85ca2b0bc..162abc78aef 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java
@@ -26,6 +26,7 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.accessibility.AccessibilityHearingAidsFragment;
+import com.android.settings.accessibility.ArrowPreference;
import com.android.settings.core.SubSettingLauncher;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -83,7 +84,7 @@ public class BluetoothDetailsHearingDeviceControlsController extends BluetoothDe
}
private Preference createHearingDeviceControlsPreference(Context context) {
- final Preference preference = new Preference(context);
+ final ArrowPreference preference = new ArrowPreference(context);
preference.setKey(KEY_HEARING_DEVICE_CONTROLS);
preference.setTitle(context.getString(R.string.bluetooth_device_controls_title));
preference.setSummary(context.getString(R.string.bluetooth_device_controls_summary));
diff --git a/tests/robotests/src/com/android/settings/accessibility/ArrowPreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/ArrowPreferenceTest.java
new file mode 100644
index 00000000000..ff4a74839b3
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/ArrowPreferenceTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+
+/** Tests for {@link ArrowPreference} */
+@RunWith(RobolectricTestRunner.class)
+public class ArrowPreferenceTest {
+
+ private final Context mContext = ApplicationProvider.getApplicationContext();
+ private ArrowPreference mPreference;
+
+ @Before
+ public void setUp() {
+ mPreference = new ArrowPreference(mContext);
+ }
+
+ @Test
+ public void construct_withArrow() {
+ assertThat(mPreference.getWidgetLayoutResource()).isEqualTo(
+ R.layout.preference_widget_arrow);
+ }
+}