Skip to content

Commit

Permalink
base: Implement Android P Volume Panel
Browse files Browse the repository at this point in the history
AICP edits:
- layout updates
- add volume offset from the top to properly align the dialog
  with power menu top
- fix caret shift when rotated right
- fix caret direction in collapse-expand animation
- remove unused volume_collapse stuff
by @eyosen

Change-Id: I32ff6166d4fdae104381cf644a60c791687d108f
Signed-off-by: IacobIonut01 <paulionut2003@gmail.com>
  • Loading branch information
IacobIonut01 authored and wartomato committed Jul 31, 2018
1 parent b1b8e85 commit 9628354
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 259 deletions.
10 changes: 2 additions & 8 deletions packages/SystemUI/res/anim/ic_caret_down_left_animation.xml
Expand Up @@ -16,17 +16,11 @@
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="250"
android:propertyXName="translateX"
android:propertyYName="translateY"
android:pathData="M 12.699,8.701 c 0.0,1.09767 0.0,5.48833 0.0,6.586"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:duration="200"
android:propertyName="rotation"
android:valueFrom="-45.0"
android:valueTo="45.0"
android:valueFrom="0"
android:valueTo="180"
android:valueType="floatType"
android:interpolator="@interpolator/ic_caret_down_animation_interpolator_0" />
</set>
10 changes: 2 additions & 8 deletions packages/SystemUI/res/anim/ic_caret_down_right_animation.xml
Expand Up @@ -16,17 +16,11 @@
-->
<set
xmlns:android="http://schemas.android.com/apk/res/android" >
<objectAnimator
android:duration="250"
android:propertyXName="translateX"
android:propertyYName="translateY"
android:pathData="M 11.287,8.701 c 0.0,1.09767 0.0,5.48833 0.0,6.586"
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:duration="200"
android:propertyName="rotation"
android:valueFrom="45.0"
android:valueTo="-45.0"
android:valueFrom="0"
android:valueTo="180"
android:valueType="floatType"
android:interpolator="@interpolator/ic_caret_down_animation_interpolator_0" />
</set>
55 changes: 0 additions & 55 deletions packages/SystemUI/res/drawable/ic_volume_collapse.xml

This file was deleted.

25 changes: 0 additions & 25 deletions packages/SystemUI/res/drawable/ic_volume_collapse_animation.xml

This file was deleted.

41 changes: 10 additions & 31 deletions packages/SystemUI/res/drawable/ic_volume_expand.xml
Expand Up @@ -19,37 +19,16 @@
android:width="24dp"
android:viewportWidth="24"
android:height="24dp"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal" >
android:viewportHeight="24" >
<group
android:name="caret___4" >
<group
android:name="right"
android:translateX="11.287"
android:translateY="15.287"
android:rotation="-45" >
<group
android:name="right_pivot"
android:translateX="4.242" >
<path
android:name="rectangle_path_1"
android:fillColor="#FFFFFFFF"
android:pathData="M -3.242,-1.0 l 6.484,0.0 c 0.5522847498,0.0 1.0,0.4477152502 1.0,1.0 l 0.0,0.0 c 0.0,0.5522847498 -0.4477152502,1.0 -1.0,1.0 l -6.484,0.0 c -0.5522847498,0.0 -1.0,-0.4477152502 -1.0,-1.0 l 0.0,0.0 c 0.0,-0.5522847498 0.4477152502,-1.0 1.0,-1.0 Z" />
</group>
</group>
<group
android:name="left"
android:translateX="12.699"
android:translateY="15.287"
android:rotation="45" >
<group
android:name="left_pivot"
android:translateX="-4.242" >
<path
android:name="rectangle_path_2"
android:fillColor="#FFFFFFFF"
android:pathData="M -3.242,-1.0 l 6.484,0.0 c 0.5522847498,0.0 1.0,0.4477152502 1.0,1.0 l 0.0,0.0 c 0.0,0.5522847498 -0.4477152502,1.0 -1.0,1.0 l -6.484,0.0 c -0.5522847498,0.0 -1.0,-0.4477152502 -1.0,-1.0 l 0.0,0.0 c 0.0,-0.5522847498 0.4477152502,-1.0 1.0,-1.0 Z" />
</group>
</group>
android:name="caret_4" >
<group android:name="expand">
<path
android:fillColor="#6c6c6c"
android:pathData="M 12 0.94 C 17.9039239757 0.94 22.69 5.72607602431 22.69 11.63 C 22.69 17.5339239757 17.9039239757 22.32 12 22.32 C 6.09607602431 22.32 1.31 17.5339239757 1.31 11.63 C 1.31 5.72607602431 6.09607602431 0.94 12 0.94 Z" />
<path
android:fillColor="#ffffff"
android:pathData="M15,16.22l-4.58-4.59L15,7l-1.41-1.4-6,6,6,6Z" />
</group>
</group>
</vector>
Expand Up @@ -17,9 +17,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_volume_expand" >
<target
android:name="right"
android:name="expand"
android:animation="@anim/ic_caret_up_right_animation" />
<target
android:name="left"
android:animation="@anim/ic_caret_up_left_animation" />
</animated-vector>
73 changes: 38 additions & 35 deletions packages/SystemUI/res/layout/volume_dialog.xml
Expand Up @@ -13,65 +13,68 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/volume_dialog"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/volume_dialog_margin_bottom"
android:background="@drawable/volume_dialog_background"
android:paddingTop="@dimen/volume_dialog_padding_top"
android:theme="@style/qs_theme"
android:translationZ="4dp" >
android:layout_gravity="end"
android:layout_marginEnd="16dp"
android:focusableInTouchMode="false"
android:orientation="vertical">

