Skip to content

Commit

Permalink
Add Android S style player + screenshot sound toggle (#9)
Browse files Browse the repository at this point in the history
* SystemUI: Redesign Media Player View

Design inspired from Android S

Co-authored-by: Akash Srivastava <[email protected]>

* base: Allow disabling screenshot shutter sound [1/2]

Includes also:

commit b794cab075a38caccbb3c411b8b697426df27653
Co-Authored-By: xyyx <[email protected]>
Date:   Thu Jan 12 21:59:42 2017 +0800

    ScreenshotSound: Fix playing screenshot's sound when camera's sounds off.
    This bug actually because Screenshot uses Camera Shutter Sound

@idoybh: Adapt to A11

Change-Id: If6f766e4b581e7c35d36e2e777ce2c37a3843ad4

Co-authored-by: hpnightowl <[email protected]>
Co-authored-by: Akash Srivastava <[email protected]>
Co-authored-by: maxwen <[email protected]>
  • Loading branch information
4 people authored and raiyanbinmohsin committed Jun 9, 2021
1 parent 46c8f3e commit 82ca685
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 131 deletions.
6 changes: 6 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -5034,6 +5034,12 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
public static final String[] LEGACY_RESTORE_SETTINGS = {
};

/**
* Whether to enable screenshot sound
* @hide
*/
public static final String SCREENSHOT_SOUND = "screenshot_sound";

/**
* These are all public system settings
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ public class SystemSettings {
Settings.System.VOLUME_ROCKER_WAKE,
Settings.System.VOLUME_BUTTON_MUSIC_CONTROL,
Settings.System.LOCKSCREEN_MEDIA_ART,
Settings.System.SCREENSHOT_SOUND,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,6 @@ public boolean validate(@Nullable String value) {
VALIDATORS.put(System.KEY_APP_SWITCH_ACTION, new InclusiveIntegerRangeValidator(0, 9));
VALIDATORS.put(System.KEY_APP_SWITCH_LONG_PRESS_ACTION, new InclusiveIntegerRangeValidator(0, 9));
VALIDATORS.put(System.LOCKSCREEN_MEDIA_ART, BOOLEAN_VALIDATOR);
VALIDATORS.put(System.SCREENSHOT_SOUND, BOOLEAN_VALIDATOR);
}
}
10 changes: 0 additions & 10 deletions packages/SystemUI/res/layout/media_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,6 @@
android:paddingBottom="30dp"
android:splitTrack="false" />

<!-- App name -->
<TextView
android:id="@+id/app_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:fontFamily="@*android:string/config_headlineFontFamily"
android:textDirection="locale"
android:textSize="14sp" />

<!-- Song name -->
<TextView
android:id="@+id/header_title"
Expand Down
2 changes: 1 addition & 1 deletion packages/SystemUI/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@
<dimen name="qs_media_width">350dp</dimen>
<dimen name="qs_media_padding">16dp</dimen>
<dimen name="qs_media_panel_outer_padding">16dp</dimen>
<dimen name="qs_media_album_size">52dp</dimen>
<dimen name="qs_media_album_size">120dp</dimen>
<dimen name="qs_media_icon_size">16dp</dimen>
<dimen name="qs_center_guideline_padding">10dp</dimen>
<dimen name="qs_seamless_icon_size">@dimen/qs_media_icon_size</dimen>
Expand Down
21 changes: 21 additions & 0 deletions packages/SystemUI/res/values/revengeos_dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2020 RevengeOS
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="quick_settings_top_margin_media">4dp</dimen>

<dimen name="quick_settings_top_margin_media_extra">10dp</dimen>

<dimen name="qs_media_action_button_size">48dp</dimen>

</resources>
119 changes: 58 additions & 61 deletions packages/SystemUI/res/xml/media_collapsed.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 The Android Open Source Project
~ Copyright (C) 2021 Project 404
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -17,42 +17,46 @@
<ConstraintSet
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<Constraint
android:id="@+id/icon"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
android:layout_marginStart="18dp"
app:layout_constraintTop_toTopOf="@id/app_name"
app:layout_constraintBottom_toBottomOf="@id/app_name"
android:id="@+id/album_art"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="@dimen/qs_media_panel_outer_padding"
android:layout_marginBottom="@dimen/qs_media_panel_outer_padding"
android:layout_marginStart="@dimen/qs_media_panel_outer_padding"
app:layout_constraintEnd_toStartOf="@id/media_action_barrier"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<Constraint
android:id="@+id/app_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/qs_center_guideline_padding"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:id="@+id/icon"
android:layout_width="@dimen/qs_media_icon_size"
android:layout_height="@dimen/qs_media_icon_size"
android:layout_marginTop="@dimen/qs_media_panel_outer_padding"
android:layout_marginStart="18dp"
app:layout_constraintStart_toEndOf="@id/album_art"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/icon"
app:layout_constraintEnd_toStartOf="@id/center_vertical_guideline"
app:layout_constraintHorizontal_bias="0"
/>

<Constraint
android:id="@+id/media_seamless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_gravity="center_vertical"
android:layout_marginTop="6dp"
android:layout_marginStart="@dimen/qs_center_guideline_padding"
android:layout_marginEnd="@dimen/qs_center_guideline_padding"
app:layout_constrainedWidth="true"
app:layout_constraintWidth_min="60dp"
app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_min="16dp"
app:layout_constraintHorizontal_bias="1"
android:layout_marginTop="@dimen/qs_media_panel_outer_padding"
android:layout_marginEnd="@dimen/qs_media_panel_outer_padding"
android:layout_marginStart="@dimen/qs_center_guideline_padding"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toEndOf="@id/icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_min="16dp"
/>

<Constraint
Expand All @@ -61,39 +65,27 @@
android:layout_height="@dimen/qs_seamless_fallback_icon_size"
android:layout_marginEnd="@dimen/qs_seamless_fallback_end_margin"
android:layout_marginStart="@dimen/qs_center_guideline_padding"
app:layout_constraintBottom_toBottomOf="@id/icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
android:alpha="0.5"
android:visibility="gone"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/app_name"
app:layout_constraintBottom_toBottomOf="@id/app_name"
app:layout_constraintTop_toTopOf="@id/icon"
app:layout_constraintStart_toEndOf="@id/center_vertical_guideline"
/>

<Constraint
android:id="@+id/album_art"
android:layout_width="@dimen/qs_media_album_size"
android:layout_height="@dimen/qs_media_album_size"
android:layout_marginTop="16dp"
android:layout_marginStart="@dimen/qs_media_panel_outer_padding"
android:layout_marginBottom="24dp"
app:layout_constraintTop_toBottomOf="@id/icon"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>

<!-- Song name -->
<Constraint
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:layout_marginStart="16dp"
android:layout_marginTop="@dimen/qqs_media_spacing"
android:layout_marginStart="@dimen/qqs_media_spacing"
app:layout_constrainedWidth="true"
app:layout_constraintTop_toBottomOf="@id/app_name"
app:layout_constraintTop_toBottomOf="@id/icon"
app:layout_constraintBottom_toTopOf="@id/header_artist"
app:layout_constraintStart_toEndOf="@id/album_art"
app:layout_constraintEnd_toStartOf="@id/media_action_barrier"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"/>

<!-- Artist name -->
Expand All @@ -102,13 +94,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginBottom="24dp"
android:layout_marginBottom="@dimen/qqs_media_spacing"
android:layout_marginEnd="@dimen/qs_media_panel_outer_padding"
app:layout_constrainedWidth="true"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_title"
app:layout_constraintStart_toStartOf="@id/header_title"
app:layout_constraintEnd_toStartOf="@id/media_action_barrier"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0"/>
/>

<!-- Seek Bar -->
<Constraint
Expand Down Expand Up @@ -140,15 +133,15 @@
android:id="@+id/action0"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="4dp"
android:layout_marginStart="@dimen/qqs_media_spacing"
android:layout_marginBottom="@dimen/qs_media_panel_outer_padding"
android:layout_marginEnd="4dp"
android:layout_marginTop="18dp"
android:visibility="gone"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@id/app_name"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/action1"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintTop_toBottomOf="@id/header_artist"
>
</Constraint>

Expand All @@ -158,10 +151,11 @@
android:layout_height="48dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginTop="18dp"
app:layout_constraintTop_toBottomOf="@id/app_name"
android:layout_marginBottom="@dimen/qs_media_panel_outer_padding"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/action0"
app:layout_constraintRight_toLeftOf="@id/action2"
app:layout_constraintTop_toBottomOf="@id/header_artist"
>
</Constraint>

Expand All @@ -171,21 +165,23 @@
android:layout_height="48dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginTop="18dp"
app:layout_constraintTop_toBottomOf="@id/app_name"
android:layout_marginBottom="@dimen/qs_media_panel_outer_padding"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/action1"
app:layout_constraintRight_toLeftOf="@id/action3"
app:layout_constraintTop_toBottomOf="@id/header_artist"
>
</Constraint>

<Constraint
android:id="@+id/action3"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="@dimen/qs_media_panel_outer_padding"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginTop="18dp"
app:layout_constraintTop_toBottomOf="@id/app_name"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/header_artist"
app:layout_constraintLeft_toRightOf="@id/action2"
app:layout_constraintRight_toLeftOf="@id/action4"
>
Expand All @@ -195,13 +191,14 @@
android:id="@+id/action4"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:visibility="gone"
android:layout_marginTop="18dp"
android:layout_marginBottom="@dimen/qs_media_panel_outer_padding"
android:layout_marginEnd="@dimen/qs_media_panel_outer_padding"
android:layout_marginStart="4dp"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@id/app_name"
app:layout_constraintTop_toBottomOf="@id/header_artist"
app:layout_constraintLeft_toRightOf="@id/action3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0"
>
Expand Down
Loading

0 comments on commit 82ca685

Please sign in to comment.