Welcome to use ItunesDemo (Download Apk)
An Android app that allows users to search for songs, albums, or artists using the iTunes API. The app provide the ability to filter and bookmark songs. It supports English, Traditional Chinese (Hong Kong), and Simplified Chinese (China) languages.
Just Watch a gif:
ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ
Enter keywords to perform a search:
After obtaining search results, the search box will display media and country categories below it. Clicking on these categories performs intersection filtering. For example, if you click "USA" and then "song," it filters out all songs from the USA. However, if you click "movie" and then "song", no results will be displayed. Clicking "song" alone filters out all songs, as shown in the image below.
In the music player, you can click on a song to listen to a preview of the song.:
For search results, if the media type is a song, clicking on the item will trigger a song playback popup for previewing the song. The same applies to the Favorites section. However, if the media type is not a song, the popup will not show. as shown in the image below
ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ
Switching between multiple pages of search results.:
In search results, you can navigate through multiple pages. Scrolling up displays the previous 20 results, while scrolling down shows the next 20 results. Each viewable set of results consists of 20 items, as illustrated in the following image.
· Use MVVM app architecture,retrofit2 + ViewModel + livedata
· Use OkHttp interceptor checkout http log
· Use glide library to show the image
· Use RecyclerView to show the data list
· Use SmartRefreshLayout library to load last page / next page data
· Use room library to achieve the favorites function
· Use junit、espresso and mockwebserver to achieve function、ui and network unit tests
ㅤ
ㅤ
ㅤ
ㅤ
ㅤ
ㅤ
ㅤ
ㅤ
ㅤ
search filtering:
· When filtering by country and media type, because it's an intersection filter, the selected types also need to exclude the unselected types. For example, if I select songs from the United States, I need to exclude movies and albums from China.
· When I select the "United States" label, it may include songs, movies, and albums under the United States category. So when I click on "songs," I need to remove movies and albums from the United States category.
· Therefore, each time a filtering label is clicked by the user, a targeted removal is performed on all the original results. That means, when "United States" is selected and then "songs" is clicked, it directly applies the filtering conditions to the original data, rather than extracting songs from the United States separately.
· This approach allows for a quick filtering function, especially when dealing with limited search results.
ㅤ ㅤ ㅤ ㅤ
multi-page loading:
· In the iTunes API, there are two parameters, "offset" and "limit." Among them, "limit" specifies the number of search results, while "offset" represents the offset.
· To implement pagination functionality, I chose the method of loading content by scrolling up and down. Whenever a new page is loaded, the offset is incremented by 20. Similarly, when loading the previous page, the offset is decreased by 20. When the offset is 0, no new API requests are made.
ㅤ ㅤ ㅤ
tap animation:
· When clicking on media of a song type, you can notice that its image has a transition animation. It utilizes the functionality of shared elements, allowing the shared display of controls between different activities, along with a transition animation.
ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