<LinearLayout
android:id="@+id/volume_dialog_content"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:gravity="end"
android:layout_gravity="end"
android:orientation="vertical"
android:layout_marginBottom="6dp"
android:elevation="4dp">

<LinearLayout
android:id="@+id/volume_dialog_rows"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="@dimen/volume_button_size"
android:orientation="vertical" >
android:layout_width="wrap_content"
android:layout_height="245dp"
android:orientation="horizontal">
<!-- volume rows added and removed here! :-) -->
</LinearLayout>

<include layout="@layout/volume_zen_footer" />
<include
layout="@layout/volume_zen_footer"
android:layout_width="0dp"
android:layout_height="0dp" />

<!-- Only shown from Tuner setting -->
<include layout="@layout/tuner_zen_mode_panel" />
<include
layout="@layout/tuner_zen_mode_panel"
android:layout_width="0dp"
android:layout_height="0dp" />

</LinearLayout>

<LinearLayout
android:id="@+id/volume_dialog_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="@dimen/volume_expander_margin_end" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.Volume.Header" />
<com.android.keyguard.AlphaOptimizedImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="end"
android:gravity="end"
android:orientation="vertical">

<com.android.keyguard.AlphaOptimizedImageButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/volume_expand_button"
style="@style/VolumeButtons"
android:layout_width="@dimen/volume_button_size"
android:layout_height="@dimen/volume_button_size"
android:layout_width="92dp"
android:layout_height="44dp"
android:layout_gravity="center_vertical|end"
android:background="@drawable/ripple_drawable"
android:clickable="true"
android:gravity="center_vertical|end"
android:soundEffectsEnabled="false"
android:src="@drawable/ic_volume_collapse_animation"
android:background="@drawable/ripple_drawable"
tools:ignore="RtlHardcoded"
/>
android:src="@drawable/ic_volume_expand"
tools:ignore="RtlHardcoded" />

</LinearLayout>
</RelativeLayout>

</LinearLayout>
64 changes: 32 additions & 32 deletions packages/SystemUI/res/layout/volume_dialog_row.xml
Expand Up @@ -13,45 +13,45 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/volume_row_height"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical"
android:paddingBottom="@dimen/volume_row_padding_bottom" >

<TextView
android:id="@+id/volume_row_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.Volume.Header"
android:paddingStart="@dimen/volume_row_header_padding_start" />
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/volume_row_slider_height"
android:orientation="horizontal"
android:paddingStart="@dimen/volume_row_padding_start" >
android:layout_width="92dp"
android:layout_height="204dp"
android:layout_marginTop="8dp"
android:orientation="vertical">

<com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/volume_row_icon"
style="@style/VolumeButtons"
android:layout_width="@dimen/volume_button_size"
android:layout_height="@dimen/volume_button_size"
android:soundEffectsEnabled="false" />
android:id="@+id/volume_row_icon"
style="@style/VolumeButtons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:soundEffectsEnabled="false" />

<SeekBar
android:id="@+id/volume_row_slider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignWithParentIfMissing="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingStart="@dimen/volume_row_slider_padding_start"/>
android:id="@+id/volume_row_slider"
android:layout_width="128dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:rotation="-90" />
</LinearLayout>

</LinearLayout>
<TextView
android:id="@+id/volume_row_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="4dp"
android:gravity="center"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.Volume.Header" />

</LinearLayout>
6 changes: 3 additions & 3 deletions packages/SystemUI/res/layout/volume_zen_footer.xml
Expand Up @@ -16,10 +16,10 @@
<com.android.systemui.volume.ZenFooter xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/volume_zen_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
android:paddingBottom="8dp" > <!-- extends LinearLayout -->
android:visibility="gone"> <!-- extends LinearLayout -->

<View
android:id="@+id/zen_embedded_divider"
Expand Down
2 changes: 1 addition & 1 deletion packages/SystemUI/res/values/dimens.xml
Expand Up @@ -653,7 +653,7 @@
<dimen name="volume_slider_interspacing">8dp</dimen>

<!-- Volume dialog vertical offset from the top of the screen -->
<dimen name="volume_offset_top">0dp</dimen>
<dimen name="volume_offset_top">120dp</dimen>

<!-- Standard image button size for volume dialog buttons -->
<dimen name="volume_button_size">48dp</dimen>
Expand Down

0 comments on commit 9628354

Please sign in to comment.