From 44dada9e60b23f500c3904af8578a874e78c0c5a Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sun, 6 Mar 2022 16:10:42 +0100 Subject: [PATCH] Use better Kotlin syntax From the PR review --- .../schabi/newpipe/local/feed/FeedFragment.kt | 2 +- .../schabi/newpipe/util/DrawableResolver.kt | 29 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index e8e78feda..55810284f 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -75,7 +75,7 @@ import org.schabi.newpipe.local.feed.item.StreamItem import org.schabi.newpipe.local.feed.service.FeedLoadService import org.schabi.newpipe.local.subscription.SubscriptionManager import org.schabi.newpipe.util.DeviceUtils -import org.schabi.newpipe.util.DrawableResolver.Companion.resolveDrawable +import org.schabi.newpipe.util.DrawableResolver.resolveDrawable import org.schabi.newpipe.util.Localization import org.schabi.newpipe.util.NavigationHelper import org.schabi.newpipe.util.ThemeHelper.getGridSpanCountStreams diff --git a/app/src/main/java/org/schabi/newpipe/util/DrawableResolver.kt b/app/src/main/java/org/schabi/newpipe/util/DrawableResolver.kt index 50f875257..ccc9e7dd4 100644 --- a/app/src/main/java/org/schabi/newpipe/util/DrawableResolver.kt +++ b/app/src/main/java/org/schabi/newpipe/util/DrawableResolver.kt @@ -2,25 +2,24 @@ package org.schabi.newpipe.util import android.content.Context import android.graphics.drawable.Drawable +import android.util.TypedValue import androidx.annotation.AttrRes /** * Utility class for resolving [Drawables](Drawable) */ -class DrawableResolver { - companion object { - @JvmStatic - fun resolveDrawable(context: Context, @AttrRes attrResId: Int): Drawable? { - return androidx.core.content.ContextCompat.getDrawable( - context, - android.util.TypedValue().apply { - context.theme.resolveAttribute( - attrResId, - this, - true - ) - }.resourceId - ) - } +object DrawableResolver { + @JvmStatic + fun resolveDrawable(context: Context, @AttrRes attrResId: Int): Drawable? { + return androidx.core.content.ContextCompat.getDrawable( + context, + TypedValue().apply { + context.theme.resolveAttribute( + attrResId, + this, + true + ) + }.resourceId + ) } }