Themes: Add Live previews for applied themes and fonts
Co-authored-by: ender1324 <ender1324@abv.bg> Signed-off-by: AndroBuddy <anirudhchimpidi8@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
22
res/color/colors.xml
Normal file
22
res/color/colors.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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>
|
||||
|
||||
<!-- Preview Icons -->
|
||||
<color name="preview_icon_shape_color">@*android:color/accent_device_default_dark</color>
|
||||
<color name="wave-background">@*android:color/primary_dark_device_default_dark</color>
|
||||
</resources>
|
||||
26
res/drawable/fluid_icon.xml
Normal file
26
res/drawable/fluid_icon.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M12,3.77L11.25,4.61C11.25,4.61 9.97,6.06 8.68,7.94C7.39,9.82 6,12.07 6,14.23A6,6 0 0,0 12,20.23A6,6 0 0,0 18,14.23C18,12.07 16.61,9.82 15.32,7.94C14.03,6.06 12.75,4.61 12.75,4.61L12,3.77M12,6.9C12.44,7.42 12.84,7.85 13.68,9.07C14.89,10.83 16,13.07 16,14.23C16,16.45 14.22,18.23 12,18.23C9.78,18.23 8,16.45 8,14.23C8,13.07 9.11,10.83 10.32,9.07C11.16,7.85 11.56,7.42 12,6.9Z" />
|
||||
</vector>
|
||||
28
res/drawable/font_preview_background.xml
Normal file
28
res/drawable/font_preview_background.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="1280dp"
|
||||
android:height="549dp"
|
||||
android:viewportWidth="1280"
|
||||
android:viewportHeight="548">
|
||||
<path
|
||||
android:pathData="M0 0V548.127H1280V0"
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:fillAlpha="0.2"/>
|
||||
</vector>
|
||||
33
res/drawable/preview_base.xml
Normal file
33
res/drawable/preview_base.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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:drawable="@drawable/wave"/>
|
||||
|
||||
<item android:gravity="center">
|
||||
<com.android.settingslib.widget.AdaptiveIconShapeDrawable
|
||||
android:height="290dp"
|
||||
android:width="290dp"
|
||||
android:color="@color/preview_icon_shape_color"/>
|
||||
</item>
|
||||
|
||||
<item android:height="181dp"
|
||||
android:width="181dp"
|
||||
android:gravity="center"
|
||||
android:drawable="@drawable/fluid_icon"/>
|
||||
</layer-list>
|
||||
33
res/drawable/preview_wallpaper.xml
Normal file
33
res/drawable/preview_wallpaper.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="1280dp"
|
||||
android:height="510dp"
|
||||
android:viewportWidth="1280"
|
||||
android:viewportHeight="510">
|
||||
<path
|
||||
android:pathData="M -11 -788 L 1291 -788 L 1291 1156 C 1291 1234.42 1227.42 1298 1149 1298 L 131 1298 C 52.576 1298 -11 1234.42 -11 1156 L -11 -788 Z"
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:fillAlpha="0.2" />
|
||||
<path
|
||||
android:pathData="M 1281 60 L 1227.17 68.203 C 1173.33 76.405 1065.67 92.81 958 158.431 C 850.333 224.051 742.667 260.203 635 252 C 527.333 243.797 419.667 174.836 312 158.431 C 149 133.594 42.833 306.077 -11 355.292 L -11 969 C -11 1043.56 49.42 1104 123.979 1104 L 1146.02 1104 C 1220.58 1104 1281 1043.56 1281 969 L 1281 60 Z"
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:fillAlpha="0.1" />
|
||||
</vector>
|
||||
|
||||
27
res/drawable/wave.xml
Normal file
27
res/drawable/wave.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="1280dp"
|
||||
android:height="549dp"
|
||||
android:viewportWidth="1280"
|
||||
android:viewportHeight="549">
|
||||
<path
|
||||
android:pathData="M 320.779 193.922 C 214.891 174.977 46.715 228.948 0 256.061 L 0 548.126 L 1280 548.126 L 1280 212.866 L 1227.06 227.074 C 1174.11 243.65 1068.22 272.067 959.221 291.011 C 853.333 309.956 747.445 319.428 641.557 295.747 C 532.555 272.067 426.667 212.866 320.779 193.922 Z"
|
||||
android:fillColor="@color/wave-background" />
|
||||
</vector>
|
||||
32
res/layout/base_preview.xml
Normal file
32
res/layout/base_preview.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:layout_gravity="center|top">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@drawable/preview_wallpaper"
|
||||
android:src="@drawable/preview_base"
|
||||
tools:ignore="ContentDescription"/>
|
||||
|
||||
</LinearLayout>
|
||||
34
res/layout/font_preview.xml
Normal file
34
res/layout/font_preview.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 ProjectFluid
|
||||
|
||||
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="180dp"
|
||||
android:layout_gravity="center|top"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@drawable/font_preview_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ColtOS Font Preview : This is how fonts will appear"
|
||||
android:textSize="32sp"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_gravity="center"/>
|
||||
</LinearLayout>
|
||||
@@ -1265,4 +1265,7 @@
|
||||
<!-- Custom Wi-Fi bar icons -->
|
||||
<string name="custom_wifi_bar_title">Wi-Fi</string>
|
||||
<string name="theme_customization_statusbar_height_title">Statusbar height</string>
|
||||
|
||||
<!-- Customization titles -->
|
||||
<string name="themes_ui">Themes UI</string>
|
||||
</resources>
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
android:key="theme_customization_category"
|
||||
android:title="@string/theme_customization_category">
|
||||
|
||||
<ListPreference
|
||||
android:layout="@layout/base_preview" />
|
||||
|
||||
<Preference
|
||||
android:key="dark_ui_mode"
|
||||
android:title="@string/dark_ui_mode"
|
||||
@@ -56,6 +59,9 @@
|
||||
android:targetClass="com.android.customization.picker.LockClockPickerActivity" />
|
||||
</Preference>
|
||||
|
||||
<ListPreference
|
||||
android:layout="@layout/font_preview" />
|
||||
|
||||
<com.android.settings.display.FontDialogPreference
|
||||
android:key="custom_font"
|
||||
android:icon="@drawable/ic_font"
|
||||
|
||||
Reference in New Issue
Block a user