Skip to content

Commit

Permalink
Added option to disable blur
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza417 committed Jul 22, 2023
1 parent cbbd761 commit d6d0512
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
minSdk 24
targetSdk 33
versionCode 3
versionName "1.3_beta"
versionName "1.4_beta"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ object MainPreferences {

private const val storageUri = "storageUri"
private const val nomediaDialog = "nomediaDialog"
private const val blur = "blur_main_list"
const val sort = "sort"
const val order = "order"
const val name = "is_name"
Expand Down Expand Up @@ -60,4 +61,12 @@ object MainPreferences {
fun getShowNomediaDialog(): Boolean {
return SharedPreferences.getSharedPreferences().getBoolean(nomediaDialog, true)
}

fun setBlur(b: Boolean) {
SharedPreferences.getSharedPreferences().edit().putBoolean(blur, b).apply()
}

fun getBlur(): Boolean {
return SharedPreferences.getSharedPreferences().getBoolean(blur, true)
}
}
14 changes: 9 additions & 5 deletions app/src/main/java/app/simple/peri/ui/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,11 @@ class MainScreen : Fragment(), SharedPreferences.OnSharedPreferenceChangeListene

override fun onWallpaperLongClicked(wallpaper: Wallpaper, position: Int, view: View, checkBox: MaterialCheckBox) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
binding?.recyclerView?.children?.forEach {
if (it is ConstraintLayout && it != view) {
it.setRenderEffect(RenderEffect.createBlurEffect(blurRadius, blurRadius, Shader.TileMode.CLAMP))
if (MainPreferences.getBlur()) {
binding?.recyclerView?.children?.forEach {
if (it is ConstraintLayout && it != view) {
it.setRenderEffect(RenderEffect.createBlurEffect(blurRadius, blurRadius, Shader.TileMode.CLAMP))
}
}
}
}
Expand Down Expand Up @@ -477,8 +479,10 @@ class MainScreen : Fragment(), SharedPreferences.OnSharedPreferenceChangeListene

private fun blurRoot() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
binding?.root?.setRenderEffect(
RenderEffect.createBlurEffect(blurRadius, blurRadius, Shader.TileMode.MIRROR))
if (MainPreferences.getBlur()) {
binding?.root?.setRenderEffect(
RenderEffect.createBlurEffect(blurRadius, blurRadius, Shader.TileMode.MIRROR))
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/app/simple/peri/ui/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class Preferences : PreferenceFragmentCompat(), SharedPreferences.OnSharedPrefer
.coerceAtLeast(1)
.coerceAtMost(4))
}

"blur" -> {
MainPreferences.setBlur(p0?.getBoolean(p1, true)!!)
}
}
}

Expand Down
Binary file added app/src/main/res/drawable-nodpi/inure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-nodpi/positional.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/ic_blur.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6,13c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM6,17c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM6,9c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM3,9.5c-0.28,0 -0.5,0.22 -0.5,0.5s0.22,0.5 0.5,0.5 0.5,-0.22 0.5,-0.5 -0.22,-0.5 -0.5,-0.5zM6,5c-0.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0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM14,20.5c-0.28,0 -0.5,0.22 -0.5,0.5s0.22,0.5 0.5,0.5 0.5,-0.22 0.5,-0.5 -0.22,-0.5 -0.5,-0.5zM10,8.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5zM10,17c-0.55,0 -1,0.45 -1,1s0.45,1 1,1 1,-0.45 1,-1 -0.45,-1 -1,-1zM14,12.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5zM14,8.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5z"
android:fillColor="#000000"/>
</vector>
6 changes: 5 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<string name="nomedia">NOMEDIA</string>
<string name="nomedia_message">Current directory /%1$s is not nomedia and maybe visible in other gallery apps, would you like to hide the directory?</string>
<string name="yes">Yes</string>
<string name="nomedia_success">.nomedia file created successfully!\n\nWARNING: The files may still be visible to programs that ignored the .nomedia file.</string>
<string name="nomedia_success">.nomedia file created successfully!\n\nWARNING: The files may still be visible to programs that ignores the .nomedia file.</string>
<string name="dont_show_again">Don\'t show again</string>
<string name="blur_summary">Enabled blur on the main screen.</string>
<string name="blur">Blur</string>
<string name="inure_app_manager_summary" translatable="false">An elegant and beautiful premium Android app manager for both rooted and non-rooted devices and a built-in terminal, analytics panel and an independent custom theme engine, developed with purely custom APIs created for this app.</string>
<string name="positional_summary">An elegant and colorful location information app for Android with Compass, Clock, Level, Sun, Moon, Trail Marker and many other features.</string>
</resources>
29 changes: 21 additions & 8 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
app:allowDividerBelow="false"
app:title=" " /> <!-- Empty title for status bar space -->

<PreferenceCategory app:title="@string/about" />

<Preference
app:icon="@drawable/ic_info"
app:key="info"
app:summary="@string/full_info"
app:title="" />

<PreferenceCategory app:title="@string/home" />

<CheckBoxPreference
Expand All @@ -24,6 +16,15 @@
app:summary="@string/show_wallpaper_names_on_the_main_screen"
app:title="@string/enabled_wallpaper_names" />

<CheckBoxPreference
app:defaultValue="true"
app:enabled="true"
app:icon="@drawable/ic_blur"
app:iconSpaceReserved="true"
app:key="blur"
app:summary="@string/blur_summary"
app:title="@string/blur" />

<ListPreference
app:defaultValue="2"
app:entries="@array/grid_span"
Expand All @@ -34,14 +35,26 @@
app:title="@string/grid_span"
app:useSimpleSummaryProvider="false" />

<PreferenceCategory app:title="@string/about" />

<Preference
app:icon="@drawable/ic_info"
app:key="info"
app:summary="@string/full_info"
app:title="" />

<PreferenceCategory app:title="@string/other_apps" />

<Preference
app:icon="@drawable/positional"
app:key="positional"
app:summary="@string/positional_summary"
app:title="@string/positional" />

<Preference
app:icon="@drawable/inure"
app:key="inure"
app:summary="@string/inure_app_manager_summary"
app:title="@string/inure_app_manager" />

</PreferenceScreen>

0 comments on commit d6d0512

Please sign in to comment.