Using surface rotation instead of insets to determine seascape configuration
Insets may not correctly indicate seascape configuration in multi-window or when the presence of device-cutouts Bug: 79376298 Change-Id: I8268efca0001fe527a0ffefe48cc71e774fad01c
This commit is contained in:
1 parent
c247a00e22
commit
59d086c3ce
9 files changed
+151
-19
No files matched your search
@@ -28,12 +28,14 @@ import android.os.StrictMode;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.ActionMode;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.badge.BadgeInfo;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.uioverrides.DisplayRotationListener;
|
||||
import com.android.launcher3.uioverrides.WallpaperColorInfo;
|
||||
import com.android.launcher3.shortcuts.DeepShortcutManager;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
@@ -61,10 +63,13 @@ public abstract class BaseDraggingActivity extends BaseActivity
|
||||
|
||||
private int mThemeRes = R.style.LauncherTheme;
|
||||
|
||||
private DisplayRotationListener mRotationListener;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mIsSafeModeEnabled = getPackageManager().isSafeMode();
|
||||
mRotationListener = new DisplayRotationListener(this, this::onDeviceRotationChanged);
|
||||
|
||||
// Update theme
|
||||
WallpaperColorInfo wallpaperColorInfo = WallpaperColorInfo.getInstance(this);
|
||||
@@ -237,12 +242,30 @@ public abstract class BaseDraggingActivity extends BaseActivity
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
WallpaperColorInfo.getInstance(this).removeOnChangeListener(this);
|
||||
mRotationListener.disable();
|
||||
}
|
||||
|
||||
public <T extends BaseDraggingActivity> void setOnStartCallback(OnStartCallback<T> callback) {
|
||||
mOnStartCallback = callback;
|
||||
}
|
||||
|
||||
protected void onDeviceProfileInitiated() {
|
||||
if (mDeviceProfile.isVerticalBarLayout()) {
|
||||
mRotationListener.enable();
|
||||
mDeviceProfile.updateIsSeascape(getWindowManager());
|
||||
} else {
|
||||
mRotationListener.disable();
|
||||
}
|
||||
}
|
||||
|
||||
private void onDeviceRotationChanged() {
|
||||
if (mDeviceProfile.updateIsSeascape(getWindowManager())) {
|
||||
reapplyUi();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void reapplyUi();
|
||||
|
||||
/**
|
||||
* Callback for listening for onStart
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user