Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2704ad4 authored by Sunny Shao's avatar Sunny Shao
Browse files

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
parent c1770fe4
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -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. -->
+15 −2
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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));
    }