[Accessibility] Color Contrast address talkback bugs
Test: local raven device Bug: 329352987 Bug: 329192396 Bug: 329187057 Flag: aconfig com.android.settings.accessibility.enable_color_contrast_control Change-Id: I60d2b23acb2e406db15f348ba7881577e55a8868
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/color_contrast_preview_background"
|
||||
android:importantForAccessibility="no"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingBottom="24dp">
|
||||
|
@@ -23,6 +23,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<FrameLayout
|
||||
android:contentDescription="@string/color_contrast_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingVertical="@dimen/settingslib_illustration_padding"
|
||||
@@ -44,12 +45,12 @@
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contrast_button_default"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/contrast_button_default"
|
||||
android:layout_width="@dimen/contrast_button_total_size"
|
||||
android:layout_height="@dimen/contrast_button_total_size"
|
||||
android:background="@drawable/accessibility_contrast_button_background">
|
||||
@@ -58,7 +59,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@string/contrast_default"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_contrast_standard"/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -79,12 +80,12 @@
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contrast_button_medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/contrast_button_medium"
|
||||
android:layout_width="@dimen/contrast_button_total_size"
|
||||
android:layout_height="@dimen/contrast_button_total_size"
|
||||
android:background="@drawable/accessibility_contrast_button_background">
|
||||
@@ -93,7 +94,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@string/contrast_medium"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_contrast_medium"/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -114,12 +115,12 @@
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/contrast_button_high"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/contrast_button_high"
|
||||
android:layout_width="@dimen/contrast_button_total_size"
|
||||
android:layout_height="@dimen/contrast_button_total_size"
|
||||
android:background="@drawable/accessibility_contrast_button_background">
|
||||
@@ -128,7 +129,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:contentDescription="@string/contrast_high"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_contrast_high"/>
|
||||
</FrameLayout>
|
||||
|
||||
|
@@ -4695,6 +4695,8 @@
|
||||
<string name="color_contrast_preview_email_body">For further assistance, please reach out to myself or Helen. This report will be</string>
|
||||
<!-- Preview screen email attachment name on the contrast page. [CHAR LIMIT=30] -->
|
||||
<string name="color_contrast_preview_email_attachment_name">Client Expenses</string>
|
||||
<!-- Title for color_contrast page footer. [CHAR LIMIT=30] -->
|
||||
<string name="color_contrast_about_title">About color contrast</string>
|
||||
<!-- Title for the accessibility text options page. [CHAR LIMIT=50] -->
|
||||
<string name="accessibility_turn_screen_darker_title">Turn screen darker</string>
|
||||
<!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
|
||||
|
@@ -39,8 +39,10 @@
|
||||
"com.android.settings.accessibility.HighTextContrastPreferenceController" />
|
||||
|
||||
<com.android.settings.accessibility.AccessibilityFooterPreference
|
||||
android:key="color_contrast_footer"
|
||||
android:title="@string/color_contrast_note"
|
||||
android:selectable="false"
|
||||
settings:searchable="false"/>
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.accessibility.ColorContrastFooterPreferenceController" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
/** Preference controller for footer in color contrast page. */
|
||||
public class ColorContrastFooterPreferenceController extends
|
||||
AccessibilityFooterPreferenceController {
|
||||
public ColorContrastFooterPreferenceController(@NonNull Context context,
|
||||
@NonNull String key) {
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getIntroductionTitle() {
|
||||
return mContext.getString(R.string.color_contrast_about_title);
|
||||
}
|
||||
}
|
@@ -26,7 +26,7 @@ import android.app.UiModeManager;
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -53,7 +53,7 @@ public class ContrastSelectorPreferenceController extends BasePreferenceControll
|
||||
|
||||
private final Executor mMainExecutor;
|
||||
private final UiModeManager mUiModeManager;
|
||||
private Map<Integer, FrameLayout> mContrastButtons = new HashMap<>();
|
||||
private Map<Integer, LinearLayout> mContrastButtons = new HashMap<>();
|
||||
|
||||
public ContrastSelectorPreferenceController(@NonNull Context context,
|
||||
@NonNull String preferenceKey) {
|
||||
|
@@ -27,7 +27,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.UiModeManager;
|
||||
import android.content.Context;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
@@ -57,7 +57,7 @@ public class ContrastSelectorPreferenceControllerTest {
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
@Mock
|
||||
private FrameLayout mFrameLayout;
|
||||
private LinearLayout mLinearLayout;
|
||||
@Mock
|
||||
private LayoutPreference mLayoutPreference;
|
||||
private Context mContext;
|
||||
@@ -72,7 +72,7 @@ public class ContrastSelectorPreferenceControllerTest {
|
||||
when(mContext.getSystemService(UiModeManager.class)).thenReturn(mUiService);
|
||||
mController = new ContrastSelectorPreferenceController(mContext, PREFERENCE_KEY);
|
||||
when(mScreen.findPreference(PREFERENCE_KEY)).thenReturn(mLayoutPreference);
|
||||
when(mLayoutPreference.findViewById(anyInt())).thenReturn(mFrameLayout);
|
||||
when(mLayoutPreference.findViewById(anyInt())).thenReturn(mLinearLayout);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -102,7 +102,7 @@ public class ContrastSelectorPreferenceControllerTest {
|
||||
public void displayPreference_shouldAddClickListener() {
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
verify(mFrameLayout, times(3)).setOnClickListener(any());
|
||||
verify(mLinearLayout, times(3)).setOnClickListener(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,6 +110,6 @@ public class ContrastSelectorPreferenceControllerTest {
|
||||
mController.displayPreference(mScreen);
|
||||
mController.onContrastChanged(1);
|
||||
|
||||
verify(mFrameLayout, times(2)).setSelected(true);
|
||||
verify(mLinearLayout, times(2)).setSelected(true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user