Cache requireArguments() in a local val

This commit is contained in:
tzugen 2021-05-04 09:37:10 +02:00
parent c8ecf4c123
commit 094c0d2757
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
1 changed files with 18 additions and 17 deletions

View File

@ -230,31 +230,32 @@ class SelectAlbumFragment : Fragment() {
} }
private fun updateDisplay(refresh: Boolean) { private fun updateDisplay(refresh: Boolean) {
val id = requireArguments().getString(Constants.INTENT_EXTRA_NAME_ID) val args = requireArguments()
val isAlbum = requireArguments().getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false) val id = args.getString(Constants.INTENT_EXTRA_NAME_ID)
val name = requireArguments().getString(Constants.INTENT_EXTRA_NAME_NAME) val isAlbum = args.getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
val parentId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PARENT_ID) val name = args.getString(Constants.INTENT_EXTRA_NAME_NAME)
val playlistId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID) val parentId = args.getString(Constants.INTENT_EXTRA_NAME_PARENT_ID)
val podcastChannelId = requireArguments().getString( val playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID)
val podcastChannelId = args.getString(
Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID
) )
val playlistName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME) val playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME)
val shareId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_SHARE_ID) val shareId = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_ID)
val shareName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME) val shareName = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME)
val albumListType = requireArguments().getString( val albumListType = args.getString(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE
) )
val genreName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME) val genreName = args.getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
val albumListTitle = requireArguments().getInt( val albumListTitle = args.getInt(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, 0 Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, 0
) )
val getStarredTracks = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0) val getStarredTracks = args.getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0)
val getVideos = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0) val getVideos = args.getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0)
val getRandomTracks = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0) val getRandomTracks = args.getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0)
val albumListSize = requireArguments().getInt( val albumListSize = args.getInt(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0 Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0
) )
val albumListOffset = requireArguments().getInt( val albumListOffset = args.getInt(
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0 Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0
) )