-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove @SuppressLint("RestrictedApi") #100
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
|
||
package com.android.tv.classics.receivers | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
|
@@ -104,20 +103,21 @@ class TvLauncherReceiver : BroadcastReceiver() { | |
* Helper method used to retrieve a metadata item object given its program ID. Restricted API | ||
* is being used to compared programs based on their ID. | ||
*/ | ||
@SuppressLint("RestrictedApi") | ||
private fun getMediaItemFromProgramId( | ||
context: Context, db: TvMediaDatabase, programId: Long?): TvMediaMetadata? { | ||
|
||
// Early exit: program ID is null | ||
if (programId == null) return null | ||
|
||
// Retrieve the program that matches this ID | ||
val programItem = | ||
TvLauncherUtils.getPreviewPrograms(context).find { it.id == programId } ?: | ||
TvLauncherUtils.getWatchNextPrograms(context).find { it.id == programId } | ||
|
||
val previewProgramItem = | ||
TvLauncherUtils.getPreviewPrograms(context).find { it.id == programId } | ||
// Retrieve the corresponding metadata item and return | ||
if(previewProgramItem != null) | ||
return previewProgramItem.let { db.metadata().findById(it.contentId) } | ||
// Retrieve the corresponding metadata item and return | ||
return programItem?.let { db.metadata().findById(it.contentId) } | ||
val watchNextProgramItem = TvLauncherUtils.getWatchNextPrograms(context).find { it.id == programId } | ||
return watchNextProgramItem?.let { db.metadata().findById(it.contentId) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see how this more verbose code block is an improvement over the inline assignment using an elvis operator with less code repetition. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ittiam-sham Is there any benefit to expanding the existing code block? |
||
} | ||
|
||
companion object { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ | |
|
||
package com.android.tv.classics.utils | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.ContentResolver | ||
import android.content.Context | ||
import android.content.res.Resources | ||
|
@@ -37,7 +36,6 @@ import com.android.tv.classics.models.TvMediaCollection | |
|
||
/** Collection of static methods used to handle Android TV Home Screen Launcher operations */ | ||
@RequiresApi(26) | ||
@SuppressLint("RestrictedApi") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately the referenced library is restricted, so this lint suppression is needed here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This removal can be merged now that bug #138150076 has been resolved. |
||
class TvLauncherUtils private constructor() { | ||
companion object { | ||
private val TAG = TvLauncherUtils::class.java.simpleName | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removal can be merged now that bug #138150076 has been resolved.