Loading packages/SystemUI/res/drawable/ic_open_in_new_window.xml 0 → 100644 +77 −0 Original line number Original line Diff line number Diff line <!-- ~ Copyright (C) 2020 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. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="@color/magnification_switch_button_color" /> <size android:width="40dp" android:height="40dp" /> </shape> </item> <item> <vector android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group android:translateX="1.500000" android:translateY="1.500000"> <path android:fillType="evenOdd" android:strokeColor="#FFFFFF" android:strokeWidth="2" android:pathData="M 3.5 1.5 L 17.5 1.5 Q 19.5 1.5 19.5 3.5 L 19.5 17.5 Q 19.5 19.5 17.5 19.5 L 3.5 19.5 Q 1.5 19.5 1.5 17.5 L 1.5 3.5 Q 1.5 1.5 3.5 1.5 Z" /> <path android:fillType="evenOdd" android:strokeColor="#FFFFFF" android:strokeWidth="1.5" android:pathData="M 4.25 4.25 H 8.75 V 8.75 H 4.25 V 4.25 Z" /> <path android:fillColor="#FFFFFF" android:fillType="evenOdd" android:strokeWidth="1" android:pathData="M 12.5 13.92 L 15.59 17 L 17 15.59 L 13.91 12.5 L 16.5 12.5 L 16.5 10.5 L 10.5 10.5 L 10.5 16.5 L 12.5 16.5 Z" /> </group> <group android:translateX="22.000000" android:translateY="2.000000"> <group android:translateX="3.000000" android:translateY="3.000000"> <group android:translateX="-3.000000" android:translateY="-3.000000"> <path android:fillColor="#80868B" android:fillType="evenOdd" android:strokeWidth="1" android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" /> </group> </group> </group> </vector> </item> <item> <ripple android:color="@color/GM2_grey_600"></ripple> </item> </layer-list> packages/SystemUI/src/com/android/systemui/accessibility/ModeSwitchesController.java +10 −10 Original line number Original line Diff line number Diff line Loading @@ -145,12 +145,10 @@ public class ModeSwitchesController { void showButton(int mode) { void showButton(int mode) { if (mImageView == null) { if (mImageView == null) { createView(); createView(mode); mWindowManager.addView(mImageView, mParams); mWindowManager.addView(mImageView, mParams); } else if (mMagnificationMode != mode) { } else if (mMagnificationMode != mode) { // TODO(b/145780606): wait for designer provide icon asset for window mode. mImageView.setImageResource(getIconResId(mode)); final int resId = R.drawable.ic_open_in_new_fullscreen; mImageView.setImageResource(resId); } } mMagnificationMode = mode; mMagnificationMode = mode; Loading @@ -167,17 +165,13 @@ public class ModeSwitchesController { () -> removeButton()); () -> removeButton()); } } private void createView() { private void createView(int mode) { // TODO(b/145780606): wait for designer provide icon asset for window mode. final int resId = R.drawable.ic_open_in_new_fullscreen; mImageView = new ImageView(mContext); mImageView = new ImageView(mContext); mImageView.setImageResource(resId); mImageView.setImageResource(getIconResId(mode)); mImageView.setClickable(true); mImageView.setClickable(true); mImageView.setFocusable(true); mImageView.setFocusable(true); mImageView.setPadding(mPadding, mPadding, mPadding, mPadding); mImageView.setPadding(mPadding, mPadding, mPadding, mPadding); mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); // TODO(b/145780606): switch magnification mode between full-screen and window by // clicking the button. mImageView.setOnClickListener( mImageView.setOnClickListener( view -> { view -> { if (view != null) { if (view != null) { Loading @@ -188,6 +182,12 @@ public class ModeSwitchesController { }); }); } } private int getIconResId(int mode) { return (mode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) ? R.drawable.ic_open_in_new_window : R.drawable.ic_open_in_new_fullscreen; } private void toggleMagnificationMode() { private void toggleMagnificationMode() { final int newMode = final int newMode = mMagnificationMode ^ Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL; mMagnificationMode ^ Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL; Loading Loading
packages/SystemUI/res/drawable/ic_open_in_new_window.xml 0 → 100644 +77 −0 Original line number Original line Diff line number Diff line <!-- ~ Copyright (C) 2020 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. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="@color/magnification_switch_button_color" /> <size android:width="40dp" android:height="40dp" /> </shape> </item> <item> <vector android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group android:translateX="1.500000" android:translateY="1.500000"> <path android:fillType="evenOdd" android:strokeColor="#FFFFFF" android:strokeWidth="2" android:pathData="M 3.5 1.5 L 17.5 1.5 Q 19.5 1.5 19.5 3.5 L 19.5 17.5 Q 19.5 19.5 17.5 19.5 L 3.5 19.5 Q 1.5 19.5 1.5 17.5 L 1.5 3.5 Q 1.5 1.5 3.5 1.5 Z" /> <path android:fillType="evenOdd" android:strokeColor="#FFFFFF" android:strokeWidth="1.5" android:pathData="M 4.25 4.25 H 8.75 V 8.75 H 4.25 V 4.25 Z" /> <path android:fillColor="#FFFFFF" android:fillType="evenOdd" android:strokeWidth="1" android:pathData="M 12.5 13.92 L 15.59 17 L 17 15.59 L 13.91 12.5 L 16.5 12.5 L 16.5 10.5 L 10.5 10.5 L 10.5 16.5 L 12.5 16.5 Z" /> </group> <group android:translateX="22.000000" android:translateY="2.000000"> <group android:translateX="3.000000" android:translateY="3.000000"> <group android:translateX="-3.000000" android:translateY="-3.000000"> <path android:fillColor="#80868B" android:fillType="evenOdd" android:strokeWidth="1" android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" /> </group> </group> </group> </vector> </item> <item> <ripple android:color="@color/GM2_grey_600"></ripple> </item> </layer-list>
packages/SystemUI/src/com/android/systemui/accessibility/ModeSwitchesController.java +10 −10 Original line number Original line Diff line number Diff line Loading @@ -145,12 +145,10 @@ public class ModeSwitchesController { void showButton(int mode) { void showButton(int mode) { if (mImageView == null) { if (mImageView == null) { createView(); createView(mode); mWindowManager.addView(mImageView, mParams); mWindowManager.addView(mImageView, mParams); } else if (mMagnificationMode != mode) { } else if (mMagnificationMode != mode) { // TODO(b/145780606): wait for designer provide icon asset for window mode. mImageView.setImageResource(getIconResId(mode)); final int resId = R.drawable.ic_open_in_new_fullscreen; mImageView.setImageResource(resId); } } mMagnificationMode = mode; mMagnificationMode = mode; Loading @@ -167,17 +165,13 @@ public class ModeSwitchesController { () -> removeButton()); () -> removeButton()); } } private void createView() { private void createView(int mode) { // TODO(b/145780606): wait for designer provide icon asset for window mode. final int resId = R.drawable.ic_open_in_new_fullscreen; mImageView = new ImageView(mContext); mImageView = new ImageView(mContext); mImageView.setImageResource(resId); mImageView.setImageResource(getIconResId(mode)); mImageView.setClickable(true); mImageView.setClickable(true); mImageView.setFocusable(true); mImageView.setFocusable(true); mImageView.setPadding(mPadding, mPadding, mPadding, mPadding); mImageView.setPadding(mPadding, mPadding, mPadding, mPadding); mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); mImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); // TODO(b/145780606): switch magnification mode between full-screen and window by // clicking the button. mImageView.setOnClickListener( mImageView.setOnClickListener( view -> { view -> { if (view != null) { if (view != null) { Loading @@ -188,6 +182,12 @@ public class ModeSwitchesController { }); }); } } private int getIconResId(int mode) { return (mode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN) ? R.drawable.ic_open_in_new_window : R.drawable.ic_open_in_new_fullscreen; } private void toggleMagnificationMode() { private void toggleMagnificationMode() { final int newMode = final int newMode = mMagnificationMode ^ Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL; mMagnificationMode ^ Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_ALL; Loading