Skip to content

Commit 619170f

Browse files
AKoskovichSKULSHADY
authored andcommitted
SystemUI: Make tri-state SystemUI dialog dimensions conditional
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>
1 parent 5ab081b commit 619170f

6 files changed

Lines changed: 92 additions & 21 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2019 CypherOS
4+
Copyright (C) 2020 Paranoid Android
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<layer-list
19+
xmlns:android="http://schemas.android.com/apk/res/android">
20+
<item>
21+
<shape>
22+
<solid android:color="#ff1d1d1d" />
23+
<corners
24+
android:topLeftRadius="@dimen/left_tri_state_down_top_left_radius"
25+
android:topRightRadius="@dimen/left_tri_state_down_top_right_radius"
26+
android:bottomLeftRadius="@dimen/left_tri_state_down_bottom_left_radius"
27+
android:bottomRightRadius="@dimen/left_tri_state_down_bottom_right_radius" />
28+
</shape>
29+
</item>
30+
</layer-list>

packages/SystemUI/res/drawable/dialog_tri_state_down_bg.xml renamed to packages/SystemUI/res/drawable/left_dialog_tri_state_up_bg.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
33
Copyright (C) 2019 CypherOS
4+
Copyright (C) 2020 Paranoid Android
45
56
Licensed under the Apache License, Version 2.0 (the "License");
67
you may not use this file except in compliance with the License.
@@ -20,10 +21,10 @@
2021
<shape>
2122
<solid android:color="#ff1d1d1d" />
2223
<corners
23-
android:topLeftRadius="@dimen/tri_state_down_top_left_radius"
24-
android:topRightRadius="@dimen/tri_state_down_top_right_radius"
25-
android:bottomLeftRadius="@dimen/tri_state_down_bottom_left_radius"
26-
android:bottomRightRadius="@dimen/tri_state_down_bottom_right_radius" />
24+
android:topLeftRadius="@dimen/left_tri_state_up_top_left_radius"
25+
android:topRightRadius="@dimen/left_tri_state_up_top_right_radius"
26+
android:bottomLeftRadius="@dimen/left_tri_state_up_bottom_left_radius"
27+
android:bottomRightRadius="@dimen/left_tri_state_up_bottom_right_radius" />
2728
</shape>
2829
</item>
29-
</layer-list>
30+
</layer-list>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2019 CypherOS
4+
Copyright (C) 2020 Paranoid Android
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<layer-list
19+
xmlns:android="http://schemas.android.com/apk/res/android">
20+
<item>
21+
<shape>
22+
<solid android:color="#ff1d1d1d" />
23+
<corners
24+
android:topLeftRadius="@dimen/right_tri_state_down_top_left_radius"
25+
android:topRightRadius="@dimen/right_tri_state_down_top_right_radius"
26+
android:bottomLeftRadius="@dimen/right_tri_state_down_bottom_left_radius"
27+
android:bottomRightRadius="@dimen/right_tri_state_down_bottom_right_radius" />
28+
</shape>
29+
</item>
30+
</layer-list>

packages/SystemUI/res/drawable/dialog_tri_state_up_bg.xml renamed to packages/SystemUI/res/drawable/right_dialog_tri_state_up_bg.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!--
33
Copyright (C) 2019 CypherOS
4+
Copyright (C) 2020 Paranoid Android
45
56
Licensed under the Apache License, Version 2.0 (the "License");
67
you may not use this file except in compliance with the License.
@@ -20,10 +21,10 @@
2021
<shape>
2122
<solid android:color="#ff1d1d1d" />
2223
<corners
23-
android:topLeftRadius="@dimen/tri_state_up_top_left_radius"
24-
android:topRightRadius="@dimen/tri_state_up_top_right_radius"
25-
android:bottomLeftRadius="@dimen/tri_state_up_bottom_left_radius"
26-
android:bottomRightRadius="@dimen/tri_state_up_bottom_right_radius" />
24+
android:topLeftRadius="@dimen/right_tri_state_up_top_left_radius"
25+
android:topRightRadius="@dimen/right_tri_state_up_top_right_radius"
26+
android:bottomLeftRadius="@dimen/right_tri_state_up_bottom_left_radius"
27+
android:bottomRightRadius="@dimen/right_tri_state_up_bottom_right_radius" />
2728
</shape>
2829
</item>
29-
</layer-list>
30+
</layer-list>

