Skip to content

Commit

Permalink
SystemUI: Make tri-state SystemUI dialog dimensions conditional
Browse files Browse the repository at this point in the history
Adjust this based on the left/right config.

@SKULSHADY: Fix dimens for right dialog

Change-Id: I282f1a318bc9bf1cfd20c6b8c41be5f79fab4534
Signed-off-by: Anushek Prasal <anushekprasal@gmail.com>
  • Loading branch information
ZVNexus authored and SKULSHADY committed Jul 19, 2023
1 parent 5ab081b commit 619170f
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 21 deletions.
30 changes: 30 additions & 0 deletions packages/SystemUI/res/drawable/left_dialog_tri_state_down_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS
Copyright (C) 2020 Paranoid Android
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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/left_tri_state_down_top_left_radius"
android:topRightRadius="@dimen/left_tri_state_down_top_right_radius"
android:bottomLeftRadius="@dimen/left_tri_state_down_bottom_left_radius"
android:bottomRightRadius="@dimen/left_tri_state_down_bottom_right_radius" />
</shape>
</item>
</layer-list>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS
Copyright (C) 2020 Paranoid Android
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,10 +21,10 @@
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/tri_state_down_top_left_radius"
android:topRightRadius="@dimen/tri_state_down_top_right_radius"
android:bottomLeftRadius="@dimen/tri_state_down_bottom_left_radius"
android:bottomRightRadius="@dimen/tri_state_down_bottom_right_radius" />
android:topLeftRadius="@dimen/left_tri_state_up_top_left_radius"
android:topRightRadius="@dimen/left_tri_state_up_top_right_radius"
android:bottomLeftRadius="@dimen/left_tri_state_up_bottom_left_radius"
android:bottomRightRadius="@dimen/left_tri_state_up_bottom_right_radius" />
</shape>
</item>
</layer-list>
</layer-list>
30 changes: 30 additions & 0 deletions packages/SystemUI/res/drawable/right_dialog_tri_state_down_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS
Copyright (C) 2020 Paranoid Android
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.
-->
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/right_tri_state_down_top_left_radius"
android:topRightRadius="@dimen/right_tri_state_down_top_right_radius"
android:bottomLeftRadius="@dimen/right_tri_state_down_bottom_left_radius"
android:bottomRightRadius="@dimen/right_tri_state_down_bottom_right_radius" />
</shape>
</item>
</layer-list>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 CypherOS
Copyright (C) 2020 Paranoid Android
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,10 +21,10 @@
<shape>
<solid android:color="#ff1d1d1d" />
<corners
android:topLeftRadius="@dimen/tri_state_up_top_left_radius"
android:topRightRadius="@dimen/tri_state_up_top_right_radius"
android:bottomLeftRadius="@dimen/tri_state_up_bottom_left_radius"
android:bottomRightRadius="@dimen/tri_state_up_bottom_right_radius" />
android:topLeftRadius="@dimen/right_tri_state_up_top_left_radius"
android:topRightRadius="@dimen/right_tri_state_up_top_right_radius"
android:bottomLeftRadius="@dimen/right_tri_state_up_bottom_left_radius"
android:bottomRightRadius="@dimen/right_tri_state_up_bottom_right_radius" />
</shape>
</item>
</layer-list>
</layer-list>
25 changes: 17 additions & 8 deletions packages/SystemUI/res/values/havoc_dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,26 @@
<dimen name="tri_state_dialog_elevation">4.0dip</dimen>
<dimen name="tri_state_dialog_icon_size">24.0dip</dimen>
<dimen name="tri_state_dialog_padding">8.0dip</dimen>
<dimen name="tri_state_down_bottom_left_radius">24.0dip</dimen>
<dimen name="tri_state_down_bottom_right_radius">24.0dip</dimen>
<dimen name="tri_state_down_top_left_radius">24.0dip</dimen>
<dimen name="tri_state_down_top_right_radius">0.0dip</dimen>
<dimen name="tri_state_mid_bottom_left_radius">24.0dip</dimen>
<dimen name="tri_state_mid_bottom_right_radius">24.0dip</dimen>
<dimen name="tri_state_mid_top_left_radius">24.0dip</dimen>
<dimen name="tri_state_mid_top_right_radius">24.0dip</dimen>
<dimen name="tri_state_up_bottom_left_radius">24.0dip</dimen>
<dimen name="tri_state_up_bottom_right_radius">0.0dip</dimen>
<dimen name="tri_state_up_top_left_radius">24.0dip</dimen>
<dimen name="tri_state_up_top_right_radius">24.0dip</dimen>

<dimen name="left_tri_state_down_bottom_left_radius">24.0dip</dimen>
<dimen name="left_tri_state_down_bottom_right_radius">24.0dip</dimen>
<dimen name="left_tri_state_down_top_left_radius">0.0dip</dimen>
<dimen name="left_tri_state_down_top_right_radius">24.0dip</dimen>
<dimen name="left_tri_state_up_bottom_left_radius">0.0dip</dimen>
<dimen name="left_tri_state_up_bottom_right_radius">24.0dip</dimen>
<dimen name="left_tri_state_up_top_left_radius">24.0dip</dimen>
<dimen name="left_tri_state_up_top_right_radius">24.0dip</dimen>
<dimen name="right_tri_state_down_bottom_left_radius">24.0dip</dimen>
<dimen name="right_tri_state_down_bottom_right_radius">24.0dip</dimen>
<dimen name="right_tri_state_down_top_left_radius">24.0dip</dimen>
<dimen name="right_tri_state_down_top_right_radius">0.0dip</dimen>
<dimen name="right_tri_state_up_bottom_left_radius">24.0dip</dimen>
<dimen name="right_tri_state_up_bottom_right_radius">0.0dip</dimen>
<dimen name="right_tri_state_up_top_left_radius">24.0dip</dimen>
<dimen name="right_tri_state_up_top_right_radius">24.0dip</dimen>

</resources>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2019 CypherOS
* Copyright 2014-2019 Paranoid Android
* Copyright (C) 2014-2020 Paranoid Android
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -356,7 +356,7 @@ private void updateTriStateLayout() {
if (mTriStateMode != MODE_VIBRATE) {
if (mTriStateMode == MODE_NORMAL) {
positionY2 = res.getDimensionPixelSize(R.dimen.tri_state_down_dialog_position) + res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
bg = R.drawable.dialog_tri_state_down_bg;
bg = isTsKeyRight ? R.drawable.right_dialog_tri_state_down_bg : R.drawable.left_dialog_tri_state_down_bg;
break;
}
}
Expand All @@ -365,7 +365,7 @@ private void updateTriStateLayout() {
break;
}
positionY2 = res.getDimensionPixelSize(R.dimen.tri_state_up_dialog_position) + res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
bg = R.drawable.dialog_tri_state_up_bg;
bg = isTsKeyRight ? R.drawable.right_dialog_tri_state_up_bg : R.drawable.left_dialog_tri_state_up_bg;
break;
}
if (mTriStateMode != -1) {
Expand Down

0 comments on commit 619170f

Please sign in to comment.