Loading quickstep/src/com/android/launcher3/uioverrides/DisplayRotationListener.javadeleted 100644 → 0 +0 −48 Original line number Diff line number Diff line /* * Copyright (C) 2018 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. */ package com.android.launcher3.uioverrides; import android.content.Context; import android.os.Handler; import com.android.systemui.shared.system.RotationWatcher; /** * Utility class for listening for rotation changes */ public class DisplayRotationListener extends RotationWatcher { private final Runnable mCallback; private Handler mHandler; public DisplayRotationListener(Context context, Runnable callback) { super(context); mCallback = callback; } @Override public void enable() { if (mHandler == null) { mHandler = new Handler(); } super.enable(); } @Override protected void onRotationChanged(int i) { mHandler.post(mCallback); } } src/com/android/launcher3/BaseDraggingActivity.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3; import static com.android.launcher3.util.DefaultDisplay.CHANGE_ROTATION; import android.app.ActivityOptions; import android.content.ActivityNotFoundException; import android.content.Intent; Loading @@ -38,8 +40,10 @@ import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.uioverrides.DisplayRotationListener; import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.util.DefaultDisplay; import com.android.launcher3.util.DefaultDisplay.DisplayInfoChangeListener; import com.android.launcher3.util.DefaultDisplay.Info; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.Themes; import com.android.launcher3.util.TraceHelper; Loading @@ -48,7 +52,7 @@ import com.android.launcher3.util.TraceHelper; * Extension of BaseActivity allowing support for drag-n-drop */ public abstract class BaseDraggingActivity extends BaseActivity implements WallpaperColorInfo.OnChangeListener { implements WallpaperColorInfo.OnChangeListener, DisplayInfoChangeListener { private static final String TAG = "BaseDraggingActivity"; Loading @@ -63,8 +67,6 @@ public abstract class BaseDraggingActivity extends BaseActivity private int mThemeRes = R.style.AppTheme; private DisplayRotationListener mRotationListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Loading @@ -72,7 +74,7 @@ public abstract class BaseDraggingActivity extends BaseActivity mIsSafeModeEnabled = TraceHelper.whitelistIpcs("isSafeMode", () -> getPackageManager().isSafeMode()); mRotationListener = new DisplayRotationListener(this, this::onDeviceRotationChanged); DefaultDisplay.INSTANCE.get(this).addChangeListener(this); // Update theme WallpaperColorInfo.INSTANCE.get(this).addOnChangeListener(this); Loading Loading @@ -238,7 +240,7 @@ public abstract class BaseDraggingActivity extends BaseActivity protected void onDestroy() { super.onDestroy(); WallpaperColorInfo.INSTANCE.get(this).removeOnChangeListener(this); mRotationListener.disable(); DefaultDisplay.INSTANCE.get(this).removeChangeListener(this); } public void runOnceOnStart(Runnable action) { Loading @@ -251,15 +253,13 @@ public abstract class BaseDraggingActivity extends BaseActivity protected void onDeviceProfileInitiated() { if (mDeviceProfile.isVerticalBarLayout()) { mRotationListener.enable(); mDeviceProfile.updateIsSeascape(this); } else { mRotationListener.disable(); } } private void onDeviceRotationChanged() { if (mDeviceProfile.updateIsSeascape(this)) { @Override public void onDisplayInfoChanged(Info info, int flags) { if ((flags & CHANGE_ROTATION) != 0 && mDeviceProfile.updateIsSeascape(this)) { reapplyUi(); } } Loading src_ui_overrides/com/android/launcher3/uioverrides/DisplayRotationListener.javadeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line /* * Copyright (C) 2018 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. */ package com.android.launcher3.uioverrides; import android.content.Context; import android.view.OrientationEventListener; /** * Utility class for listening for rotation changes */ public class DisplayRotationListener extends OrientationEventListener { private final Runnable mCallback; public DisplayRotationListener(Context context, Runnable callback) { super(context); mCallback = callback; } @Override public void onOrientationChanged(int i) { mCallback.run(); } } Loading
quickstep/src/com/android/launcher3/uioverrides/DisplayRotationListener.javadeleted 100644 → 0 +0 −48 Original line number Diff line number Diff line /* * Copyright (C) 2018 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. */ package com.android.launcher3.uioverrides; import android.content.Context; import android.os.Handler; import com.android.systemui.shared.system.RotationWatcher; /** * Utility class for listening for rotation changes */ public class DisplayRotationListener extends RotationWatcher { private final Runnable mCallback; private Handler mHandler; public DisplayRotationListener(Context context, Runnable callback) { super(context); mCallback = callback; } @Override public void enable() { if (mHandler == null) { mHandler = new Handler(); } super.enable(); } @Override protected void onRotationChanged(int i) { mHandler.post(mCallback); } }
src/com/android/launcher3/BaseDraggingActivity.java +11 −11 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.launcher3; import static com.android.launcher3.util.DefaultDisplay.CHANGE_ROTATION; import android.app.ActivityOptions; import android.content.ActivityNotFoundException; import android.content.Intent; Loading @@ -38,8 +40,10 @@ import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.model.AppLaunchTracker; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.uioverrides.DisplayRotationListener; import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.util.DefaultDisplay; import com.android.launcher3.util.DefaultDisplay.DisplayInfoChangeListener; import com.android.launcher3.util.DefaultDisplay.Info; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.Themes; import com.android.launcher3.util.TraceHelper; Loading @@ -48,7 +52,7 @@ import com.android.launcher3.util.TraceHelper; * Extension of BaseActivity allowing support for drag-n-drop */ public abstract class BaseDraggingActivity extends BaseActivity implements WallpaperColorInfo.OnChangeListener { implements WallpaperColorInfo.OnChangeListener, DisplayInfoChangeListener { private static final String TAG = "BaseDraggingActivity"; Loading @@ -63,8 +67,6 @@ public abstract class BaseDraggingActivity extends BaseActivity private int mThemeRes = R.style.AppTheme; private DisplayRotationListener mRotationListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Loading @@ -72,7 +74,7 @@ public abstract class BaseDraggingActivity extends BaseActivity mIsSafeModeEnabled = TraceHelper.whitelistIpcs("isSafeMode", () -> getPackageManager().isSafeMode()); mRotationListener = new DisplayRotationListener(this, this::onDeviceRotationChanged); DefaultDisplay.INSTANCE.get(this).addChangeListener(this); // Update theme WallpaperColorInfo.INSTANCE.get(this).addOnChangeListener(this); Loading Loading @@ -238,7 +240,7 @@ public abstract class BaseDraggingActivity extends BaseActivity protected void onDestroy() { super.onDestroy(); WallpaperColorInfo.INSTANCE.get(this).removeOnChangeListener(this); mRotationListener.disable(); DefaultDisplay.INSTANCE.get(this).removeChangeListener(this); } public void runOnceOnStart(Runnable action) { Loading @@ -251,15 +253,13 @@ public abstract class BaseDraggingActivity extends BaseActivity protected void onDeviceProfileInitiated() { if (mDeviceProfile.isVerticalBarLayout()) { mRotationListener.enable(); mDeviceProfile.updateIsSeascape(this); } else { mRotationListener.disable(); } } private void onDeviceRotationChanged() { if (mDeviceProfile.updateIsSeascape(this)) { @Override public void onDisplayInfoChanged(Info info, int flags) { if ((flags & CHANGE_ROTATION) != 0 && mDeviceProfile.updateIsSeascape(this)) { reapplyUi(); } } Loading
src_ui_overrides/com/android/launcher3/uioverrides/DisplayRotationListener.javadeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line /* * Copyright (C) 2018 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. */ package com.android.launcher3.uioverrides; import android.content.Context; import android.view.OrientationEventListener; /** * Utility class for listening for rotation changes */ public class DisplayRotationListener extends OrientationEventListener { private final Runnable mCallback; public DisplayRotationListener(Context context, Runnable callback) { super(context); mCallback = callback; } @Override public void onOrientationChanged(int i) { mCallback.run(); } }