• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.launcher3.graphics;
17 
18 import android.content.Context;
19 import android.graphics.Rect;
20 
21 public abstract class RotationMode {
22 
23     public static RotationMode NORMAL = new RotationMode(0) { };
24 
25     public final float surfaceRotation;
26     public final boolean isTransposed;
27 
RotationMode(float surfaceRotation)28     public RotationMode(float surfaceRotation) {
29         this.surfaceRotation = surfaceRotation;
30         isTransposed = surfaceRotation != 0;
31     }
32 
mapRect(Rect rect, Rect out)33     public final void mapRect(Rect rect, Rect out) {
34         mapRect(rect.left, rect.top, rect.right, rect.bottom, out);
35     }
36 
mapRect(int left, int top, int right, int bottom, Rect out)37     public void mapRect(int left, int top, int right, int bottom, Rect out) {
38         out.set(left, top, right, bottom);
39     }
40 
mapInsets(Context context, Rect insets, Rect out)41     public void mapInsets(Context context, Rect insets, Rect out) {
42         out.set(insets);
43     }
44 
toNaturalGravity(int absoluteGravity)45     public int toNaturalGravity(int absoluteGravity) {
46         return absoluteGravity;
47     }
48 }
49