packages/SystemUI/res/values/havoc_dimens.xml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,26 @@
4141
<dimen name="tri_state_dialog_elevation">4.0dip</dimen>
4242
<dimen name="tri_state_dialog_icon_size">24.0dip</dimen>
4343
<dimen name="tri_state_dialog_padding">8.0dip</dimen>
44-
<dimen name="tri_state_down_bottom_left_radius">24.0dip</dimen>
45-
<dimen name="tri_state_down_bottom_right_radius">24.0dip</dimen>
46-
<dimen name="tri_state_down_top_left_radius">24.0dip</dimen>
47-
<dimen name="tri_state_down_top_right_radius">0.0dip</dimen>
4844
<dimen name="tri_state_mid_bottom_left_radius">24.0dip</dimen>
4945
<dimen name="tri_state_mid_bottom_right_radius">24.0dip</dimen>
5046
<dimen name="tri_state_mid_top_left_radius">24.0dip</dimen>
5147
<dimen name="tri_state_mid_top_right_radius">24.0dip</dimen>
52-
<dimen name="tri_state_up_bottom_left_radius">24.0dip</dimen>
53-
<dimen name="tri_state_up_bottom_right_radius">0.0dip</dimen>
54-
<dimen name="tri_state_up_top_left_radius">24.0dip</dimen>
55-
<dimen name="tri_state_up_top_right_radius">24.0dip</dimen>
48+
49+
<dimen name="left_tri_state_down_bottom_left_radius">24.0dip</dimen>
50+
<dimen name="left_tri_state_down_bottom_right_radius">24.0dip</dimen>
51+
<dimen name="left_tri_state_down_top_left_radius">0.0dip</dimen>
52+
<dimen name="left_tri_state_down_top_right_radius">24.0dip</dimen>
53+
<dimen name="left_tri_state_up_bottom_left_radius">0.0dip</dimen>
54+
<dimen name="left_tri_state_up_bottom_right_radius">24.0dip</dimen>
55+
<dimen name="left_tri_state_up_top_left_radius">24.0dip</dimen>
56+
<dimen name="left_tri_state_up_top_right_radius">24.0dip</dimen>
57+
<dimen name="right_tri_state_down_bottom_left_radius">24.0dip</dimen>
58+
<dimen name="right_tri_state_down_bottom_right_radius">24.0dip</dimen>
59+
<dimen name="right_tri_state_down_top_left_radius">24.0dip</dimen>
60+
<dimen name="right_tri_state_down_top_right_radius">0.0dip</dimen>
61+
<dimen name="right_tri_state_up_bottom_left_radius">24.0dip</dimen>
62+
<dimen name="right_tri_state_up_bottom_right_radius">0.0dip</dimen>
63+
<dimen name="right_tri_state_up_top_left_radius">24.0dip</dimen>
64+
<dimen name="right_tri_state_up_top_right_radius">24.0dip</dimen>
5665

5766
</resources>

packages/SystemUI/src/com/android/systemui/tristate/TriStateUiControllerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2019 CypherOS
3-
* Copyright 2014-2019 Paranoid Android
3+
* Copyright (C) 2014-2020 Paranoid Android
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -356,7 +356,7 @@ private void updateTriStateLayout() {
356356
if (mTriStateMode != MODE_VIBRATE) {
357357
if (mTriStateMode == MODE_NORMAL) {
358358
positionY2 = res.getDimensionPixelSize(R.dimen.tri_state_down_dialog_position) + res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
359-
bg = R.drawable.dialog_tri_state_down_bg;
359+
bg = isTsKeyRight ? R.drawable.right_dialog_tri_state_down_bg : R.drawable.left_dialog_tri_state_down_bg;
360360
break;
361361
}
362362
}
@@ -365,7 +365,7 @@ private void updateTriStateLayout() {
365365
break;
366366
}
367367
positionY2 = res.getDimensionPixelSize(R.dimen.tri_state_up_dialog_position) + res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
368-
bg = R.drawable.dialog_tri_state_up_bg;
368+
bg = isTsKeyRight ? R.drawable.right_dialog_tri_state_up_bg : R.drawable.left_dialog_tri_state_up_bg;
369369
break;
370370
}
371371
if (mTriStateMode != -1) {

0 commit comments

Comments
 (0)