Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fb8fb0b authored by Matthew DeVore's avatar Matthew DeVore
Browse files

Show border highlight when dragging display

In the process of adding highlight we use an extra feature of
LayerDrawable to add insets so that we can add padding without changing
the actual dimensions or position of the DisplayBlock Views.

To make it easier to keep the values consistent and to aid in conversion
between px and dp, use dimen values to store padding and highlight
metrics.

Bug: b/352650922
Flag: com.android.settings.flags.display_topology_pane_in_display_list
Test: atest DisplayTopologyPreferenceTest.kt
Change-Id: I51ff2ce4a086e84a0c529346f8ede90430090b11
parent dac774ed
Loading
Loading
Loading
Loading
+39 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2025 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.
  ~
  -->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Inner border -->
    <item>
        <shape android:shape="rectangle">
            <stroke
                android:color="@color/display_topology_background_color"
                android:width="@dimen/display_block_padding" />
            <corners android:radius="@dimen/display_block_corner_radius" />
        </shape>
    </item>

    <!-- Outer border -->
    <item>
        <shape android:shape="rectangle">
            <stroke
                android:color="@color/system_secondary"
                android:width="@dimen/display_block_highlight_width" />
            <corners android:radius="@dimen/display_block_corner_radius" />
        </shape>
    </item>
</layer-list>
+23 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2025 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.
  ~
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <stroke
        android:color="@color/display_topology_background_color"
        android:width="@dimen/display_block_padding" />
    <corners android:radius="@dimen/display_block_corner_radius" />
</shape>
+1 −0
Original line number Original line Diff line number Diff line
@@ -82,5 +82,6 @@


    <!-- Connected displays -->
    <!-- Connected displays -->
    <color name="display_topology_background_color">@color/settingslib_color_charcoal</color>
    <color name="display_topology_background_color">@color/settingslib_color_charcoal</color>
    <color name="system_secondary">@android:color/system_secondary_dark</color>
</resources>
</resources>
+1 −0
Original line number Original line Diff line number Diff line
@@ -224,4 +224,5 @@


    <!-- Connected displays -->
    <!-- Connected displays -->
    <color name="display_topology_background_color">@color/settingslib_color_grey100</color>
    <color name="display_topology_background_color">@color/settingslib_color_grey100</color>
    <color name="system_secondary">@android:color/system_secondary_light</color>
</resources>
</resources>
+3 −0
Original line number Original line Diff line number Diff line
@@ -550,4 +550,7 @@


    <!-- Connected displays -->
    <!-- Connected displays -->
    <dimen name="display_topology_pane_margin">24dp</dimen>
    <dimen name="display_topology_pane_margin">24dp</dimen>
    <dimen name="display_block_padding">5dp</dimen>
    <dimen name="display_block_highlight_width">2dp</dimen>
    <dimen name="display_block_corner_radius">10dp</dimen>
</resources>
</resources>
Loading