diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2019-04-30 12:04:37 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2019-05-02 10:59:28 -0700 |
commit | ae6e318711239601fdd11a14c3cf8c542b808f19 (patch) | |
tree | cc648803791d551f80202267b1c05ca6f1084517 /src/com/android/launcher3/graphics | |
parent | c2803ec5b272c902b6ab314d782afe852163b4ff (diff) | |
download | android_packages_apps_Trebuchet-ae6e318711239601fdd11a14c3cf8c542b808f19.tar.gz android_packages_apps_Trebuchet-ae6e318711239601fdd11a14c3cf8c542b808f19.tar.bz2 android_packages_apps_Trebuchet-ae6e318711239601fdd11a14c3cf8c542b808f19.zip |
Initial changes to creating a fake landscape Launcher UI
Workspace and hotseat are drawn in rotated UI giving the impression that the
device is in Portrait, even though it is in landscape
Bug: 131360075
Change-Id: I29c4068af25fd4dcf7039b9a45886e864a137977
Diffstat (limited to 'src/com/android/launcher3/graphics')
-rw-r--r-- | src/com/android/launcher3/graphics/RotationMode.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/com/android/launcher3/graphics/RotationMode.java b/src/com/android/launcher3/graphics/RotationMode.java new file mode 100644 index 000000000..1b2cbdb9f --- /dev/null +++ b/src/com/android/launcher3/graphics/RotationMode.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2019 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.graphics; + +import android.graphics.Rect; + +public abstract class RotationMode { + + public final float surfaceRotation; + public final boolean isTransposed; + + private RotationMode(float surfaceRotation) { + this.surfaceRotation = surfaceRotation; + isTransposed = surfaceRotation != 0; + } + + public final void mapRect(Rect rect, Rect out) { + mapRect(rect.left, rect.top, rect.right, rect.bottom, out); + } + + public void mapRect(int left, int top, int right, int bottom, Rect out) { + out.set(left, top, right, bottom); + } + + public static RotationMode NORMAL = new RotationMode(0) { }; + + public static RotationMode LANDSCAPE = new RotationMode(-90) { + @Override + public void mapRect(int left, int top, int right, int bottom, Rect out) { + out.left = top; + out.top = right; + out.right = bottom; + out.bottom = left; + } + }; + + public static RotationMode SEASCAPE = new RotationMode(90) { + @Override + public void mapRect(int left, int top, int right, int bottom, Rect out) { + out.left = bottom; + out.top = left; + out.right = top; + out.bottom = right; + } + }; +} |