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 17 package com.android.launcher3.touch; 18 19 import android.content.res.Resources; 20 import android.graphics.PointF; 21 import android.graphics.Rect; 22 import android.view.Surface; 23 import android.view.View; 24 25 import com.android.launcher3.DeviceProfile; 26 import com.android.launcher3.Utilities; 27 28 public class SeascapePagedViewHandler extends LandscapePagedViewHandler { 29 30 @Override getSecondaryTranslationDirectionFactor()31 public int getSecondaryTranslationDirectionFactor() { 32 return -1; 33 } 34 35 @Override getTaskDragDisplacementFactor(boolean isRtl)36 public int getTaskDragDisplacementFactor(boolean isRtl) { 37 return isRtl ? -1 : 1; 38 } 39 40 @Override getRecentsRtlSetting(Resources resources)41 public boolean getRecentsRtlSetting(Resources resources) { 42 return Utilities.isRtl(resources); 43 } 44 45 @Override getDegreesRotated()46 public float getDegreesRotated() { 47 return 270; 48 } 49 50 @Override getRotation()51 public int getRotation() { 52 return Surface.ROTATION_270; 53 } 54 55 @Override isGoingUp(float displacement, boolean isRtl)56 public boolean isGoingUp(float displacement, boolean isRtl) { 57 return isRtl ? displacement > 0 : displacement < 0; 58 } 59 60 @Override adjustFloatingIconStartVelocity(PointF velocity)61 public void adjustFloatingIconStartVelocity(PointF velocity) { 62 float oldX = velocity.x; 63 float oldY = velocity.y; 64 velocity.set(oldY, -oldX); 65 } 66 67 @Override getTaskMenuX(float x, View thumbnailView)68 public float getTaskMenuX(float x, View thumbnailView) { 69 return x; 70 } 71 72 @Override getTaskMenuY(float y, View thumbnailView)73 public float getTaskMenuY(float y, View thumbnailView) { 74 return y + thumbnailView.getMeasuredHeight(); 75 } 76 77 @Override setPrimaryAndResetSecondaryTranslate(View view, float translation)78 public void setPrimaryAndResetSecondaryTranslate(View view, float translation) { 79 view.setTranslationX(0); 80 view.setTranslationY(translation); 81 } 82 83 @Override getDistanceToBottomOfRect(DeviceProfile dp, Rect rect)84 public int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect) { 85 return dp.widthPx - rect.right; 86 } 87 } 88