-
Notifications
You must be signed in to change notification settings - Fork 342
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") #99
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 |
---|---|---|
|
@@ -398,20 +398,24 @@ class WatchNextTest { | |
// Insert a new row. | ||
rowId++ | ||
|
||
val programBuilder = WatchNextProgram.Builder() | ||
.setId(rowId) | ||
.setTitle(values?.getAsString(TvContractCompat.WatchNextPrograms.COLUMN_TITLE)) | ||
.setInternalProviderId( | ||
values?.getAsString( | ||
TvContractCompat.WatchNextPrograms | ||
.COLUMN_INTERNAL_PROVIDER_ID | ||
) | ||
) | ||
.setLastPlaybackPositionMillis( | ||
values!!.getAsInteger( | ||
TvContractCompat.WatchNextPrograms.COLUMN_LAST_PLAYBACK_POSITION_MILLIS | ||
) | ||
) | ||
val programBuilder = | ||
values?.getAsString(TvContractCompat.WatchNextPrograms.COLUMN_TITLE)?.let { | ||
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. What is the purpose of this refactoring? Reading the value first and providing it as a lambda is more difficult to understand, in my opinion. |
||
WatchNextProgram.Builder() | ||
.setId(rowId) | ||
.setTitle(it) | ||
.setInternalProviderId( | ||
values.getAsString( | ||
TvContractCompat.WatchNextPrograms | ||
.COLUMN_INTERNAL_PROVIDER_ID | ||
) | ||
) | ||
.setLastPlaybackPositionMillis( | ||
values!!.getAsInteger( | ||
TvContractCompat.WatchNextPrograms.COLUMN_LAST_PLAYBACK_POSITION_MILLIS | ||
) | ||
) | ||
} | ||
|
||
|
||
values.getAsInteger( | ||
TvContractCompat.WatchNextPrograms.COLUMN_SEASON_DISPLAY_NUMBER | ||
|
@@ -483,26 +487,31 @@ class WatchNextTest { | |
): Int { | ||
val id = uri.lastPathSegment?.toLong() ?: return 0 | ||
|
||
val program = WatchNextProgram.Builder() | ||
.setId(id) | ||
.setTitle(values?.getAsString(TvContractCompat.WatchNextPrograms.COLUMN_TITLE)) | ||
.setInternalProviderId( | ||
values?.getAsString( | ||
TvContractCompat | ||
.WatchNextPrograms.COLUMN_INTERNAL_PROVIDER_ID | ||
val program = values?.getAsString( | ||
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. Same comment here as above. |
||
TvContractCompat | ||
.WatchNextPrograms.COLUMN_INTERNAL_PROVIDER_ID | ||
)?.let { | ||
WatchNextProgram.Builder() | ||
.setId(id) | ||
.setTitle(values.getAsString(TvContractCompat.WatchNextPrograms.COLUMN_TITLE)) | ||
.setInternalProviderId( | ||
it | ||
) | ||
) | ||
.setLastPlaybackPositionMillis( | ||
values!!.getAsInteger( | ||
TvContractCompat.WatchNextPrograms.COLUMN_LAST_PLAYBACK_POSITION_MILLIS | ||
.setLastPlaybackPositionMillis( | ||
values.getAsInteger( | ||
TvContractCompat.WatchNextPrograms.COLUMN_LAST_PLAYBACK_POSITION_MILLIS | ||
) | ||
|
||
) | ||
) | ||
.build() | ||
.build() | ||
} | ||
|
||
// Since kotlin collections don't directly provide a replace function, for testing | ||
// purpose, remove existing and add new entry to avoid complexity. | ||
this.valuesInMemory.removeIf { it.id == id } | ||
this.valuesInMemory.add(program) | ||
if (program != null) { | ||
this.valuesInMemory.add(program) | ||
} | ||
return 1 | ||
} | ||
|
||
|
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.
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 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.