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

Commit a0623f5a authored by Edgar Wang's avatar Edgar Wang
Browse files

Using material color in SettingsLib

- Starting from Android V, we use material color directly to have
  better connumication cross different teams.
- Also marked a bunch of colors as deprecated, we should not use
  them  after Android V.

Bug: 299907492
Test: visual
Change-Id: I5400abbaab004d4b7fe27a8bafeca3a257cdf937
parent 997fb0e8
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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.
-->
<resources>
    <style name="Theme.CollapsingToolbar.Settings" parent="@style/Theme.MaterialComponents.DayNight">
        <item name="elevationOverlayEnabled">true</item>
        <item name="elevationOverlayColor">?attr/colorPrimary</item>
        <item name="colorPrimary">@color/settingslib_materialColorOnSurfaceInverse</item>
        <item name="colorAccent">@color/settingslib_materialColorPrimaryFixed</item>
    </style>
</resources>
 No newline at end of file
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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.
-->
<resources>
    <style name="CollapsingToolbarTitle.Collapsed" parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title">
        <item name="android:fontFamily">@string/settingslib_config_headlineFontFamily</item>
        <item name="android:textSize">20dp</item>
        <item name="android:textColor">@color/settingslib_materialColorOnSurface</item>
    </style>

    <style name="CollapsingToolbarTitle.Expanded" parent="CollapsingToolbarTitle.Collapsed">
        <item name="android:textSize">36dp</item>
        <item name="android:textColor">@color/settingslib_materialColorOnSurface</item>
    </style>
</resources>
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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.
-->
<resources>
    <style name="Theme.CollapsingToolbar.Settings" parent="@style/Theme.MaterialComponents.DayNight">
        <item name="elevationOverlayEnabled">true</item>
        <item name="elevationOverlayColor">?attr/colorPrimary</item>
        <item name="colorPrimary">@color/settingslib_materialColorOnSurfaceInverse</item>
        <item name="colorAccent">@color/settingslib_materialColorPrimary</item>
    </style>
</resources>
 No newline at end of file
+0 −74
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2024 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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:background="?android:attr/selectableItemBackground"
    android:orientation="vertical"
    android:clipToPadding="false">

    <LinearLayout
        android:id="@+id/icon_frame"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="56dp"
        android:gravity="start|top"
        android:orientation="horizontal"
        android:paddingEnd="12dp"
        android:paddingTop="16dp"
        android:paddingBottom="4dp">
        <ImageView
            android:id="@android:id/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:textAlignment="viewStart"
            android:paddingTop="16dp"
            android:paddingBottom="8dp"
            android:textColor="@color/settingslib_materialColorOnSurfaceVariant"
            android:hyphenationFrequency="normalFast"
            android:lineBreakWordStyle="phrase"
            android:ellipsize="marquee" />

        <com.android.settingslib.widget.LinkTextView
            android:id="@+id/settingslib_learn_more"
            android:text="@string/settingslib_learn_more_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:textAlignment="viewStart"
            android:paddingBottom="8dp"
            android:clickable="true"
            android:visibility="gone" />
    </LinearLayout>

</LinearLayout>
 No newline at end of file
+7 −10
Original line number Diff line number Diff line
@@ -15,12 +15,9 @@
  limitations under the License.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="@color/settingslib_materialColorOnSurfaceVariant"
        android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false"
          android:color="@color/settingslib_materialColorOnPrimaryContainer"
          android:alpha="?android:attr/disabledAlpha" />
    <item android:color="@color/settingslib_materialColorOnPrimaryContainer"/>
</selector>
 No newline at end of file
Loading