diff options
author | Setup Wizard Team <android-setup-team-eng@google.com> | 2021-06-08 19:33:02 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-06-08 19:33:02 +0000 |
commit | 436c3d09a9a2bb26ed6f86fcacfdb950b6df102b (patch) | |
tree | 500ec3a19a29c72fa8244bce4a50653e20ebb45b | |
parent | 64c4248ca54ad04194577de7322b3c460d2ce56c (diff) | |
parent | e944b25bd50e207607968dfe1a7952210b3a4791 (diff) | |
download | setupdesign-436c3d09a9a2bb26ed6f86fcacfdb950b6df102b.tar.gz |
Import updated Android Setupdesign Library 377243486 am: a8dcfe7e54 am: e944b25bd5
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/setupdesign/+/14809434
Change-Id: I44e69953d91ccb252b9636f02b388ca4c756013b
-rw-r--r-- | main/res/color/sud_switch_track_on.xml | 26 | ||||
-rw-r--r-- | main/res/drawable-v21/sud_switch_thumb_on.xml | 31 | ||||
-rw-r--r-- | main/res/drawable/sud_switch_thumb_off.xml | 31 | ||||
-rw-r--r-- | main/res/drawable/sud_switch_thumb_on.xml | 32 | ||||
-rw-r--r-- | main/res/drawable/sud_switch_thumb_selector.xml | 21 | ||||
-rw-r--r-- | main/res/drawable/sud_switch_track_off_background.xml | 24 | ||||
-rw-r--r-- | main/res/drawable/sud_switch_track_on_background.xml | 24 | ||||
-rw-r--r-- | main/res/drawable/sud_switch_track_selector.xml | 21 | ||||
-rw-r--r-- | main/res/values/styles.xml | 8 |
9 files changed, 218 insertions, 0 deletions
diff --git a/main/res/color/sud_switch_track_on.xml b/main/res/color/sud_switch_track_on.xml new file mode 100644 index 0000000..a95a1ee --- /dev/null +++ b/main/res/color/sud_switch_track_on.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2021 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools"> + <item android:state_enabled="false" + android:color="?android:attr/colorForeground" + android:alpha="?android:attr/disabledAlpha" /> + <item android:state_checked="true" + android:color="?android:attr/colorControlActivated" tools:ignore="NewApi" + android:alpha="?android:attr/disabledAlpha" /> + <item android:color="?android:attr/colorForeground" /> +</selector> diff --git a/main/res/drawable-v21/sud_switch_thumb_on.xml b/main/res/drawable-v21/sud_switch_thumb_on.xml new file mode 100644 index 0000000..224f181 --- /dev/null +++ b/main/res/drawable-v21/sud_switch_thumb_on.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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"> + <item + android:top="@dimen/sud_switch_thumb_margin" + android:left="@dimen/sud_switch_thumb_margin" + android:right="@dimen/sud_switch_thumb_margin" + android:bottom="@dimen/sud_switch_thumb_margin"> + <shape android:shape="oval"> + <size + android:height="@dimen/sud_switch_thumb_size" + android:width="@dimen/sud_switch_thumb_size" /> + <solid android:color="?android:attr/colorControlActivated" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/main/res/drawable/sud_switch_thumb_off.xml b/main/res/drawable/sud_switch_thumb_off.xml new file mode 100644 index 0000000..6b4f115 --- /dev/null +++ b/main/res/drawable/sud_switch_thumb_off.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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"> + <item + android:top="@dimen/sud_switch_thumb_margin" + android:left="@dimen/sud_switch_thumb_margin" + android:right="@dimen/sud_switch_thumb_margin" + android:bottom="@dimen/sud_switch_thumb_margin"> + <shape android:shape="oval"> + <size + android:height="@dimen/sud_switch_thumb_size" + android:width="@dimen/sud_switch_thumb_size" /> + <solid android:color="@color/sud_switch_thumb_off" /> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/main/res/drawable/sud_switch_thumb_on.xml b/main/res/drawable/sud_switch_thumb_on.xml new file mode 100644 index 0000000..cc1cf06 --- /dev/null +++ b/main/res/drawable/sud_switch_thumb_on.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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" + xmlns:tools="http://schemas.android.com/tools"> + <item + android:top="@dimen/sud_switch_thumb_margin" + android:left="@dimen/sud_switch_thumb_margin" + android:right="@dimen/sud_switch_thumb_margin" + android:bottom="@dimen/sud_switch_thumb_margin"> + <shape android:shape="oval"> + <size + android:height="@dimen/sud_switch_thumb_size" + android:width="@dimen/sud_switch_thumb_size" /> + <solid android:color="?android:attr/colorAccent" tools:ignore="NewApi" /> + </shape> + </item> +</layer-list> diff --git a/main/res/drawable/sud_switch_thumb_selector.xml b/main/res/drawable/sud_switch_thumb_selector.xml new file mode 100644 index 0000000..b30ffb0 --- /dev/null +++ b/main/res/drawable/sud_switch_thumb_selector.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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. + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/sud_switch_thumb_on" android:state_checked="true" /> + <item android:drawable="@drawable/sud_switch_thumb_off" android:state_checked="false" /> +</selector>
\ No newline at end of file diff --git a/main/res/drawable/sud_switch_track_off_background.xml b/main/res/drawable/sud_switch_track_off_background.xml new file mode 100644 index 0000000..d15cb9b --- /dev/null +++ b/main/res/drawable/sud_switch_track_off_background.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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" + android:width="@dimen/sud_switch_track_width" + android:height="@dimen/sud_switch_track_height"> + <solid android:color="@color/sud_switch_track_off" /> + <corners android:radius="@dimen/sud_switch_track_radius" /> +</shape>
\ No newline at end of file diff --git a/main/res/drawable/sud_switch_track_on_background.xml b/main/res/drawable/sud_switch_track_on_background.xml new file mode 100644 index 0000000..ff40595 --- /dev/null +++ b/main/res/drawable/sud_switch_track_on_background.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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" + android:width="@dimen/sud_switch_track_width" + android:height="@dimen/sud_switch_track_height"> + <solid android:color="@color/sud_switch_track_on" /> + <corners android:radius="@dimen/sud_switch_track_radius" /> +</shape>
\ No newline at end of file diff --git a/main/res/drawable/sud_switch_track_selector.xml b/main/res/drawable/sud_switch_track_selector.xml new file mode 100644 index 0000000..11cee5c --- /dev/null +++ b/main/res/drawable/sud_switch_track_selector.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2021 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. + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:drawable="@drawable/sud_switch_track_on_background" android:state_checked="true" /> + <item android:drawable="@drawable/sud_switch_track_off_background" android:state_checked="false" /> +</selector>
\ No newline at end of file diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml index 42a2574..04555c0 100644 --- a/main/res/values/styles.xml +++ b/main/res/values/styles.xml @@ -810,4 +810,12 @@ <item name="android:windowBackground">@color/sud_glif_window_bg_light_color</item> </style> + <style name="SudSwitchBarStyle"> + <item name="android:layout_gravity">center_vertical</item> + <item name="track">@drawable/sud_switch_track_selector</item> + <item name="android:track">@drawable/sud_switch_track_selector</item> + <item name="android:thumb">@drawable/sud_switch_thumb_selector</item> + <item name="android:switchMinWidth">@dimen/sud_switch_min_width</item> + </style> + </resources> |