Loading packages/SystemUI/accessibility/accessibilitymenu/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ android_app { "androidx.coordinatorlayout_coordinatorlayout", "androidx.core_core", "androidx.preference_preference", "androidx.viewpager_viewpager", "androidx.viewpager2_viewpager2", "com_android_systemui_flags_lib", "SettingsLibDisplayUtils", "SettingsLibSettingsTheme", Loading packages/SystemUI/accessibility/accessibilitymenu/res/layout/footerlayout_switch_page.xml +2 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android:orientation="horizontal"> <ImageButton android:id="@+id/menu_prev_button" android:id="@+id/menu_left_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" Loading @@ -38,7 +38,7 @@ android:background="?android:attr/listDivider"/> <ImageButton android:id="@+id/menu_next_button" android:id="@+id/menu_right_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" Loading packages/SystemUI/accessibility/accessibilitymenu/res/layout/grid_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="match_parent" android:horizontalSpacing="@dimen/a11ymenu_grid_layout_margin" android:listSelector="@android:color/transparent" android:numColumns="3" Loading packages/SystemUI/accessibility/accessibilitymenu/res/layout/paged_menu.xml +2 −4 Original line number Diff line number Diff line Loading @@ -6,18 +6,16 @@ android:background="@drawable/view_background" > <LinearLayout android:layout_width="@dimen/row_width" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <androidx.viewpager.widget.ViewPager <androidx.viewpager2.widget.ViewPager2 android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/table_margin_top" android:paddingBottom="@dimen/a11ymenu_layout_margin" android:paddingLeft="@dimen/a11ymenu_layout_margin" android:paddingRight="@dimen/a11ymenu_layout_margin" android:layout_gravity="center" android:gravity="center" /> Loading packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/view/A11yMenuFooter.java +35 −16 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ package com.android.systemui.accessibility.accessibilitymenu.view; import static android.view.View.LAYOUT_DIRECTION_LTR; import android.content.res.Configuration; import android.graphics.Rect; import android.text.TextUtils; import android.view.TouchDelegate; import android.view.View; import android.view.View.OnClickListener; Loading @@ -37,46 +41,61 @@ public class A11yMenuFooter { public interface A11yMenuFooterCallBack { /** Calls back when user clicks the left button. */ void onLeftButtonClicked(); void onNextButtonClicked(); /** Calls back when user clicks the right button. */ void onRightButtonClicked(); void onPreviousButtonClicked(); } private final FooterButtonClickListener mFooterButtonClickListener; private ImageButton mPreviousPageBtn; private ImageButton mNextPageBtn; private ImageButton mPageLeftBtn; private ImageButton mPageRightBtn; private View mTopListDivider; private View mBottomListDivider; private final A11yMenuFooterCallBack mCallBack; private final ViewGroup mMenuLayout; private int mRightToLeftDirection = LAYOUT_DIRECTION_LTR; public A11yMenuFooter(ViewGroup menuLayout, A11yMenuFooterCallBack callBack) { this.mCallBack = callBack; mFooterButtonClickListener = new FooterButtonClickListener(); configureFooterLayout(menuLayout); mMenuLayout = menuLayout; } public @Nullable ImageButton getPreviousPageBtn() { return mPreviousPageBtn; return mRightToLeftDirection == LAYOUT_DIRECTION_LTR ? mPageLeftBtn : mPageRightBtn; } public @Nullable ImageButton getNextPageBtn() { return mNextPageBtn; return mRightToLeftDirection == LAYOUT_DIRECTION_LTR ? mPageRightBtn : mPageLeftBtn; } /** Sets right to left direction of footer. */ public void updateRightToLeftDirection(Configuration configuration) { mRightToLeftDirection = TextUtils.getLayoutDirectionFromLocale( configuration.getLocales().get(0)); getPreviousPageBtn().setContentDescription(mMenuLayout.getResources().getString( R.string.previous_button_content_description)); getNextPageBtn().setContentDescription(mMenuLayout.getResources().getString( R.string.next_button_content_description)); } private void configureFooterLayout(ViewGroup menuLayout) { ViewGroup footerContainer = menuLayout.findViewById(R.id.footerlayout); footerContainer.setVisibility(View.VISIBLE); mPreviousPageBtn = menuLayout.findViewById(R.id.menu_prev_button); mNextPageBtn = menuLayout.findViewById(R.id.menu_next_button); mPageLeftBtn = menuLayout.findViewById(R.id.menu_left_button); mPageRightBtn = menuLayout.findViewById(R.id.menu_right_button); mTopListDivider = menuLayout.findViewById(R.id.top_listDivider); mBottomListDivider = menuLayout.findViewById(R.id.bottom_listDivider); // Registers listeners for footer buttons. setListener(mPreviousPageBtn); setListener(mNextPageBtn); setListener(mPageLeftBtn); setListener(mPageRightBtn); menuLayout .getViewTreeObserver() Loading @@ -85,8 +104,8 @@ public class A11yMenuFooter { @Override public void onGlobalLayout() { menuLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); expandBtnTouchArea(mPreviousPageBtn, menuLayout); expandBtnTouchArea(mNextPageBtn, (View) mNextPageBtn.getParent()); expandBtnTouchArea(mPageLeftBtn, menuLayout); expandBtnTouchArea(mPageRightBtn, (View) mPageRightBtn.getParent()); } }); } Loading Loading @@ -115,10 +134,10 @@ public class A11yMenuFooter { private class FooterButtonClickListener implements OnClickListener { @Override public void onClick(View view) { if (view.getId() == R.id.menu_prev_button) { mCallBack.onLeftButtonClicked(); } else if (view.getId() == R.id.menu_next_button) { mCallBack.onRightButtonClicked(); if (view.getId() == getPreviousPageBtn().getId()) { mCallBack.onPreviousButtonClicked(); } else if (view.getId() == getNextPageBtn().getId()) { mCallBack.onNextButtonClicked(); } } } Loading Loading
packages/SystemUI/accessibility/accessibilitymenu/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ android_app { "androidx.coordinatorlayout_coordinatorlayout", "androidx.core_core", "androidx.preference_preference", "androidx.viewpager_viewpager", "androidx.viewpager2_viewpager2", "com_android_systemui_flags_lib", "SettingsLibDisplayUtils", "SettingsLibSettingsTheme", Loading
packages/SystemUI/accessibility/accessibilitymenu/res/layout/footerlayout_switch_page.xml +2 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android:orientation="horizontal"> <ImageButton android:id="@+id/menu_prev_button" android:id="@+id/menu_left_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" Loading @@ -38,7 +38,7 @@ android:background="?android:attr/listDivider"/> <ImageButton android:id="@+id/menu_next_button" android:id="@+id/menu_right_button" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" Loading
packages/SystemUI/accessibility/accessibilitymenu/res/layout/grid_view.xml +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="match_parent" android:horizontalSpacing="@dimen/a11ymenu_grid_layout_margin" android:listSelector="@android:color/transparent" android:numColumns="3" Loading
packages/SystemUI/accessibility/accessibilitymenu/res/layout/paged_menu.xml +2 −4 Original line number Diff line number Diff line Loading @@ -6,18 +6,16 @@ android:background="@drawable/view_background" > <LinearLayout android:layout_width="@dimen/row_width" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <androidx.viewpager.widget.ViewPager <androidx.viewpager2.widget.ViewPager2 android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="@dimen/table_margin_top" android:paddingBottom="@dimen/a11ymenu_layout_margin" android:paddingLeft="@dimen/a11ymenu_layout_margin" android:paddingRight="@dimen/a11ymenu_layout_margin" android:layout_gravity="center" android:gravity="center" /> Loading
packages/SystemUI/accessibility/accessibilitymenu/src/com/android/systemui/accessibility/accessibilitymenu/view/A11yMenuFooter.java +35 −16 Original line number Diff line number Diff line Loading @@ -16,7 +16,11 @@ package com.android.systemui.accessibility.accessibilitymenu.view; import static android.view.View.LAYOUT_DIRECTION_LTR; import android.content.res.Configuration; import android.graphics.Rect; import android.text.TextUtils; import android.view.TouchDelegate; import android.view.View; import android.view.View.OnClickListener; Loading @@ -37,46 +41,61 @@ public class A11yMenuFooter { public interface A11yMenuFooterCallBack { /** Calls back when user clicks the left button. */ void onLeftButtonClicked(); void onNextButtonClicked(); /** Calls back when user clicks the right button. */ void onRightButtonClicked(); void onPreviousButtonClicked(); } private final FooterButtonClickListener mFooterButtonClickListener; private ImageButton mPreviousPageBtn; private ImageButton mNextPageBtn; private ImageButton mPageLeftBtn; private ImageButton mPageRightBtn; private View mTopListDivider; private View mBottomListDivider; private final A11yMenuFooterCallBack mCallBack; private final ViewGroup mMenuLayout; private int mRightToLeftDirection = LAYOUT_DIRECTION_LTR; public A11yMenuFooter(ViewGroup menuLayout, A11yMenuFooterCallBack callBack) { this.mCallBack = callBack; mFooterButtonClickListener = new FooterButtonClickListener(); configureFooterLayout(menuLayout); mMenuLayout = menuLayout; } public @Nullable ImageButton getPreviousPageBtn() { return mPreviousPageBtn; return mRightToLeftDirection == LAYOUT_DIRECTION_LTR ? mPageLeftBtn : mPageRightBtn; } public @Nullable ImageButton getNextPageBtn() { return mNextPageBtn; return mRightToLeftDirection == LAYOUT_DIRECTION_LTR ? mPageRightBtn : mPageLeftBtn; } /** Sets right to left direction of footer. */ public void updateRightToLeftDirection(Configuration configuration) { mRightToLeftDirection = TextUtils.getLayoutDirectionFromLocale( configuration.getLocales().get(0)); getPreviousPageBtn().setContentDescription(mMenuLayout.getResources().getString( R.string.previous_button_content_description)); getNextPageBtn().setContentDescription(mMenuLayout.getResources().getString( R.string.next_button_content_description)); } private void configureFooterLayout(ViewGroup menuLayout) { ViewGroup footerContainer = menuLayout.findViewById(R.id.footerlayout); footerContainer.setVisibility(View.VISIBLE); mPreviousPageBtn = menuLayout.findViewById(R.id.menu_prev_button); mNextPageBtn = menuLayout.findViewById(R.id.menu_next_button); mPageLeftBtn = menuLayout.findViewById(R.id.menu_left_button); mPageRightBtn = menuLayout.findViewById(R.id.menu_right_button); mTopListDivider = menuLayout.findViewById(R.id.top_listDivider); mBottomListDivider = menuLayout.findViewById(R.id.bottom_listDivider); // Registers listeners for footer buttons. setListener(mPreviousPageBtn); setListener(mNextPageBtn); setListener(mPageLeftBtn); setListener(mPageRightBtn); menuLayout .getViewTreeObserver() Loading @@ -85,8 +104,8 @@ public class A11yMenuFooter { @Override public void onGlobalLayout() { menuLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); expandBtnTouchArea(mPreviousPageBtn, menuLayout); expandBtnTouchArea(mNextPageBtn, (View) mNextPageBtn.getParent()); expandBtnTouchArea(mPageLeftBtn, menuLayout); expandBtnTouchArea(mPageRightBtn, (View) mPageRightBtn.getParent()); } }); } Loading Loading @@ -115,10 +134,10 @@ public class A11yMenuFooter { private class FooterButtonClickListener implements OnClickListener { @Override public void onClick(View view) { if (view.getId() == R.id.menu_prev_button) { mCallBack.onLeftButtonClicked(); } else if (view.getId() == R.id.menu_next_button) { mCallBack.onRightButtonClicked(); if (view.getId() == getPreviousPageBtn().getId()) { mCallBack.onPreviousButtonClicked(); } else if (view.getId() == getNextPageBtn().getId()) { mCallBack.onNextButtonClicked(); } } } Loading