diff options
| author | Lucas Dupin <dupin@google.com> | 2018-10-16 18:06:43 -0700 |
|---|---|---|
| committer | Lucas Dupin <dupin@google.com> | 2018-12-02 04:32:13 -0800 |
| commit | 086c6fc0ae56df214fd648274065b85bd0ff3a52 (patch) | |
| tree | b47c55b88891f5627c45149e37900efe73e92644 /core/java | |
| parent | 298c49e4f08644f4478380a4e75d63207e2c671c (diff) | |
Let launcher modify window corner radius
Test: Manualy launch an app
Test: Press home when activity is on top of the stack
Test: Quick scrub
Test: Swipe up on the home button, swipe down
Test: Tap on notification on the shade
Test: atest ActivityLaunchAnimatorTest
Bug: 111514493
Change-Id: Ib7e29e7e07bf2a245ff949373af700b319e273fc
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/com/android/internal/policy/PhoneWindow.java | 1 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/ScreenDecorationsUtils.java | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 031377ebe27b..488b9912ee49 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -41,6 +41,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; +import android.content.res.Resources; import android.content.res.Resources.Theme; import android.content.res.TypedArray; import android.graphics.Color; diff --git a/core/java/com/android/internal/policy/ScreenDecorationsUtils.java b/core/java/com/android/internal/policy/ScreenDecorationsUtils.java new file mode 100644 index 000000000000..100c6ee6763b --- /dev/null +++ b/core/java/com/android/internal/policy/ScreenDecorationsUtils.java @@ -0,0 +1,50 @@ +/* + * 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.internal.policy; + +import com.android.internal.R; + +import android.content.res.Resources; + +/** + * Utility functions for screen decorations used by both window manager and System UI. + */ +public class ScreenDecorationsUtils { + + /** + * Corner radius that should be used on windows in order to cover the display. + * These values are expressed in pixels because they should not respect display or font + * scaling, this means that we don't have to reload them on config changes. + */ + public static float getWindowCornerRadius(Resources resources) { + // Radius that should be used in case top or bottom aren't defined. + float defaultRadius = resources.getDimension(R.dimen.rounded_corner_radius); + + float topRadius = resources.getDimension(R.dimen.rounded_corner_radius_top); + if (topRadius == 0) { + topRadius = defaultRadius; + } + float bottomRadius = resources.getDimension(R.dimen.rounded_corner_radius_bottom); + if (bottomRadius == 0) { + bottomRadius = defaultRadius; + } + + // Always use the smallest radius to make sure the rounded corners will + // completely cover the display. + return Math.min(topRadius, bottomRadius); + } +} |
