Merge "Do not use shared lib resources" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
cd12f1b260
@@ -82,6 +82,8 @@
|
||||
|
||||
<dimen name="navigation_key_width">128dp</dimen>
|
||||
|
||||
<dimen name="navigation_key_padding">25dp</dimen>
|
||||
|
||||
<!-- Keyboard shortcuts helper -->
|
||||
<dimen name="ksh_layout_width">488dp</dimen>
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
-->
|
||||
<resources>
|
||||
|
||||
<!-- The maximum width of the navigation bar ripples. -->
|
||||
<dimen name="key_button_ripple_max_width">76dp</dimen>
|
||||
|
||||
<!-- The padding around the navigation buttons -->
|
||||
<dimen name="navigation_key_padding">0dp</dimen>
|
||||
|
||||
<dimen name="button_size">80dp</dimen>
|
||||
<dimen name="navigation_side_padding">@dimen/button_size</dimen>
|
||||
<dimen name="navigation_key_width">@dimen/button_size</dimen>
|
||||
|
||||
@@ -522,6 +522,19 @@
|
||||
<!-- Size of the icon inside each item in the ringer selector drawer. -->
|
||||
<dimen name="volume_ringer_drawer_icon_size">24dp</dimen>
|
||||
|
||||
<!-- The maximum width of the navigation bar ripples. -->
|
||||
<dimen name="key_button_ripple_max_width">95dp</dimen>
|
||||
|
||||
<dimen name="rounded_corner_content_padding">0dp</dimen>
|
||||
|
||||
<dimen name="navigation_key_padding">0dp</dimen>
|
||||
|
||||
<!-- Floating rotation button -->
|
||||
<dimen name="floating_rotation_button_diameter">40dp</dimen>
|
||||
<dimen name="floating_rotation_button_min_margin">20dp</dimen>
|
||||
<dimen name="floating_rotation_button_taskbar_left_margin">20dp</dimen>
|
||||
<dimen name="floating_rotation_button_taskbar_bottom_margin">10dp</dimen>
|
||||
|
||||
<!-- Gravity for the notification panel -->
|
||||
<integer name="notification_panel_layout_gravity">0x31</integer><!-- center_horizontal|top -->
|
||||
|
||||
|
||||
@@ -45,9 +45,6 @@ android_library {
|
||||
":wm_shell-aidls",
|
||||
":wm_shell_util-sources",
|
||||
],
|
||||
resource_dirs: [
|
||||
"res",
|
||||
],
|
||||
static_libs: [
|
||||
"PluginCoreLib",
|
||||
"androidx.dynamicanimation_dynamicanimation",
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
* Copyright (c) 2021, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<dimen name="navigation_key_padding">25dp</dimen>
|
||||
</resources>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
* Copyright (c) 2021, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- The maximum width of the navigation bar ripples. -->
|
||||
<dimen name="key_button_ripple_max_width">76dp</dimen>
|
||||
|
||||
<!-- The padding around the navigation buttons -->
|
||||
<dimen name="navigation_key_padding">0dp</dimen>
|
||||
</resources>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
* Copyright (c) 2021, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- The maximum width of the navigation bar ripples. -->
|
||||
<dimen name="key_button_ripple_max_width">95dp</dimen>
|
||||
|
||||
<dimen name="rounded_corner_content_padding">0dp</dimen>
|
||||
|
||||
<dimen name="navigation_key_padding">0dp</dimen>
|
||||
|
||||
<!-- Floating rotation button -->
|
||||
<dimen name="floating_rotation_button_diameter">40dp</dimen>
|
||||
<dimen name="floating_rotation_button_min_margin">20dp</dimen>
|
||||
<dimen name="floating_rotation_button_taskbar_left_margin">20dp</dimen>
|
||||
<dimen name="floating_rotation_button_taskbar_bottom_margin">10dp</dimen>
|
||||
</resources>
|
||||
@@ -35,10 +35,9 @@ import android.view.ViewConfiguration;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.PathInterpolator;
|
||||
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.android.systemui.shared.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -90,8 +89,8 @@ public class KeyButtonRipple extends Drawable {
|
||||
|
||||
private Type mType = Type.ROUNDED_RECT;
|
||||
|
||||
public KeyButtonRipple(Context ctx, View targetView) {
|
||||
mMaxWidth = ctx.getResources().getDimensionPixelSize(R.dimen.key_button_ripple_max_width);
|
||||
public KeyButtonRipple(Context ctx, View targetView, @DimenRes int maxWidthResource) {
|
||||
mMaxWidth = ctx.getResources().getDimensionPixelSize(maxWidthResource);
|
||||
mTargetView = targetView;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.systemui.shared.rotation;
|
||||
|
||||
import android.annotation.DimenRes;
|
||||
import android.annotation.IdRes;
|
||||
import android.annotation.LayoutRes;
|
||||
import android.annotation.StringRes;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
@@ -61,29 +64,33 @@ public class FloatingRotationButton implements RotationButton {
|
||||
private RotationButtonUpdatesCallback mUpdatesCallback;
|
||||
private Position mPosition;
|
||||
|
||||
public FloatingRotationButton(Context context, @StringRes int contentDescription) {
|
||||
public FloatingRotationButton(Context context, @StringRes int contentDescription,
|
||||
@LayoutRes int layout, @IdRes int keyButtonId, @DimenRes int minMargin,
|
||||
@DimenRes int roundedContentPadding, @DimenRes int taskbarLeftMargin,
|
||||
@DimenRes int taskbarBottomMargin, @DimenRes int buttonDiameter,
|
||||
@DimenRes int rippleMaxWidth) {
|
||||
mWindowManager = context.getSystemService(WindowManager.class);
|
||||
mKeyButtonContainer = (ViewGroup) LayoutInflater.from(context).inflate(
|
||||
R.layout.rotate_suggestion, null);
|
||||
mKeyButtonView = mKeyButtonContainer.findViewById(R.id.rotate_suggestion);
|
||||
mKeyButtonContainer = (ViewGroup) LayoutInflater.from(context).inflate(layout, null);
|
||||
mKeyButtonView = mKeyButtonContainer.findViewById(keyButtonId);
|
||||
mKeyButtonView.setVisibility(View.VISIBLE);
|
||||
mKeyButtonView.setContentDescription(context.getString(contentDescription));
|
||||
mKeyButtonView.setRipple(rippleMaxWidth);
|
||||
|
||||
Resources res = context.getResources();
|
||||
|
||||
int defaultMargin = Math.max(
|
||||
res.getDimensionPixelSize(R.dimen.floating_rotation_button_min_margin),
|
||||
res.getDimensionPixelSize(R.dimen.rounded_corner_content_padding));
|
||||
res.getDimensionPixelSize(minMargin),
|
||||
res.getDimensionPixelSize(roundedContentPadding));
|
||||
|
||||
int taskbarMarginLeft =
|
||||
res.getDimensionPixelSize(R.dimen.floating_rotation_button_taskbar_left_margin);
|
||||
res.getDimensionPixelSize(taskbarLeftMargin);
|
||||
int taskbarMarginBottom =
|
||||
res.getDimensionPixelSize(R.dimen.floating_rotation_button_taskbar_bottom_margin);
|
||||
res.getDimensionPixelSize(taskbarBottomMargin);
|
||||
|
||||
mPositionCalculator = new FloatingRotationButtonPositionCalculator(defaultMargin,
|
||||
taskbarMarginLeft, taskbarMarginBottom);
|
||||
|
||||
final int diameter = res.getDimensionPixelSize(R.dimen.floating_rotation_button_diameter);
|
||||
final int diameter = res.getDimensionPixelSize(buttonDiameter);
|
||||
mContainerSize = diameter + Math.max(defaultMargin, Math.max(taskbarMarginLeft,
|
||||
taskbarMarginBottom));
|
||||
}
|
||||
|
||||
@@ -26,13 +26,15 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.DimenRes;
|
||||
|
||||
import com.android.systemui.navigationbar.buttons.KeyButtonRipple;
|
||||
|
||||
public class FloatingRotationButtonView extends ImageView {
|
||||
|
||||
private static final float BACKGROUND_ALPHA = 0.92f;
|
||||
|
||||
private final KeyButtonRipple mRipple;
|
||||
private KeyButtonRipple mRipple;
|
||||
private final Paint mOvalBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
|
||||
|
||||
public FloatingRotationButtonView(Context context, AttributeSet attrs) {
|
||||
@@ -44,12 +46,15 @@ public class FloatingRotationButtonView extends ImageView {
|
||||
|
||||
setClickable(true);
|
||||
|
||||
mRipple = new KeyButtonRipple(context, this);
|
||||
setBackground(mRipple);
|
||||
setWillNotDraw(false);
|
||||
forceHasOverlappingRendering(false);
|
||||
}
|
||||
|
||||
public void setRipple(@DimenRes int rippleMaxWidthResource) {
|
||||
mRipple = new KeyButtonRipple(getContext(), this, rippleMaxWidthResource);
|
||||
setBackground(mRipple);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onWindowVisibilityChanged(int visibility) {
|
||||
super.onWindowVisibilityChanged(visibility);
|
||||
|
||||
@@ -323,8 +323,16 @@ public class NavigationBarView extends FrameLayout implements
|
||||
mContextualButtonGroup.addButton(accessibilityButton);
|
||||
mRotationContextButton = new RotationContextButton(R.id.rotate_suggestion,
|
||||
mLightContext, R.drawable.ic_sysbar_rotate_button_ccw_start_0);
|
||||
mFloatingRotationButton = new FloatingRotationButton(context,
|
||||
R.string.accessibility_rotate_button);
|
||||
mFloatingRotationButton = new FloatingRotationButton(mContext,
|
||||
R.string.accessibility_rotate_button,
|
||||
R.layout.rotate_suggestion,
|
||||
R.id.rotate_suggestion,
|
||||
R.dimen.floating_rotation_button_min_margin,
|
||||
R.dimen.rounded_corner_content_padding,
|
||||
R.dimen.floating_rotation_button_taskbar_left_margin,
|
||||
R.dimen.floating_rotation_button_taskbar_bottom_margin,
|
||||
R.dimen.floating_rotation_button_diameter,
|
||||
R.dimen.key_button_ripple_max_width);
|
||||
mRotationButtonController = new RotationButtonController(mLightContext, mLightIconColor,
|
||||
mDarkIconColor, R.drawable.ic_sysbar_rotate_button_ccw_start_0,
|
||||
R.drawable.ic_sysbar_rotate_button_ccw_start_90,
|
||||
|
||||
@@ -168,7 +168,7 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
|
||||
setClickable(true);
|
||||
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
|
||||
|
||||
mRipple = new KeyButtonRipple(context, this);
|
||||
mRipple = new KeyButtonRipple(context, this, R.dimen.key_button_ripple_max_width);
|
||||
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
|
||||
mInputManager = manager;
|
||||
setBackground(mRipple);
|
||||
|
||||
Reference in New Issue
Block a user