Merge "Update the margins and colors of MainSwitchBar to fit the spec." into sc-dev am: bd5c79d216

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14515951

Change-Id: I5499775f2d81288c38c5ddb036de3e53b8d30eea
This commit is contained in:
Stanley Wang
2021-05-17 13:05:40 +00:00
committed by Automerger Merge Worker
6 changed files with 23 additions and 14 deletions

View File

@@ -26,7 +26,7 @@
android:height="@dimen/settingslib_switch_thumb_size" android:height="@dimen/settingslib_switch_thumb_size"
android:width="@dimen/settingslib_switch_thumb_size"/> android:width="@dimen/settingslib_switch_thumb_size"/>
<solid <solid
android:color="@color/settingslib_state_off_color" android:color="@color/settingslib_thumb_off_color"
android:alpha="?android:attr/disabledAlpha"/> android:alpha="?android:attr/disabledAlpha"/>
</shape> </shape>
</item> </item>

View File

@@ -25,7 +25,7 @@
<size <size
android:height="@dimen/settingslib_switch_thumb_size" android:height="@dimen/settingslib_switch_thumb_size"
android:width="@dimen/settingslib_switch_thumb_size"/> android:width="@dimen/settingslib_switch_thumb_size"/>
<solid android:color="@color/settingslib_state_off_color"/> <solid android:color="@color/settingslib_thumb_off_color"/>
</shape> </shape>
</item> </item>
</layer-list> </layer-list>

View File

@@ -19,10 +19,6 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:background="?android:attr/colorBackground" android:background="?android:attr/colorBackground"
android:orientation="vertical"> android:orientation="vertical">
@@ -31,15 +27,16 @@
android:minHeight="@dimen/settingslib_min_switch_bar_height" android:minHeight="@dimen/settingslib_min_switch_bar_height"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:paddingLeft="@dimen/settingslib_switchbar_margin_start" android:layout_margin="@dimen/settingslib_switchbar_margin"
android:paddingRight="@dimen/settingslib_switchbar_margin_end"> android:paddingStart="@dimen/settingslib_switchbar_padding_left"
android:paddingEnd="@dimen/settingslib_switchbar_padding_right">
<TextView <TextView
android:id="@+id/switch_text" android:id="@+id/switch_text"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginRight="16dp" android:layout_marginEnd="16dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:maxLines="2" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"

View File

@@ -15,10 +15,16 @@
limitations under the License. limitations under the License.
--> -->
<resources xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"> <resources>
<color name="settingslib_switchbar_switch_track_tint">#82000000</color> <color name="settingslib_switchbar_switch_track_tint">#82000000</color>
<color name="settingslib_switchbar_switch_thumb_tint">@android:color/black</color> <color name="settingslib_switchbar_switch_thumb_tint">@android:color/black</color>
<!-- Material next thumb off color-->
<color name="settingslib_thumb_off_color">@android:color/system_neutral2_300</color>
<!-- Material next track on color--> <!-- Material next track on color-->
<color name="settingslib_track_on_color">?androidprv:attr/colorSurfaceHighlight</color> <color name="settingslib_track_on_color">@android:color/system_accent2_700</color>
<!-- Material next track off color-->
<color name="settingslib_track_off_color">@android:color/system_neutral1_700</color>
</resources> </resources>

View File

@@ -26,9 +26,12 @@
<!-- Material next state off color--> <!-- Material next state off color-->
<color name="settingslib_state_off_color">?androidprv:attr/colorAccentSecondary</color> <color name="settingslib_state_off_color">?androidprv:attr/colorAccentSecondary</color>
<!-- Material next thumb off color-->
<color name="settingslib_thumb_off_color">@android:color/system_neutral2_100</color>
<!-- Material next track on color--> <!-- Material next track on color-->
<color name="settingslib_track_on_color">?androidprv:attr/colorAccentPrimaryVariant</color> <color name="settingslib_track_on_color">?androidprv:attr/colorAccentPrimaryVariant</color>
<!-- Material next track off color--> <!-- Material next track off color-->
<color name="settingslib_track_off_color">?androidprv:attr/colorAccentSecondaryVariant</color> <color name="settingslib_track_off_color">@android:color/system_neutral2_600</color>
</resources> </resources>

View File

@@ -17,11 +17,14 @@
<resources> <resources>
<!-- Size of layout margin -->
<dimen name="settingslib_switchbar_margin">16dp</dimen>
<!-- Size of layout margin left --> <!-- Size of layout margin left -->
<dimen name="settingslib_switchbar_margin_start">24dp</dimen> <dimen name="settingslib_switchbar_padding_left">24dp</dimen>
<!-- Size of layout margin right --> <!-- Size of layout margin right -->
<dimen name="settingslib_switchbar_margin_end">16dp</dimen> <dimen name="settingslib_switchbar_padding_right">16dp</dimen>
<!-- Minimum width of switch --> <!-- Minimum width of switch -->
<dimen name="settingslib_min_switch_width">52dp</dimen> <dimen name="settingslib_min_switch_width">52dp</dimen>