Merge "Fix alignment issue between Vision Settings and Font/Display" into sc-v2-dev am: 17df1ff01f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16056987

Change-Id: I7b9a5992c671ed304e3ad2cdec7f546d6c77b446
This commit is contained in:
TreeHugger Robot
2021-11-01 02:50:16 +00:00
committed by Automerger Merge Worker
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 -->
<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
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. -->

View File

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

View File

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