Loading packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnification.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.systemui.accessibility; package com.android.systemui.accessibility; import android.content.Context; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.database.ContentObserver; import android.database.ContentObserver; import android.os.Handler; import android.os.Handler; import android.provider.Settings; import android.provider.Settings; Loading @@ -35,10 +37,25 @@ public class WindowMagnification extends SystemUI { private WindowMagnificationController mWindowMagnificationController; private WindowMagnificationController mWindowMagnificationController; private final Handler mHandler; private final Handler mHandler; private Configuration mLastConfiguration; @Inject @Inject public WindowMagnification(Context context, @Main Handler mainHandler) { public WindowMagnification(Context context, @Main Handler mainHandler) { super(context); super(context); mHandler = mainHandler; mHandler = mainHandler; mLastConfiguration = new Configuration(context.getResources().getConfiguration()); } @Override public void onConfigurationChanged(Configuration newConfig) { final int configDiff = newConfig.diff(mLastConfiguration); if ((configDiff & ActivityInfo.CONFIG_DENSITY) == 0) { return; } mLastConfiguration.setTo(newConfig); if (mWindowMagnificationController != null) { mWindowMagnificationController.onConfigurationChanged(configDiff); } } } @Override @Override Loading packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +14 −2 Original line number Original line Diff line number Diff line Loading @@ -113,6 +113,7 @@ public class WindowMagnificationController implements View.OnClickListener, if (mMirrorView != null) { if (mMirrorView != null) { return; return; } } setInitialStartBounds(); createOverlayWindow(); createOverlayWindow(); } } Loading Loading @@ -178,9 +179,20 @@ public class WindowMagnificationController implements View.OnClickListener, } } } } private void createMirrorWindow() { /** setInitialStartBounds(); * Called when the configuration has changed, and it updates window magnification UI. * * @param configDiff a bit mask of the differences between the configurations */ void onConfigurationChanged(int configDiff) { // TODO(b/145780606): update toggle button UI. if (mMirrorView != null) { mWm.removeView(mMirrorView); createMirrorWindow(); } } private void createMirrorWindow() { // The window should be the size the mirrored surface will be but also add room for the // The window should be the size the mirrored surface will be but also add room for the // border and the drag handle. // border and the drag handle. int dragViewHeight = (int) mContext.getResources().getDimension( int dragViewHeight = (int) mContext.getResources().getDimension( Loading Loading
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnification.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.systemui.accessibility; package com.android.systemui.accessibility; import android.content.Context; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.database.ContentObserver; import android.database.ContentObserver; import android.os.Handler; import android.os.Handler; import android.provider.Settings; import android.provider.Settings; Loading @@ -35,10 +37,25 @@ public class WindowMagnification extends SystemUI { private WindowMagnificationController mWindowMagnificationController; private WindowMagnificationController mWindowMagnificationController; private final Handler mHandler; private final Handler mHandler; private Configuration mLastConfiguration; @Inject @Inject public WindowMagnification(Context context, @Main Handler mainHandler) { public WindowMagnification(Context context, @Main Handler mainHandler) { super(context); super(context); mHandler = mainHandler; mHandler = mainHandler; mLastConfiguration = new Configuration(context.getResources().getConfiguration()); } @Override public void onConfigurationChanged(Configuration newConfig) { final int configDiff = newConfig.diff(mLastConfiguration); if ((configDiff & ActivityInfo.CONFIG_DENSITY) == 0) { return; } mLastConfiguration.setTo(newConfig); if (mWindowMagnificationController != null) { mWindowMagnificationController.onConfigurationChanged(configDiff); } } } @Override @Override Loading
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +14 −2 Original line number Original line Diff line number Diff line Loading @@ -113,6 +113,7 @@ public class WindowMagnificationController implements View.OnClickListener, if (mMirrorView != null) { if (mMirrorView != null) { return; return; } } setInitialStartBounds(); createOverlayWindow(); createOverlayWindow(); } } Loading Loading @@ -178,9 +179,20 @@ public class WindowMagnificationController implements View.OnClickListener, } } } } private void createMirrorWindow() { /** setInitialStartBounds(); * Called when the configuration has changed, and it updates window magnification UI. * * @param configDiff a bit mask of the differences between the configurations */ void onConfigurationChanged(int configDiff) { // TODO(b/145780606): update toggle button UI. if (mMirrorView != null) { mWm.removeView(mMirrorView); createMirrorWindow(); } } private void createMirrorWindow() { // The window should be the size the mirrored surface will be but also add room for the // The window should be the size the mirrored surface will be but also add room for the // border and the drag handle. // border and the drag handle. int dragViewHeight = (int) mContext.getResources().getDimension( int dragViewHeight = (int) mContext.getResources().getDimension( Loading