Fixed odd accent color for profile image
This commit is contained in:
parent
1d7203cbec
commit
9d6d7de1c7
5 changed files with 10 additions and 11 deletions
|
@ -187,7 +187,7 @@ class HomeFragment :
|
||||||
}
|
}
|
||||||
GlideApp.with(requireActivity())
|
GlideApp.with(requireActivity())
|
||||||
.load(RetroGlideExtension.getUserModel())
|
.load(RetroGlideExtension.getUserModel())
|
||||||
.userProfileOptions(RetroGlideExtension.getUserModel())
|
.userProfileOptions(RetroGlideExtension.getUserModel(), requireContext())
|
||||||
.into(binding.userImage)
|
.into(binding.userImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ class UserInfoFragment : Fragment() {
|
||||||
}
|
}
|
||||||
GlideApp.with(this)
|
GlideApp.with(this)
|
||||||
.load(RetroGlideExtension.getUserModel())
|
.load(RetroGlideExtension.getUserModel())
|
||||||
.userProfileOptions(RetroGlideExtension.getUserModel())
|
.userProfileOptions(RetroGlideExtension.getUserModel(), requireContext())
|
||||||
.into(binding.userImage)
|
.into(binding.userImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package code.name.monkey.retromusic.glide
|
package code.name.monkey.retromusic.glide
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
|
import code.name.monkey.appthemehelper.ThemeStore.Companion.accentColor
|
||||||
import code.name.monkey.appthemehelper.util.TintHelper
|
import code.name.monkey.appthemehelper.util.TintHelper
|
||||||
|
@ -150,10 +151,11 @@ object RetroGlideExtension {
|
||||||
@GlideOption
|
@GlideOption
|
||||||
fun userProfileOptions(
|
fun userProfileOptions(
|
||||||
baseRequestOptions: BaseRequestOptions<*>,
|
baseRequestOptions: BaseRequestOptions<*>,
|
||||||
file: File
|
file: File,
|
||||||
|
context: Context
|
||||||
): BaseRequestOptions<*> {
|
): BaseRequestOptions<*> {
|
||||||
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
return baseRequestOptions.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
.error(getErrorUserProfile())
|
.error(getErrorUserProfile(context))
|
||||||
.signature(createSignature(file))
|
.signature(createSignature(file))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,11 +203,11 @@ object RetroGlideExtension {
|
||||||
return File(dir, USER_BANNER)
|
return File(dir, USER_BANNER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getErrorUserProfile(): Drawable {
|
private fun getErrorUserProfile(context: Context): Drawable {
|
||||||
return TintHelper.createTintedDrawable(
|
return TintHelper.createTintedDrawable(
|
||||||
getContext(),
|
getContext(),
|
||||||
R.drawable.ic_account,
|
R.drawable.ic_account,
|
||||||
accentColor(getContext())
|
accentColor(context)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,7 @@ class WallpaperAccentManager(val context: Context) {
|
||||||
.getWallpaperColors(WallpaperManager.FLAG_SYSTEM)
|
.getWallpaperColors(WallpaperManager.FLAG_SYSTEM)
|
||||||
if (colors != null) {
|
if (colors != null) {
|
||||||
val primaryColor = colors.primaryColor.toArgb()
|
val primaryColor = colors.primaryColor.toArgb()
|
||||||
if (primaryColor != ThemeStore.wallpaperColor(context)) {
|
ThemeStore.editTheme(context).wallpaperColor(context, primaryColor).commit()
|
||||||
ThemeStore.editTheme(context).wallpaperColor(primaryColor).commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,7 @@
|
||||||
android:key="wallpaper_accent"
|
android:key="wallpaper_accent"
|
||||||
android:layout="@layout/list_item_view_switch"
|
android:layout="@layout/list_item_view_switch"
|
||||||
android:summary="@string/pref_summary_wallpaper_accent"
|
android:summary="@string/pref_summary_wallpaper_accent"
|
||||||
android:title="@string/pref_title_wallpaper_accent"
|
android:title="@string/pref_title_wallpaper_accent" />
|
||||||
app:isPreferenceVisible="@bool/wallpaper_accent_visible" />
|
|
||||||
|
|
||||||
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
|
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEColorPreference
|
||||||
android:dependency="material_you"
|
android:dependency="material_you"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue