Fix alignment issue between Vision Settings and Font/Display

- Use the same approach of Vision page to tweak the padding of the header

Fixes: 202897526
Test: make RunSettingsGoogleRoboTests -j ROBOTEST_FILTER=com.android.settings.accessibility.AccessibilityScreenSizeForSetupWizardActivityTest
Change-Id: I06eb5cb3ea6952b2cfdaa71f15757e415b61f5cc
This commit is contained in:
Sunny Shao
2021-10-14 22:38:24 +08:00
parent c1770fe4cf
commit d2704ad4ca
4 changed files with 20 additions and 23 deletions

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->
<resources>
<!-- Top margin for preview view pager -->
<dimen name="preview_size_top_margin">0dp</dimen>
</resources>

View File

@@ -529,6 +529,9 @@
<!-- Whether to show Smart Storage toggle --> <!-- Whether to show Smart Storage toggle -->
<bool name="config_show_smart_storage_toggle">true</bool> <bool name="config_show_smart_storage_toggle">true</bool>
<!-- Whether suw to support two panes -->
<bool name="config_suw_supported_two_panes">false</bool>
<!-- Display settings screen, Color mode options. Must be the same length and order as <!-- Display settings screen, Color mode options. Must be the same length and order as
config_color_mode_options_values below. Only the values that also appear in config_color_mode_options_values below. Only the values that also appear in
frameworks/base/core/res/res/values/config.xml's config_availableColorModes are shown. --> frameworks/base/core/res/res/values/config.xml's config_availableColorModes are shown. -->

View File

@@ -21,6 +21,7 @@ import android.app.settings.SettingsEnums;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.LinearLayout;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
@@ -69,7 +70,7 @@ public class AccessibilityScreenSizeForSetupWizardActivity extends InstrumentedA
? R.style.SudDynamicColorThemeGlifV3_DayNight : R.style.SudThemeGlifV3_DayNight; ? R.style.SudDynamicColorThemeGlifV3_DayNight : R.style.SudThemeGlifV3_DayNight;
setTheme(appliedTheme); setTheme(appliedTheme);
setContentView(R.layout.accessibility_screen_size_setup_wizard); setContentView(R.layout.accessibility_screen_size_setup_wizard);
generateHeader(); updateHeaderLayout();
scrollToBottom(); scrollToBottom();
initFooterButton(); initFooterButton();
if (savedInstanceState == null) { if (savedInstanceState == null) {
@@ -101,7 +102,15 @@ public class AccessibilityScreenSizeForSetupWizardActivity extends InstrumentedA
} }
@VisibleForTesting @VisibleForTesting
void generateHeader() { void updateHeaderLayout() {
if (ThemeHelper.shouldApplyExtendedPartnerConfig(this) && isSuwSupportedTwoPanes()) {
final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
final LinearLayout headerLayout = layout.findManagedViewById(R.id.sud_layout_header);
if (headerLayout != null) {
headerLayout.setPadding(0, layout.getPaddingTop(), 0,
layout.getPaddingBottom());
}
}
((TextView) findViewById(R.id.suc_layout_title)).setText( ((TextView) findViewById(R.id.suc_layout_title)).setText(
getFragmentType(getIntent()) == FragmentType.FONT_SIZE getFragmentType(getIntent()) == FragmentType.FONT_SIZE
? R.string.title_font_size ? R.string.title_font_size
@@ -112,6 +121,10 @@ public class AccessibilityScreenSizeForSetupWizardActivity extends InstrumentedA
: R.string.screen_zoom_short_summary); : R.string.screen_zoom_short_summary);
} }
private boolean isSuwSupportedTwoPanes() {
return getResources().getBoolean(R.bool.config_suw_supported_two_panes);
}
private void initFooterButton() { private void initFooterButton() {
final GlifLayout layout = findViewById(R.id.setup_wizard_layout); final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class); final FooterBarMixin mixin = layout.getMixin(FooterBarMixin.class);

View File

@@ -126,14 +126,14 @@ public class AccessibilityScreenSizeForSetupWizardActivityTest {
} }
@Test @Test
public void generateHeader_displaySizePage_returnDisplaySizeTitle() { public void updateHeaderLayout_displaySizePage_returnDisplaySizeTitle() {
final Intent intent = new Intent(); final Intent intent = new Intent();
intent.putExtra(VISION_FRAGMENT_NO, FragmentType.SCREEN_SIZE); intent.putExtra(VISION_FRAGMENT_NO, FragmentType.SCREEN_SIZE);
intent.putExtra(EXTRA_PAGE_TRANSITION_TYPE, TransitionType.TRANSITION_FADE); intent.putExtra(EXTRA_PAGE_TRANSITION_TYPE, TransitionType.TRANSITION_FADE);
final AccessibilityScreenSizeForSetupWizardActivity activity = Robolectric.buildActivity( final AccessibilityScreenSizeForSetupWizardActivity activity = Robolectric.buildActivity(
AccessibilityScreenSizeForSetupWizardActivity.class, intent).get(); AccessibilityScreenSizeForSetupWizardActivity.class, intent).get();
activity.setContentView(R.layout.accessibility_screen_size_setup_wizard); activity.setContentView(R.layout.accessibility_screen_size_setup_wizard);
activity.generateHeader(); activity.updateHeaderLayout();
final GlifLayout layout = activity.findViewById(R.id.setup_wizard_layout); final GlifLayout layout = activity.findViewById(R.id.setup_wizard_layout);
assertThat(layout.getHeaderText()).isEqualTo(mContext.getText(R.string.screen_zoom_title)); assertThat(layout.getHeaderText()).isEqualTo(mContext.getText(R.string.screen_zoom_title));
} }