Shorten INTENT Constants names
This commit is contained in:
parent
f1e789ea9b
commit
2ac1ea3f89
|
@ -76,8 +76,8 @@ public class LyricsFragment extends Fragment {
|
||||||
{
|
{
|
||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
if (arguments == null) return null;
|
if (arguments == null) return null;
|
||||||
String artist = arguments.getString(Constants.INTENT_EXTRA_NAME_ARTIST);
|
String artist = arguments.getString(Constants.INTENT_ARTIST);
|
||||||
String title = arguments.getString(Constants.INTENT_EXTRA_NAME_TITLE);
|
String title = arguments.getString(Constants.INTENT_TITLE);
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
return musicService.getLyrics(artist, title);
|
return musicService.getLyrics(artist, title);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,9 +102,9 @@ public class PlaylistsFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, playlist.getId());
|
bundle.putString(Constants.INTENT_ID, playlist.getId());
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId());
|
bundle.putString(Constants.INTENT_PLAYLIST_ID, playlist.getId());
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName());
|
bundle.putString(Constants.INTENT_PLAYLIST_NAME, playlist.getName());
|
||||||
Navigation.findNavController(getView()).navigate(R.id.trackCollectionFragment, bundle);
|
Navigation.findNavController(getView()).navigate(R.id.trackCollectionFragment, bundle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -187,16 +187,16 @@ public class PlaylistsFragment extends Fragment {
|
||||||
downloadHandler.getValue().downloadPlaylist(this, playlist.getId(), playlist.getName(), false, false, false, false, true, false, false);
|
downloadHandler.getValue().downloadPlaylist(this, playlist.getId(), playlist.getName(), false, false, false, false, true, false, false);
|
||||||
} else if (itemId == R.id.playlist_menu_play_now) {
|
} else if (itemId == R.id.playlist_menu_play_now) {
|
||||||
bundle = new Bundle();
|
bundle = new Bundle();
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId());
|
bundle.putString(Constants.INTENT_PLAYLIST_ID, playlist.getId());
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName());
|
bundle.putString(Constants.INTENT_PLAYLIST_NAME, playlist.getName());
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true);
|
bundle.putBoolean(Constants.INTENT_AUTOPLAY, true);
|
||||||
Navigation.findNavController(getView()).navigate(R.id.trackCollectionFragment, bundle);
|
Navigation.findNavController(getView()).navigate(R.id.trackCollectionFragment, bundle);
|
||||||
} else if (itemId == R.id.playlist_menu_play_shuffled) {
|
} else if (itemId == R.id.playlist_menu_play_shuffled) {
|
||||||
bundle = new Bundle();
|
bundle = new Bundle();
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID, playlist.getId());
|
bundle.putString(Constants.INTENT_PLAYLIST_ID, playlist.getId());
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME, playlist.getName());
|
bundle.putString(Constants.INTENT_PLAYLIST_NAME, playlist.getName());
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, true);
|
bundle.putBoolean(Constants.INTENT_AUTOPLAY, true);
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);
|
bundle.putBoolean(Constants.INTENT_SHUFFLE, true);
|
||||||
Navigation.findNavController(getView()).navigate(R.id.trackCollectionFragment, bundle);
|
Navigation.findNavController(getView()).navigate(R.id.trackCollectionFragment, bundle);
|
||||||
} else if (itemId == R.id.playlist_menu_delete) {
|
} else if (itemId == R.id.playlist_menu_delete) {
|
||||||
deletePlaylist(playlist);
|
deletePlaylist(playlist);
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class PodcastFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID, pc.getId());
|
bundle.putString(Constants.INTENT_PODCAST_CHANNEL_ID, pc.getId());
|
||||||
Navigation.findNavController(view).navigate(R.id.trackCollectionFragment, bundle);
|
Navigation.findNavController(view).navigate(R.id.trackCollectionFragment, bundle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,9 +75,9 @@ public class SelectGenreFragment extends Fragment {
|
||||||
if (genre != null)
|
if (genre != null)
|
||||||
{
|
{
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_GENRE_NAME, genre.getName());
|
bundle.putString(Constants.INTENT_GENRE_NAME, genre.getName());
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Settings.getMaxSongs());
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, Settings.getMaxSongs());
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0);
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_OFFSET, 0);
|
||||||
Navigation.findNavController(view).navigate(R.id.trackCollectionFragment, bundle);
|
Navigation.findNavController(view).navigate(R.id.trackCollectionFragment, bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,8 +104,8 @@ public class SharesFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_SHARE_ID, share.getId());
|
bundle.putString(Constants.INTENT_SHARE_ID, share.getId());
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_SHARE_NAME, share.getName());
|
bundle.putString(Constants.INTENT_SHARE_NAME, share.getName());
|
||||||
Navigation.findNavController(view).navigate(R.id.trackCollectionFragment, bundle);
|
Navigation.findNavController(view).navigate(R.id.trackCollectionFragment, bundle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class UltrasonicAppWidgetProvider extends AppWidgetProvider
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(context, NavigationActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
Intent intent = new Intent(context, NavigationActivity.class).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
if (playerActive)
|
if (playerActive)
|
||||||
intent.putExtra(Constants.INTENT_EXTRA_NAME_SHOW_PLAYER, true);
|
intent.putExtra(Constants.INTENT_SHOW_PLAYER, true);
|
||||||
|
|
||||||
intent.setAction("android.intent.action.MAIN");
|
intent.setAction("android.intent.action.MAIN");
|
||||||
intent.addCategory("android.intent.category.LAUNCHER");
|
intent.addCategory("android.intent.category.LAUNCHER");
|
||||||
|
|
|
@ -319,7 +319,7 @@ class NavigationActivity : AppCompatActivity() {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
if (intent == null) return
|
if (intent == null) return
|
||||||
|
|
||||||
if (intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_SHOW_PLAYER, false)) {
|
if (intent.getBooleanExtra(Constants.INTENT_SHOW_PLAYER, false)) {
|
||||||
findNavController(R.id.nav_host_fragment).navigate(R.id.playerFragment)
|
findNavController(R.id.nav_host_fragment).navigate(R.id.playerFragment)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -335,8 +335,8 @@ class NavigationActivity : AppCompatActivity() {
|
||||||
suggestions.saveRecentQuery(query, null)
|
suggestions.saveRecentQuery(query, null)
|
||||||
|
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_QUERY, query)
|
bundle.putString(Constants.INTENT_QUERY, query)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, autoPlay)
|
bundle.putBoolean(Constants.INTENT_AUTOPLAY, autoPlay)
|
||||||
findNavController(R.id.nav_host_fragment).navigate(R.id.searchFragment, bundle)
|
findNavController(R.id.nav_host_fragment).navigate(R.id.searchFragment, bundle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class AlbumListFragment : EntryListFragment<MusicDirectory.Album>() {
|
||||||
): LiveData<List<MusicDirectory.Album>> {
|
): LiveData<List<MusicDirectory.Album>> {
|
||||||
if (args == null) throw IllegalArgumentException("Required arguments are missing")
|
if (args == null) throw IllegalArgumentException("Required arguments are missing")
|
||||||
|
|
||||||
val refresh = args.getBoolean(Constants.INTENT_EXTRA_NAME_REFRESH) || refresh
|
val refresh = args.getBoolean(Constants.INTENT_REFRESH) || refresh
|
||||||
val append = args.getBoolean(Constants.INTENT_EXTRA_NAME_APPEND)
|
val append = args.getBoolean(Constants.INTENT_APPEND)
|
||||||
|
|
||||||
return listModel.getAlbumList(refresh or append, refreshListView!!, args)
|
return listModel.getAlbumList(refresh or append, refreshListView!!, args)
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class AlbumListFragment : EntryListFragment<MusicDirectory.Album>() {
|
||||||
// Triggered only when new data needs to be appended to the list
|
// Triggered only when new data needs to be appended to the list
|
||||||
// Add whatever code is needed to append new items to the bottom of the list
|
// Add whatever code is needed to append new items to the bottom of the list
|
||||||
val appendArgs = getArgumentsClone()
|
val appendArgs = getArgumentsClone()
|
||||||
appendArgs.putBoolean(Constants.INTENT_EXTRA_NAME_APPEND, true)
|
appendArgs.putBoolean(Constants.INTENT_APPEND, true)
|
||||||
getLiveData(appendArgs)
|
getLiveData(appendArgs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,10 +80,10 @@ class AlbumListFragment : EntryListFragment<MusicDirectory.Album>() {
|
||||||
|
|
||||||
override fun onItemClick(item: MusicDirectory.Album) {
|
override fun onItemClick(item: MusicDirectory.Album) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, item.id)
|
bundle.putString(Constants.INTENT_ID, item.id)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, item.isDirectory)
|
bundle.putBoolean(Constants.INTENT_IS_ALBUM, item.isDirectory)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, item.title)
|
bundle.putString(Constants.INTENT_NAME, item.title)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, item.parent)
|
bundle.putString(Constants.INTENT_PARENT_ID, item.parent)
|
||||||
findNavController().navigate(R.id.trackCollectionFragment, bundle)
|
findNavController().navigate(R.id.trackCollectionFragment, bundle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ArtistListFragment : EntryListFragment<ArtistOrIndex>() {
|
||||||
* The central function to pass a query to the model and return a LiveData object
|
* The central function to pass a query to the model and return a LiveData object
|
||||||
*/
|
*/
|
||||||
override fun getLiveData(args: Bundle?, refresh: Boolean): LiveData<List<ArtistOrIndex>> {
|
override fun getLiveData(args: Bundle?, refresh: Boolean): LiveData<List<ArtistOrIndex>> {
|
||||||
val refresh = args?.getBoolean(Constants.INTENT_EXTRA_NAME_REFRESH) ?: false || refresh
|
val refresh = args?.getBoolean(Constants.INTENT_REFRESH) ?: false || refresh
|
||||||
return listModel.getItems(refresh, refreshListView!!)
|
return listModel.getItems(refresh, refreshListView!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,22 +63,19 @@ class ArtistListFragment : EntryListFragment<ArtistOrIndex>() {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
|
|
||||||
// Common arguments
|
// Common arguments
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, item.id)
|
bundle.putString(Constants.INTENT_ID, item.id)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, item.name)
|
bundle.putString(Constants.INTENT_NAME, item.name)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, item.id)
|
bundle.putString(Constants.INTENT_PARENT_ID, item.id)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, (item is Artist))
|
bundle.putBoolean(Constants.INTENT_ARTIST, (item is Artist))
|
||||||
|
|
||||||
// Check type
|
// Check type
|
||||||
if (item is Index) {
|
if (item is Index) {
|
||||||
navController.navigate(R.id.artistsListToTrackCollection, bundle)
|
navController.navigate(R.id.artistsListToTrackCollection, bundle)
|
||||||
} else {
|
} else {
|
||||||
bundle.putString(
|
bundle.putString(Constants.INTENT_ALBUM_LIST_TYPE, Constants.ALBUMS_OF_ARTIST)
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE,
|
bundle.putString(Constants.INTENT_ALBUM_LIST_TITLE, item.name)
|
||||||
Constants.ALBUMS_OF_ARTIST
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, 1000)
|
||||||
)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_OFFSET, 0)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, item.name)
|
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 1000)
|
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0)
|
|
||||||
navController.navigate(R.id.artistsListToAlbumsList, bundle)
|
navController.navigate(R.id.artistsListToAlbumsList, bundle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ abstract class EntryListFragment<T : GenericEntry> : MultiListFragment<T>() {
|
||||||
|
|
||||||
override fun onItemClick(item: T) {
|
override fun onItemClick(item: T) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, item.id)
|
bundle.putString(Constants.INTENT_ID, item.id)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, item.name)
|
bundle.putString(Constants.INTENT_NAME, item.name)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, item.id)
|
bundle.putString(Constants.INTENT_PARENT_ID, item.id)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, (item is Artist))
|
bundle.putBoolean(Constants.INTENT_ARTIST, (item is Artist))
|
||||||
findNavController().navigate(R.id.trackCollectionFragment, bundle)
|
findNavController().navigate(R.id.trackCollectionFragment, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,21 +201,21 @@ class MainFragment : Fragment(), KoinComponent {
|
||||||
|
|
||||||
private fun showStarredSongs() {
|
private fun showStarredSongs() {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_STARRED, 1)
|
bundle.putInt(Constants.INTENT_STARRED, 1)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.mainToTrackCollection, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.mainToTrackCollection, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showRandomSongs() {
|
private fun showRandomSongs() {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_RANDOM, 1)
|
bundle.putInt(Constants.INTENT_RANDOM, 1)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Settings.maxSongs)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, Settings.maxSongs)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.mainToTrackCollection, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.mainToTrackCollection, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showArtists() {
|
private fun showArtists() {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(
|
bundle.putString(
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE,
|
Constants.INTENT_ALBUM_LIST_TITLE,
|
||||||
requireContext().resources.getString(R.string.main_artists_title)
|
requireContext().resources.getString(R.string.main_artists_title)
|
||||||
)
|
)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.mainToArtistList, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.mainToArtistList, bundle)
|
||||||
|
@ -224,10 +224,10 @@ class MainFragment : Fragment(), KoinComponent {
|
||||||
private fun showAlbumList(type: String, titleIndex: Int) {
|
private fun showAlbumList(type: String, titleIndex: Int) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val title = requireContext().resources.getString(titleIndex, "")
|
val title = requireContext().resources.getString(titleIndex, "")
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE, type)
|
bundle.putString(Constants.INTENT_ALBUM_LIST_TYPE, type)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, title)
|
bundle.putString(Constants.INTENT_ALBUM_LIST_TITLE, title)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Settings.maxAlbums)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, Settings.maxAlbums)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_OFFSET, 0)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.mainToAlbumList, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.mainToAlbumList, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class MainFragment : Fragment(), KoinComponent {
|
||||||
|
|
||||||
private fun showVideos() {
|
private fun showVideos() {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 1)
|
bundle.putInt(Constants.INTENT_VIDEOS, 1)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.mainToTrackCollection, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.mainToTrackCollection, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ abstract class MultiListFragment<T : Identifiable> : Fragment() {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
// Set the title if available
|
// Set the title if available
|
||||||
setTitle(arguments?.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE))
|
setTitle(arguments?.getString(Constants.INTENT_ALBUM_LIST_TITLE))
|
||||||
|
|
||||||
// Setup refresh handler
|
// Setup refresh handler
|
||||||
refreshListView = view.findViewById(refreshListId)
|
refreshListView = view.findViewById(refreshListId)
|
||||||
|
|
|
@ -123,15 +123,15 @@ class NowPlayingFragment : Fragment() {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
|
|
||||||
if (Settings.shouldUseId3Tags) {
|
if (Settings.shouldUseId3Tags) {
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, true)
|
bundle.putBoolean(Constants.INTENT_IS_ALBUM, true)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, song.albumId)
|
bundle.putString(Constants.INTENT_ID, song.albumId)
|
||||||
} else {
|
} else {
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
|
bundle.putBoolean(Constants.INTENT_IS_ALBUM, false)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, song.parent)
|
bundle.putString(Constants.INTENT_ID, song.parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, song.album)
|
bundle.putString(Constants.INTENT_NAME, song.album)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, song.album)
|
bundle.putString(Constants.INTENT_NAME, song.album)
|
||||||
|
|
||||||
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment)
|
Navigation.findNavController(requireActivity(), R.id.nav_host_fragment)
|
||||||
.navigate(R.id.trackCollectionFragment, bundle)
|
.navigate(R.id.trackCollectionFragment, bundle)
|
||||||
|
|
|
@ -339,7 +339,7 @@ class PlayerFragment :
|
||||||
registerForContextMenu(playlistView)
|
registerForContextMenu(playlistView)
|
||||||
|
|
||||||
if (arguments != null && requireArguments().getBoolean(
|
if (arguments != null && requireArguments().getBoolean(
|
||||||
Constants.INTENT_EXTRA_NAME_SHUFFLE,
|
Constants.INTENT_SHUFFLE,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
@ -579,10 +579,10 @@ class PlayerFragment :
|
||||||
|
|
||||||
if (Settings.shouldUseId3Tags) {
|
if (Settings.shouldUseId3Tags) {
|
||||||
bundle = Bundle()
|
bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, entry.artistId)
|
bundle.putString(Constants.INTENT_ID, entry.artistId)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.artist)
|
bundle.putString(Constants.INTENT_NAME, entry.artist)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, entry.artistId)
|
bundle.putString(Constants.INTENT_PARENT_ID, entry.artistId)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, true)
|
bundle.putBoolean(Constants.INTENT_ARTIST, true)
|
||||||
Navigation.findNavController(requireView())
|
Navigation.findNavController(requireView())
|
||||||
.navigate(R.id.playerToSelectAlbum, bundle)
|
.navigate(R.id.playerToSelectAlbum, bundle)
|
||||||
}
|
}
|
||||||
|
@ -593,10 +593,10 @@ class PlayerFragment :
|
||||||
|
|
||||||
val albumId = if (Settings.shouldUseId3Tags) entry.albumId else entry.parent
|
val albumId = if (Settings.shouldUseId3Tags) entry.albumId else entry.parent
|
||||||
bundle = Bundle()
|
bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, albumId)
|
bundle.putString(Constants.INTENT_ID, albumId)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, entry.album)
|
bundle.putString(Constants.INTENT_NAME, entry.album)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, entry.parent)
|
bundle.putString(Constants.INTENT_PARENT_ID, entry.parent)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, true)
|
bundle.putBoolean(Constants.INTENT_IS_ALBUM, true)
|
||||||
Navigation.findNavController(requireView())
|
Navigation.findNavController(requireView())
|
||||||
.navigate(R.id.playerToSelectAlbum, bundle)
|
.navigate(R.id.playerToSelectAlbum, bundle)
|
||||||
return true
|
return true
|
||||||
|
@ -605,8 +605,8 @@ class PlayerFragment :
|
||||||
if (entry == null) return false
|
if (entry == null) return false
|
||||||
|
|
||||||
bundle = Bundle()
|
bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ARTIST, entry.artist)
|
bundle.putString(Constants.INTENT_ARTIST, entry.artist)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_TITLE, entry.title)
|
bundle.putString(Constants.INTENT_TITLE, entry.title)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.playerToLyrics, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.playerToLyrics, bundle)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,8 +127,8 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
|
||||||
// Fragment was started with a query (e.g. from voice search), try to execute search right away
|
// Fragment was started with a query (e.g. from voice search), try to execute search right away
|
||||||
val arguments = arguments
|
val arguments = arguments
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
val query = arguments.getString(Constants.INTENT_EXTRA_NAME_QUERY)
|
val query = arguments.getString(Constants.INTENT_QUERY)
|
||||||
val autoPlay = arguments.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false)
|
val autoPlay = arguments.getBoolean(Constants.INTENT_AUTOPLAY, false)
|
||||||
if (query != null) {
|
if (query != null) {
|
||||||
return search(query, autoPlay)
|
return search(query, autoPlay)
|
||||||
}
|
}
|
||||||
|
@ -149,8 +149,8 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
|
||||||
|
|
||||||
val arguments = arguments
|
val arguments = arguments
|
||||||
val autoPlay = arguments != null &&
|
val autoPlay = arguments != null &&
|
||||||
arguments.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false)
|
arguments.getBoolean(Constants.INTENT_AUTOPLAY, false)
|
||||||
val query = arguments?.getString(Constants.INTENT_EXTRA_NAME_QUERY)
|
val query = arguments?.getString(Constants.INTENT_QUERY)
|
||||||
|
|
||||||
// If started with a query, enter it to the searchView
|
// If started with a query, enter it to the searchView
|
||||||
if (query != null) {
|
if (query != null) {
|
||||||
|
@ -268,32 +268,29 @@ class SearchFragment : MultiListFragment<Identifiable>(), KoinComponent {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
|
|
||||||
// Common arguments
|
// Common arguments
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, item.id)
|
bundle.putString(Constants.INTENT_ID, item.id)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, item.name)
|
bundle.putString(Constants.INTENT_NAME, item.name)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, item.id)
|
bundle.putString(Constants.INTENT_PARENT_ID, item.id)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, (item is Artist))
|
bundle.putBoolean(Constants.INTENT_ARTIST, (item is Artist))
|
||||||
|
|
||||||
// Check type
|
// Check type
|
||||||
if (item is Index) {
|
if (item is Index) {
|
||||||
findNavController().navigate(R.id.searchToTrackCollection, bundle)
|
findNavController().navigate(R.id.searchToTrackCollection, bundle)
|
||||||
} else {
|
} else {
|
||||||
bundle.putString(
|
bundle.putString(Constants.INTENT_ALBUM_LIST_TYPE, Constants.ALBUMS_OF_ARTIST)
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE,
|
bundle.putString(Constants.INTENT_ALBUM_LIST_TITLE, item.name)
|
||||||
Constants.ALBUMS_OF_ARTIST
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, 1000)
|
||||||
)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_OFFSET, 0)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, item.name)
|
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 1000)
|
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0)
|
|
||||||
findNavController().navigate(R.id.searchToAlbumsList, bundle)
|
findNavController().navigate(R.id.searchToAlbumsList, bundle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onAlbumSelected(album: MusicDirectory.Album, autoplay: Boolean) {
|
private fun onAlbumSelected(album: MusicDirectory.Album, autoplay: Boolean) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, album.id)
|
bundle.putString(Constants.INTENT_ID, album.id)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, album.title)
|
bundle.putString(Constants.INTENT_NAME, album.title)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, album.isDirectory)
|
bundle.putBoolean(Constants.INTENT_IS_ALBUM, album.isDirectory)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, autoplay)
|
bundle.putBoolean(Constants.INTENT_AUTOPLAY, autoplay)
|
||||||
Navigation.findNavController(requireView()).navigate(R.id.searchToTrackCollection, bundle)
|
Navigation.findNavController(requireView()).navigate(R.id.searchToTrackCollection, bundle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,8 +284,8 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val isArtist = arguments?.getBoolean(Constants.INTENT_EXTRA_NAME_ARTIST, false) ?: false
|
val isArtist = arguments?.getBoolean(Constants.INTENT_ARTIST, false) ?: false
|
||||||
val id = arguments?.getString(Constants.INTENT_EXTRA_NAME_ID)
|
val id = arguments?.getString(Constants.INTENT_ID)
|
||||||
|
|
||||||
if (hasSubFolders && id != null) {
|
if (hasSubFolders && id != null) {
|
||||||
downloadHandler.downloadRecursively(
|
downloadHandler.downloadRecursively(
|
||||||
|
@ -428,7 +428,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
|
|
||||||
// Hide more button when results are less than album list size
|
// Hide more button when results are less than album list size
|
||||||
if (musicDirectory.size < requireArguments().getInt(
|
if (musicDirectory.size < requireArguments().getInt(
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0
|
Constants.INTENT_ALBUM_LIST_SIZE, 0
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
moreButton!!.visibility = View.GONE
|
moreButton!!.visibility = View.GONE
|
||||||
|
@ -437,15 +437,15 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
moreButton!!.setOnClickListener {
|
moreButton!!.setOnClickListener {
|
||||||
val theGenre = requireArguments().getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
|
val theGenre = requireArguments().getString(Constants.INTENT_GENRE_NAME)
|
||||||
val size = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0)
|
val size = requireArguments().getInt(Constants.INTENT_ALBUM_LIST_SIZE, 0)
|
||||||
val theOffset = requireArguments().getInt(
|
val theOffset = requireArguments().getInt(
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0
|
Constants.INTENT_ALBUM_LIST_OFFSET, 0
|
||||||
) + size
|
) + size
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_GENRE_NAME, theGenre)
|
bundle.putString(Constants.INTENT_GENRE_NAME, theGenre)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, size)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, size)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, theOffset)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_OFFSET, theOffset)
|
||||||
|
|
||||||
Navigation.findNavController(requireView())
|
Navigation.findNavController(requireView())
|
||||||
.navigate(R.id.trackCollectionFragment, bundle)
|
.navigate(R.id.trackCollectionFragment, bundle)
|
||||||
|
@ -472,7 +472,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val listSize = arguments?.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0) ?: 0
|
val listSize = arguments?.getInt(Constants.INTENT_ALBUM_LIST_SIZE, 0) ?: 0
|
||||||
|
|
||||||
// Hide select button for video lists and singular selection lists
|
// Hide select button for video lists and singular selection lists
|
||||||
selectButton!!.isVisible = !allVideos && viewAdapter.hasMultipleSelection() && songCount > 0
|
selectButton!!.isVisible = !allVideos && viewAdapter.hasMultipleSelection() && songCount > 0
|
||||||
|
@ -482,15 +482,15 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
moreButton!!.visibility = View.GONE
|
moreButton!!.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
moreButton!!.visibility = View.VISIBLE
|
moreButton!!.visibility = View.VISIBLE
|
||||||
if (arguments?.getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0) ?: 0 > 0) {
|
if (arguments?.getInt(Constants.INTENT_RANDOM, 0) ?: 0 > 0) {
|
||||||
moreButton!!.setOnClickListener {
|
moreButton!!.setOnClickListener {
|
||||||
val offset = requireArguments().getInt(
|
val offset = requireArguments().getInt(
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0
|
Constants.INTENT_ALBUM_LIST_OFFSET, 0
|
||||||
) + listSize
|
) + listSize
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_RANDOM, 1)
|
bundle.putInt(Constants.INTENT_RANDOM, 1)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, listSize)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_SIZE, listSize)
|
||||||
bundle.putInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, offset)
|
bundle.putInt(Constants.INTENT_ALBUM_LIST_OFFSET, offset)
|
||||||
Navigation.findNavController(requireView()).navigate(
|
Navigation.findNavController(requireView()).navigate(
|
||||||
R.id.trackCollectionFragment, bundle
|
R.id.trackCollectionFragment, bundle
|
||||||
)
|
)
|
||||||
|
@ -505,7 +505,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
enableButtons()
|
enableButtons()
|
||||||
|
|
||||||
val isAlbumList = arguments?.containsKey(
|
val isAlbumList = arguments?.containsKey(
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE
|
Constants.INTENT_ALBUM_LIST_TYPE
|
||||||
) ?: false
|
) ?: false
|
||||||
|
|
||||||
playAllButtonVisible = !(isAlbumList || entryList.isEmpty()) && !allVideos
|
playAllButtonVisible = !(isAlbumList || entryList.isEmpty()) && !allVideos
|
||||||
|
@ -515,7 +515,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
shareButton?.isVisible = shareButtonVisible
|
shareButton?.isVisible = shareButtonVisible
|
||||||
|
|
||||||
if (songCount > 0 && listModel.showHeader) {
|
if (songCount > 0 && listModel.showHeader) {
|
||||||
val intentAlbumName = arguments?.getString(Constants.INTENT_EXTRA_NAME_NAME, "")
|
val intentAlbumName = arguments?.getString(Constants.INTENT_NAME, "")
|
||||||
val albumHeader = AlbumHeader(it, intentAlbumName)
|
val albumHeader = AlbumHeader(it, intentAlbumName)
|
||||||
val mixedList: MutableList<Identifiable> = mutableListOf(albumHeader)
|
val mixedList: MutableList<Identifiable> = mutableListOf(albumHeader)
|
||||||
mixedList.addAll(entryList)
|
mixedList.addAll(entryList)
|
||||||
|
@ -524,11 +524,11 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
viewAdapter.submitList(entryList)
|
viewAdapter.submitList(entryList)
|
||||||
}
|
}
|
||||||
|
|
||||||
val playAll = arguments?.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false) ?: false
|
val playAll = arguments?.getBoolean(Constants.INTENT_AUTOPLAY, false) ?: false
|
||||||
|
|
||||||
if (playAll && songCount > 0) {
|
if (playAll && songCount > 0) {
|
||||||
playAll(
|
playAll(
|
||||||
arguments?.getBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, false) ?: false,
|
arguments?.getBoolean(Constants.INTENT_SHUFFLE, false) ?: false,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -560,28 +560,22 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
refresh: Boolean
|
refresh: Boolean
|
||||||
): LiveData<List<MusicDirectory.Child>> {
|
): LiveData<List<MusicDirectory.Child>> {
|
||||||
if (args == null) return listModel.currentList
|
if (args == null) return listModel.currentList
|
||||||
val id = args.getString(Constants.INTENT_EXTRA_NAME_ID)
|
val id = args.getString(Constants.INTENT_ID)
|
||||||
val isAlbum = args.getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
|
val isAlbum = args.getBoolean(Constants.INTENT_IS_ALBUM, false)
|
||||||
val name = args.getString(Constants.INTENT_EXTRA_NAME_NAME)
|
val name = args.getString(Constants.INTENT_NAME)
|
||||||
val playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID)
|
val playlistId = args.getString(Constants.INTENT_PLAYLIST_ID)
|
||||||
val podcastChannelId = args.getString(
|
val podcastChannelId = args.getString(Constants.INTENT_PODCAST_CHANNEL_ID)
|
||||||
Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID
|
val playlistName = args.getString(Constants.INTENT_PLAYLIST_NAME)
|
||||||
)
|
val shareId = args.getString(Constants.INTENT_SHARE_ID)
|
||||||
val playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME)
|
val shareName = args.getString(Constants.INTENT_SHARE_NAME)
|
||||||
val shareId = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_ID)
|
val genreName = args.getString(Constants.INTENT_GENRE_NAME)
|
||||||
val shareName = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME)
|
|
||||||
val genreName = args.getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
|
|
||||||
|
|
||||||
val getStarredTracks = args.getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0)
|
val getStarredTracks = args.getInt(Constants.INTENT_STARRED, 0)
|
||||||
val getVideos = args.getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0)
|
val getVideos = args.getInt(Constants.INTENT_VIDEOS, 0)
|
||||||
val getRandomTracks = args.getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0)
|
val getRandomTracks = args.getInt(Constants.INTENT_RANDOM, 0)
|
||||||
val albumListSize = args.getInt(
|
val albumListSize = args.getInt(Constants.INTENT_ALBUM_LIST_SIZE, 0)
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0
|
val albumListOffset = args.getInt(Constants.INTENT_ALBUM_LIST_OFFSET, 0)
|
||||||
)
|
val refresh2 = args.getBoolean(Constants.INTENT_REFRESH, true) || refresh
|
||||||
val albumListOffset = args.getInt(
|
|
||||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0
|
|
||||||
)
|
|
||||||
val refresh2 = args.getBoolean(Constants.INTENT_EXTRA_NAME_REFRESH, true) || refresh
|
|
||||||
|
|
||||||
listModel.viewModelScope.launch(handler) {
|
listModel.viewModelScope.launch(handler) {
|
||||||
refreshListView?.isRefreshing = true
|
refreshListView?.isRefreshing = true
|
||||||
|
@ -698,10 +692,10 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
when {
|
when {
|
||||||
item.isDirectory -> {
|
item.isDirectory -> {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_ID, item.id)
|
bundle.putString(Constants.INTENT_ID, item.id)
|
||||||
bundle.putBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, item.isDirectory)
|
bundle.putBoolean(Constants.INTENT_IS_ALBUM, item.isDirectory)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_NAME, item.title)
|
bundle.putString(Constants.INTENT_NAME, item.title)
|
||||||
bundle.putString(Constants.INTENT_EXTRA_NAME_PARENT_ID, item.parent)
|
bundle.putString(Constants.INTENT_PARENT_ID, item.parent)
|
||||||
Navigation.findNavController(requireView()).navigate(
|
Navigation.findNavController(requireView()).navigate(
|
||||||
R.id.trackCollectionFragment,
|
R.id.trackCollectionFragment,
|
||||||
bundle
|
bundle
|
||||||
|
|
|
@ -24,7 +24,7 @@ class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||||
): LiveData<List<MusicDirectory.Album>> {
|
): LiveData<List<MusicDirectory.Album>> {
|
||||||
// Don't reload the data if navigating back to the view that was active before.
|
// Don't reload the data if navigating back to the view that was active before.
|
||||||
// This way, we keep the scroll position
|
// This way, we keep the scroll position
|
||||||
val albumListType = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE)!!
|
val albumListType = args.getString(Constants.INTENT_ALBUM_LIST_TYPE)!!
|
||||||
|
|
||||||
if (refresh || list.value?.isEmpty() != false || albumListType != lastType) {
|
if (refresh || list.value?.isEmpty() != false || albumListType != lastType) {
|
||||||
lastType = albumListType
|
lastType = albumListType
|
||||||
|
@ -51,10 +51,10 @@ class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||||
) {
|
) {
|
||||||
super.load(isOffline, useId3Tags, musicService, refresh, args)
|
super.load(isOffline, useId3Tags, musicService, refresh, args)
|
||||||
|
|
||||||
val albumListType = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE)!!
|
val albumListType = args.getString(Constants.INTENT_ALBUM_LIST_TYPE)!!
|
||||||
val size = args.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0)
|
val size = args.getInt(Constants.INTENT_ALBUM_LIST_SIZE, 0)
|
||||||
var offset = args.getInt(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0)
|
var offset = args.getInt(Constants.INTENT_ALBUM_LIST_OFFSET, 0)
|
||||||
val append = args.getBoolean(Constants.INTENT_EXTRA_NAME_APPEND, false)
|
val append = args.getBoolean(Constants.INTENT_APPEND, false)
|
||||||
|
|
||||||
val musicDirectory: List<MusicDirectory.Album>
|
val musicDirectory: List<MusicDirectory.Album>
|
||||||
val musicFolderId = if (showSelectFolderHeader(args)) {
|
val musicFolderId = if (showSelectFolderHeader(args)) {
|
||||||
|
@ -71,8 +71,8 @@ class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||||
return getAlbumsOfArtist(
|
return getAlbumsOfArtist(
|
||||||
musicService,
|
musicService,
|
||||||
refresh,
|
refresh,
|
||||||
args.getString(Constants.INTENT_EXTRA_NAME_ID, ""),
|
args.getString(Constants.INTENT_ID, ""),
|
||||||
args.getString(Constants.INTENT_EXTRA_NAME_NAME, "")
|
args.getString(Constants.INTENT_NAME, "")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||||
override fun showSelectFolderHeader(args: Bundle?): Boolean {
|
override fun showSelectFolderHeader(args: Bundle?): Boolean {
|
||||||
if (args == null) return false
|
if (args == null) return false
|
||||||
|
|
||||||
val albumListType = args.getString(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE)!!
|
val albumListType = args.getString(Constants.INTENT_ALBUM_LIST_TYPE)!!
|
||||||
|
|
||||||
val isAlphabetical = (albumListType == AlbumListType.SORTED_BY_NAME.toString()) ||
|
val isAlphabetical = (albumListType == AlbumListType.SORTED_BY_NAME.toString()) ||
|
||||||
(albumListType == AlbumListType.SORTED_BY_ARTIST.toString())
|
(albumListType == AlbumListType.SORTED_BY_ARTIST.toString())
|
||||||
|
|
|
@ -416,7 +416,7 @@ class CachedMusicService(private val musicService: MusicService) : MusicService,
|
||||||
override fun getVideos(refresh: Boolean): MusicDirectory? {
|
override fun getVideos(refresh: Boolean): MusicDirectory? {
|
||||||
checkSettingsChanged()
|
checkSettingsChanged()
|
||||||
var cache =
|
var cache =
|
||||||
if (refresh) null else cachedMusicDirectories[Constants.INTENT_EXTRA_NAME_VIDEOS]
|
if (refresh) null else cachedMusicDirectories[Constants.INTENT_VIDEOS]
|
||||||
var dir = cache?.get()
|
var dir = cache?.get()
|
||||||
if (dir == null) {
|
if (dir == null) {
|
||||||
dir = musicService.getVideos(refresh)
|
dir = musicService.getVideos(refresh)
|
||||||
|
@ -424,7 +424,7 @@ class CachedMusicService(private val musicService: MusicService) : MusicService,
|
||||||
Settings.directoryCacheTime.toLong(), TimeUnit.SECONDS
|
Settings.directoryCacheTime.toLong(), TimeUnit.SECONDS
|
||||||
)
|
)
|
||||||
cache.set(dir)
|
cache.set(dir)
|
||||||
cachedMusicDirectories.put(Constants.INTENT_EXTRA_NAME_VIDEOS, cache)
|
cachedMusicDirectories.put(Constants.INTENT_VIDEOS, cache)
|
||||||
}
|
}
|
||||||
return dir
|
return dir
|
||||||
}
|
}
|
||||||
|
|
|
@ -702,7 +702,7 @@ class MediaPlayerService : Service() {
|
||||||
val intent = Intent(this, NavigationActivity::class.java)
|
val intent = Intent(this, NavigationActivity::class.java)
|
||||||
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
val flags = PendingIntent.FLAG_UPDATE_CURRENT
|
val flags = PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
intent.putExtra(Constants.INTENT_EXTRA_NAME_SHOW_PLAYER, true)
|
intent.putExtra(Constants.INTENT_SHOW_PLAYER, true)
|
||||||
return PendingIntent.getActivity(this, 0, intent, flags)
|
return PendingIntent.getActivity(this, 0, intent, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class DownloadHandler(
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
val playlistName: String? = fragment.arguments?.getString(
|
val playlistName: String? = fragment.arguments?.getString(
|
||||||
Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME
|
Constants.INTENT_PLAYLIST_NAME
|
||||||
)
|
)
|
||||||
if (playlistName != null) {
|
if (playlistName != null) {
|
||||||
mediaPlayerController.suggestedPlaylistName = playlistName
|
mediaPlayerController.suggestedPlaylistName = playlistName
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ShareHandler(val context: Context) {
|
||||||
|
|
||||||
if (!shareDetails.ShareOnServer && shareDetails.Entries.size == 1) return null
|
if (!shareDetails.ShareOnServer && shareDetails.Entries.size == 1) return null
|
||||||
if (shareDetails.Entries.isEmpty()) {
|
if (shareDetails.Entries.isEmpty()) {
|
||||||
fragment.arguments?.getString(Constants.INTENT_EXTRA_NAME_ID).ifNotNull {
|
fragment.arguments?.getString(Constants.INTENT_ID).ifNotNull {
|
||||||
ids.add(it)
|
ids.add(it)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,31 +16,31 @@ object Constants {
|
||||||
const val REST_CLIENT_ID = "Ultrasonic"
|
const val REST_CLIENT_ID = "Ultrasonic"
|
||||||
|
|
||||||
// Names for intent extras.
|
// Names for intent extras.
|
||||||
const val INTENT_EXTRA_NAME_ID = "subsonic.id"
|
const val INTENT_ID = "subsonic.id"
|
||||||
const val INTENT_EXTRA_NAME_NAME = "subsonic.name"
|
const val INTENT_NAME = "subsonic.name"
|
||||||
const val INTENT_EXTRA_NAME_ARTIST = "subsonic.artist"
|
const val INTENT_ARTIST = "subsonic.artist"
|
||||||
const val INTENT_EXTRA_NAME_TITLE = "subsonic.title"
|
const val INTENT_TITLE = "subsonic.title"
|
||||||
const val INTENT_EXTRA_NAME_AUTOPLAY = "subsonic.playall"
|
const val INTENT_AUTOPLAY = "subsonic.playall"
|
||||||
const val INTENT_EXTRA_NAME_QUERY = "subsonic.query"
|
const val INTENT_QUERY = "subsonic.query"
|
||||||
const val INTENT_EXTRA_NAME_PLAYLIST_ID = "subsonic.playlist.id"
|
const val INTENT_PLAYLIST_ID = "subsonic.playlist.id"
|
||||||
const val INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID = "subsonic.podcastChannel.id"
|
const val INTENT_PODCAST_CHANNEL_ID = "subsonic.podcastChannel.id"
|
||||||
const val INTENT_EXTRA_NAME_PARENT_ID = "subsonic.parent.id"
|
const val INTENT_PARENT_ID = "subsonic.parent.id"
|
||||||
const val INTENT_EXTRA_NAME_PLAYLIST_NAME = "subsonic.playlist.name"
|
const val INTENT_PLAYLIST_NAME = "subsonic.playlist.name"
|
||||||
const val INTENT_EXTRA_NAME_SHARE_ID = "subsonic.share.id"
|
const val INTENT_SHARE_ID = "subsonic.share.id"
|
||||||
const val INTENT_EXTRA_NAME_SHARE_NAME = "subsonic.share.name"
|
const val INTENT_SHARE_NAME = "subsonic.share.name"
|
||||||
const val INTENT_EXTRA_NAME_ALBUM_LIST_TYPE = "subsonic.albumlisttype"
|
const val INTENT_ALBUM_LIST_TYPE = "subsonic.albumlisttype"
|
||||||
const val INTENT_EXTRA_NAME_ALBUM_LIST_TITLE = "subsonic.albumlisttitle"
|
const val INTENT_ALBUM_LIST_TITLE = "subsonic.albumlisttitle"
|
||||||
const val INTENT_EXTRA_NAME_ALBUM_LIST_SIZE = "subsonic.albumlistsize"
|
const val INTENT_ALBUM_LIST_SIZE = "subsonic.albumlistsize"
|
||||||
const val INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET = "subsonic.albumlistoffset"
|
const val INTENT_ALBUM_LIST_OFFSET = "subsonic.albumlistoffset"
|
||||||
const val INTENT_EXTRA_NAME_SHUFFLE = "subsonic.shuffle"
|
const val INTENT_SHUFFLE = "subsonic.shuffle"
|
||||||
const val INTENT_EXTRA_NAME_REFRESH = "subsonic.refresh"
|
const val INTENT_REFRESH = "subsonic.refresh"
|
||||||
const val INTENT_EXTRA_NAME_STARRED = "subsonic.starred"
|
const val INTENT_STARRED = "subsonic.starred"
|
||||||
const val INTENT_EXTRA_NAME_RANDOM = "subsonic.random"
|
const val INTENT_RANDOM = "subsonic.random"
|
||||||
const val INTENT_EXTRA_NAME_GENRE_NAME = "subsonic.genre"
|
const val INTENT_GENRE_NAME = "subsonic.genre"
|
||||||
const val INTENT_EXTRA_NAME_IS_ALBUM = "subsonic.isalbum"
|
const val INTENT_IS_ALBUM = "subsonic.isalbum"
|
||||||
const val INTENT_EXTRA_NAME_VIDEOS = "subsonic.videos"
|
const val INTENT_VIDEOS = "subsonic.videos"
|
||||||
const val INTENT_EXTRA_NAME_SHOW_PLAYER = "subsonic.showplayer"
|
const val INTENT_SHOW_PLAYER = "subsonic.showplayer"
|
||||||
const val INTENT_EXTRA_NAME_APPEND = "subsonic.append"
|
const val INTENT_APPEND = "subsonic.append"
|
||||||
|
|
||||||
// Names for Intent Actions
|
// Names for Intent Actions
|
||||||
const val CMD_PROCESS_KEYCODE = "org.moire.ultrasonic.CMD_PROCESS_KEYCODE"
|
const val CMD_PROCESS_KEYCODE = "org.moire.ultrasonic.CMD_PROCESS_KEYCODE"
|
||||||
|
|
Loading…
Reference in New Issue