Skip to content

Commit 44dada9

Browse files
committed
Use better Kotlin syntax
From the PR review
1 parent 1b8c517 commit 44dada9

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import org.schabi.newpipe.local.feed.item.StreamItem
7575
import org.schabi.newpipe.local.feed.service.FeedLoadService
7676
import org.schabi.newpipe.local.subscription.SubscriptionManager
7777
import org.schabi.newpipe.util.DeviceUtils
78-
import org.schabi.newpipe.util.DrawableResolver.Companion.resolveDrawable
78+
import org.schabi.newpipe.util.DrawableResolver.resolveDrawable
7979
import org.schabi.newpipe.util.Localization
8080
import org.schabi.newpipe.util.NavigationHelper
8181
import org.schabi.newpipe.util.ThemeHelper.getGridSpanCountStreams

app/src/main/java/org/schabi/newpipe/util/DrawableResolver.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,24 @@ package org.schabi.newpipe.util
22

33
import android.content.Context
44
import android.graphics.drawable.Drawable
5+
import android.util.TypedValue
56
import androidx.annotation.AttrRes
67

78
/**
89
* Utility class for resolving [Drawables](Drawable)
910
*/
10-
class DrawableResolver {
11-
companion object {
12-
@JvmStatic
13-
fun resolveDrawable(context: Context, @AttrRes attrResId: Int): Drawable? {
14-
return androidx.core.content.ContextCompat.getDrawable(
15-
context,
16-
android.util.TypedValue().apply {
17-
context.theme.resolveAttribute(
18-
attrResId,
19-
this,
20-
true
21-
)
22-
}.resourceId
23-
)
24-
}
11+
object DrawableResolver {
12+
@JvmStatic
13+
fun resolveDrawable(context: Context, @AttrRes attrResId: Int): Drawable? {
14+
return androidx.core.content.ContextCompat.getDrawable(
15+
context,
16+
TypedValue().apply {
17+
context.theme.resolveAttribute(
18+
attrResId,
19+
this,
20+
true
21+
)
22+
}.resourceId
23+
)
2524
}
2625
}

0 commit comments

Comments
 (0)