Loading tests/SilkFX/AndroidManifest.xml +8 −2 Original line number Diff line number Diff line Loading @@ -20,17 +20,20 @@ <uses-sdk android:minSdkVersion="30"/> <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" /> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> <application android:label="SilkFX" android:theme="@android:style/Theme.Material"> <activity android:name=".Main" android:label="SilkFX Demos" android:banner="@drawable/background1" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LEANBACK_LAUNCHER"/> </intent-filter> </activity> Loading @@ -41,13 +44,16 @@ <activity android:name=".materials.GlassActivity" android:label="Glass Examples" android:banner="@drawable/background1" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> <activity android:name=".materials.BackgroundBlurActivity" android:theme="@style/Theme.BackgroundBlurTheme" android:exported="true"> </activity> </application> </manifest> tests/SilkFX/res/drawable/background_blur_drawable.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2022 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"> <solid android:color="#20FFFFFF"/> <corners android:radius="10dp"/> </shape> tests/SilkFX/res/drawable/blur_activity_background_drawable_white.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 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"> <corners android:radius="10dp"/> </shape> tests/SilkFX/res/layout/activity_background_blur.xml 0 → 100644 +173 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 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" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/background" android:layout_width="390dp" android:layout_height="wrap_content" android:layout_gravity="center" android:padding="15dp" android:orientation="vertical" tools:context=".materials.BackgroundBlurActivity"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:padding="10dp" android:textColor="#ffffffff" android:text="Hello blurry world!"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Background blur"/> <SeekBar android:id="@+id/set_background_blur" android:min="0" android:max="300" android:layout_width="160dp" android:layout_height="wrap_content"/> <TextView android:id="@+id/background_blur_radius" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:ems="3" android:gravity="center" android:paddingLeft="10dp" android:paddingRight="10dp" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Background alpha"/> <SeekBar android:id="@+id/set_background_alpha" android:min="0" android:max="100" android:layout_width="160dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/background_alpha" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:ems="3" android:gravity="center" android:paddingLeft="10dp" android:paddingRight="10dp" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Blur behind"/> <SeekBar android:id="@+id/set_blur_behind" android:min="0" android:max="300" android:layout_width="160dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/blur_behind_radius" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textColor="#ffffffff" android:paddingLeft="10dp" android:paddingRight="10dp" android:ems="3" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Dim amount"/> <SeekBar android:id="@+id/set_dim_amount" android:min="0" android:max="100" android:layout_width="160dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/dim_amount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textColor="#ffffffff" android:paddingLeft="10dp" android:paddingRight="10dp" android:ems="3" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="5dp" android:orientation="vertical" android:gravity="center"> <Button android:id="@+id/toggle_blur_enabled" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Disable blur" android:onClick="toggleForceBlurDisabled"/> <Button android:id="@+id/toggle_battery_saving_mode" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TODO" android:onClick="toggleBatterySavingMode"/> </LinearLayout> <requestFocus/> </LinearLayout> tests/SilkFX/res/values/style.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 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. --> <!-- Styles for immersive actions UI. --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="Theme.BackgroundBlurTheme" parent= "Theme.AppCompat.Dialog"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBlurBehindEnabled">true</item> <item name="android:backgroundDimEnabled">false</item> <item name="android:windowElevation">0dp</item> <item name="buttonStyle">@style/AppTheme.Button</item> <item name="colorAccent">#bbffffff</item> </style> <style name="AppTheme.Button" parent="Widget.AppCompat.Button"> <item name="android:textColor">#ffffffff</item> </style> </resources> Loading
tests/SilkFX/AndroidManifest.xml +8 −2 Original line number Diff line number Diff line Loading @@ -20,17 +20,20 @@ <uses-sdk android:minSdkVersion="30"/> <uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" /> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> <application android:label="SilkFX" android:theme="@android:style/Theme.Material"> <activity android:name=".Main" android:label="SilkFX Demos" android:banner="@drawable/background1" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LEANBACK_LAUNCHER"/> </intent-filter> </activity> Loading @@ -41,13 +44,16 @@ <activity android:name=".materials.GlassActivity" android:label="Glass Examples" android:banner="@drawable/background1" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> <activity android:name=".materials.BackgroundBlurActivity" android:theme="@style/Theme.BackgroundBlurTheme" android:exported="true"> </activity> </application> </manifest>
tests/SilkFX/res/drawable/background_blur_drawable.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <!-- ~ Copyright (C) 2022 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"> <solid android:color="#20FFFFFF"/> <corners android:radius="10dp"/> </shape>
tests/SilkFX/res/drawable/blur_activity_background_drawable_white.xml 0 → 100644 +20 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 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"> <corners android:radius="10dp"/> </shape>
tests/SilkFX/res/layout/activity_background_blur.xml 0 → 100644 +173 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 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" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/background" android:layout_width="390dp" android:layout_height="wrap_content" android:layout_gravity="center" android:padding="15dp" android:orientation="vertical" tools:context=".materials.BackgroundBlurActivity"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:padding="10dp" android:textColor="#ffffffff" android:text="Hello blurry world!"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Background blur"/> <SeekBar android:id="@+id/set_background_blur" android:min="0" android:max="300" android:layout_width="160dp" android:layout_height="wrap_content"/> <TextView android:id="@+id/background_blur_radius" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:ems="3" android:gravity="center" android:paddingLeft="10dp" android:paddingRight="10dp" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Background alpha"/> <SeekBar android:id="@+id/set_background_alpha" android:min="0" android:max="100" android:layout_width="160dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/background_alpha" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:ems="3" android:gravity="center" android:paddingLeft="10dp" android:paddingRight="10dp" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Blur behind"/> <SeekBar android:id="@+id/set_blur_behind" android:min="0" android:max="300" android:layout_width="160dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/blur_behind_radius" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textColor="#ffffffff" android:paddingLeft="10dp" android:paddingRight="10dp" android:ems="3" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="#ffffffff" android:text="Dim amount"/> <SeekBar android:id="@+id/set_dim_amount" android:min="0" android:max="100" android:layout_width="160dp" android:layout_height="wrap_content" /> <TextView android:id="@+id/dim_amount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textColor="#ffffffff" android:paddingLeft="10dp" android:paddingRight="10dp" android:ems="3" android:text="TODO"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="5dp" android:orientation="vertical" android:gravity="center"> <Button android:id="@+id/toggle_blur_enabled" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Disable blur" android:onClick="toggleForceBlurDisabled"/> <Button android:id="@+id/toggle_battery_saving_mode" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TODO" android:onClick="toggleBatterySavingMode"/> </LinearLayout> <requestFocus/> </LinearLayout>
tests/SilkFX/res/values/style.xml 0 → 100644 +31 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 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. --> <!-- Styles for immersive actions UI. --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="Theme.BackgroundBlurTheme" parent= "Theme.AppCompat.Dialog"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBlurBehindEnabled">true</item> <item name="android:backgroundDimEnabled">false</item> <item name="android:windowElevation">0dp</item> <item name="buttonStyle">@style/AppTheme.Button</item> <item name="colorAccent">#bbffffff</item> </style> <style name="AppTheme.Button" parent="Widget.AppCompat.Button"> <item name="android:textColor">#ffffffff</item> </style> </resources>