diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaNextUpdatedPutResolver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaNextUpdatedPutResolver.kt index 9ed7924fa..aa9f1d366 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaNextUpdatedPutResolver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/resolvers/MangaNextUpdatedPutResolver.kt @@ -1,6 +1,6 @@ package eu.kanade.tachiyomi.data.database.resolvers -import android.content.ContentValues +import androidx.core.content.contentValuesOf import com.pushtorefresh.storio.sqlite.StorIOSQLite import com.pushtorefresh.storio.sqlite.operations.put.PutResolver import com.pushtorefresh.storio.sqlite.operations.put.PutResult @@ -25,7 +25,7 @@ class MangaNextUpdatedPutResolver : PutResolver() { .whereArgs(manga.id) .build() - fun mapToContentValues(manga: Manga) = ContentValues(1).apply { - put(MangaTable.COL_NEXT_UPDATE, manga.next_update) - } + fun mapToContentValues(manga: Manga) = contentValuesOf( + MangaTable.COL_NEXT_UPDATE to manga.next_update + ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index a15b90b4e..e0eddbd7c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -14,6 +14,7 @@ import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.int import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonPrimitive +import kotlinx.serialization.json.long import uy.kohesive.injekt.injectLazy import java.util.Date @@ -67,7 +68,7 @@ internal class ExtensionGithubApi { val pkgName = element.jsonObject["pkg"]!!.jsonPrimitive.content val apkName = element.jsonObject["apk"]!!.jsonPrimitive.content val versionName = element.jsonObject["version"]!!.jsonPrimitive.content - val versionCode = element.jsonObject["code"]!!.jsonPrimitive.int + val versionCode = element.jsonObject["code"]!!.jsonPrimitive.long val lang = element.jsonObject["lang"]!!.jsonPrimitive.content val nsfw = element.jsonObject["nsfw"]!!.jsonPrimitive.int == 1 val icon = "${REPO_URL_PREFIX}icon/${apkName.replace(".apk", ".png")}" diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt index a08ed8480..b80d86161 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt @@ -7,7 +7,7 @@ sealed class Extension { abstract val name: String abstract val pkgName: String abstract val versionName: String - abstract val versionCode: Int + abstract val versionCode: Long abstract val lang: String? abstract val isNsfw: Boolean @@ -15,7 +15,7 @@ sealed class Extension { override val name: String, override val pkgName: String, override val versionName: String, - override val versionCode: Int, + override val versionCode: Long, override val lang: String, override val isNsfw: Boolean, val pkgFactory: String?, @@ -29,7 +29,7 @@ sealed class Extension { override val name: String, override val pkgName: String, override val versionName: String, - override val versionCode: Int, + override val versionCode: Long, override val lang: String, override val isNsfw: Boolean, val apkName: String, @@ -40,7 +40,7 @@ sealed class Extension { override val name: String, override val pkgName: String, override val versionName: String, - override val versionCode: Int, + override val versionCode: Long, val signatureHash: String, override val lang: String? = null, override val isNsfw: Boolean = false diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 5ca8189c4..c2ec94041 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.content.Context import android.content.pm.PackageInfo import android.content.pm.PackageManager +import androidx.core.content.pm.PackageInfoCompat import dalvik.system.PathClassLoader import eu.kanade.tachiyomi.annotations.Nsfw import eu.kanade.tachiyomi.data.preference.PreferencesHelper @@ -103,7 +104,7 @@ internal object ExtensionLoader { val extName = pkgManager.getApplicationLabel(appInfo).toString().substringAfter("Tachiyomi: ") val versionName = pkgInfo.versionName - val versionCode = pkgInfo.versionCode + val versionCode = PackageInfoCompat.getLongVersionCode(pkgInfo) if (versionName.isNullOrEmpty()) { val exception = Exception("Missing versionName for extension $extName") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/filter/TriStateItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/filter/TriStateItem.kt index 9bc93ee7f..aa3d8b6aa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/filter/TriStateItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/filter/TriStateItem.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.browse.source.filter import android.view.View import android.widget.CheckedTextView import androidx.appcompat.content.res.AppCompatResources +import androidx.core.view.updatePadding import androidx.recyclerview.widget.RecyclerView import com.google.android.material.R import eu.davidea.flexibleadapter.FlexibleAdapter @@ -72,7 +73,7 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem val rect = region.rectF - canvas?.save() - - // Scale rect from 1f,1f to screen width and height - canvas?.scale(width.toFloat(), height.toFloat()) - regionPaint.color = ContextCompat.getColor(context, region.type.colorRes) - canvas?.drawRect(rect, regionPaint) - - canvas?.restore() + canvas?.withSave { + // Scale rect from 1f,1f to screen width and height + scale(width.toFloat(), height.toFloat()) + regionPaint.color = context.getColor(region.type.colorRes) + drawRect(rect, regionPaint) + } // Don't want scale anymore because it messes with drawText - canvas?.save() + canvas?.withSave { - // Translate origin to rect start (left, top) - canvas?.translate((width * rect.left), (height * rect.top)) + // Translate origin to rect start (left, top) + translate((width * rect.left), (height * rect.top)) - // Calculate center of rect width on screen - val x = width * (abs(rect.left - rect.right) / 2) + // Calculate center of rect width on screen + val x = width * (abs(rect.left - rect.right) / 2) - // Calculate center of rect height on screen - val y = height * (abs(rect.top - rect.bottom) / 2) + // Calculate center of rect height on screen + val y = height * (abs(rect.top - rect.bottom) / 2) - canvas?.drawText(context.getString(region.type.nameRes), x, y, textBorderPaint) - canvas?.drawText(context.getString(region.type.nameRes), x, y, textPaint) - - canvas?.restore() + drawText(context.getString(region.type.nameRes), x, y, textBorderPaint) + drawText(context.getString(region.type.nameRes), x, y, textPaint) + } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt index e53ee8b72..5d3f74ed3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/GestureDetectorWithLongTap.kt @@ -6,6 +6,7 @@ import android.os.Looper import android.view.GestureDetector import android.view.MotionEvent import android.view.ViewConfiguration +import androidx.core.os.postDelayed import kotlin.math.abs /** @@ -43,7 +44,7 @@ open class GestureDetectorWithLongTap( if (ev.downTime - lastUp > doubleTapTime) { downX = ev.rawX downY = ev.rawY - handler.postDelayed(longTapFn, longTapTime) + handler.postDelayed(longTapTime) { longTapFn } } } MotionEvent.ACTION_MOVE -> { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index d0a56eaa9..6a5ac26fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -16,6 +16,7 @@ import android.widget.ImageView import android.widget.LinearLayout import android.widget.TextView import androidx.core.view.isVisible +import androidx.core.view.setMargins import androidx.core.view.updateLayoutParams import coil.imageLoader import coil.request.CachePolicy @@ -457,7 +458,7 @@ class PagerPageHolder( TextView(context).apply { layoutParams = LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { - setMargins(margins, margins, margins, margins) + setMargins(margins) } gravity = Gravity.CENTER setText(R.string.decode_image_error) @@ -467,7 +468,7 @@ class PagerPageHolder( PagerButton(context, viewer).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { - setMargins(margins, margins, margins, margins) + setMargins(margins) } setText(R.string.action_retry) setOnClickListener { @@ -481,7 +482,7 @@ class PagerPageHolder( if (imageUrl.orEmpty().startsWith("http", true)) { PagerButton(context, viewer).apply { layoutParams = LayoutParams(WRAP_CONTENT, WRAP_CONTENT).apply { - setMargins(margins, margins, margins, margins) + setMargins(margins) } setText(R.string.action_open_in_web_view) setOnClickListener { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index 34923846a..e41aae4a9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -6,6 +6,7 @@ import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.MATCH_PARENT +import androidx.core.app.ActivityCompat import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView @@ -139,7 +140,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr } config.themeChangedListener = { - activity.recreate() + ActivityCompat.recreate(activity) } config.navigationModeChangedListener = { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt index 3c7d8b50f..64a80b0c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAppearanceController.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.ui.setting import android.os.Build +import androidx.core.app.ActivityCompat import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.asImmediateFlow @@ -74,7 +75,7 @@ class SettingsAppearanceController : SettingsController() { defaultValue = appThemes[0].name onChange { - activity?.recreate() + activity?.let { ActivityCompat.recreate(it) } true } } @@ -87,7 +88,7 @@ class SettingsAppearanceController : SettingsController() { .launchIn(viewScope) onChange { - activity?.recreate() + activity?.let { ActivityCompat.recreate(it) } true } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt b/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt index efdb8f535..459768b43 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/preference/PreferenceDSL.kt @@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.util.preference import androidx.annotation.StringRes import androidx.appcompat.content.res.AppCompatResources -import androidx.core.graphics.drawable.DrawableCompat import androidx.preference.CheckBoxPreference import androidx.preference.DialogPreference import androidx.preference.EditTextPreference @@ -150,7 +149,7 @@ var Preference.summaryRes: Int var Preference.iconTint: Int get() = 0 // set only set(value) { - DrawableCompat.setTint(icon, value) + icon.setTint(value) } var ListPreference.entriesRes: Array diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt index bc4f7e964..26fa1d93a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/DiskUtil.kt @@ -7,7 +7,6 @@ import android.os.Environment import android.os.StatFs import androidx.core.content.ContextCompat import androidx.core.net.toUri -import androidx.core.os.EnvironmentCompat import com.hippo.unifile.UniFile import eu.kanade.tachiyomi.util.lang.Hash import java.io.File @@ -51,7 +50,7 @@ object DiskUtil { .filterNotNull() .mapNotNull { val file = File(it.absolutePath.substringBefore("/Android/")) - val state = EnvironmentCompat.getStorageState(file) + val state = Environment.getExternalStorageState(file) if (state == Environment.MEDIA_MOUNTED || state == Environment.MEDIA_MOUNTED_READ_ONLY) { file } else { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index bf77644ff..bc7ac01bb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -102,7 +102,7 @@ fun Context.copyToClipboard(label: String, content: String) { */ fun Context.notificationBuilder(channelId: String, block: (NotificationCompat.Builder.() -> Unit)? = null): NotificationCompat.Builder { val builder = NotificationCompat.Builder(this, channelId) - .setColor(ContextCompat.getColor(this, R.color.accent_blue)) + .setColor(getColor(R.color.accent_blue)) if (block != null) { builder.block() } @@ -152,7 +152,7 @@ fun Context.hasPermission(permission: String) = ContextCompat.checkSelfPermissio val tv = TypedValue() return if (this.theme.resolveAttribute(attr, tv, true)) { if (tv.resourceId != 0) { - ContextCompat.getColor(this, tv.resourceId) + getColor(tv.resourceId) } else { tv.data } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt index 3c4a56454..9ed470e9b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt @@ -4,7 +4,6 @@ import android.content.Context import android.content.res.Configuration import android.graphics.Bitmap import android.graphics.BitmapFactory -import android.graphics.Canvas import android.graphics.Color import android.graphics.Rect import android.graphics.drawable.ColorDrawable @@ -12,6 +11,7 @@ import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable import android.os.Build import androidx.core.graphics.alpha +import androidx.core.graphics.applyCanvas import androidx.core.graphics.blue import androidx.core.graphics.createBitmap import androidx.core.graphics.green @@ -132,8 +132,9 @@ object ImageUtil { Side.RIGHT -> Rect(width - width / 2, 0, width, height) Side.LEFT -> Rect(0, 0, width / 2, height) } - val canvas = Canvas(half) - canvas.drawBitmap(imageBitmap, part, singlePage, null) + half.applyCanvas { + drawBitmap(imageBitmap, part, singlePage, null) + } val output = ByteArrayOutputStream() half.compress(Bitmap.CompressFormat.JPEG, 100, output) @@ -151,21 +152,22 @@ object ImageUtil { val width = imageBitmap.width val result = createBitmap(width / 2, height * 2) - val canvas = Canvas(result) - // right -> upper - val rightPart = when (upperSide) { - Side.RIGHT -> Rect(width - width / 2, 0, width, height) - Side.LEFT -> Rect(0, 0, width / 2, height) + result.applyCanvas { + // right -> upper + val rightPart = when (upperSide) { + Side.RIGHT -> Rect(width - width / 2, 0, width, height) + Side.LEFT -> Rect(0, 0, width / 2, height) + } + val upperPart = Rect(0, 0, width / 2, height) + drawBitmap(imageBitmap, rightPart, upperPart, null) + // left -> bottom + val leftPart = when (upperSide) { + Side.LEFT -> Rect(width - width / 2, 0, width, height) + Side.RIGHT -> Rect(0, 0, width / 2, height) + } + val bottomPart = Rect(0, height, width / 2, height * 2) + drawBitmap(imageBitmap, leftPart, bottomPart, null) } - val upperPart = Rect(0, 0, width / 2, height) - canvas.drawBitmap(imageBitmap, rightPart, upperPart, null) - // left -> bottom - val leftPart = when (upperSide) { - Side.LEFT -> Rect(width - width / 2, 0, width, height) - Side.RIGHT -> Rect(0, 0, width / 2, height) - } - val bottomPart = Rect(0, height, width / 2, height * 2) - canvas.drawBitmap(imageBitmap, leftPart, bottomPart, null) val output = ByteArrayOutputStream() result.compress(Bitmap.CompressFormat.JPEG, 100, output) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt index 08eba0de5..79d7942df 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt @@ -13,10 +13,10 @@ import android.view.ViewGroup import android.widget.TextView import androidx.annotation.MenuRes import androidx.annotation.StringRes +import androidx.appcompat.content.res.AppCompatResources import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.TooltipCompat -import androidx.core.content.ContextCompat import androidx.core.view.children import androidx.core.view.descendants import androidx.core.view.forEach @@ -123,10 +123,10 @@ inline fun View.popupMenu( if (selectedItemId != null) { (popup.menu as? MenuBuilder)?.setOptionalIconsVisible(true) - val emptyIcon = ContextCompat.getDrawable(context, R.drawable.ic_blank_24dp) + val emptyIcon = AppCompatResources.getDrawable(context, R.drawable.ic_blank_24dp) popup.menu.forEach { item -> item.icon = when (item.itemId) { - selectedItemId -> ContextCompat.getDrawable(context, R.drawable.ic_check_24dp)?.mutate()?.apply { + selectedItemId -> AppCompatResources.getDrawable(context, R.drawable.ic_check_24dp)?.mutate()?.apply { setTint(context.getResourceColor(android.R.attr.textColorPrimary)) } else -> emptyIcon diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt index 01a2939fe..b056880c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt @@ -7,7 +7,6 @@ import android.view.ViewGroup import androidx.annotation.AttrRes import androidx.annotation.CallSuper import androidx.appcompat.content.res.AppCompatResources -import androidx.core.content.ContextCompat import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import eu.kanade.tachiyomi.R @@ -102,7 +101,7 @@ open class ExtendedNavigationView @JvmOverloads constructor( return when (state) { SORT_ASC -> tintVector(context, R.drawable.ic_arrow_up_white_32dp) SORT_DESC -> tintVector(context, R.drawable.ic_arrow_down_white_32dp) - SORT_NONE -> ContextCompat.getDrawable(context, R.drawable.empty_drawable_32dp) + SORT_NONE -> AppCompatResources.getDrawable(context, R.drawable.empty_drawable_32dp) else -> null } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt index bb6eae9e0..49863d7a8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialSpinnerView.kt @@ -8,9 +8,9 @@ import android.view.LayoutInflater import android.view.MenuItem import android.widget.FrameLayout import androidx.annotation.ArrayRes +import androidx.appcompat.content.res.AppCompatResources import androidx.appcompat.view.menu.MenuBuilder import androidx.appcompat.widget.PopupMenu -import androidx.core.content.ContextCompat import androidx.core.view.forEach import androidx.core.view.get import com.tfcporciuncula.flow.Preference @@ -38,10 +38,10 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att } private val emptyIcon by lazy { - ContextCompat.getDrawable(context, R.drawable.ic_blank_24dp) + AppCompatResources.getDrawable(context, R.drawable.ic_blank_24dp) } private val checkmarkIcon by lazy { - ContextCompat.getDrawable(context, R.drawable.ic_check_24dp)?.mutate()?.apply { + AppCompatResources.getDrawable(context, R.drawable.ic_check_24dp)?.mutate()?.apply { setTint(context.getResourceColor(android.R.attr.textColorPrimary)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt index 45cfca1f3..5aa85d753 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt @@ -13,7 +13,6 @@ import android.widget.RadioButton import android.widget.Spinner import android.widget.TextView import androidx.appcompat.widget.TintTypedArray -import androidx.core.view.ViewCompat import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.R @@ -44,14 +43,10 @@ open class SimpleNavigationView @JvmOverloads constructor( R.style.Widget_Design_NavigationView ) - ViewCompat.setBackground( - this, - a.getDrawable(R.styleable.NavigationView_android_background) - ) + setBackground(a.getDrawable(R.styleable.NavigationView_android_background)) if (a.hasValue(R.styleable.NavigationView_elevation)) { - ViewCompat.setElevation( - this, + setElevation( a.getDimensionPixelSize( R.styleable.NavigationView_elevation, 0