Merge "Fix VolumeDialog position and appearance on TVs" into rvc-dev am: 3cfde121c2
Change-Id: I59003ae14581646bd2139957aa33984ceddb687e
This commit is contained in:
101
packages/SystemUI/res/layout-land-television/volume_dialog.xml
Normal file
101
packages/SystemUI/res/layout-land-television/volume_dialog.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<!--
|
||||
~ Copyright (C) 2020 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
|
||||
-->
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:sysui="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/volume_dialog_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:theme="@style/qs_theme">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/volume_dialog"
|
||||
android:minWidth="@dimen/volume_dialog_panel_width"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:background="@android:color/transparent"
|
||||
android:paddingRight="@dimen/volume_dialog_panel_transparent_padding_right"
|
||||
android:paddingTop="@dimen/volume_dialog_panel_transparent_padding"
|
||||
android:paddingBottom="@dimen/volume_dialog_panel_transparent_padding"
|
||||
android:paddingLeft="@dimen/volume_dialog_panel_transparent_padding"
|
||||
android:clipToPadding="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/volume_dialog_panel_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="68dp"
|
||||
android:layout_gravity="right"
|
||||
android:orientation="vertical"
|
||||
android:translationZ="@dimen/volume_dialog_elevation"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:background="@drawable/rounded_bg_full">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/volume_dialog_rows"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="@dimen/volume_dialog_panel_width"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingRight="@dimen/volume_dialog_stream_padding"
|
||||
android:paddingLeft="@dimen/volume_dialog_stream_padding">
|
||||
<!-- volume rows added and removed here! :-) -->
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/odi_captions"
|
||||
android:layout_width="@dimen/volume_dialog_caption_size"
|
||||
android:layout_height="@dimen/volume_dialog_caption_size"
|
||||
android:layout_marginRight="68dp"
|
||||
android:layout_gravity="right"
|
||||
android:clipToPadding="false"
|
||||
android:translationZ="@dimen/volume_dialog_elevation"
|
||||
android:background="@drawable/rounded_bg_full">
|
||||
|
||||
<com.android.systemui.volume.CaptionsToggleImageButton
|
||||
android:id="@+id/odi_captions_icon"
|
||||
android:src="@drawable/ic_volume_odi_captions_disabled"
|
||||
style="@style/VolumeButtons"
|
||||
android:background="@drawable/rounded_ripple"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:tint="@color/caption_tint_color_selector"
|
||||
android:layout_gravity="center"
|
||||
android:soundEffectsEnabled="false"
|
||||
sysui:optedOut="false"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/odi_captions_tooltip_stub"
|
||||
android:inflatedId="@+id/odi_captions_tooltip_view"
|
||||
android:layout="@layout/volume_tool_tip_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/volume_tool_tip_right_margin"
|
||||
android:layout_marginTop="@dimen/volume_tool_tip_top_margin"
|
||||
android:layout_gravity="right"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
22
packages/SystemUI/res/values-television/integers.xml
Normal file
22
packages/SystemUI/res/values-television/integers.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2020 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 position of the volume dialog on the screen.
|
||||
See com.android.systemui.volume.VolumeDialogImpl.
|
||||
Value 81 corresponds to BOTTOM|CENTER_HORIZONTAL. -->
|
||||
<integer name="volume_dialog_gravity">81</integer>
|
||||
</resources>
|
||||
@@ -40,4 +40,8 @@
|
||||
|
||||
<integer name="magnification_default_scale">2</integer>
|
||||
|
||||
<!-- The position of the volume dialog on the screen.
|
||||
See com.android.systemui.volume.VolumeDialogImpl.
|
||||
Value 21 corresponds to RIGHT|CENTER_VERTICAL. -->
|
||||
<integer name="volume_dialog_gravity">21</integer>
|
||||
</resources>
|
||||
@@ -65,7 +65,6 @@ import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.AccessibilityDelegate;
|
||||
@@ -224,7 +223,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
lp.format = PixelFormat.TRANSLUCENT;
|
||||
lp.setTitle(VolumeDialogImpl.class.getSimpleName());
|
||||
lp.windowAnimations = -1;
|
||||
lp.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
|
||||
lp.gravity = mContext.getResources().getInteger(R.integer.volume_dialog_gravity);
|
||||
mWindow.setAttributes(lp);
|
||||
mWindow.setLayout(WRAP_CONTENT, WRAP_CONTENT);
|
||||
|
||||
@@ -825,7 +824,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
}
|
||||
|
||||
protected void updateRingerH() {
|
||||
if (mState != null) {
|
||||
if (mRinger != null && mState != null) {
|
||||
final StreamState ss = mState.states.get(AudioManager.STREAM_RING);
|
||||
if (ss == null) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user