Compare commits
84 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd872fc23d | ||
|
|
64a1966ad8 | ||
|
|
5ef5731fe3 | ||
|
|
c5cece8477 | ||
|
|
bae9221070 | ||
|
|
c0dbe01bf9 | ||
|
|
5f550b0df4 | ||
|
|
6100c3e7f1 | ||
|
|
f01ca9fed0 | ||
|
|
d232ebfa6f | ||
|
|
53ca88989f | ||
|
|
a82cf70433 | ||
|
|
89aa18b5f0 | ||
|
|
431014adc4 | ||
|
|
6110a9c8e7 | ||
|
|
993374e56c | ||
|
|
a2801f3168 | ||
|
|
99c31f4318 | ||
|
|
05785979e3 | ||
|
|
586a1a160e | ||
|
|
d04ed8d430 | ||
|
|
193447d07e | ||
|
|
1725b0de2e | ||
|
|
a2401302ed | ||
|
|
f39891dd2c | ||
|
|
8c5390bfef | ||
|
|
10673a49d4 | ||
|
|
3ce34fb874 | ||
|
|
5c94e9122c | ||
|
|
8140e80d61 | ||
|
|
c1b2ec09a4 | ||
|
|
3b3f55c5de | ||
|
|
17020e5192 | ||
|
|
f22aea7b1d | ||
|
|
844b57054b | ||
|
|
8de9aff1f6 | ||
|
|
f59f572e5c | ||
|
|
da2221540e | ||
|
|
9fa29c183a | ||
|
|
d034171d92 | ||
|
|
3a30b3d379 | ||
|
|
2624f396e5 | ||
|
|
8ae32a3a22 | ||
|
|
3c1975f6bf | ||
|
|
43a96faca4 | ||
|
|
bbd6d0864c | ||
|
|
ccea7674bd | ||
|
|
7f332c26ad | ||
|
|
206a7f38ca | ||
|
|
16e0a5e12e | ||
|
|
c6896939e2 | ||
|
|
526253723b | ||
|
|
9350a9cc2e | ||
|
|
e2ec2e4602 | ||
|
|
bca2e8fcae | ||
|
|
43674ea1f9 | ||
|
|
373a1f87a1 | ||
|
|
e14a595fba | ||
|
|
727e137008 | ||
|
|
883d853129 | ||
|
|
0d329aff64 | ||
|
|
94cb6fa279 | ||
|
|
257d80ecac | ||
|
|
d0f77fe0fc | ||
|
|
e95b504dbb | ||
|
|
0b68799507 | ||
|
|
9167be2cf2 | ||
|
|
d426c08cdd | ||
|
|
972c32b9d8 | ||
|
|
a279e20a49 | ||
|
|
fe60fea928 | ||
|
|
c6df43da9c | ||
|
|
475ed3e7c8 | ||
|
|
fb4c762655 | ||
|
|
a110faabe3 | ||
|
|
df2bf43492 | ||
|
|
b46fea6890 | ||
|
|
213a0d5293 | ||
|
|
08b6379601 | ||
|
|
3fbadc2521 | ||
|
|
9e78caeda4 | ||
|
|
e072a49288 | ||
|
|
b89e18eebf | ||
|
|
63607794d6 |
43
CHANGELOG.md
43
CHANGELOG.md
@@ -1,11 +1,46 @@
|
||||
# Changelog
|
||||
|
||||
## Pending release...
|
||||
## [4.6.3](https://github.com/eddyizm/tempo/releases/tag/v4.6.3) (2026-01-10)
|
||||
* fix: give user feedback when trying to add podcast/radio on unsupport… by @eddyizm in https://github.com/eddyizm/tempus/pull/328
|
||||
* docs: Clarify Android Auto enablement by @Forage in https://github.com/eddyizm/tempus/pull/336
|
||||
* fix: instant mix gets a big refactor, with cascading fallbacks to produce a larger queue by @eddyizm in https://github.com/eddyizm/tempus/pull/330
|
||||
* chore(i18n): add missing keys, update Chinese translation and alphabetize by @hongwei1203 in https://github.com/eddyizm/tempus/pull/332
|
||||
* chore(i18n): Update Polish translation by @skajmer in https://github.com/eddyizm/tempus/pull/339
|
||||
* feat: Ability to toggle visibility of artist biography by @kmarius in https://github.com/eddyizm/tempus/pull/338
|
||||
|
||||
* chore: bringing in media service refactor previously reverted after more testing by @eddyizm in https://github.com/eddyizm/tempus/pull/286
|
||||
* fix: refactor start queue to put the db writing in the background by @eddyizm in https://github.com/eddyizm/tempus/pull/287
|
||||
* Feat: playerqueue fab allows playqueue actions -> saving to playlist, download all, load queue, shuffle, clean queue by @eddyizm in https://github.com/eddyizm/tempus/pull/288
|
||||
## [4.6.0](https://github.com/eddyizm/tempo/releases/tag/v4.6.0) (2025-12-22)
|
||||
* chore: Update description_empty_title in English and Polish by @tyren234 in https://github.com/eddyizm/tempus/pull/307
|
||||
* chore(i18n): Update Polish translation by @skajmer in https://github.com/eddyizm/tempus/pull/310
|
||||
* fix: checks preference and writes files externally, updates the ui by @eddyizm in https://github.com/eddyizm/tempus/pull/312
|
||||
* chore: Update description_empty_title in Italian by @pochopsp in https://github.com/eddyizm/tempus/pull/314
|
||||
* chore: Update description_empty_title in French and Spanish by @pochopsp in https://github.com/eddyizm/tempus/pull/315
|
||||
* feat: added regular playlist to home view by @eddyizm in https://github.com/eddyizm/tempus/pull/322
|
||||
|
||||
## New Contributors
|
||||
* @tyren234 made their first contribution in https://github.com/eddyizm/tempus/pull/307
|
||||
* @pochopsp made their first contribution in https://github.com/eddyizm/tempus/pull/314
|
||||
|
||||
|
||||
## [4.5.0](https://github.com/eddyizm/tempo/releases/tag/v4.5.0) (2025-12-12)
|
||||
## What's Changed
|
||||
* fix: updates starred syncing downloads to user defined directory by @eddyizm in https://github.com/eddyizm/tempus/pull/298
|
||||
* fix: handle empty albums and null mappings by @eddyizm in https://github.com/eddyizm/tempus/pull/301
|
||||
* feat: integrate sort recent searches chronologically by @J4mm3ris in https://github.com/eddyizm/tempus/pull/300
|
||||
* feat: add heart to artist/album pages, fixed artist cover art failing by @eddyizm in https://github.com/eddyizm/tempus/pull/303
|
||||
|
||||
## New Contributors
|
||||
* @J4mm3ris made their first contribution in https://github.com/eddyizm/tempus/pull/300
|
||||
|
||||
**Full Changelog**: https://github.com/eddyizm/tempus/compare/v4.4.0...v4.5.0
|
||||
|
||||
## [4.4.0](https://github.com/eddyizm/tempo/releases/tag/v4.4.0) (2025-11-29)
|
||||
## What's Changed
|
||||
* chore: bringing in media service refactor previously reverted after more testing by @eddyizm in https://github.com/eddyizm/tempus/pull/286
|
||||
* fix: refactor start queue to put the db writing in the background to address instant mix bug by @eddyizm in https://github.com/eddyizm/tempus/pull/287
|
||||
* Feat: playerqueue fab allows playqueue actions -> saving to playlist, download all, load queue, shuffle, clean queue by @eddyizm in https://github.com/eddyizm/tempus/pull/288
|
||||
* chore(i18n): Update Polish translation by @skajmer in https://github.com/eddyizm/tempus/pull/291
|
||||
|
||||
**Full Changelog**: https://github.com/eddyizm/tempus/compare/v4.3.0...v4.4.0
|
||||
|
||||
## [4.3.0](https://github.com/eddyizm/tempo/releases/tag/v4.3.0) (2025-11-23)
|
||||
## What's Changed
|
||||
|
||||
13
README.md
13
README.md
@@ -10,8 +10,8 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
<!-- Reproducible build -->
|
||||
[<img src="https://shields.rbtlog.dev/simple/com.eddyizm.degoogled.tempus" alt="RB Status">](https://shields.rbtlog.dev/com.eddyizm.degoogled.tempus)
|
||||
<!-- Reproducible build -->
|
||||
<a href="https://shields.rbtlog.dev/com.eddyizm.degoogled.tempus"><img src="https://shields.rbtlog.dev/simple/com.eddyizm.degoogled.tempus" alt="RB Status"></a>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
**Tempus** is an open-source and lightweight music client for Subsonic, designed and built natively for Android. It provides a seamless and intuitive music streaming experience, allowing you to access and play your Subsonic music library directly from your Android device.
|
||||
|
||||
Tempus does not rely on magic algorithms to decide what you should listen to. Instead, the interface is built around your listening history, randomness, and optionally integrates with services like Last.fm to personalize your music experience.
|
||||
Tempus does not rely on magic algorithms to decide what you should listen to. Instead, the interface is built around your listening history, randomness, and optionally integrates with services like Listenbrainz.org and Last.fm to personalize your music experience (These must be supported by your backend).
|
||||
|
||||
The project is a fork of [Tempo](#credits).
|
||||
|
||||
@@ -59,16 +59,19 @@ Please note the two variants in the release assets include release/debug and 32/
|
||||
- **Streaming and Offline Mode**: Stream music directly from your Subsonic server. Offline mode is currently under active development and may have limitations when using multiple servers.
|
||||
- **Playlist Management**: Create, edit, and manage playlists to curate your perfect music collection.
|
||||
- **Gapless Playback**: Experience uninterrupted playback with gapless listening mode.
|
||||
- **Chromecast Support**: Stream your music to Chromecast devices. The support is currently in a rudimentary state.
|
||||
- **Chromecast Support**: Stream your music to Chromecast devices. The support is currently in a rudimentary state.*
|
||||
- **Scrobbling Integration**: Optionally integrate Tempus with Last.fm or Listenbrainz.org to scrobble your played tracks, gather music insights, and further personalize your music recommendations, if supported by your Subsonic server.
|
||||
- **Podcasts and Radio**: If your Subsonic server supports it, listen to podcasts and radio shows directly within Tempus, expanding your audio entertainment options.
|
||||
- **Instant Mix**: Full refactor of instant mix function which leverages subsonics similar songs by artist/album and randomSongs endpoints to server a larger play queue more reliably.
|
||||
- **Transcoding Support**: Activate transcoding of tracks on your Subsonic server, allowing you to set a transcoding profile for optimized streaming directly from the app. This feature requires support from your Subsonic server.
|
||||
- **Android Auto Support**: Enjoy your favorite music on the go with full Android Auto integration, allowing you to seamlessly control and listen to your tracks directly from your mobile device while driving.
|
||||
- **Android Auto Support**: Enjoy your favorite music on the go with full Android Auto integration, allowing you to seamlessly control and listen to your tracks directly from your mobile device while driving.*
|
||||
- **Multiple Libraries**: Tempus handles multi-library setups gracefully. They are displayed as Library folders.
|
||||
- **Equalizer**: Option to use in app equalizer.
|
||||
- **Widget**: New widget to keeping the basic controls on your screen at all times.
|
||||
- **Available in 11 languages**: Currently in Chinese, French, German, Italian, Korean, Polish, Portuguese, Russion, Spanish and Turkish
|
||||
|
||||
**Github version only*
|
||||
|
||||
## Screenshot
|
||||
|
||||
<p align="center">
|
||||
|
||||
20
USAGE.md
20
USAGE.md
@@ -30,7 +30,7 @@ This app works with any service that implements the Subsonic API, including:
|
||||
- [Gonic](https://github.com/sentriz/gonic)
|
||||
- [Ampache](https://github.com/ampache/ampache)
|
||||
- [NextCloud Music](https://apps.nextcloud.com/apps/music)
|
||||
|
||||
- [Airsonic Advanced](https://github.com/kagemomiji/airsonic-advanced)
|
||||
|
||||
|
||||
|
||||
@@ -160,7 +160,23 @@ If your server supports it - add a internet radio station feed
|
||||
## Android Auto
|
||||
|
||||
### Enabling on your head unit
|
||||
- You have to enable Android Auto developer options, which are different from actual Android dev options. Then you have to enable "Unknown sources" in Android Auto, otherwise the app won't appear as it isn't downloaded from Play Store. (screenshots needed)
|
||||
To allow the Tempus app on your car's head unit, "Unknown sources" needs to be enabled in the Android Auto "Developer settings". This is because Tempus isn't installed through Play Store. Note that the Android Auto developer settings are different from the global Android "Developer options".
|
||||
1. Switch to developer mode in the Android Auto settings by tapping ten times on the "Version" item at the bottom, followed by giving your permission.
|
||||
<p align="left">
|
||||
<img width="270" height="600" alt="1a" src="https://github.com/user-attachments/assets/f09f6999-9761-4b05-8ec7-bf221a15dda3" />
|
||||
<img width="270" height="600" alt="1b" src="https://github.com/user-attachments/assets/0795e508-ba01-41c5-96a7-7c03b0156591" />
|
||||
<img width="270" height="600" alt="1c" src="https://github.com/user-attachments/assets/51c15f67-fddb-452e-b5d3-5092edeab390" />
|
||||
</p>
|
||||
|
||||
2. Go to the "Developer settings" by the menu at the top right.
|
||||
<p align="left">
|
||||
<img width="270" height="600" alt="2" src="https://github.com/user-attachments/assets/1ecd1f3e-026d-4d25-87f2-be7f12efbac6" />
|
||||
</p>
|
||||
|
||||
3. Scroll down to the bottom and check "Unknown sources".
|
||||
<p align="left">
|
||||
<img width="270" height="600" alt="3" src="https://github.com/user-attachments/assets/37db88e9-1b76-417f-9c47-da9f3a750fff" />
|
||||
</p>
|
||||
|
||||
|
||||
### Server Settings
|
||||
|
||||
@@ -10,8 +10,8 @@ android {
|
||||
minSdkVersion 24
|
||||
targetSdk 35
|
||||
|
||||
versionCode 9
|
||||
versionName '4.4.0'
|
||||
versionCode 12
|
||||
versionName '4.6.3'
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
||||
javaCompileOptions {
|
||||
|
||||
1158
app/schemas/com.cappielloantonio.tempo.database.AppDatabase/13.json
Normal file
1158
app/schemas/com.cappielloantonio.tempo.database.AppDatabase/13.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ import com.cappielloantonio.tempo.subsonic.models.Playlist;
|
||||
|
||||
@UnstableApi
|
||||
@Database(
|
||||
version = 12,
|
||||
version = 13,
|
||||
entities = {Queue.class, Server.class, RecentSearch.class, Download.class, Chronology.class, Favorite.class, SessionMediaItem.class, Playlist.class, LyricsCache.class},
|
||||
autoMigrations = {@AutoMigration(from = 10, to = 11), @AutoMigration(from = 11, to = 12)}
|
||||
)
|
||||
|
||||
@@ -12,9 +12,12 @@ import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface RecentSearchDao {
|
||||
@Query("SELECT * FROM recent_search ORDER BY search DESC")
|
||||
@Query("SELECT search FROM recent_search ORDER BY timestamp DESC")
|
||||
List<String> getRecent();
|
||||
|
||||
@Query("SELECT search FROM recent_search ORDER BY search DESC")
|
||||
List<String> getAlpha();
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(RecentSearch search);
|
||||
|
||||
|
||||
@@ -13,5 +13,8 @@ import kotlinx.parcelize.Parcelize
|
||||
data class RecentSearch(
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "search")
|
||||
var search: String
|
||||
var search: String,
|
||||
|
||||
@ColumnInfo(name = "timestamp", defaultValue = "0")
|
||||
var timestamp: Long
|
||||
) : Parcelable
|
||||
|
||||
@@ -2,15 +2,16 @@ package com.cappielloantonio.tempo.repository;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.cappielloantonio.tempo.App;
|
||||
import com.cappielloantonio.tempo.interfaces.DecadesCallback;
|
||||
import com.cappielloantonio.tempo.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumInfo;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.util.Constants.SeedType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -204,29 +205,12 @@ public class AlbumRepository {
|
||||
return albumInfo;
|
||||
}
|
||||
|
||||
public void getInstantMix(AlbumID3 album, int count, MediaCallback callback) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getBrowsingClient()
|
||||
.getSimilarSongs2(album.getId(), count)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSimilarSongs2() != null) {
|
||||
songs.addAll(response.body().getSubsonicResponse().getSimilarSongs2().getSongs());
|
||||
}
|
||||
|
||||
callback.onLoadMedia(songs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
callback.onLoadMedia(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
public MutableLiveData<List<Child>> getInstantMix(AlbumID3 album, int count) {
|
||||
// Delegate to the centralized SongRepository
|
||||
return new SongRepository().getInstantMix(album.getId(), SeedType.ALBUM, count);
|
||||
}
|
||||
|
||||
|
||||
public MutableLiveData<List<Integer>> getDecades() {
|
||||
MutableLiveData<List<Integer>> decades = new MutableLiveData<>();
|
||||
|
||||
@@ -237,7 +221,7 @@ public class AlbumRepository {
|
||||
@Override
|
||||
public void onLoadYear(int last) {
|
||||
if (first != -1 && last != -1) {
|
||||
List<Integer> decadeList = new ArrayList();
|
||||
List<Integer> decadeList = new ArrayList<>();
|
||||
|
||||
int startDecade = first - (first % 10);
|
||||
int lastDecade = last - (last % 10);
|
||||
@@ -298,4 +282,4 @@ public class AlbumRepository {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,14 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import android.util.Log;
|
||||
|
||||
import com.cappielloantonio.tempo.App;
|
||||
import com.cappielloantonio.tempo.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistInfo2;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.IndexID3;
|
||||
import com.cappielloantonio.tempo.util.Constants.SeedType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -149,7 +151,7 @@ public class ArtistRepository {
|
||||
|
||||
if(response.body().getSubsonicResponse().getArtists() != null && response.body().getSubsonicResponse().getArtists().getIndices() != null) {
|
||||
for (IndexID3 index : response.body().getSubsonicResponse().getArtists().getIndices()) {
|
||||
if(index != null && index.getArtists() != null) {
|
||||
if(index.getArtists() != null) {
|
||||
artists.addAll(index.getArtists());
|
||||
}
|
||||
}
|
||||
@@ -287,26 +289,8 @@ public class ArtistRepository {
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getInstantMix(ArtistID3 artist, int count) {
|
||||
MutableLiveData<List<Child>> instantMix = new MutableLiveData<>();
|
||||
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getBrowsingClient()
|
||||
.getSimilarSongs2(artist.getId(), count)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSimilarSongs2() != null) {
|
||||
instantMix.setValue(response.body().getSubsonicResponse().getSimilarSongs2().getSongs());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return instantMix;
|
||||
// Delegate to the centralized SongRepository
|
||||
return new SongRepository().getInstantMix(artist.getId(), SeedType.ARTIST, count);
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getRandomSong(ArtistID3 artist, int count) {
|
||||
|
||||
@@ -66,88 +66,33 @@ public class PodcastRepository {
|
||||
return liveNewestPodcastEpisodes;
|
||||
}
|
||||
|
||||
public void refreshPodcasts() {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> refreshPodcasts() {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getPodcastClient()
|
||||
.refreshPodcasts()
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.refreshPodcasts();
|
||||
}
|
||||
|
||||
public void createPodcastChannel(String url) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> createPodcastChannel(String url) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getPodcastClient()
|
||||
.createPodcastChannel(url)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.createPodcastChannel(url);
|
||||
}
|
||||
|
||||
public void deletePodcastChannel(String channelId) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> deletePodcastChannel(String channelId) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getPodcastClient()
|
||||
.deletePodcastChannel(channelId)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.deletePodcastChannel(channelId);
|
||||
}
|
||||
|
||||
public void deletePodcastEpisode(String episodeId) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> deletePodcastEpisode(String episodeId) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getPodcastClient()
|
||||
.deletePodcastEpisode(episodeId)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.deletePodcastEpisode(episodeId);
|
||||
}
|
||||
|
||||
public void downloadPodcastEpisode(String episodeId) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> downloadPodcastEpisode(String episodeId) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getPodcastClient()
|
||||
.downloadPodcastEpisode(episodeId)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.downloadPodcastEpisode(episodeId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,54 +38,22 @@ public class RadioRepository {
|
||||
return radioStation;
|
||||
}
|
||||
|
||||
public void createInternetRadioStation(String name, String streamURL, String homepageURL) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> createInternetRadioStation(String name, String streamURL, String homepageURL) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getInternetRadioClient()
|
||||
.createInternetRadioStation(streamURL, name, homepageURL)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.createInternetRadioStation(streamURL, name, homepageURL);
|
||||
}
|
||||
|
||||
public void updateInternetRadioStation(String id, String name, String streamURL, String homepageURL) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> updateInternetRadioStation(String id, String name, String streamURL, String homepageURL) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getInternetRadioClient()
|
||||
.updateInternetRadioStation(id, streamURL, name, homepageURL)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.updateInternetRadioStation(id, streamURL, name, homepageURL);
|
||||
}
|
||||
|
||||
public void deleteInternetRadioStation(String id) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
public Call<ApiResponse> deleteInternetRadioStation(String id) {
|
||||
return App.getSubsonicClientInstance(false)
|
||||
.getInternetRadioClient()
|
||||
.deleteInternetRadioStation(id)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
.deleteInternetRadioStation(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.SearchResult2;
|
||||
import com.cappielloantonio.tempo.subsonic.models.SearchResult3;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -186,7 +187,12 @@ public class SearchingRepository {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
recent = recentSearchDao.getRecent();
|
||||
if(Preferences.isSearchSortingChronologicallyEnabled()){
|
||||
recent = recentSearchDao.getRecent();
|
||||
}
|
||||
else {
|
||||
recent = recentSearchDao.getAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getRecent() {
|
||||
|
||||
@@ -1,22 +1,33 @@
|
||||
package com.cappielloantonio.tempo.repository;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.tempo.App;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.SubsonicResponse;
|
||||
import com.cappielloantonio.tempo.util.Constants.SeedType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class SongRepository {
|
||||
|
||||
private static final String TAG = "SongRepository";
|
||||
public interface MediaCallbackInternal {
|
||||
void onSongsAvailable(List<Child> songs);
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getStarredSongs(boolean random, int size) {
|
||||
MutableLiveData<List<Child>> starredSongs = new MutableLiveData<>(Collections.emptyList());
|
||||
@@ -42,219 +53,332 @@ public class SongRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
|
||||
return starredSongs;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getInstantMix(String id, int count) {
|
||||
MutableLiveData<List<Child>> instantMix = new MutableLiveData<>();
|
||||
/**
|
||||
* Used by ViewModels. Updates the LiveData list incrementally as songs are found.
|
||||
*/
|
||||
public MutableLiveData<List<Child>> getInstantMix(String id, SeedType type, int count) {
|
||||
MutableLiveData<List<Child>> instantMix = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getBrowsingClient()
|
||||
.getSimilarSongs2(id, count)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSimilarSongs2() != null) {
|
||||
instantMix.setValue(response.body().getSubsonicResponse().getSimilarSongs2().getSongs());
|
||||
performSmartMix(id, type, count, songs -> {
|
||||
List<Child> current = instantMix.getValue();
|
||||
if (current != null) {
|
||||
for (Child s : songs) {
|
||||
if (!current.contains(s)) current.add(s);
|
||||
}
|
||||
|
||||
if (current.size() < count / 2) {
|
||||
fillWithRandom(count - current.size(), remainder -> {
|
||||
for (Child r : remainder) {
|
||||
if (!current.contains(r)) current.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
instantMix.setValue(null);
|
||||
}
|
||||
});
|
||||
instantMix.postValue(current);
|
||||
});
|
||||
} else {
|
||||
instantMix.postValue(current);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return instantMix;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getRandomSample(int number, Integer fromYear, Integer toYear) {
|
||||
MutableLiveData<List<Child>> randomSongsSample = new MutableLiveData<>();
|
||||
/**
|
||||
* Overloaded method used by other Repositories
|
||||
*/
|
||||
public void getInstantMix(String id, SeedType type, int count, MediaCallbackInternal callback) {
|
||||
new MediaCallbackAccumulator(callback, count).start(id, type);
|
||||
}
|
||||
|
||||
private class MediaCallbackAccumulator {
|
||||
private final MediaCallbackInternal originalCallback;
|
||||
private final int targetCount;
|
||||
private final List<Child> accumulatedSongs = new ArrayList<>();
|
||||
private final Set<String> trackIds = new HashSet<>();
|
||||
private boolean isComplete = false;
|
||||
|
||||
MediaCallbackAccumulator(MediaCallbackInternal callback, int count) {
|
||||
this.originalCallback = callback;
|
||||
this.targetCount = count;
|
||||
}
|
||||
|
||||
void start(String id, SeedType type) {
|
||||
performSmartMix(id, type, targetCount, this::onBatchReceived);
|
||||
}
|
||||
|
||||
private void onBatchReceived(List<Child> batch) {
|
||||
if (isComplete || batch == null || batch.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int added = 0;
|
||||
for (Child song : batch) {
|
||||
if (!trackIds.contains(song.getId()) && accumulatedSongs.size() < targetCount) {
|
||||
trackIds.add(song.getId());
|
||||
accumulatedSongs.add(song);
|
||||
added++;
|
||||
}
|
||||
}
|
||||
|
||||
if (accumulatedSongs.size() >= targetCount) {
|
||||
originalCallback.onSongsAvailable(new ArrayList<>(accumulatedSongs));
|
||||
isComplete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void performSmartMix(final String id, final SeedType type, final int count, final MediaCallbackInternal callback) {
|
||||
switch (type) {
|
||||
case ARTIST:
|
||||
fetchSimilarByArtist(id, count, callback);
|
||||
break;
|
||||
case ALBUM:
|
||||
fetchAlbumSongsThenSimilar(id, count, callback);
|
||||
break;
|
||||
case TRACK:
|
||||
fetchSingleTrackThenSimilar(id, count, callback);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchAlbumSongsThenSimilar(String albumId, int count, MediaCallbackInternal callback) {
|
||||
App.getSubsonicClientInstance(false).getBrowsingClient().getAlbum(albumId).enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null &&
|
||||
response.body().getSubsonicResponse().getAlbum() != null) {
|
||||
List<Child> albumSongs = response.body().getSubsonicResponse().getAlbum().getSongs();
|
||||
if (albumSongs != null && !albumSongs.isEmpty()) {
|
||||
int fromAlbum = Math.min(count, albumSongs.size());
|
||||
List<Child> limitedAlbumSongs = albumSongs.subList(0, fromAlbum);
|
||||
callback.onSongsAvailable(new ArrayList<>(limitedAlbumSongs));
|
||||
|
||||
int remaining = count - fromAlbum;
|
||||
if (remaining > 0 && albumSongs.get(0).getArtistId() != null) {
|
||||
fetchSimilarByArtist(albumSongs.get(0).getArtistId(), remaining, callback);
|
||||
} else if (remaining > 0) {
|
||||
Log.d(TAG, "No artistId available, skipping similar artist fetch");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "Album fetch failed or empty, calling fillWithRandom");
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
Log.d(TAG, "Album fetch failed: " + t.getMessage());
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fetchSimilarByArtist(String artistId, final int count, final MediaCallbackInternal callback) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getAlbumSongListClient()
|
||||
.getRandomSongs(number, fromYear, toYear)
|
||||
.getBrowsingClient()
|
||||
.getSimilarSongs2(artistId, count)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getRandomSongs() != null && response.body().getSubsonicResponse().getRandomSongs().getSongs() != null) {
|
||||
songs.addAll(response.body().getSubsonicResponse().getRandomSongs().getSongs());
|
||||
List<Child> similar = extractSongs(response, "similarSongs2");
|
||||
if (!similar.isEmpty()) {
|
||||
List<Child> limitedSimilar = similar.subList(0, Math.min(count, similar.size()));
|
||||
callback.onSongsAvailable(limitedSimilar);
|
||||
} else {
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
|
||||
randomSongsSample.setValue(songs);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fetchSingleTrackThenSimilar(String trackId, int count, MediaCallbackInternal callback) {
|
||||
App.getSubsonicClientInstance(false).getBrowsingClient().getSong(trackId).enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
Child song = response.body().getSubsonicResponse().getSong();
|
||||
if (song != null) {
|
||||
callback.onSongsAvailable(Collections.singletonList(song));
|
||||
int remaining = count - 1;
|
||||
if (remaining > 0) {
|
||||
fetchSimilarOnly(trackId, remaining, callback);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void fetchSimilarOnly(String id, int count, MediaCallbackInternal callback) {
|
||||
App.getSubsonicClientInstance(false).getBrowsingClient().getSimilarSongs(id, count).enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = extractSongs(response, "similarSongs");
|
||||
if (!songs.isEmpty()) {
|
||||
List<Child> limitedSongs = songs.subList(0, Math.min(count, songs.size()));
|
||||
callback.onSongsAvailable(limitedSongs);
|
||||
} else {
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
fillWithRandom(count, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void fillWithRandom(int target, final MediaCallbackInternal callback) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getAlbumSongListClient()
|
||||
.getRandomSongs(target, null, null)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> random = extractSongs(response, "randomSongs");
|
||||
if (!random.isEmpty()) {
|
||||
List<Child> limitedRandom = random.subList(0, Math.min(target, random.size()));
|
||||
callback.onSongsAvailable(limitedRandom);
|
||||
} else {
|
||||
callback.onSongsAvailable(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
callback.onSongsAvailable(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<Child> extractSongs(Response<ApiResponse> response, String type) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
SubsonicResponse res = response.body().getSubsonicResponse();
|
||||
List<Child> list = null;
|
||||
if (type.equals("similarSongs") && res.getSimilarSongs() != null) {
|
||||
list = res.getSimilarSongs().getSongs();
|
||||
} else if (type.equals("similarSongs2") && res.getSimilarSongs2() != null) {
|
||||
list = res.getSimilarSongs2().getSongs();
|
||||
} else if (type.equals("randomSongs") && res.getRandomSongs() != null) {
|
||||
list = res.getRandomSongs().getSongs();
|
||||
}
|
||||
return (list != null) ? list : new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getRandomSample(int number, Integer fromYear, Integer toYear) {
|
||||
MutableLiveData<List<Child>> randomSongsSample = new MutableLiveData<>();
|
||||
App.getSubsonicClientInstance(false).getAlbumSongListClient().getRandomSongs(number, fromYear, toYear).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getRandomSongs() != null) {
|
||||
songs.addAll(Objects.requireNonNull(response.body().getSubsonicResponse().getRandomSongs().getSongs()));
|
||||
}
|
||||
randomSongsSample.setValue(songs);
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
return randomSongsSample;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getRandomSampleWithGenre(int number, Integer fromYear, Integer toYear, String genre) {
|
||||
MutableLiveData<List<Child>> randomSongsSample = new MutableLiveData<>();
|
||||
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getAlbumSongListClient()
|
||||
.getRandomSongs(number, fromYear, toYear, genre)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getRandomSongs() != null && response.body().getSubsonicResponse().getRandomSongs().getSongs() != null) {
|
||||
songs.addAll(response.body().getSubsonicResponse().getRandomSongs().getSongs());
|
||||
}
|
||||
|
||||
randomSongsSample.setValue(songs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
App.getSubsonicClientInstance(false).getAlbumSongListClient().getRandomSongs(number, fromYear, toYear, genre).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getRandomSongs() != null) {
|
||||
songs.addAll(Objects.requireNonNull(response.body().getSubsonicResponse().getRandomSongs().getSongs()));
|
||||
}
|
||||
randomSongsSample.setValue(songs);
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
return randomSongsSample;
|
||||
}
|
||||
|
||||
public void scrobble(String id, boolean submission) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getMediaAnnotationClient()
|
||||
.scrobble(id, submission)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
App.getSubsonicClientInstance(false).getMediaAnnotationClient().scrobble(id, submission).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
}
|
||||
|
||||
public void setRating(String id, int rating) {
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getMediaAnnotationClient()
|
||||
.setRating(id, rating)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
App.getSubsonicClientInstance(false).getMediaAnnotationClient().setRating(id, rating).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getSongsByGenre(String id, int page) {
|
||||
MutableLiveData<List<Child>> songsByGenre = new MutableLiveData<>();
|
||||
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getAlbumSongListClient()
|
||||
.getSongsByGenre(id, 100, 100 * page)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSongsByGenre() != null) {
|
||||
songsByGenre.setValue(response.body().getSubsonicResponse().getSongsByGenre().getSongs());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
App.getSubsonicClientInstance(false).getAlbumSongListClient().getSongsByGenre(id, 100, 100 * page).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSongsByGenre() != null) {
|
||||
songsByGenre.setValue(response.body().getSubsonicResponse().getSongsByGenre().getSongs());
|
||||
}
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
return songsByGenre;
|
||||
}
|
||||
|
||||
public MutableLiveData<List<Child>> getSongsByGenres(ArrayList<String> genresId) {
|
||||
MutableLiveData<List<Child>> songsByGenre = new MutableLiveData<>();
|
||||
|
||||
for (String id : genresId)
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getAlbumSongListClient()
|
||||
.getSongsByGenre(id, 500, 0)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSongsByGenre() != null) {
|
||||
songs.addAll(response.body().getSubsonicResponse().getSongsByGenre().getSongs());
|
||||
}
|
||||
|
||||
songsByGenre.setValue(songs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
for (String id : genresId) {
|
||||
App.getSubsonicClientInstance(false).getAlbumSongListClient().getSongsByGenre(id, 500, 0).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
List<Child> songs = new ArrayList<>();
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getSongsByGenre() != null) {
|
||||
songs.addAll(Objects.requireNonNull(response.body().getSubsonicResponse().getSongsByGenre().getSongs()));
|
||||
}
|
||||
songsByGenre.setValue(songs);
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
}
|
||||
return songsByGenre;
|
||||
}
|
||||
|
||||
public MutableLiveData<Child> getSong(String id) {
|
||||
MutableLiveData<Child> song = new MutableLiveData<>();
|
||||
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getBrowsingClient()
|
||||
.getSong(id)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
song.setValue(response.body().getSubsonicResponse().getSong());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
App.getSubsonicClientInstance(false).getBrowsingClient().getSong(id).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
song.setValue(response.body().getSubsonicResponse().getSong());
|
||||
}
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
return song;
|
||||
}
|
||||
|
||||
public MutableLiveData<String> getSongLyrics(Child song) {
|
||||
MutableLiveData<String> lyrics = new MutableLiveData<>(null);
|
||||
|
||||
App.getSubsonicClientInstance(false)
|
||||
.getMediaRetrievalClient()
|
||||
.getLyrics(song.getArtist(), song.getTitle())
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getLyrics() != null) {
|
||||
lyrics.setValue(response.body().getSubsonicResponse().getLyrics().getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
App.getSubsonicClientInstance(false).getMediaRetrievalClient().getLyrics(song.getArtist(), song.getTitle()).enqueue(new Callback<ApiResponse>() {
|
||||
@Override public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null && response.body().getSubsonicResponse().getLyrics() != null) {
|
||||
lyrics.setValue(response.body().getSubsonicResponse().getLyrics().getValue());
|
||||
}
|
||||
}
|
||||
@Override public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {}
|
||||
});
|
||||
return lyrics;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import com.cappielloantonio.tempo.repository.SongRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.InternetRadioStation;
|
||||
import com.cappielloantonio.tempo.subsonic.models.PodcastEpisode;
|
||||
import com.cappielloantonio.tempo.util.Constants.SeedType;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel;
|
||||
@@ -183,11 +184,13 @@ public class MediaManager {
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
public static void startQueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, List<Child> media, int startIndex) {
|
||||
if (mediaBrowserListenableFuture != null) {
|
||||
|
||||
mediaBrowserListenableFuture.addListener(() -> {
|
||||
try {
|
||||
if (mediaBrowserListenableFuture.isDone()) {
|
||||
final MediaBrowser browser = mediaBrowserListenableFuture.get();
|
||||
final List<MediaItem> items = MappingUtil.mapMediaItems(media);
|
||||
|
||||
new Handler(Looper.getMainLooper()).post(() -> {
|
||||
justStarted.set(true);
|
||||
browser.setMediaItems(items, startIndex, 0);
|
||||
@@ -196,28 +199,31 @@ public class MediaManager {
|
||||
Player.Listener timelineListener = new Player.Listener() {
|
||||
@Override
|
||||
public void onTimelineChanged(Timeline timeline, int reason) {
|
||||
|
||||
int itemCount = browser.getMediaItemCount();
|
||||
if (itemCount > 0 && startIndex >= 0 && startIndex < itemCount) {
|
||||
browser.seekTo(startIndex, 0);
|
||||
browser.play();
|
||||
browser.removeListener(this);
|
||||
} else {
|
||||
Log.d(TAG, "Cannot start playback: itemCount=" + itemCount + ", startIndex=" + startIndex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
browser.addListener(timelineListener);
|
||||
});
|
||||
|
||||
backgroundExecutor.execute(() -> {
|
||||
Log.d(TAG, "Background: enqueuing to database");
|
||||
enqueueDatabase(media, true, 0);
|
||||
});
|
||||
}
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
Log.e(TAG, "Error executing startQueue logic: " + e.getMessage(), e);
|
||||
Log.e(TAG, "Error in startQueue: " + e.getMessage(), e);
|
||||
}
|
||||
}, MoreExecutors.directExecutor());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void startQueue(ListenableFuture<MediaBrowser> mediaBrowserListenableFuture, Child media) {
|
||||
@@ -442,7 +448,7 @@ public class MediaManager {
|
||||
if (mediaItem != null && Preferences.isContinuousPlayEnabled() && Preferences.isInstantMixUsable()) {
|
||||
Preferences.setLastInstantMix();
|
||||
|
||||
LiveData<List<Child>> instantMix = getSongRepository().getInstantMix(mediaItem.mediaId, 10);
|
||||
LiveData<List<Child>> instantMix = getSongRepository().getInstantMix(mediaItem.mediaId, SeedType.TRACK, 10);
|
||||
instantMix.observeForever(new Observer<List<Child>>() {
|
||||
@Override
|
||||
public void onChanged(List<Child> media) {
|
||||
|
||||
@@ -22,6 +22,7 @@ open class Playlist(
|
||||
var name: String? = null,
|
||||
@ColumnInfo(name = "duration")
|
||||
var duration: Long = 0,
|
||||
@SerializedName("coverArt")
|
||||
@ColumnInfo(name = "coverArt")
|
||||
var coverArtId: String? = null,
|
||||
) : Parcelable {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.cappielloantonio.tempo.subsonic.models
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
@Keep
|
||||
class SimilarSongs {
|
||||
@SerializedName("song")
|
||||
var songs: List<Child>? = null
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import com.cappielloantonio.tempo.service.MediaManager;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.Constants;
|
||||
import com.cappielloantonio.tempo.util.ExternalAudioReader;
|
||||
import com.cappielloantonio.tempo.util.MusicUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
@@ -31,7 +32,9 @@ import com.google.common.util.concurrent.MoreExecutors;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueueAdapter.ViewHolder> {
|
||||
private static final String TAG = "PlayerSongQueueAdapter";
|
||||
@@ -39,7 +42,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
||||
|
||||
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
|
||||
private List<Child> songs;
|
||||
|
||||
private final Map<String, Boolean> downloadStatusCache = new ConcurrentHashMap<>();
|
||||
private String currentPlayingId;
|
||||
private boolean isPlaying;
|
||||
private List<Integer> currentPlayingPositions = Collections.emptyList();
|
||||
@@ -80,7 +83,6 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
||||
.build()
|
||||
.thumbnail(thumbnail)
|
||||
.into(holder.item.queueSongCoverImageView);
|
||||
|
||||
MediaManager.getCurrentIndex(mediaBrowserListenableFuture, new MediaIndexCallback() {
|
||||
@Override
|
||||
public void onRecovery(int index) {
|
||||
@@ -96,16 +98,19 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
||||
}
|
||||
});
|
||||
|
||||
DownloaderManager downloaderManager = DownloadUtil.getDownloadTracker(holder.itemView.getContext());
|
||||
boolean isDownloaded = false;
|
||||
|
||||
if (downloaderManager != null) {
|
||||
boolean isDownloaded = downloaderManager.isDownloaded(song.getId());
|
||||
|
||||
if (isDownloaded) {
|
||||
holder.item.downloadIndicatorIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.item.downloadIndicatorIcon.setVisibility(View.GONE);
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager downloaderManager = DownloadUtil.getDownloadTracker(holder.itemView.getContext());
|
||||
if (downloaderManager != null) {
|
||||
isDownloaded = downloaderManager.isDownloaded(song.getId());
|
||||
}
|
||||
} else {
|
||||
isDownloaded = ExternalAudioReader.getUri(song) != null;
|
||||
}
|
||||
|
||||
if (isDownloaded) {
|
||||
holder.item.downloadIndicatorIcon.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.item.downloadIndicatorIcon.setVisibility(View.GONE);
|
||||
}
|
||||
@@ -169,7 +174,7 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
|
||||
holder.item.coverArtOverlay.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Child> getItems() {
|
||||
return this.songs;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.cappielloantonio.tempo.ui.dialog;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.cappielloantonio.tempo.App;
|
||||
import com.cappielloantonio.tempo.R;
|
||||
import com.cappielloantonio.tempo.databinding.DialogRadioEditorBinding;
|
||||
import com.cappielloantonio.tempo.interfaces.RadioCallback;
|
||||
@@ -21,7 +23,6 @@ import java.util.Objects;
|
||||
public class RadioEditorDialog extends DialogFragment {
|
||||
private DialogRadioEditorBinding bind;
|
||||
private RadioEditorViewModel radioEditorViewModel;
|
||||
|
||||
private final RadioCallback radioCallback;
|
||||
|
||||
private String radioName;
|
||||
@@ -36,25 +37,26 @@ public class RadioEditorDialog extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
bind = DialogRadioEditorBinding.inflate(getLayoutInflater());
|
||||
|
||||
radioEditorViewModel = new ViewModelProvider(requireActivity()).get(RadioEditorViewModel.class);
|
||||
|
||||
setupObservers();
|
||||
|
||||
return new MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(bind.getRoot())
|
||||
.setTitle(R.string.radio_editor_dialog_title)
|
||||
.setPositiveButton(R.string.radio_editor_dialog_positive_button, (dialog, id) -> {
|
||||
if (validateInput()) {
|
||||
if (radioEditorViewModel.getRadioToEdit() == null) {
|
||||
radioEditorViewModel.createRadio(radioName, radioStreamURL, radioHomepageURL.isEmpty() ? null : radioHomepageURL);
|
||||
radioEditorViewModel.createRadio(radioName, radioStreamURL,
|
||||
radioHomepageURL.isEmpty() ? null : radioHomepageURL);
|
||||
} else {
|
||||
radioEditorViewModel.updateRadio(radioName, radioStreamURL, radioHomepageURL.isEmpty() ? null : radioHomepageURL);
|
||||
radioEditorViewModel.updateRadio(radioName, radioStreamURL,
|
||||
radioHomepageURL.isEmpty() ? null : radioHomepageURL);
|
||||
}
|
||||
dismissDialog();
|
||||
}
|
||||
})
|
||||
.setNeutralButton(R.string.radio_editor_dialog_neutral_button, (dialog, id) -> {
|
||||
radioEditorViewModel.deleteRadio();
|
||||
dismissDialog();
|
||||
})
|
||||
.setNegativeButton(R.string.radio_editor_dialog_negative_button, (dialog, id) -> {
|
||||
dialog.cancel();
|
||||
@@ -62,6 +64,24 @@ public class RadioEditorDialog extends DialogFragment {
|
||||
.create();
|
||||
}
|
||||
|
||||
private void setupObservers() {
|
||||
radioEditorViewModel.getIsSuccess().observe(this, isSuccess -> {
|
||||
if (isSuccess != null && isSuccess) {
|
||||
Toast.makeText(requireContext(),
|
||||
radioEditorViewModel.getRadioToEdit() == null ?
|
||||
App.getContext().getString(R.string.radio_editor_dialog_added) : App.getContext().getString(R.string.radio_editor_dialog_updated),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
dismissDialog();
|
||||
}
|
||||
});
|
||||
radioEditorViewModel.getErrorMessage().observe(this, error -> {
|
||||
if (error != null && !error.isEmpty()) {
|
||||
Toast.makeText(requireContext(), error, Toast.LENGTH_LONG).show();
|
||||
radioEditorViewModel.clearError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@@ -77,7 +97,6 @@ public class RadioEditorDialog extends DialogFragment {
|
||||
private void setParameterInfo() {
|
||||
if (getArguments() != null && getArguments().getParcelable(Constants.INTERNET_RADIO_STATION_OBJECT) != null) {
|
||||
InternetRadioStation toEdit = requireArguments().getParcelable(Constants.INTERNET_RADIO_STATION_OBJECT);
|
||||
|
||||
radioEditorViewModel.setRadioToEdit(toEdit);
|
||||
|
||||
bind.internetRadioStationNameTextView.setText(toEdit.getName());
|
||||
@@ -90,22 +109,21 @@ public class RadioEditorDialog extends DialogFragment {
|
||||
radioName = Objects.requireNonNull(bind.internetRadioStationNameTextView.getText()).toString().trim();
|
||||
radioStreamURL = Objects.requireNonNull(bind.internetRadioStationStreamUrlTextView.getText()).toString().trim();
|
||||
radioHomepageURL = Objects.requireNonNull(bind.internetRadioStationHomepageUrlTextView.getText()).toString().trim();
|
||||
|
||||
if (TextUtils.isEmpty(radioName)) {
|
||||
bind.internetRadioStationNameTextView.setError(getString(R.string.error_required));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(radioStreamURL)) {
|
||||
bind.internetRadioStationStreamUrlTextView.setError(getString(R.string.error_required));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dismissDialog() {
|
||||
radioCallback.onDismiss();
|
||||
if (radioCallback != null) {
|
||||
radioCallback.onDismiss();
|
||||
}
|
||||
Objects.requireNonNull(getDialog()).dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -12,6 +12,7 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -60,12 +61,14 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
||||
private SongHorizontalAdapter songHorizontalAdapter;
|
||||
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
|
||||
|
||||
/** @noinspection deprecation*/
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
/** @noinspection deprecation*/
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
@@ -81,7 +84,7 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
||||
albumPageViewModel = new ViewModelProvider(requireActivity()).get(AlbumPageViewModel.class);
|
||||
playbackViewModel = new ViewModelProvider(requireActivity()).get(PlaybackViewModel.class);
|
||||
|
||||
init();
|
||||
init(view);
|
||||
initAppBar();
|
||||
initAlbumInfoTextButton();
|
||||
initAlbumNotes();
|
||||
@@ -119,12 +122,13 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
||||
bind = null;
|
||||
}
|
||||
|
||||
/** @noinspection deprecation*/
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_rate_album) {
|
||||
Bundle bundle = new Bundle();
|
||||
AlbumID3 album = albumPageViewModel.getAlbum().getValue();
|
||||
bundle.putParcelable(Constants.ALBUM_OBJECT, (Parcelable) album);
|
||||
bundle.putParcelable(Constants.ALBUM_OBJECT, album);
|
||||
RatingDialog dialog = new RatingDialog();
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(requireActivity().getSupportFragmentManager(), null);
|
||||
@@ -159,8 +163,21 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
albumPageViewModel.setAlbum(getViewLifecycleOwner(), requireArguments().getParcelable(Constants.ALBUM_OBJECT));
|
||||
private void init(View view) {
|
||||
AlbumID3 albumArg = requireArguments().getParcelable(Constants.ALBUM_OBJECT);
|
||||
assert albumArg != null;
|
||||
albumPageViewModel.setAlbum(getViewLifecycleOwner(), albumArg);
|
||||
ToggleButton favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
favoriteToggle.setChecked(albumArg.getStarred() != null);
|
||||
|
||||
favoriteToggle.setOnClickListener(v -> {
|
||||
albumPageViewModel.setFavorite();
|
||||
});
|
||||
albumPageViewModel.getAlbum().observe(getViewLifecycleOwner(), album -> {
|
||||
if (album != null) {
|
||||
favoriteToggle.setChecked(album.getStarred() != null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initAppBar() {
|
||||
|
||||
@@ -2,15 +2,21 @@ package com.cappielloantonio.tempo.ui.fragment;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.session.MediaBrowser;
|
||||
@@ -28,18 +34,21 @@ import com.cappielloantonio.tempo.interfaces.ClickCallback;
|
||||
import com.cappielloantonio.tempo.service.MediaManager;
|
||||
import com.cappielloantonio.tempo.service.MediaService;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.ui.activity.MainActivity;
|
||||
import com.cappielloantonio.tempo.ui.adapter.AlbumCatalogueAdapter;
|
||||
import com.cappielloantonio.tempo.ui.adapter.ArtistCatalogueAdapter;
|
||||
import com.cappielloantonio.tempo.ui.adapter.SongHorizontalAdapter;
|
||||
import com.cappielloantonio.tempo.util.Constants;
|
||||
import com.cappielloantonio.tempo.util.MusicUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
import com.cappielloantonio.tempo.viewmodel.ArtistPageViewModel;
|
||||
import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@UnstableApi
|
||||
public class ArtistPageFragment extends Fragment implements ClickCallback {
|
||||
@@ -63,7 +72,7 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
||||
artistPageViewModel = new ViewModelProvider(requireActivity()).get(ArtistPageViewModel.class);
|
||||
playbackViewModel = new ViewModelProvider(requireActivity()).get(PlaybackViewModel.class);
|
||||
|
||||
init();
|
||||
init(view);
|
||||
initAppBar();
|
||||
initArtistInfo();
|
||||
initPlayButtons();
|
||||
@@ -100,7 +109,7 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
||||
bind = null;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
private void init(View view) {
|
||||
artistPageViewModel.setArtist(requireArguments().getParcelable(Constants.ARTIST_OBJECT));
|
||||
|
||||
bind.mostStreamedSongTextViewClickable.setOnClickListener(v -> {
|
||||
@@ -109,6 +118,14 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
||||
bundle.putParcelable(Constants.ARTIST_OBJECT, artistPageViewModel.getArtist());
|
||||
activity.navController.navigate(R.id.action_artistPageFragment_to_songListPageFragment, bundle);
|
||||
});
|
||||
|
||||
ToggleButton favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
favoriteToggle.setChecked(artistPageViewModel.getArtist().getStarred() != null);
|
||||
favoriteToggle.setOnClickListener(v -> artistPageViewModel.setFavorite(requireContext()));
|
||||
|
||||
Button bioToggle = view.findViewById(R.id.button_toggle_bio);
|
||||
bioToggle.setOnClickListener(v ->
|
||||
Toast.makeText(getActivity(), R.string.artist_no_artist_info_toast, Toast.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
private void initAppBar() {
|
||||
@@ -126,53 +143,118 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
|
||||
if (artistInfo == null) {
|
||||
if (bind != null) bind.artistPageBioSector.setVisibility(View.GONE);
|
||||
} else {
|
||||
String normalizedBio = MusicUtil.forceReadableString(artistInfo.getBiography());
|
||||
if (getContext() != null && bind != null) {
|
||||
ArtistID3 currentArtist = artistPageViewModel.getArtist();
|
||||
String primaryId = currentArtist.getCoverArtId() != null && !currentArtist.getCoverArtId().trim().isEmpty()
|
||||
? currentArtist.getCoverArtId()
|
||||
: currentArtist.getId();
|
||||
|
||||
final String fallbackId = (Objects.requireNonNull(primaryId).equals(currentArtist.getCoverArtId()) &&
|
||||
currentArtist.getId() != null &&
|
||||
!currentArtist.getId().equals(primaryId))
|
||||
? currentArtist.getId()
|
||||
: null;
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), primaryId, CustomGlideRequest.ResourceType.Artist)
|
||||
.build()
|
||||
.listener(new com.bumptech.glide.request.RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable com.bumptech.glide.load.engine.GlideException e,
|
||||
Object model,
|
||||
@NonNull com.bumptech.glide.request.target.Target<Drawable> target,
|
||||
boolean isFirstResource) {
|
||||
if (e != null) {
|
||||
e.getMessage();
|
||||
if (e.getMessage().contains("400") && fallbackId != null) {
|
||||
|
||||
if (bind != null)
|
||||
bind.artistPageBioSector.setVisibility(!normalizedBio.trim().isEmpty() ? View.VISIBLE : View.GONE);
|
||||
if (bind != null)
|
||||
bind.bioMoreTextViewClickable.setVisibility(artistInfo.getLastFmUrl() != null ? View.VISIBLE : View.GONE);
|
||||
Log.d("ArtistCover", "Primary ID failed (400), trying fallback: " + fallbackId);
|
||||
|
||||
if (getContext() != null && bind != null) CustomGlideRequest.Builder
|
||||
.from(requireContext(), artistPageViewModel.getArtist().getId(), CustomGlideRequest.ResourceType.Artist)
|
||||
.build()
|
||||
.into(bind.artistBackdropImageView);
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), fallbackId, CustomGlideRequest.ResourceType.Artist)
|
||||
.build()
|
||||
.into(bind.artistBackdropImageView);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bind != null) bind.bioTextView.setText(normalizedBio);
|
||||
@Override
|
||||
public boolean onResourceReady(@NonNull Drawable resource,
|
||||
@NonNull Object model,
|
||||
com.bumptech.glide.request.target.Target<Drawable> target,
|
||||
@NonNull com.bumptech.glide.load.DataSource dataSource,
|
||||
boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(bind.artistBackdropImageView);
|
||||
}
|
||||
|
||||
if (bind != null) bind.bioMoreTextViewClickable.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(artistInfo.getLastFmUrl()));
|
||||
startActivity(intent);
|
||||
});
|
||||
if (bind != null) {
|
||||
String normalizedBio = MusicUtil.forceReadableString(artistInfo.getBiography()).trim();
|
||||
String lastFmUrl = artistInfo.getLastFmUrl();
|
||||
|
||||
if (bind != null) bind.artistPageBioSector.setVisibility(View.VISIBLE);
|
||||
if (normalizedBio.isEmpty()) {
|
||||
bind.bioTextView.setVisibility(View.GONE);
|
||||
} else {
|
||||
bind.bioTextView.setText(normalizedBio);
|
||||
}
|
||||
|
||||
if (lastFmUrl == null) {
|
||||
bind.bioMoreTextViewClickable.setVisibility(View.GONE);
|
||||
} else {
|
||||
bind.bioMoreTextViewClickable.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(artistInfo.getLastFmUrl()));
|
||||
startActivity(intent);
|
||||
});
|
||||
bind.bioMoreTextViewClickable.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (!normalizedBio.isEmpty() || lastFmUrl != null) {
|
||||
View view = bind.getRoot();
|
||||
|
||||
Button bioToggle = view.findViewById(R.id.button_toggle_bio);
|
||||
bioToggle.setOnClickListener(v -> {
|
||||
if (bind != null) {
|
||||
boolean displayBio = Preferences.getArtistDisplayBiography();
|
||||
Preferences.setArtistDisplayBiography(!displayBio);
|
||||
bind.artistPageBioSector.setVisibility(displayBio ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
boolean displayBio = Preferences.getArtistDisplayBiography();
|
||||
bind.artistPageBioSector.setVisibility(displayBio ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initPlayButtons() {
|
||||
bind.artistPageShuffleButton.setOnClickListener(v -> {
|
||||
artistPageViewModel.getArtistShuffleList().observe(getViewLifecycleOwner(), songs -> {
|
||||
if (!songs.isEmpty()) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.artist_error_retrieving_tracks), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
bind.artistPageRadioButton.setOnClickListener(v -> {
|
||||
artistPageViewModel.getArtistInstantMix().observe(getViewLifecycleOwner(), songs -> {
|
||||
bind.artistPageShuffleButton.setOnClickListener(v -> artistPageViewModel.getArtistShuffleList().observe(getViewLifecycleOwner(), new Observer<List<Child>>() {
|
||||
@Override
|
||||
public void onChanged(List<Child> songs) {
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.artist_error_retrieving_radio), Toast.LENGTH_SHORT).show();
|
||||
artistPageViewModel.getArtistShuffleList().removeObserver(this);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}));
|
||||
|
||||
bind.artistPageRadioButton.setOnClickListener(v -> artistPageViewModel.getArtistInstantMix().observe(getViewLifecycleOwner(), new Observer<List<Child>>() {
|
||||
@Override
|
||||
public void onChanged(List<Child> songs) {
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
artistPageViewModel.getArtistInstantMix().removeObserver(this);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void initTopSongsView() {
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -38,10 +40,10 @@ import com.cappielloantonio.tempo.model.HomeSector;
|
||||
import com.cappielloantonio.tempo.service.DownloaderManager;
|
||||
import com.cappielloantonio.tempo.service.MediaManager;
|
||||
import com.cappielloantonio.tempo.service.MediaService;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||
import com.cappielloantonio.tempo.ui.activity.MainActivity;
|
||||
import com.cappielloantonio.tempo.ui.adapter.AlbumAdapter;
|
||||
import com.cappielloantonio.tempo.ui.adapter.AlbumHorizontalAdapter;
|
||||
@@ -57,6 +59,8 @@ import com.cappielloantonio.tempo.ui.dialog.HomeRearrangementDialog;
|
||||
import com.cappielloantonio.tempo.ui.dialog.PlaylistEditorDialog;
|
||||
import com.cappielloantonio.tempo.util.Constants;
|
||||
import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.ExternalAudioReader;
|
||||
import com.cappielloantonio.tempo.util.ExternalAudioWriter;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.MusicUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
@@ -66,8 +70,6 @@ import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
import androidx.media3.common.MediaItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -228,6 +230,12 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
activity.navController.navigate(R.id.action_homeFragment_to_albumListPageFragment, bundle);
|
||||
});
|
||||
|
||||
bind.playlistCatalogueTextViewClickable.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.PLAYLIST_ALL, Constants.PLAYLIST_ALL);
|
||||
activity.navController.navigate(R.id.action_homeFragment_to_playlistCatalogueFragment, bundle);
|
||||
});
|
||||
|
||||
bind.recentlyPlayedAlbumsTextViewClickable.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.ALBUM_RECENTLY_PLAYED, Constants.ALBUM_RECENTLY_PLAYED);
|
||||
@@ -279,51 +287,113 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
}
|
||||
|
||||
private void initSyncStarredView() {
|
||||
if (Preferences.isStarredSyncEnabled() && Preferences.getDownloadDirectoryUri() == null) {
|
||||
homeViewModel.getAllStarredTracks().observeForever(new Observer<List<Child>>() {
|
||||
if (Preferences.isStarredSyncEnabled()) {
|
||||
homeViewModel.getAllStarredTracks().observe(getViewLifecycleOwner(), new Observer<List<Child>>() {
|
||||
@Override
|
||||
public void onChanged(List<Child> songs) {
|
||||
if (songs != null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
List<String> toSync = new ArrayList<>();
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
int songsToSyncCount = 0;
|
||||
List<String> toSyncSample = new ArrayList<>();
|
||||
|
||||
for (Child song : songs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
toSync.add(song.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
if (!toSync.isEmpty()) {
|
||||
bind.homeSyncStarredCard.setVisibility(View.VISIBLE);
|
||||
bind.homeSyncStarredTracksToSync.setText(String.join(", ", toSync));
|
||||
}
|
||||
}
|
||||
|
||||
homeViewModel.getAllStarredTracks().removeObserver(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bind.homeSyncStarredCancel.setOnClickListener(v -> bind.homeSyncStarredCard.setVisibility(View.GONE));
|
||||
|
||||
bind.homeSyncStarredDownload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
homeViewModel.getAllStarredTracks().observeForever(new Observer<List<Child>>() {
|
||||
@Override
|
||||
public void onChanged(List<Child> songs) {
|
||||
if (songs != null) {
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
|
||||
for (Child song : songs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||
songsToSyncCount++;
|
||||
if (toSyncSample.size() < 3) {
|
||||
toSyncSample.add(song.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Child song : songs) {
|
||||
if (ExternalAudioReader.getUri(song) == null) {
|
||||
songsToSyncCount++;
|
||||
if (toSyncSample.size() < 3) {
|
||||
toSyncSample.add(song.getTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
homeViewModel.getAllStarredTracks().removeObserver(this);
|
||||
if (songsToSyncCount > 0) {
|
||||
bind.homeSyncStarredCard.setVisibility(View.VISIBLE);
|
||||
|
||||
StringBuilder displayText = new StringBuilder();
|
||||
if (!toSyncSample.isEmpty()) {
|
||||
displayText.append(String.join(", ", toSyncSample));
|
||||
if (songsToSyncCount > 3) {
|
||||
displayText.append("...");
|
||||
}
|
||||
}
|
||||
|
||||
String countText = getResources().getQuantityString(
|
||||
R.plurals.home_sync_starred_songs_count,
|
||||
songsToSyncCount,
|
||||
songsToSyncCount
|
||||
);
|
||||
|
||||
if (displayText.length() > 0) {
|
||||
bind.homeSyncStarredTracksToSync.setText(displayText.toString() + "\n" + countText);
|
||||
} else {
|
||||
bind.homeSyncStarredTracksToSync.setText(countText);
|
||||
}
|
||||
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
} else {
|
||||
bind.homeSyncStarredCard.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
bind.homeSyncStarredCancel.setOnClickListener(v -> {
|
||||
bind.homeSyncStarredCard.setVisibility(View.GONE);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
});
|
||||
|
||||
bind.homeSyncStarredDownload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
homeViewModel.getAllStarredTracks().observe(getViewLifecycleOwner(), new Observer<List<Child>>() {
|
||||
@Override
|
||||
public void onChanged(List<Child> songs) {
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
int downloadedCount = 0;
|
||||
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
for (Child song : songs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||
downloadedCount++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Child song : songs) {
|
||||
if (ExternalAudioReader.getUri(song) == null) {
|
||||
ExternalAudioWriter.downloadToUserDirectory(requireContext(), song);
|
||||
downloadedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadedCount > 0) {
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, downloadedCount, downloadedCount),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
bind.homeSyncStarredCard.setVisibility(View.GONE);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -331,6 +401,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
}
|
||||
|
||||
private void initSyncStarredAlbumsView() {
|
||||
|
||||
if (Preferences.isStarredAlbumsSyncEnabled()) {
|
||||
homeViewModel.getStarredAlbums(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), new Observer<List<AlbumID3>>() {
|
||||
@Override
|
||||
@@ -344,6 +415,9 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
|
||||
bind.homeSyncStarredAlbumsCancel.setOnClickListener(v -> {
|
||||
bind.homeSyncStarredAlbumsCard.setVisibility(View.GONE);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
});
|
||||
|
||||
bind.homeSyncStarredAlbumsDownload.setOnClickListener(v -> {
|
||||
@@ -351,24 +425,36 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
@Override
|
||||
public void onChanged(List<Child> allSongs) {
|
||||
if (allSongs != null && !allSongs.isEmpty()) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
int songsToDownload = 0;
|
||||
|
||||
for (Child song : allSongs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||
songsToDownload++;
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
for (Child song : allSongs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||
songsToDownload++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Child song : allSongs) {
|
||||
if (ExternalAudioReader.getUri(song) == null) {
|
||||
ExternalAudioWriter.downloadToUserDirectory(requireContext(), song);
|
||||
songsToDownload++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (songsToDownload > 0) {
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, songsToDownload, songsToDownload),
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, songsToDownload, songsToDownload),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bind.homeSyncStarredAlbumsCard.setVisibility(View.GONE);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -379,33 +465,73 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
@Override
|
||||
public void onChanged(List<Child> allSongs) {
|
||||
if (allSongs != null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
int songsToDownload = 0;
|
||||
List<String> albumsNeedingSync = new ArrayList<>();
|
||||
|
||||
for (AlbumID3 album : albums) {
|
||||
boolean albumNeedsSync = false;
|
||||
// Check if any songs from this album need downloading
|
||||
for (Child song : allSongs) {
|
||||
if (song.getAlbumId() != null && song.getAlbumId().equals(album.getId()) &&
|
||||
!manager.isDownloaded(song.getId())) {
|
||||
songsToDownload++;
|
||||
albumNeedsSync = true;
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
|
||||
for (AlbumID3 album : albums) {
|
||||
boolean albumNeedsSync = false;
|
||||
for (Child song : allSongs) {
|
||||
if (song.getAlbumId() != null && song.getAlbumId().equals(album.getId()) &&
|
||||
!manager.isDownloaded(song.getId())) {
|
||||
songsToDownload++;
|
||||
albumNeedsSync = true;
|
||||
}
|
||||
}
|
||||
if (albumNeedsSync) {
|
||||
albumsNeedingSync.add(album.getName());
|
||||
}
|
||||
}
|
||||
if (albumNeedsSync) {
|
||||
albumsNeedingSync.add(album.getName());
|
||||
} else {
|
||||
for (AlbumID3 album : albums) {
|
||||
boolean albumNeedsSync = false;
|
||||
for (Child song : allSongs) {
|
||||
if (song.getAlbumId() != null && song.getAlbumId().equals(album.getId()) &&
|
||||
ExternalAudioReader.getUri(song) == null) {
|
||||
songsToDownload++;
|
||||
albumNeedsSync = true;
|
||||
}
|
||||
}
|
||||
if (albumNeedsSync) {
|
||||
albumsNeedingSync.add(album.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (songsToDownload > 0) {
|
||||
bind.homeSyncStarredAlbumsCard.setVisibility(View.VISIBLE);
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.home_sync_starred_albums_count,
|
||||
albumsNeedingSync.size(),
|
||||
|
||||
StringBuilder displayText = new StringBuilder();
|
||||
List<String> sampleAlbums = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < Math.min(albumsNeedingSync.size(), 3); i++) {
|
||||
sampleAlbums.add(albumsNeedingSync.get(i));
|
||||
}
|
||||
|
||||
if (!sampleAlbums.isEmpty()) {
|
||||
displayText.append(String.join(", ", sampleAlbums));
|
||||
if (albumsNeedingSync.size() > 3) {
|
||||
displayText.append("...");
|
||||
}
|
||||
}
|
||||
|
||||
String countText = getResources().getQuantityString(
|
||||
R.plurals.home_sync_starred_albums_count,
|
||||
albumsNeedingSync.size(),
|
||||
albumsNeedingSync.size()
|
||||
);
|
||||
bind.homeSyncStarredAlbumsToSync.setText(message);
|
||||
|
||||
if (displayText.length() > 0) {
|
||||
bind.homeSyncStarredAlbumsToSync.setText(displayText.toString() + "\n" + countText);
|
||||
} else {
|
||||
bind.homeSyncStarredAlbumsToSync.setText(countText);
|
||||
}
|
||||
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
} else {
|
||||
bind.homeSyncStarredAlbumsCard.setVisibility(View.GONE);
|
||||
}
|
||||
@@ -428,6 +554,9 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
|
||||
bind.homeSyncStarredArtistsCancel.setOnClickListener(v -> {
|
||||
bind.homeSyncStarredArtistsCard.setVisibility(View.GONE);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
});
|
||||
|
||||
bind.homeSyncStarredArtistsDownload.setOnClickListener(v -> {
|
||||
@@ -435,24 +564,36 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
@Override
|
||||
public void onChanged(List<Child> allSongs) {
|
||||
if (allSongs != null && !allSongs.isEmpty()) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
int songsToDownload = 0;
|
||||
|
||||
for (Child song : allSongs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||
songsToDownload++;
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
for (Child song : allSongs) {
|
||||
if (!manager.isDownloaded(song.getId())) {
|
||||
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||
songsToDownload++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Child song : allSongs) {
|
||||
if (ExternalAudioReader.getUri(song) == null) {
|
||||
ExternalAudioWriter.downloadToUserDirectory(requireContext(), song);
|
||||
songsToDownload++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (songsToDownload > 0) {
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, songsToDownload, songsToDownload),
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, songsToDownload, songsToDownload),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bind.homeSyncStarredArtistsCard.setVisibility(View.GONE);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -463,33 +604,73 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
@Override
|
||||
public void onChanged(List<Child> allSongs) {
|
||||
if (allSongs != null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
int songsToDownload = 0;
|
||||
List<String> artistsNeedingSync = new ArrayList<>();
|
||||
|
||||
for (ArtistID3 artist : artists) {
|
||||
boolean artistNeedsSync = false;
|
||||
// Check if any songs from this artist need downloading
|
||||
for (Child song : allSongs) {
|
||||
if (song.getArtistId() != null && song.getArtistId().equals(artist.getId()) &&
|
||||
!manager.isDownloaded(song.getId())) {
|
||||
songsToDownload++;
|
||||
artistNeedsSync = true;
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
|
||||
for (ArtistID3 artist : artists) {
|
||||
boolean artistNeedsSync = false;
|
||||
for (Child song : allSongs) {
|
||||
if (song.getArtistId() != null && song.getArtistId().equals(artist.getId()) &&
|
||||
!manager.isDownloaded(song.getId())) {
|
||||
songsToDownload++;
|
||||
artistNeedsSync = true;
|
||||
}
|
||||
}
|
||||
if (artistNeedsSync) {
|
||||
artistsNeedingSync.add(artist.getName());
|
||||
}
|
||||
}
|
||||
if (artistNeedsSync) {
|
||||
artistsNeedingSync.add(artist.getName());
|
||||
} else {
|
||||
for (ArtistID3 artist : artists) {
|
||||
boolean artistNeedsSync = false;
|
||||
for (Child song : allSongs) {
|
||||
if (song.getArtistId() != null && song.getArtistId().equals(artist.getId()) &&
|
||||
ExternalAudioReader.getUri(song) == null) {
|
||||
songsToDownload++;
|
||||
artistNeedsSync = true;
|
||||
}
|
||||
}
|
||||
if (artistNeedsSync) {
|
||||
artistsNeedingSync.add(artist.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (songsToDownload > 0) {
|
||||
bind.homeSyncStarredArtistsCard.setVisibility(View.VISIBLE);
|
||||
String message = getResources().getQuantityString(
|
||||
R.plurals.home_sync_starred_artists_count,
|
||||
artistsNeedingSync.size(),
|
||||
|
||||
StringBuilder displayText = new StringBuilder();
|
||||
List<String> sampleArtists = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < Math.min(artistsNeedingSync.size(), 3); i++) {
|
||||
sampleArtists.add(artistsNeedingSync.get(i));
|
||||
}
|
||||
|
||||
if (!sampleArtists.isEmpty()) {
|
||||
displayText.append(String.join(", ", sampleArtists));
|
||||
if (artistsNeedingSync.size() > 3) {
|
||||
displayText.append("...");
|
||||
}
|
||||
}
|
||||
|
||||
String countText = getResources().getQuantityString(
|
||||
R.plurals.home_sync_starred_artists_count,
|
||||
artistsNeedingSync.size(),
|
||||
artistsNeedingSync.size()
|
||||
);
|
||||
bind.homeSyncStarredArtistsToSync.setText(message);
|
||||
|
||||
if (displayText.length() > 0) {
|
||||
bind.homeSyncStarredArtistsToSync.setText(displayText.toString() + "\n" + countText);
|
||||
} else {
|
||||
bind.homeSyncStarredArtistsToSync.setText(countText);
|
||||
}
|
||||
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> reorder());
|
||||
}
|
||||
} else {
|
||||
bind.homeSyncStarredArtistsCard.setVisibility(View.GONE);
|
||||
}
|
||||
@@ -497,7 +678,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initDiscoverSongSlideView() {
|
||||
if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_DISCOVERY)) return;
|
||||
|
||||
@@ -962,6 +1143,18 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
if (bind != null && homeViewModel.getHomeSectorList() != null) {
|
||||
bind.homeLinearLayoutContainer.removeAllViews();
|
||||
|
||||
if (bind.homeSyncStarredCard.getVisibility() == View.VISIBLE) {
|
||||
bind.homeLinearLayoutContainer.addView(bind.homeSyncStarredCard);
|
||||
}
|
||||
|
||||
if (bind.homeSyncStarredAlbumsCard.getVisibility() == View.VISIBLE) {
|
||||
bind.homeLinearLayoutContainer.addView(bind.homeSyncStarredAlbumsCard);
|
||||
}
|
||||
|
||||
if (bind.homeSyncStarredArtistsCard.getVisibility() == View.VISIBLE) {
|
||||
bind.homeLinearLayoutContainer.addView(bind.homeSyncStarredArtistsCard);
|
||||
}
|
||||
|
||||
for (HomeSector sector : homeViewModel.getHomeSectorList()) {
|
||||
if (!sector.isVisible()) continue;
|
||||
|
||||
@@ -1062,20 +1255,25 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||
MediaBrowser.releaseFuture(mediaBrowserListenableFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaClick(Bundle bundle) {
|
||||
if (bundle.containsKey(Constants.MEDIA_MIX)) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, bundle.getParcelable(Constants.TRACK_OBJECT));
|
||||
Child track = bundle.getParcelable(Constants.TRACK_OBJECT);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
|
||||
if (mediaBrowserListenableFuture != null) {
|
||||
homeViewModel.getMediaInstantMix(getViewLifecycleOwner(), bundle.getParcelable(Constants.TRACK_OBJECT)).observe(getViewLifecycleOwner(), songs -> {
|
||||
MusicUtil.ratingFilter(songs);
|
||||
final boolean[] playbackStarted = {false};
|
||||
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
MediaManager.enqueue(mediaBrowserListenableFuture, songs, true);
|
||||
}
|
||||
});
|
||||
homeViewModel.getMediaInstantMix(getViewLifecycleOwner(), track)
|
||||
.observe(getViewLifecycleOwner(), songs -> {
|
||||
if (playbackStarted[0] || songs == null || songs.isEmpty()) return;
|
||||
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
if (playbackStarted[0]) return;
|
||||
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
playbackStarted[0] = true;
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
} else if (bundle.containsKey(Constants.MEDIA_CHRONOLOGY)) {
|
||||
List<Child> media = bundle.getParcelableArrayList(Constants.TRACKS_OBJECT);
|
||||
|
||||
@@ -21,6 +21,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cappielloantonio.tempo.R;
|
||||
import com.cappielloantonio.tempo.databinding.InnerFragmentPlayerQueueBinding;
|
||||
import com.cappielloantonio.tempo.interfaces.ClickCallback;
|
||||
import com.cappielloantonio.tempo.service.DownloaderManager;
|
||||
@@ -32,6 +33,8 @@ import com.cappielloantonio.tempo.ui.adapter.PlayerSongQueueAdapter;
|
||||
import com.cappielloantonio.tempo.ui.dialog.PlaylistChooserDialog;
|
||||
import com.cappielloantonio.tempo.util.Constants;
|
||||
import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.ExternalAudioReader;
|
||||
import com.cappielloantonio.tempo.util.ExternalAudioWriter;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
import com.cappielloantonio.tempo.viewmodel.PlaybackViewModel;
|
||||
@@ -384,28 +387,62 @@ public class PlayerQueueFragment extends Fragment implements ClickCallback {
|
||||
return;
|
||||
}
|
||||
|
||||
List<MediaItem> mediaItemsToDownload = MappingUtil.mapMediaItems(queueSongs);
|
||||
int downloadCount = 0;
|
||||
|
||||
if (Preferences.getDownloadDirectoryUri() == null) {
|
||||
List<MediaItem> mediaItemsToDownload = MappingUtil.mapMediaItems(queueSongs);
|
||||
List<com.cappielloantonio.tempo.model.Download> downloadModels = new ArrayList<>();
|
||||
|
||||
List<com.cappielloantonio.tempo.model.Download> downloadModels = new ArrayList<>();
|
||||
for (Child child : queueSongs) {
|
||||
com.cappielloantonio.tempo.model.Download downloadModel =
|
||||
new com.cappielloantonio.tempo.model.Download(child);
|
||||
downloadModel.setArtist(child.getArtist());
|
||||
downloadModel.setAlbum(child.getAlbum());
|
||||
downloadModel.setCoverArtId(child.getCoverArtId());
|
||||
downloadModels.add(downloadModel);
|
||||
}
|
||||
|
||||
for (Child child : queueSongs) {
|
||||
com.cappielloantonio.tempo.model.Download downloadModel =
|
||||
new com.cappielloantonio.tempo.model.Download(child);
|
||||
downloadModel.setArtist(child.getArtist());
|
||||
downloadModel.setAlbum(child.getAlbum());
|
||||
downloadModel.setCoverArtId(child.getCoverArtId());
|
||||
downloadModels.add(downloadModel);
|
||||
}
|
||||
DownloaderManager downloaderManager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
|
||||
DownloaderManager downloaderManager = DownloadUtil.getDownloadTracker(requireContext());
|
||||
|
||||
if (downloaderManager != null) {
|
||||
downloaderManager.download(mediaItemsToDownload, downloadModels);
|
||||
Toast.makeText(requireContext(), "Starting download of " + queueSongs.size() + " songs in the background.", Toast.LENGTH_SHORT).show();
|
||||
if (downloaderManager != null) {
|
||||
downloaderManager.download(mediaItemsToDownload, downloadModels);
|
||||
downloadCount = queueSongs.size();
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, downloadCount, downloadCount),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
new Handler().postDelayed(() -> {
|
||||
if (playerSongQueueAdapter != null) {
|
||||
playerSongQueueAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
Log.e(TAG, "DownloaderManager not initialized. Check DownloadUtil.");
|
||||
Toast.makeText(requireContext(), "Download service unavailable.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "DownloaderManager not initialized. Check DownloadUtil.");
|
||||
Toast.makeText(requireContext(), "Download service unavailable.", Toast.LENGTH_SHORT).show();
|
||||
for (Child song : queueSongs) {
|
||||
if (ExternalAudioReader.getUri(song) == null) {
|
||||
ExternalAudioWriter.downloadToUserDirectory(requireContext(), song);
|
||||
downloadCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadCount > 0) {
|
||||
Toast.makeText(requireContext(),
|
||||
getResources().getQuantityString(R.plurals.songs_download_started, downloadCount, downloadCount),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
new Handler().postDelayed(() -> {
|
||||
if (playerSongQueueAdapter != null) {
|
||||
playerSongQueueAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}, 2000);
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "All songs already downloaded", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
toggleFabMenu();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import androidx.navigation.fragment.NavHostFragment;
|
||||
|
||||
import com.cappielloantonio.tempo.R;
|
||||
import com.cappielloantonio.tempo.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.tempo.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.tempo.model.Download;
|
||||
import com.cappielloantonio.tempo.repository.AlbumRepository;
|
||||
import com.cappielloantonio.tempo.service.MediaManager;
|
||||
@@ -43,7 +42,6 @@ import com.cappielloantonio.tempo.util.ExternalAudioReader;
|
||||
import com.cappielloantonio.tempo.viewmodel.AlbumBottomSheetViewModel;
|
||||
import com.cappielloantonio.tempo.viewmodel.HomeViewModel;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -61,7 +59,10 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
private List<Child> currentAlbumTracks = Collections.emptyList();
|
||||
private List<MediaItem> currentAlbumMediaItems = Collections.emptyList();
|
||||
|
||||
private boolean isFirstBatch = true;
|
||||
|
||||
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
|
||||
private static final String TAG = "AlbumBottomSheetDialog";
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -114,33 +115,41 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
|
||||
ToggleButton favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
favoriteToggle.setChecked(albumBottomSheetViewModel.getAlbum().getStarred() != null);
|
||||
favoriteToggle.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.setFavorite(requireContext());
|
||||
});
|
||||
favoriteToggle.setOnClickListener(v -> albumBottomSheetViewModel.setFavorite(requireContext()));
|
||||
|
||||
TextView playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
AlbumRepository albumRepository = new AlbumRepository();
|
||||
albumRepository.getInstantMix(album, 20, new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
if (activity == null) return;
|
||||
|
||||
@Override
|
||||
public void onLoadMedia(List<?> media) {
|
||||
MusicUtil.ratingFilter((ArrayList<Child>) media);
|
||||
ListenableFuture<MediaBrowser> activityBrowserFuture = activity.getMediaBrowserListenableFuture();
|
||||
if (activityBrowserFuture == null) return;
|
||||
|
||||
if (!media.isEmpty()) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, (ArrayList<Child>) media, 0);
|
||||
((MainActivity) requireActivity()).setBottomSheetInPeek(true);
|
||||
isFirstBatch = true;
|
||||
Toast.makeText(requireContext(), R.string.bottom_sheet_generating_instant_mix, Toast.LENGTH_SHORT).show();
|
||||
|
||||
albumBottomSheetViewModel.getAlbumInstantMix(activity, album).observe(activity, media -> {
|
||||
if (media == null || media.isEmpty()) return;
|
||||
if (getActivity() == null) return;
|
||||
|
||||
MusicUtil.ratingFilter(media);
|
||||
|
||||
if (isFirstBatch) {
|
||||
isFirstBatch = false;
|
||||
|
||||
MediaManager.startQueue(activityBrowserFuture, media, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
|
||||
if (isAdded()) {
|
||||
dismissBottomSheet();
|
||||
}
|
||||
|
||||
dismissBottomSheet();
|
||||
} else {
|
||||
MediaManager.enqueue(activityBrowserFuture, media, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
TextView playRandom = view.findViewById(R.id.play_random_text_view);
|
||||
playRandom.setOnClickListener(v -> {
|
||||
AlbumRepository albumRepository = new AlbumRepository();
|
||||
@@ -186,18 +195,16 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
});
|
||||
|
||||
TextView addToPlaylist = view.findViewById(R.id.add_to_playlist_text_view);
|
||||
addToPlaylist.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.getAlbumTracks().observe(getViewLifecycleOwner(), songs -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelableArrayList(Constants.TRACKS_OBJECT, new ArrayList<>(songs));
|
||||
addToPlaylist.setOnClickListener(v -> albumBottomSheetViewModel.getAlbumTracks().observe(getViewLifecycleOwner(), songs -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelableArrayList(Constants.TRACKS_OBJECT, new ArrayList<>(songs));
|
||||
|
||||
PlaylistChooserDialog dialog = new PlaylistChooserDialog();
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(requireActivity().getSupportFragmentManager(), null);
|
||||
PlaylistChooserDialog dialog = new PlaylistChooserDialog();
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(requireActivity().getSupportFragmentManager(), null);
|
||||
|
||||
dismissBottomSheet();
|
||||
});
|
||||
});
|
||||
dismissBottomSheet();
|
||||
}));
|
||||
|
||||
removeAllTextView = view.findViewById(R.id.remove_all_text_view);
|
||||
albumBottomSheetViewModel.getAlbumTracks().observe(getViewLifecycleOwner(), songs -> {
|
||||
@@ -291,4 +298,5 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
private void refreshShares() {
|
||||
homeViewModel.refreshShares(requireActivity());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import com.cappielloantonio.tempo.viewmodel.ArtistBottomSheetViewModel;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
||||
@UnstableApi
|
||||
public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implements View.OnClickListener {
|
||||
private static final String TAG = "AlbumBottomSheetDialog";
|
||||
@@ -38,6 +39,8 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
||||
|
||||
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
|
||||
|
||||
private boolean isFirstBatch = true;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -86,20 +89,31 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
||||
|
||||
TextView playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
ArtistRepository artistRepository = new ArtistRepository();
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
if (activity == null) return;
|
||||
|
||||
artistRepository.getInstantMix(artist, 20).observe(getViewLifecycleOwner(), songs -> {
|
||||
// navidrome may return null for this
|
||||
if (songs == null)
|
||||
return;
|
||||
MusicUtil.ratingFilter(songs);
|
||||
ListenableFuture<MediaBrowser> activityBrowserFuture = activity.getMediaBrowserListenableFuture();
|
||||
if (activityBrowserFuture == null) return;
|
||||
|
||||
if (!songs.isEmpty()) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
((MainActivity) requireActivity()).setBottomSheetInPeek(true);
|
||||
isFirstBatch = true;
|
||||
Toast.makeText(requireContext(), R.string.bottom_sheet_generating_instant_mix, Toast.LENGTH_SHORT).show();
|
||||
|
||||
artistBottomSheetViewModel.getArtistInstantMix(activity, artist).observe(activity, media -> {
|
||||
if (media == null || media.isEmpty()) return;
|
||||
if (getActivity() == null) return;
|
||||
|
||||
MusicUtil.ratingFilter(media);
|
||||
|
||||
if (isFirstBatch) {
|
||||
isFirstBatch = false;
|
||||
MediaManager.startQueue(activityBrowserFuture, media, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
if (isAdded()) {
|
||||
dismissBottomSheet();
|
||||
}
|
||||
} else {
|
||||
MediaManager.enqueue(activityBrowserFuture, media, true);
|
||||
}
|
||||
|
||||
dismissBottomSheet();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -108,16 +122,10 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
||||
ArtistRepository artistRepository = new ArtistRepository();
|
||||
artistRepository.getRandomSong(artist, 50).observe(getViewLifecycleOwner(), songs -> {
|
||||
MusicUtil.ratingFilter(songs);
|
||||
|
||||
if (!songs.isEmpty()) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
((MainActivity) requireActivity()).setBottomSheetInPeek(true);
|
||||
|
||||
dismissBottomSheet();
|
||||
} else {
|
||||
Toast.makeText(requireContext(), getString(R.string.artist_error_retrieving_tracks), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
dismissBottomSheet();
|
||||
});
|
||||
});
|
||||
@@ -139,4 +147,5 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
||||
private void releaseMediaBrowser() {
|
||||
MediaBrowser.releaseFuture(mediaBrowserListenableFuture);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.ClipboardManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -44,8 +45,6 @@ import com.google.android.material.chip.Chip;
|
||||
import com.google.android.material.chip.ChipGroup;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import com.cappielloantonio.tempo.util.ExternalAudioWriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,7 +66,9 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
private AssetLinkUtil.AssetLink currentAlbumLink;
|
||||
private AssetLinkUtil.AssetLink currentArtistLink;
|
||||
|
||||
private boolean isFirstBatch = true;
|
||||
private ListenableFuture<MediaBrowser> mediaBrowserListenableFuture;
|
||||
private static final String TAG = "SongBottomSheetDialog";
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -143,20 +144,34 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
|
||||
TextView playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, song);
|
||||
((MainActivity) requireActivity()).setBottomSheetInPeek(true);
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
if (activity == null) return;
|
||||
|
||||
songBottomSheetViewModel.getInstantMix(getViewLifecycleOwner(), song).observe(getViewLifecycleOwner(), songs -> {
|
||||
MusicUtil.ratingFilter(songs);
|
||||
ListenableFuture<MediaBrowser> activityBrowserFuture = activity.getMediaBrowserListenableFuture();
|
||||
if (activityBrowserFuture == null) {
|
||||
Log.e(TAG, "MediaBrowser Future is null in MainActivity");
|
||||
return;
|
||||
}
|
||||
|
||||
if (songs == null) {
|
||||
dismissBottomSheet();
|
||||
return;
|
||||
}
|
||||
isFirstBatch = true;
|
||||
Toast.makeText(requireContext(), R.string.bottom_sheet_generating_instant_mix, Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (!songs.isEmpty()) {
|
||||
MediaManager.enqueue(mediaBrowserListenableFuture, songs, true);
|
||||
dismissBottomSheet();
|
||||
songBottomSheetViewModel.getInstantMix(activity, song).observe(activity, media -> {
|
||||
|
||||
if (media == null || media.isEmpty()) return;
|
||||
if (getActivity() == null) return;
|
||||
|
||||
MusicUtil.ratingFilter(media);
|
||||
|
||||
if (isFirstBatch) {
|
||||
isFirstBatch = false;
|
||||
MediaManager.startQueue(activityBrowserFuture, media, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
if (isAdded()) {
|
||||
dismissBottomSheet();
|
||||
}
|
||||
} else {
|
||||
MediaManager.enqueue(activityBrowserFuture, media, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -327,16 +342,12 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
chip.setVisibility(View.VISIBLE);
|
||||
|
||||
chip.setOnClickListener(v -> {
|
||||
if (assetLink != null) {
|
||||
((MainActivity) requireActivity()).openAssetLink(assetLink);
|
||||
}
|
||||
((MainActivity) requireActivity()).openAssetLink(assetLink);
|
||||
});
|
||||
|
||||
chip.setOnLongClickListener(v -> {
|
||||
if (assetLink != null) {
|
||||
AssetLinkUtil.copyToClipboard(requireContext(), assetLink);
|
||||
Toast.makeText(requireContext(), getString(R.string.asset_link_copied_toast, id), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
AssetLinkUtil.copyToClipboard(requireContext(), assetLink);
|
||||
Toast.makeText(requireContext(), getString(R.string.asset_link_copied_toast, id), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -397,4 +408,5 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
||||
private void refreshShares() {
|
||||
homeViewModel.refreshShares(requireActivity());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -133,4 +133,7 @@ object Constants {
|
||||
const val CUSTOM_COMMAND_TOGGLE_REPEAT_MODE_OFF = "android.media3.session.demo.REPEAT_OFF"
|
||||
const val CUSTOM_COMMAND_TOGGLE_REPEAT_MODE_ONE = "android.media3.session.demo.REPEAT_ONE"
|
||||
const val CUSTOM_COMMAND_TOGGLE_REPEAT_MODE_ALL = "android.media3.session.demo.REPEAT_ALL"
|
||||
enum class SeedType {
|
||||
ARTIST, ALBUM, TRACK
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.cappielloantonio.tempo.util;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
@@ -35,84 +36,106 @@ public class MappingUtil {
|
||||
return mediaItems;
|
||||
}
|
||||
|
||||
private static final String TAG = "MappingUtil";
|
||||
|
||||
public static MediaItem mapMediaItem(Child media) {
|
||||
Uri uri = getUri(media);
|
||||
Uri artworkUri = Uri.parse(CustomGlideRequest.createUrl(media.getCoverArtId(), Preferences.getImageSize()));
|
||||
try {
|
||||
Uri uri = getUri(media);
|
||||
String coverArtId = media.getCoverArtId();
|
||||
Uri artworkUri = null;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("id", media.getId());
|
||||
bundle.putString("parentId", media.getParentId());
|
||||
bundle.putBoolean("isDir", media.isDir());
|
||||
bundle.putString("title", media.getTitle());
|
||||
bundle.putString("album", media.getAlbum());
|
||||
bundle.putString("artist", media.getArtist());
|
||||
bundle.putInt("track", media.getTrack() != null ? media.getTrack() : 0);
|
||||
bundle.putInt("year", media.getYear() != null ? media.getYear() : 0);
|
||||
bundle.putString("genre", media.getGenre());
|
||||
bundle.putString("coverArtId", media.getCoverArtId());
|
||||
bundle.putLong("size", media.getSize() != null ? media.getSize() : 0);
|
||||
bundle.putString("contentType", media.getContentType());
|
||||
bundle.putString("suffix", media.getSuffix());
|
||||
bundle.putString("transcodedContentType", media.getTranscodedContentType());
|
||||
bundle.putString("transcodedSuffix", media.getTranscodedSuffix());
|
||||
bundle.putInt("duration", media.getDuration() != null ? media.getDuration() : 0);
|
||||
bundle.putInt("bitrate", media.getBitrate() != null ? media.getBitrate() : 0);
|
||||
bundle.putInt("samplingRate", media.getSamplingRate() != null ? media.getSamplingRate() : 0);
|
||||
bundle.putInt("bitDepth", media.getBitDepth() != null ? media.getBitDepth() : 0);
|
||||
bundle.putString("path", media.getPath());
|
||||
bundle.putBoolean("isVideo", media.isVideo());
|
||||
bundle.putInt("userRating", media.getUserRating() != null ? media.getUserRating() : 0);
|
||||
bundle.putDouble("averageRating", media.getAverageRating() != null ? media.getAverageRating() : 0);
|
||||
bundle.putLong("playCount", media.getPlayCount() != null ? media.getPlayCount() : 0);
|
||||
bundle.putInt("discNumber", media.getDiscNumber() != null ? media.getDiscNumber() : 0);
|
||||
bundle.putLong("created", media.getCreated() != null ? media.getCreated().getTime() : 0);
|
||||
bundle.putLong("starred", media.getStarred() != null ? media.getStarred().getTime() : 0);
|
||||
bundle.putString("albumId", media.getAlbumId());
|
||||
bundle.putString("artistId", media.getArtistId());
|
||||
bundle.putString("type", Constants.MEDIA_TYPE_MUSIC);
|
||||
bundle.putLong("bookmarkPosition", media.getBookmarkPosition() != null ? media.getBookmarkPosition() : 0);
|
||||
bundle.putInt("originalWidth", media.getOriginalWidth() != null ? media.getOriginalWidth() : 0);
|
||||
bundle.putInt("originalHeight", media.getOriginalHeight() != null ? media.getOriginalHeight() : 0);
|
||||
bundle.putString("uri", uri.toString());
|
||||
bundle.putString("assetLinkSong", AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_SONG, media.getId()));
|
||||
bundle.putString("assetLinkAlbum", AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_ALBUM, media.getAlbumId()));
|
||||
bundle.putString("assetLinkArtist", AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_ARTIST, media.getArtistId()));
|
||||
bundle.putString("assetLinkGenre", AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_GENRE, media.getGenre()));
|
||||
Integer year = media.getYear();
|
||||
bundle.putString("assetLinkYear", year != null && year != 0 ? AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_YEAR, String.valueOf(year)) : null);
|
||||
if (coverArtId != null) {
|
||||
artworkUri = Uri.parse(CustomGlideRequest.createUrl(coverArtId, Preferences.getImageSize()));
|
||||
}
|
||||
|
||||
return new MediaItem.Builder()
|
||||
.setMediaId(media.getId())
|
||||
.setMediaMetadata(
|
||||
new MediaMetadata.Builder()
|
||||
.setTitle(media.getTitle())
|
||||
.setTrackNumber(media.getTrack() != null ? media.getTrack() : 0)
|
||||
.setDiscNumber(media.getDiscNumber() != null ? media.getDiscNumber() : 0)
|
||||
.setReleaseYear(media.getYear() != null ? media.getYear() : 0)
|
||||
.setAlbumTitle(media.getAlbum())
|
||||
.setArtist(media.getArtist())
|
||||
.setArtworkUri(artworkUri)
|
||||
.setUserRating(new HeartRating(media.getStarred() != null))
|
||||
.setSupportedCommands(
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("id", media.getId());
|
||||
bundle.putString("parentId", media.getParentId());
|
||||
bundle.putBoolean("isDir", media.isDir());
|
||||
|
||||
bundle.putString("title", media.getTitle());
|
||||
bundle.putString("album", media.getAlbum());
|
||||
bundle.putString("artist", media.getArtist());
|
||||
|
||||
bundle.putInt("track", media.getTrack() != null ? media.getTrack() : 0);
|
||||
bundle.putInt("year", media.getYear() != null ? media.getYear() : 0);
|
||||
bundle.putString("genre", media.getGenre());
|
||||
bundle.putString("coverArtId", coverArtId);
|
||||
bundle.putLong("size", media.getSize() != null ? media.getSize() : 0);
|
||||
bundle.putString("contentType", media.getContentType());
|
||||
bundle.putString("suffix", media.getSuffix());
|
||||
bundle.putString("transcodedContentType", media.getTranscodedContentType());
|
||||
bundle.putString("transcodedSuffix", media.getTranscodedSuffix());
|
||||
bundle.putInt("duration", media.getDuration() != null ? media.getDuration() : 0);
|
||||
bundle.putInt("bitrate", media.getBitrate() != null ? media.getBitrate() : 0);
|
||||
bundle.putInt("samplingRate", media.getSamplingRate() != null ? media.getSamplingRate() : 0);
|
||||
bundle.putInt("bitDepth", media.getBitDepth() != null ? media.getBitDepth() : 0);
|
||||
bundle.putString("path", media.getPath());
|
||||
bundle.putBoolean("isVideo", media.isVideo());
|
||||
bundle.putInt("userRating", media.getUserRating() != null ? media.getUserRating() : 0);
|
||||
bundle.putDouble("averageRating", media.getAverageRating() != null ? media.getAverageRating() : 0);
|
||||
bundle.putLong("playCount", media.getPlayCount() != null ? media.getPlayCount() : 0);
|
||||
bundle.putInt("discNumber", media.getDiscNumber() != null ? media.getDiscNumber() : 0);
|
||||
bundle.putLong("created", media.getCreated() != null ? media.getCreated().getTime() : 0);
|
||||
bundle.putLong("starred", media.getStarred() != null ? media.getStarred().getTime() : 0);
|
||||
bundle.putString("albumId", media.getAlbumId());
|
||||
bundle.putString("artistId", media.getArtistId());
|
||||
bundle.putString("type", Constants.MEDIA_TYPE_MUSIC);
|
||||
bundle.putLong("bookmarkPosition", media.getBookmarkPosition() != null ? media.getBookmarkPosition() : 0);
|
||||
bundle.putInt("originalWidth", media.getOriginalWidth() != null ? media.getOriginalWidth() : 0);
|
||||
bundle.putInt("originalHeight", media.getOriginalHeight() != null ? media.getOriginalHeight() : 0);
|
||||
bundle.putString("uri", uri.toString());
|
||||
|
||||
bundle.putString("assetLinkSong", media.getId() != null ? AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_SONG, media.getId()) : null);
|
||||
bundle.putString("assetLinkAlbum", media.getAlbumId() != null ? AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_ALBUM, media.getAlbumId()) : null);
|
||||
bundle.putString("assetLinkArtist", media.getArtistId() != null ? AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_ARTIST, media.getArtistId()) : null);
|
||||
bundle.putString("assetLinkGenre", AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_GENRE, media.getGenre()));
|
||||
Integer year = media.getYear();
|
||||
bundle.putString("assetLinkYear", year != null && year != 0 ? AssetLinkUtil.buildLink(AssetLinkUtil.TYPE_YEAR, String.valueOf(year)) : null);
|
||||
|
||||
return new MediaItem.Builder()
|
||||
.setMediaId(media.getId())
|
||||
.setMediaMetadata(
|
||||
new MediaMetadata.Builder()
|
||||
.setTitle(media.getTitle())
|
||||
.setTrackNumber(media.getTrack() != null ? media.getTrack() : 0)
|
||||
.setDiscNumber(media.getDiscNumber() != null ? media.getDiscNumber() : 0)
|
||||
.setReleaseYear(media.getYear() != null ? media.getYear() : 0)
|
||||
.setAlbumTitle(media.getAlbum())
|
||||
.setArtist(media.getArtist())
|
||||
.setArtworkUri(artworkUri)
|
||||
.setUserRating(new HeartRating(media.getStarred() != null))
|
||||
.setSupportedCommands(
|
||||
ImmutableList.of(
|
||||
Constants.CUSTOM_COMMAND_TOGGLE_HEART_ON,
|
||||
Constants.CUSTOM_COMMAND_TOGGLE_HEART_OFF
|
||||
)
|
||||
)
|
||||
.setExtras(bundle)
|
||||
.setIsBrowsable(false)
|
||||
.setIsPlayable(true)
|
||||
.build()
|
||||
)
|
||||
.setRequestMetadata(
|
||||
new MediaItem.RequestMetadata.Builder()
|
||||
.setMediaUri(uri)
|
||||
.setExtras(bundle)
|
||||
.build()
|
||||
)
|
||||
.setMimeType(MimeTypes.BASE_TYPE_AUDIO)
|
||||
.setUri(uri)
|
||||
.build();
|
||||
)
|
||||
.setExtras(bundle)
|
||||
.setIsBrowsable(false)
|
||||
.setIsPlayable(true)
|
||||
.build()
|
||||
)
|
||||
.setRequestMetadata(
|
||||
new MediaItem.RequestMetadata.Builder()
|
||||
.setMediaUri(uri)
|
||||
.setExtras(bundle)
|
||||
.build()
|
||||
)
|
||||
.setMimeType(MimeTypes.BASE_TYPE_AUDIO)
|
||||
.setUri(uri)
|
||||
.build();
|
||||
|
||||
} catch (Exception e) {
|
||||
String id = media != null ? media.getId() : "NULL_MEDIA_OBJECT";
|
||||
String title = media != null ? media.getTitle() : "N/A";
|
||||
|
||||
Log.e(TAG, "Instant Mix CRASH! Failed to map song to MediaItem. " +
|
||||
"Problematic Song ID: " + id +
|
||||
", Title: " + title +
|
||||
". Inspect this song's Subsonic data for missing fields.", e);
|
||||
throw new RuntimeException("Mapping failed for song ID: " + id, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static MediaItem mapMediaItem(MediaItem old) {
|
||||
|
||||
@@ -81,6 +81,8 @@ object Preferences {
|
||||
private const val ALBUM_SORT_ORDER = "album_sort_order"
|
||||
private const val DEFAULT_ALBUM_SORT_ORDER = Constants.ALBUM_ORDER_BY_NAME
|
||||
private const val ARTIST_SORT_BY_ALBUM_COUNT= "artist_sort_by_album_count"
|
||||
private const val SORT_SEARCH_CHRONOLOGICALLY= "sort_search_chronologically"
|
||||
private const val ARTIST_DISPLAY_BIOGRAPHY= "artist_display_biography"
|
||||
|
||||
@JvmStatic
|
||||
fun getServer(): String? {
|
||||
@@ -674,4 +676,19 @@ object Preferences {
|
||||
else
|
||||
return Constants.ARTIST_ORDER_BY_NAME
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isSearchSortingChronologicallyEnabled(): Boolean {
|
||||
return App.getInstance().preferences.getBoolean(SORT_SEARCH_CHRONOLOGICALLY, false)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getArtistDisplayBiography(): Boolean {
|
||||
return App.getInstance().preferences.getBoolean(ARTIST_DISPLAY_BIOGRAPHY, true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setArtistDisplayBiography(displayBiographyEnabled: Boolean) {
|
||||
App.getInstance().preferences.edit().putBoolean(ARTIST_DISPLAY_BIOGRAPHY, displayBiographyEnabled).apply()
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,13 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
import com.cappielloantonio.tempo.model.Download;
|
||||
import com.cappielloantonio.tempo.interfaces.StarCallback;
|
||||
@@ -24,6 +27,7 @@ import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.NetworkUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -33,8 +37,8 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
||||
private final ArtistRepository artistRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
private final SharingRepository sharingRepository;
|
||||
|
||||
private AlbumID3 album;
|
||||
private final MutableLiveData<List<Child>> instantMix = new MutableLiveData<>(null);
|
||||
|
||||
public AlbumBottomSheetViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
@@ -116,6 +120,7 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
||||
MutableLiveData<List<Child>> tracksLiveData = albumRepository.getAlbumTracks(album.getId());
|
||||
|
||||
tracksLiveData.observeForever(new Observer<List<Child>>() {
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
public void onChanged(List<Child> songs) {
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
@@ -129,4 +134,12 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getAlbumInstantMix(LifecycleOwner owner, AlbumID3 album) {
|
||||
instantMix.setValue(Collections.emptyList());
|
||||
|
||||
albumRepository.getInstantMix(album, 20).observe(owner, instantMix::postValue);
|
||||
|
||||
return instantMix;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,18 +8,23 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.tempo.interfaces.StarCallback;
|
||||
import com.cappielloantonio.tempo.repository.AlbumRepository;
|
||||
import com.cappielloantonio.tempo.repository.ArtistRepository;
|
||||
import com.cappielloantonio.tempo.repository.FavoriteRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumInfo;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.util.NetworkUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class AlbumPageViewModel extends AndroidViewModel {
|
||||
private final AlbumRepository albumRepository;
|
||||
private final ArtistRepository artistRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
private String albumId;
|
||||
private String artistId;
|
||||
private final MutableLiveData<AlbumID3> album = new MutableLiveData<>(null);
|
||||
@@ -29,6 +34,7 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
||||
|
||||
albumRepository = new AlbumRepository();
|
||||
artistRepository = new ArtistRepository();
|
||||
favoriteRepository = new FavoriteRepository();
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getAlbumSongLiveList() {
|
||||
@@ -49,6 +55,61 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void setFavorite() {
|
||||
AlbumID3 currentAlbum = album.getValue();
|
||||
if (currentAlbum == null) return;
|
||||
|
||||
if (currentAlbum.getStarred() != null) {
|
||||
if (NetworkUtil.isOffline()) {
|
||||
removeFavoriteOffline(currentAlbum);
|
||||
} else {
|
||||
removeFavoriteOnline(currentAlbum);
|
||||
}
|
||||
} else {
|
||||
if (NetworkUtil.isOffline()) {
|
||||
setFavoriteOffline(currentAlbum);
|
||||
} else {
|
||||
setFavoriteOnline(currentAlbum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFavoriteOffline(AlbumID3 album) {
|
||||
favoriteRepository.starLater(null, album.getId(), null, false);
|
||||
album.setStarred(null);
|
||||
this.album.postValue(album);
|
||||
}
|
||||
|
||||
private void removeFavoriteOnline(AlbumID3 album) {
|
||||
favoriteRepository.unstar(null, album.getId(), null, new StarCallback() {
|
||||
@Override
|
||||
public void onError() {
|
||||
favoriteRepository.starLater(null, album.getId(), null, false);
|
||||
}
|
||||
});
|
||||
|
||||
album.setStarred(null);
|
||||
this.album.postValue(album);
|
||||
}
|
||||
|
||||
private void setFavoriteOffline(AlbumID3 album) {
|
||||
favoriteRepository.starLater(null, album.getId(), null, true);
|
||||
album.setStarred(new Date());
|
||||
this.album.postValue(album);
|
||||
}
|
||||
|
||||
private void setFavoriteOnline(AlbumID3 album) {
|
||||
favoriteRepository.star(null, album.getId(), null, new StarCallback() {
|
||||
@Override
|
||||
public void onError() {
|
||||
favoriteRepository.starLater(null, album.getId(), null, true);
|
||||
}
|
||||
});
|
||||
|
||||
album.setStarred(new Date());
|
||||
this.album.postValue(album);
|
||||
}
|
||||
|
||||
public LiveData<ArtistID3> getArtist() {
|
||||
return artistRepository.getArtistInfo(artistId);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,12 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
import com.cappielloantonio.tempo.model.Download;
|
||||
import com.cappielloantonio.tempo.interfaces.StarCallback;
|
||||
@@ -17,6 +22,7 @@ import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.List;
|
||||
@@ -24,6 +30,7 @@ import java.util.List;
|
||||
public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
||||
private final ArtistRepository artistRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
private final MutableLiveData<List<Child>> instantMix = new MutableLiveData<>(null);
|
||||
|
||||
private ArtistID3 artist;
|
||||
|
||||
@@ -95,6 +102,7 @@ public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
||||
Log.d("ArtistSync", "Starting artist sync for: " + artist.getName());
|
||||
|
||||
artistRepository.getArtistAllSongs(artist.getId(), new ArtistRepository.ArtistSongsCallback() {
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
public void onSongsCollected(List<Child> songs) {
|
||||
Log.d("ArtistSync", "Callback triggered with songs: " + (songs != null ? songs.size() : 0));
|
||||
@@ -114,5 +122,12 @@ public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
||||
Log.d("ArtistSync", "Artist sync preference is disabled");
|
||||
}
|
||||
}
|
||||
///
|
||||
|
||||
public LiveData<List<Child>> getArtistInstantMix(LifecycleOwner owner, ArtistID3 artist) {
|
||||
instantMix.setValue(Collections.emptyList());
|
||||
|
||||
artistRepository.getInstantMix(artist, 20).observe(owner, instantMix::postValue);
|
||||
|
||||
return instantMix;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,37 @@
|
||||
package com.cappielloantonio.tempo.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
import com.cappielloantonio.tempo.model.Download;
|
||||
import com.cappielloantonio.tempo.interfaces.StarCallback;
|
||||
import com.cappielloantonio.tempo.repository.AlbumRepository;
|
||||
import com.cappielloantonio.tempo.repository.ArtistRepository;
|
||||
import com.cappielloantonio.tempo.repository.FavoriteRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistInfo2;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.NetworkUtil;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ArtistPageViewModel extends AndroidViewModel {
|
||||
private final AlbumRepository albumRepository;
|
||||
private final ArtistRepository artistRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
|
||||
private ArtistID3 artist;
|
||||
|
||||
@@ -26,6 +40,7 @@ public class ArtistPageViewModel extends AndroidViewModel {
|
||||
|
||||
albumRepository = new AlbumRepository();
|
||||
artistRepository = new ArtistRepository();
|
||||
favoriteRepository = new FavoriteRepository();
|
||||
}
|
||||
|
||||
public LiveData<List<AlbumID3>> getAlbumList() {
|
||||
@@ -55,4 +70,70 @@ public class ArtistPageViewModel extends AndroidViewModel {
|
||||
public void setArtist(ArtistID3 artist) {
|
||||
this.artist = artist;
|
||||
}
|
||||
|
||||
public void setFavorite(Context context) {
|
||||
if (artist.getStarred() != null) {
|
||||
if (NetworkUtil.isOffline()) {
|
||||
removeFavoriteOffline();
|
||||
} else {
|
||||
removeFavoriteOnline();
|
||||
}
|
||||
} else {
|
||||
if (NetworkUtil.isOffline()) {
|
||||
setFavoriteOffline();
|
||||
} else {
|
||||
setFavoriteOnline(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFavoriteOffline() {
|
||||
favoriteRepository.starLater(null, null, artist.getId(), false);
|
||||
artist.setStarred(null);
|
||||
}
|
||||
|
||||
private void removeFavoriteOnline() {
|
||||
favoriteRepository.unstar(null, null, artist.getId(), new StarCallback() {
|
||||
@Override
|
||||
public void onError() {
|
||||
favoriteRepository.starLater(null, null, artist.getId(), false);
|
||||
}
|
||||
});
|
||||
|
||||
artist.setStarred(null);
|
||||
}
|
||||
|
||||
private void setFavoriteOffline() {
|
||||
favoriteRepository.starLater(null, null, artist.getId(), true);
|
||||
artist.setStarred(new Date());
|
||||
}
|
||||
|
||||
private void setFavoriteOnline(Context context) {
|
||||
favoriteRepository.star(null, null, artist.getId(), new StarCallback() {
|
||||
@Override
|
||||
public void onError() {
|
||||
favoriteRepository.starLater(null, null, artist.getId(), true);
|
||||
}
|
||||
});
|
||||
|
||||
artist.setStarred(new Date());
|
||||
|
||||
if (Preferences.isStarredArtistsSyncEnabled()) {
|
||||
artistRepository.getArtistAllSongs(artist.getId(), new ArtistRepository.ArtistSongsCallback() {
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
@Override
|
||||
public void onSongsCollected(List<Child> songs) {
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
DownloadUtil.getDownloadTracker(context).download(
|
||||
MappingUtil.mapDownloads(songs),
|
||||
songs.stream().map(Download::new).collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.d("ArtistSync", "Artist sync preference is disabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Playlist;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||
import com.cappielloantonio.tempo.util.Constants.SeedType;
|
||||
import com.cappielloantonio.tempo.util.Preferences;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
@@ -34,7 +35,6 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HomeViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "HomeViewModel";
|
||||
@@ -223,7 +223,7 @@ public class HomeViewModel extends AndroidViewModel {
|
||||
public LiveData<List<Child>> getMediaInstantMix(LifecycleOwner owner, Child media) {
|
||||
mediaInstantMix.setValue(Collections.emptyList());
|
||||
|
||||
songRepository.getInstantMix(media.getId(), 20).observe(owner, mediaInstantMix::postValue);
|
||||
songRepository.getInstantMix(media.getId(), SeedType.TRACK, 20).observe(owner, mediaInstantMix::postValue);
|
||||
|
||||
return mediaInstantMix;
|
||||
}
|
||||
@@ -248,15 +248,15 @@ public class HomeViewModel extends AndroidViewModel {
|
||||
pinnedPlaylists.setValue(Collections.emptyList());
|
||||
|
||||
playlistRepository.getPlaylists(false, -1).observe(owner, remotes -> {
|
||||
playlistRepository.getPinnedPlaylists().observe(owner, locals -> {
|
||||
if (remotes != null && locals != null) {
|
||||
List<Playlist> toReturn = remotes.stream()
|
||||
.filter(remote -> locals.stream().anyMatch(local -> local.getId().equals(remote.getId())))
|
||||
.collect(Collectors.toList());
|
||||
if (remotes != null && !remotes.isEmpty()) {
|
||||
List<Playlist> playlists = new ArrayList<>(remotes);
|
||||
Collections.shuffle(playlists);
|
||||
List<Playlist> randomPlaylists = playlists.size() > 5
|
||||
? playlists.subList(0, 5)
|
||||
: playlists;
|
||||
|
||||
pinnedPlaylists.setValue(toReturn);
|
||||
}
|
||||
});
|
||||
pinnedPlaylists.setValue(randomPlaylists);
|
||||
}
|
||||
});
|
||||
|
||||
return pinnedPlaylists;
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Observer;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.session.MediaBrowser;
|
||||
|
||||
import com.cappielloantonio.tempo.interfaces.StarCallback;
|
||||
import com.cappielloantonio.tempo.model.Download;
|
||||
@@ -278,7 +277,7 @@ public class PlayerBottomSheetViewModel extends AndroidViewModel {
|
||||
public LiveData<List<Child>> getMediaInstantMix(LifecycleOwner owner, Child media) {
|
||||
instantMix.setValue(Collections.emptyList());
|
||||
|
||||
songRepository.getInstantMix(media.getId(), 20).observe(owner, instantMix::postValue);
|
||||
songRepository.getInstantMix(media.getId(), Constants.SeedType.TRACK, 20).observe(owner, instantMix::postValue);
|
||||
|
||||
return instantMix;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
package com.cappielloantonio.tempo.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
||||
import com.cappielloantonio.tempo.repository.PodcastRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
import com.cappielloantonio.tempo.subsonic.models.PodcastChannel;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class PodcastChannelBottomSheetViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "PodcastChannelBottomSheetViewModel";
|
||||
private final PodcastRepository podcastRepository;
|
||||
|
||||
private PodcastChannel podcastChannel;
|
||||
@@ -28,6 +38,59 @@ public class PodcastChannelBottomSheetViewModel extends AndroidViewModel {
|
||||
}
|
||||
|
||||
public void deletePodcastChannel() {
|
||||
if (podcastChannel != null) podcastRepository.deletePodcastChannel(podcastChannel.getId());
|
||||
if (podcastChannel != null && podcastChannel.getId() != null) {
|
||||
podcastRepository.deletePodcastChannel(podcastChannel.getId())
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.code() == 501) {
|
||||
Toast.makeText(getApplication(),
|
||||
"Podcasts are not supported by this server",
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ApiResponse apiResponse = response.body();
|
||||
|
||||
String status = apiResponse.subsonicResponse.getStatus();
|
||||
|
||||
if ("ok".equals(status)) {
|
||||
Toast.makeText(getApplication(),
|
||||
"Podcast channel deleted",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
//TODO refresh the UI after deleting
|
||||
//podcastRepository.refreshPodcasts();
|
||||
}
|
||||
} else {
|
||||
handleHttpError(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
Toast.makeText(getApplication(),
|
||||
"Network error: " + t.getMessage(),
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void handleHttpError(Response<ApiResponse> response) {
|
||||
String errorMsg = "HTTP error: " + response.code();
|
||||
if (response.errorBody() != null) {
|
||||
try {
|
||||
String serverMsg = response.errorBody().string();
|
||||
if (!serverMsg.isEmpty()) {
|
||||
errorMsg += " - " + serverMsg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Error reading error body", e);
|
||||
}
|
||||
}
|
||||
|
||||
Toast.makeText(getApplication(), errorMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,27 +1,99 @@
|
||||
package com.cappielloantonio.tempo.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.tempo.R;
|
||||
import com.cappielloantonio.tempo.repository.PodcastRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.models.InternetRadioStation;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class PodcastChannelEditorViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "RadioEditorViewModel";
|
||||
private static final String TAG = "PodcastChannelEditorViewModel";
|
||||
|
||||
private final PodcastRepository podcastRepository;
|
||||
|
||||
private InternetRadioStation toEdit;
|
||||
private final MutableLiveData<Boolean> isSuccess = new MutableLiveData<>(false);
|
||||
private final MutableLiveData<String> errorMessage = new MutableLiveData<>();
|
||||
|
||||
public PodcastChannelEditorViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
podcastRepository = new PodcastRepository();
|
||||
}
|
||||
|
||||
public void createChannel(String url) {
|
||||
podcastRepository.createPodcastChannel(url);
|
||||
public LiveData<Boolean> getIsSuccess() {
|
||||
return isSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
public LiveData<String> getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void clearError() {
|
||||
errorMessage.setValue(null);
|
||||
}
|
||||
|
||||
public void createChannel(String url) {
|
||||
errorMessage.setValue(null);
|
||||
isSuccess.setValue(false);
|
||||
|
||||
podcastRepository.createPodcastChannel(url)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.code() == 501) {
|
||||
showError(getApplication().getString(R.string.podcast_channel_not_supported_snackbar));
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ApiResponse apiResponse = response.body();
|
||||
|
||||
String status = apiResponse.subsonicResponse.getStatus();
|
||||
if ("ok".equals(status)) {
|
||||
isSuccess.setValue(true);
|
||||
}
|
||||
} else {
|
||||
handleHttpError(response);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
showError("Network error: " + t.getMessage());
|
||||
Log.e(TAG, "Network error", t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleHttpError(Response<ApiResponse> response) {
|
||||
String errorMsg = "HTTP error: " + response.code();
|
||||
if (response.errorBody() != null) {
|
||||
try {
|
||||
String serverMsg = response.errorBody().string();
|
||||
if (!serverMsg.isEmpty()) {
|
||||
errorMsg += " - " + serverMsg;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Error reading error body", e);
|
||||
}
|
||||
}
|
||||
showError(errorMsg);
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Toast.makeText(getApplication(), message, Toast.LENGTH_LONG).show();
|
||||
errorMessage.setValue(message);
|
||||
Log.e(TAG, "Error shown: " + message);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,47 @@
|
||||
package com.cappielloantonio.tempo.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.tempo.R;
|
||||
import com.cappielloantonio.tempo.repository.RadioRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.base.ApiResponse;
|
||||
import com.cappielloantonio.tempo.subsonic.models.InternetRadioStation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
public class RadioEditorViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "RadioEditorViewModel";
|
||||
|
||||
private final RadioRepository radioRepository;
|
||||
|
||||
private InternetRadioStation toEdit;
|
||||
|
||||
private final MutableLiveData<Boolean> isSuccess = new MutableLiveData<>(false);
|
||||
private final MutableLiveData<String> errorMessage = new MutableLiveData<>();
|
||||
|
||||
public RadioEditorViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
radioRepository = new RadioRepository();
|
||||
}
|
||||
|
||||
|
||||
public LiveData<Boolean> getIsSuccess() { return isSuccess; }
|
||||
public LiveData<String> getErrorMessage() { return errorMessage; }
|
||||
|
||||
public void clearError() {
|
||||
errorMessage.setValue(null);
|
||||
}
|
||||
|
||||
public InternetRadioStation getRadioToEdit() {
|
||||
return toEdit;
|
||||
}
|
||||
@@ -30,14 +51,120 @@ public class RadioEditorViewModel extends AndroidViewModel {
|
||||
}
|
||||
|
||||
public void createRadio(String name, String streamURL, String homepageURL) {
|
||||
radioRepository.createInternetRadioStation(name, streamURL, homepageURL);
|
||||
errorMessage.setValue(null);
|
||||
isSuccess.setValue(false);
|
||||
|
||||
radioRepository.createInternetRadioStation(name, streamURL, homepageURL)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
// Handle HTTP 501 (Not Implemented) from Navidrome
|
||||
if (response.code() == 501) {
|
||||
showError(getApplication().getString(R.string.radio_dialog_not_supported_snackbar));
|
||||
return;
|
||||
}
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ApiResponse apiResponse = response.body();
|
||||
String status = apiResponse.subsonicResponse.getStatus();
|
||||
if ("ok".equals(status)) {
|
||||
isSuccess.setValue(true);
|
||||
} else if ("failed".equals(status)) {
|
||||
handleFailedResponse(apiResponse);
|
||||
}
|
||||
} else {
|
||||
errorMessage.setValue("HTTP error: " + response.code());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
errorMessage.setValue("Network error: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateRadio(String name, String streamURL, String homepageURL) {
|
||||
if (toEdit != null) radioRepository.updateInternetRadioStation(toEdit.getId(), name, streamURL, homepageURL);
|
||||
if (toEdit != null && toEdit.getId() != null) {
|
||||
errorMessage.setValue(null);
|
||||
isSuccess.setValue(false);
|
||||
|
||||
radioRepository.updateInternetRadioStation(toEdit.getId(), name, streamURL, homepageURL)
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ApiResponse apiResponse = response.body();
|
||||
if (apiResponse.subsonicResponse != null) {
|
||||
String status = apiResponse.subsonicResponse.getStatus();
|
||||
if ("ok".equals(status)) {
|
||||
isSuccess.setValue(true);
|
||||
} else if ("failed".equals(status)) {
|
||||
handleFailedResponse(apiResponse);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
errorMessage.setValue("HTTP error: " + response.code());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
errorMessage.setValue("Network error: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRadio() {
|
||||
if (toEdit != null) radioRepository.deleteInternetRadioStation(toEdit.getId());
|
||||
if (toEdit != null && toEdit.getId() != null) {
|
||||
errorMessage.setValue(null);
|
||||
isSuccess.setValue(false);
|
||||
|
||||
radioRepository.deleteInternetRadioStation(toEdit.getId())
|
||||
.enqueue(new Callback<ApiResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<ApiResponse> call, @NonNull Response<ApiResponse> response) {
|
||||
if (response.isSuccessful() && response.body() != null) {
|
||||
ApiResponse apiResponse = response.body();
|
||||
|
||||
String status = apiResponse.subsonicResponse.getStatus();
|
||||
|
||||
if ("ok".equals(status)) {
|
||||
isSuccess.setValue(true);
|
||||
} else if ("failed".equals(status)) {
|
||||
handleFailedResponse(apiResponse);
|
||||
}
|
||||
} else {
|
||||
errorMessage.setValue("HTTP error: " + response.code());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<ApiResponse> call, @NonNull Throwable t) {
|
||||
errorMessage.setValue("Network error: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Toast.makeText(getApplication(), message, Toast.LENGTH_LONG).show();
|
||||
errorMessage.setValue(message);
|
||||
}
|
||||
|
||||
private void handleFailedResponse(ApiResponse apiResponse) {
|
||||
String errorMsg = "Unknown server error";
|
||||
|
||||
if (apiResponse.subsonicResponse.getError() != null) {
|
||||
errorMsg = apiResponse.subsonicResponse.getError().getMessage();
|
||||
|
||||
if ("Not implemented".equals(errorMsg)) {
|
||||
errorMsg = getApplication().getString((R.string.radio_dialog_not_supported_snackbar));
|
||||
}
|
||||
}
|
||||
|
||||
Toast.makeText(getApplication(), errorMsg, Toast.LENGTH_LONG).show();
|
||||
|
||||
errorMessage.setValue(errorMsg);
|
||||
}
|
||||
}
|
||||
@@ -48,11 +48,11 @@ public class SearchViewModel extends AndroidViewModel {
|
||||
}
|
||||
|
||||
public void insertNewSearch(String search) {
|
||||
searchingRepository.insert(new RecentSearch(search));
|
||||
searchingRepository.insert(new RecentSearch(search, System.currentTimeMillis() / 1000L));
|
||||
}
|
||||
|
||||
public void deleteRecentSearch(String search) {
|
||||
searchingRepository.delete(new RecentSearch(search));
|
||||
searchingRepository.delete(new RecentSearch(search, 0));
|
||||
}
|
||||
|
||||
public LiveData<List<String>> getSearchSuggestion(String query) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
|
||||
import com.cappielloantonio.tempo.interfaces.MediaCallback;
|
||||
import com.cappielloantonio.tempo.interfaces.StarCallback;
|
||||
import com.cappielloantonio.tempo.model.Download;
|
||||
import com.cappielloantonio.tempo.repository.AlbumRepository;
|
||||
@@ -21,6 +22,7 @@ import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||
import com.cappielloantonio.tempo.util.Constants.SeedType;
|
||||
import com.cappielloantonio.tempo.util.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.NetworkUtil;
|
||||
@@ -128,11 +130,22 @@ public class SongBottomSheetViewModel extends AndroidViewModel {
|
||||
public LiveData<List<Child>> getInstantMix(LifecycleOwner owner, Child media) {
|
||||
instantMix.setValue(Collections.emptyList());
|
||||
|
||||
songRepository.getInstantMix(media.getId(), 20).observe(owner, instantMix::postValue);
|
||||
songRepository.getInstantMix(media.getId(), SeedType.TRACK, 20).observe(owner, instantMix::postValue);
|
||||
|
||||
return instantMix;
|
||||
}
|
||||
|
||||
public void getInstantMix(Child media, int count, MediaCallback callback) {
|
||||
|
||||
songRepository.getInstantMix(media.getId(), SeedType.TRACK, count, songs -> {
|
||||
if (songs != null && !songs.isEmpty()) {
|
||||
callback.onLoadMedia(songs);
|
||||
} else {
|
||||
callback.onLoadMedia(Collections.emptyList());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public MutableLiveData<Share> shareTrack() {
|
||||
return sharingRepository.createShare(song.getId(), song.getTitle(), null);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_notes_textview" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
@@ -188,43 +187,69 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_detail_view" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/album_page_button_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:gravity="center_vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/upper_button_divider">
|
||||
|
||||
<Button
|
||||
android:id="@+id/album_page_play_button"
|
||||
<LinearLayout
|
||||
android:id="@+id/album_page_button_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/album_page_play_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_play"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/album_page_play_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/album_page_play_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_play"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/album_page_shuffle_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/album_page_shuffle_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_shuffle"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/button_favorite"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:background="@drawable/button_favorite_selector"
|
||||
android:checked="false"
|
||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
android:textOff=""
|
||||
android:textOn="" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/album_page_shuffle_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/album_page_shuffle_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_shuffle"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
@@ -239,7 +264,8 @@
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_page_button_layout" />
|
||||
app:layout_constraintTop_toBottomOf="@id/album_page_button_layout"
|
||||
tools:ignore="NotSibling" />
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_button_divider"
|
||||
@@ -249,7 +275,7 @@
|
||||
android:layout_marginBottom="18dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_page_button_layout" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/album_bio_label" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -63,40 +63,80 @@
|
||||
android:layout_marginEnd="18dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/album_page_button_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp">
|
||||
android:paddingBottom="4dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/artist_page_shuffle_button"
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/album_page_button_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/artist_page_shuffle_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_shuffle"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/artist_page_shuffle_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/artist_page_shuffle_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_shuffle"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/artist_page_radio_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/artist_page_radio_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_feed"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/button_favorite"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:background="@drawable/button_favorite_selector"
|
||||
android:checked="false"
|
||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
android:textOff=""
|
||||
android:textOn="" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/artist_page_radio_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/artist_page_radio_button"
|
||||
android:textAllCaps="false"
|
||||
app:icon="@drawable/ic_feed"
|
||||
app:iconGravity="textStart"
|
||||
app:iconPadding="18dp" />
|
||||
android:id="@+id/button_toggle_bio"
|
||||
android:layout_width="34dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:background="@drawable/ic_info_stream"
|
||||
android:foreground="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:gravity="center"
|
||||
android:text=""
|
||||
android:textOff=""
|
||||
android:textOn="" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
|
||||
@@ -379,16 +379,6 @@
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Best of -->
|
||||
<LinearLayout
|
||||
android:id="@+id/home_best_of_artist_sector"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/most_streamed_song_pre_text_view"
|
||||
@@ -400,6 +390,16 @@
|
||||
android:paddingEnd="16dp"
|
||||
android:text="@string/home_subtitle_best_of"
|
||||
android:textAllCaps="true" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Best of -->
|
||||
<LinearLayout
|
||||
android:id="@+id/home_best_of_artist_sector"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/best_of_artist_text_view_refreshable"
|
||||
@@ -566,6 +566,7 @@
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--Starred Albums-->
|
||||
<LinearLayout
|
||||
android:id="@+id/starred_albums_sector"
|
||||
android:layout_width="match_parent"
|
||||
@@ -615,6 +616,7 @@
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!--Starred Artists-->
|
||||
<LinearLayout
|
||||
android:id="@+id/starred_artists_sector"
|
||||
android:layout_width="match_parent"
|
||||
@@ -913,16 +915,36 @@
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pinned_playlists_text_view"
|
||||
style="@style/TitleLarge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/home_title_pinned_playlists" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/playlist_catalogue_text_view_clickable"
|
||||
style="@style/TitleMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/library_title_playlist_see_all_button" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/pinned_playlists_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -65,6 +65,9 @@
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_playlistPageFragment"
|
||||
app:destination="@id/playlistPageFragment" />
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_playlistCatalogueFragment"
|
||||
app:destination="@id/playlistCatalogueFragment" />
|
||||
<action
|
||||
android:id="@+id/action_homeFragment_to_podcastChannelCatalogueFragment"
|
||||
app:destination="@id/podcastChannelCatalogueFragment" />
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<string name="delete_download_storage_dialog_positive_button">Continuar</string>
|
||||
<string name="delete_download_storage_dialog_summary">Por favor, sea consciente de que si continúa, todos los elementos descargados de todos los servidores se eliminarán.</string>
|
||||
<string name="delete_download_storage_dialog_title">Eliminar elementos guardados</string>
|
||||
<string name="description_empty_title">Descripción no disponible</string>
|
||||
<string name="description_empty_title">Letra no disponible</string>
|
||||
<string name="disc_titlefull">Disco %1$s - %2$s</string>
|
||||
<string name="disc_titleless">Disco %1$s</string>
|
||||
<string name="download_directory_dialog_negative_button">Cancelar</string>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<string name="delete_download_storage_dialog_positive_button">Continuer</string>
|
||||
<string name="delete_download_storage_dialog_summary">Attention, la poursuite de cette action entraînera la suppression définitive de tous les éléments sauvegardés et téléchargés à partir de tous les serveurs</string>
|
||||
<string name="delete_download_storage_dialog_title">Supprimer les éléments téléchargés</string>
|
||||
<string name="description_empty_title">Aucune description disponible</string>
|
||||
<string name="description_empty_title">Paroles non disponibles</string>
|
||||
<string name="disc_titlefull">Disque %1$s - %2$s</string>
|
||||
<string name="disc_titleless">Disque %1$s</string>
|
||||
<string name="download_directory_dialog_negative_button">Annuler</string>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<string name="delete_download_storage_dialog_positive_button">Continua</string>
|
||||
<string name="delete_download_storage_dialog_summary">Attenzione, procedendo questa azione eliminerà definitivamente tutti gli elementi scaricati da tutti i server.</string>
|
||||
<string name="delete_download_storage_dialog_title">Elimina elementi salvati</string>
|
||||
<string name="description_empty_title">Descrizione non disponibile</string>
|
||||
<string name="description_empty_title">Testo non disponibile</string>
|
||||
<string name="disc_titlefull">Disco %1$s - %2$s</string>
|
||||
<string name="disc_titleless">Disco %1$s</string>
|
||||
<string name="download_directory_dialog_negative_button">Annulla</string>
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
<string name="battery_optimization_negative_button">Ignoruj</string>
|
||||
<string name="battery_optimization_neutral_button">Nie pytaj ponownie</string>
|
||||
<string name="battery_optimization_positive_button">Wyłącz</string>
|
||||
<string name="bottom_sheet_generating_instant_mix">Generowanie natychmiastowego mixu...</string>
|
||||
<string name="bottom_sheet_problem_generating_instant_mix">Nie udało się pobrać utworów z serwera subsonic.</string>
|
||||
<string name="connection_alert_dialog_negative_button">Anuluj</string>
|
||||
<string name="connection_alert_dialog_neutral_button">Włącz oszczędzanie danych</string>
|
||||
<string name="connection_alert_dialog_positive_button">OK</string>
|
||||
@@ -61,7 +63,7 @@
|
||||
<string name="delete_download_storage_dialog_positive_button">Kontynuuj</string>
|
||||
<string name="delete_download_storage_dialog_summary">Miej na uwadze to że kontynuowanie tej operacji spowoduje usunięcie wszystkich pobranych plików z wszystkich serwerów.</string>
|
||||
<string name="delete_download_storage_dialog_title">Usuwanie zapisanych plików</string>
|
||||
<string name="description_empty_title">Brak opisu</string>
|
||||
<string name="description_empty_title">Brak tekstu</string>
|
||||
<string name="disc_titlefull">Płyta %1$s - %2$s</string>
|
||||
<string name="disc_titleless">Płyta %1$s</string>
|
||||
<string name="download_directory_dialog_negative_button">Anuluj</string>
|
||||
@@ -124,6 +126,10 @@
|
||||
<string name="home_sync_starred_albums_subtitle">Albumy oznaczone gwiazdką będą dostępne offline</string>
|
||||
<string name="home_sync_starred_artists_title">Synchronizacja wykonawców oznaczonych gwiazdką</string>
|
||||
<string name="home_sync_starred_artists_subtitle">Masz wykonawców oznaczonych gwiazdką, bez pobranej muzyki</string>
|
||||
<plurals name="home_sync_starred_songs_count">
|
||||
<item quantity="one">%d piosenka wymaga synchronizacji</item>
|
||||
<item quantity="other">%d piosenek wymaga synchronizacji</item>
|
||||
</plurals>
|
||||
<string name="home_title_best_of">Najlepsze</string>
|
||||
<string name="home_title_discovery">Odkrywanie</string>
|
||||
<string name="home_title_discovery_shuffle_all_button">Odtwórz wszystkie losowo</string>
|
||||
@@ -242,6 +248,7 @@
|
||||
<string name="podcast_channel_catalogue_title_expanded">Przeglądaj Kanały</string>
|
||||
<string name="podcast_channel_editor_dialog_hint_rss_url">Url RSS</string>
|
||||
<string name="podcast_channel_editor_dialog_title">Kanał Podcastu</string>
|
||||
<string name="podcast_channel_not_supported_snackbar">Podcasty nie są obsługiwane przez ten serwer.</string>
|
||||
<string name="podcast_channel_page_title_description_section">Opis</string>
|
||||
<string name="podcast_channel_page_title_episode_section">Odcinki</string>
|
||||
<string name="podcast_channel_page_title_no_episode_available">Brak dostępnych odcinków</string>
|
||||
@@ -256,10 +263,13 @@
|
||||
<string name="radio_editor_dialog_negative_button">Anuluj</string>
|
||||
<string name="radio_editor_dialog_neutral_button">Usuń</string>
|
||||
<string name="radio_editor_dialog_positive_button">Zapisz</string>
|
||||
<string name="radio_editor_dialog_added">Dodano stację radiową</string>
|
||||
<string name="radio_editor_dialog_updated">Stacja radiowa uaktualniona</string>
|
||||
<string name="radio_editor_dialog_title">Internetowa Stacja Radiowa</string>
|
||||
<string name="radio_station_info_empty_button">Naciśnij aby ukryć tę sekcję\nEfekty będą widoczne po restarcie</string>
|
||||
<string name="radio_station_info_empty_subtitle">Gdy dodasz stację radiową, znajdziesz ją tutaj</string>
|
||||
<string name="radio_station_info_empty_title">Nie znaleziono stacji!</string>
|
||||
<string name="radio_dialog_not_supported_snackbar">Zarządzanie internetowymi stacjami radiowymi nie jest obsługiwane przez ten serwer.</string>
|
||||
<string name="rating_dialog_negative_button">Anuluj</string>
|
||||
<string name="rating_dialog_positive_button">Zapisz</string>
|
||||
<string name="rating_dialog_title">Oceń</string>
|
||||
@@ -527,4 +537,6 @@
|
||||
<string name="folder_play_collecting">Zbieranie piosenek z folderu…</string>
|
||||
<string name="folder_play_playing">Odtwarzanie %d piosenek</string>
|
||||
<string name="folder_play_no_songs">Nie znaleziono piosenek w folderze</string>
|
||||
<string name="search_sort_title">Sortuj ostatnie wyszukiwania chronologicznie</string>
|
||||
<string name="search_sort_summary">Jeżeli włączone, sortuje wyszukiwania chronologicznie. Sortuje po naziwe jeżeli wyłączone.</string>
|
||||
</resources>
|
||||
|
||||
@@ -32,6 +32,21 @@
|
||||
<item>300</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="streaming_cache_size_titles">
|
||||
<item>禁用</item>
|
||||
<item>128 MiB</item>
|
||||
<item>256 MiB</item>
|
||||
<item>512 MiB</item>
|
||||
<item>1024 MiB</item>
|
||||
</string-array>
|
||||
<string-array name="streaming_cache_size_values">
|
||||
<item>0</item>
|
||||
<item>128</item>
|
||||
<item>256</item>
|
||||
<item>512</item>
|
||||
<item>1024</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="max_bitrate_wifi_list_titles">
|
||||
<item>原始</item>
|
||||
<item>32 kbps</item>
|
||||
@@ -224,4 +239,19 @@
|
||||
<item>4</item>
|
||||
<item>8</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="skip_min_star_rating_titles">
|
||||
<item>不筛选评分</item>
|
||||
<item>1 星及以上</item>
|
||||
<item>2 星及以上</item>
|
||||
<item>3 星及以上</item>
|
||||
<item>4 星及以上</item>
|
||||
</string-array>
|
||||
<string-array name="skip_min_star_rating_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -1,13 +1,13 @@
|
||||
<resources>
|
||||
<string name="activity_battery_optimizations_conclusion">如果遇到问题,请访问 https://dontkillmyapp.com。 省电优化选项可能会影响应用的性能,网站上提供了如何禁用这些选项的详细说明。</string>
|
||||
<string name="activity_battery_optimizations_summary">请禁用针对媒体锁屏播放的电池优化。</string>
|
||||
<string name="activity_battery_optimizations_summary">请禁用针对锁屏播放的电池优化。</string>
|
||||
<string name="activity_battery_optimizations_title">电池优化</string>
|
||||
<string name="activity_info_offline_mode">离线模式</string>
|
||||
<string name="album_bottom_sheet_add_to_playlist">添加到播放列表</string>
|
||||
<string name="album_bottom_sheet_add_to_queue">添加到队列</string>
|
||||
<string name="album_bottom_sheet_download_all">全部下载</string>
|
||||
<string name="album_bottom_sheet_go_to_artist">查看该艺术家</string>
|
||||
<string name="album_bottom_sheet_instant_mix">即时混合</string>
|
||||
<string name="album_bottom_sheet_instant_mix">即时混听</string>
|
||||
<string name="album_bottom_sheet_play_next">下一首播放</string>
|
||||
<string name="album_bottom_sheet_remove_all">移除所有</string>
|
||||
<string name="album_bottom_sheet_share">分享</string>
|
||||
@@ -17,25 +17,27 @@
|
||||
<string name="album_error_retrieving_artist">检索艺术家时出错</string>
|
||||
<string name="album_list_page_downloaded">已下载的专辑</string>
|
||||
<string name="album_list_page_most_played">最常播放的专辑</string>
|
||||
<string name="album_list_page_new_releases">新发行</string>
|
||||
<string name="album_list_page_new_releases">新发行的专辑</string>
|
||||
<string name="album_list_page_recently_added">最近添加的专辑</string>
|
||||
<string name="album_list_page_recently_played">最近播放的专辑</string>
|
||||
<string name="album_list_page_starred">收藏的专辑</string>
|
||||
<string name="album_list_page_title">专辑</string>
|
||||
<string name="album_page_extra_info_button">更多相似</string>
|
||||
<string name="album_page_play_button">播放</string>
|
||||
<string name="album_page_release_date_label">发行日期:%1$s</string>
|
||||
<string name="album_page_release_dates_label">发行日期:%1$s(原版发行于 %2$s)</string>
|
||||
<string name="album_page_shuffle_button">随机播放</string>
|
||||
<string name="album_page_tracks_count_and_duration">%1$d 首歌曲 • %2$d 分钟</string>
|
||||
<string name="app_name">Tempus</string>
|
||||
<string name="artist_adapter_radio_station_starting">正在搜索...</string>
|
||||
<string name="artist_bottom_sheet_instant_mix">即时混合</string>
|
||||
<string name="artist_bottom_sheet_instant_mix">即时混听</string>
|
||||
<string name="artist_bottom_sheet_shuffle">随机播放</string>
|
||||
<string name="artist_catalogue_title">艺术家</string>
|
||||
<string name="artist_catalogue_title_expanded">浏览艺术家</string>
|
||||
<string name="artist_error_retrieving_radio">检索艺术家的电台时出错</string>
|
||||
<string name="artist_error_retrieving_tracks">检索艺术家曲目时出错</string>
|
||||
<string name="artist_error_retrieving_tracks">检索艺术家歌曲时出错</string>
|
||||
<string name="artist_list_page_downloaded">已下载的艺术家</string>
|
||||
<string name="artist_list_page_starred">收藏的艺人</string>
|
||||
<string name="artist_list_page_starred">收藏的艺术家</string>
|
||||
<string name="artist_list_page_title">艺术家</string>
|
||||
<string name="artist_page_radio_button">电台</string>
|
||||
<string name="artist_page_shuffle_button">随机播放</string>
|
||||
@@ -43,33 +45,63 @@
|
||||
<string name="artist_page_title_album_more_like_this_button">更多相似</string>
|
||||
<string name="artist_page_title_album_section">专辑</string>
|
||||
<string name="artist_page_title_biography_more_button">更多</string>
|
||||
<string name="artist_page_title_biography_section">个人简介</string>
|
||||
<string name="artist_page_title_biography_section">艺术家简介</string>
|
||||
<string name="artist_page_title_most_streamed_song_section">最常播放的歌曲</string>
|
||||
<string name="artist_page_title_most_streamed_song_see_all_button">查看全部</string>
|
||||
<string name="asset_link_chip_text">%1$s • %2$s</string>
|
||||
<string name="asset_link_clipboard_label">Tempus 资源链接</string>
|
||||
<string name="asset_link_copied_toast">已将 %1$s 复制到剪贴板</string>
|
||||
<string name="asset_link_debug_toast">资源链接:%1$s</string>
|
||||
<string name="asset_link_error_album">无法打开该专辑</string>
|
||||
<string name="asset_link_error_artist">无法打开该艺术家页</string>
|
||||
<string name="asset_link_error_playlist">无法打开该播放列表</string>
|
||||
<string name="asset_link_error_song">无法打开该歌曲</string>
|
||||
<string name="asset_link_error_unsupported">不支持的资源链接</string>
|
||||
<string name="asset_link_label_album">专辑 UID</string>
|
||||
<string name="asset_link_label_artist">艺术家 UID</string>
|
||||
<string name="asset_link_label_genre">流派 UID</string>
|
||||
<string name="asset_link_label_playlist">播放列表 UID</string>
|
||||
<string name="asset_link_label_song">歌曲 UID</string>
|
||||
<string name="asset_link_label_unknown">资源 UID</string>
|
||||
<string name="asset_link_label_year">年份 UID</string>
|
||||
<string name="battery_optimization_negative_button">忽略</string>
|
||||
<string name="battery_optimization_neutral_button">不要再问</string>
|
||||
<string name="battery_optimization_neutral_button">不再询问</string>
|
||||
<string name="battery_optimization_positive_button">禁用</string>
|
||||
<string name="cast_expanded_controller_loading">加载中...</string>
|
||||
<string name="connection_alert_dialog_negative_button">取消</string>
|
||||
<string name="connection_alert_dialog_neutral_button">启用流量节省</string>
|
||||
<string name="connection_alert_dialog_positive_button">确定</string>
|
||||
<string name="connection_alert_dialog_summary">已限制通过 Wi-Fi 以外的连接访问 Subsonic 服务器。 要阻止此警告对话框再次出现,请在应用程序设置中禁用连接检查。</string>
|
||||
<string name="connection_alert_dialog_title">Wi-Fi网络未连接</string>
|
||||
<string name="connection_alert_dialog_title">Wi-Fi 网络未连接</string>
|
||||
<string name="content_description_shuffle_button">随机</string>
|
||||
<string name="delete_download_storage_dialog_negative_button">取消</string>
|
||||
<string name="delete_download_storage_dialog_positive_button">继续</string>
|
||||
<string name="delete_download_storage_dialog_summary">请注意,继续执行此操作将永久删除从所有服务器下载的所有已保存的项目。</string>
|
||||
<string name="delete_download_storage_dialog_title">删除已保存的项目</string>
|
||||
<string name="description_empty_title">没有可用的描述</string>
|
||||
<string name="description_empty_title">没有可用的歌词</string>
|
||||
<string name="disc_titlefull">第 %1$s 张光盘 - %2$s</string>
|
||||
<string name="disc_titleless">第 %1$s 张光盘</string>
|
||||
<string name="download_directory_dialog_negative_button">取消</string>
|
||||
<string name="download_directory_dialog_positive_button">下载</string>
|
||||
<string name="download_directory_dialog_summary">该文件夹中的所有曲目将被下载。 子文件夹中的曲目将不会被下载。</string>
|
||||
<string name="download_directory_dialog_title">下载曲目</string>
|
||||
<string name="download_info_empty_subtitle">下载歌曲后,您可以在这里找到它。</string>
|
||||
<string name="download_directory_dialog_summary">该文件夹中的所有歌曲将被下载。子文件夹中的歌曲将不会被下载。</string>
|
||||
<string name="download_directory_dialog_title">下载歌曲</string>
|
||||
<string name="download_directory_set">设置歌曲下载位置</string>
|
||||
<string name="download_info_empty_subtitle">下载歌曲后,您可以在这里找到它</string>
|
||||
<string name="download_info_empty_title">还没有下载!</string>
|
||||
<string name="download_item_multiple_subtitle_formatter">%1$s • %2$s 个项目</string>
|
||||
<string name="download_item_single_subtitle_formatter">%1$s 个项目</string>
|
||||
<string name="download_refresh_button_content_description">刷新下载项</string>
|
||||
<string name="download_refresh_no_changes">没有遗漏的下载项。</string>
|
||||
<string name="download_refresh_no_directory">设置下载目录以刷新下载内容。</string>
|
||||
<plurals name="download_refresh_removed">
|
||||
<item quantity="one">已移除 %d 个缺失的下载项。</item>
|
||||
<item quantity="other">已移除 %d 个缺失的下载项。</item>
|
||||
</plurals>
|
||||
<string name="download_shuffle_all_subtitle">随机播放全部</string>
|
||||
<string name="download_storage_dialog_sub_summary">要使更改生效,请重新启动应用程序。</string>
|
||||
<string name="download_storage_dialog_summary">更改已下载文件的目录将会立即删除以前已下载的所有文件。</string>
|
||||
<string name="download_storage_dialog_title">选择存储选项</string>
|
||||
<string name="download_storage_directory_dialog_neutral_button">目录</string>
|
||||
<string name="download_storage_external_dialog_positive_button">外部</string>
|
||||
<string name="download_storage_internal_dialog_negative_button">内部</string>
|
||||
<string name="download_title_section">下载</string>
|
||||
@@ -78,31 +110,75 @@
|
||||
<string name="downloaded_bottom_sheet_remove">移除</string>
|
||||
<string name="downloaded_bottom_sheet_remove_all">移除所有</string>
|
||||
<string name="downloaded_bottom_sheet_shuffle">随机播放</string>
|
||||
<string name="empty_string"></string>
|
||||
<string name="empty_string" />
|
||||
<string name="equalizer_enable">启用</string>
|
||||
<string name="equalizer_fragment_title">均衡器</string>
|
||||
<string name="equalizer_not_supported">此设备不支持</string>
|
||||
<string name="equalizer_reset">重置</string>
|
||||
<string name="error_required">必需</string>
|
||||
<string name="error_server_prefix">必须是 http 或 https 前缀</string>
|
||||
<string name="exo_controls_heart_off_description">取消收藏</string>
|
||||
<string name="exo_controls_heart_on_description">收藏</string>
|
||||
<string name="exo_download_notification_channel_name">下载</string>
|
||||
<string name="filter_artist">筛选艺术家</string>
|
||||
<string name="filter_info_selection">选择两个或多个过滤器</string>
|
||||
<string name="filter_title">筛选</string>
|
||||
<string name="filter_title_expanded">筛选流派</string>
|
||||
<string name="folder_play_collecting">正在读取文件夹中的歌曲...</string>
|
||||
<string name="folder_play_no_songs">文件夹内未发现歌曲</string>
|
||||
<string name="folder_play_playing">正在播放 %d 首歌曲</string>
|
||||
<string name="generic_list_page_count">(%1$d)</string>
|
||||
<string name="generic_list_page_count_unknown">(+%1$d)</string>
|
||||
<string name="genre_catalogue_title">流派目录</string>
|
||||
<string name="genre_catalogue_title_expanded">浏览流派</string>
|
||||
<string name="github_update_dialog_negative_button">稍后提醒</string>
|
||||
<string name="github_update_dialog_neutral_button">支持项目</string>
|
||||
<string name="github_update_dialog_positive_button">立即下载</string>
|
||||
<string name="github_update_dialog_summary">GitHub 上发布了新版本。</string>
|
||||
<string name="github_update_dialog_title">有可用更新</string>
|
||||
<string name="home_option_reorganize">定制首页</string>
|
||||
<string name="home_rearrangement_dialog_negative_button">取消</string>
|
||||
<string name="home_rearrangement_dialog_neutral_button">重置</string>
|
||||
<string name="home_rearrangement_dialog_positive_button">保存</string>
|
||||
<string name="home_rearrangement_dialog_subtitle">请重启应用以应用更改。</string>
|
||||
<string name="home_rearrangement_dialog_title">主页排序</string>
|
||||
<string name="home_section_music">音乐</string>
|
||||
<string name="home_section_podcast">播客</string>
|
||||
<string name="home_section_radio">电台</string>
|
||||
<string name="home_subtitle_best_of">您最喜欢的艺术家的热门歌曲</string>
|
||||
<string name="home_subtitle_made_for_you">从您喜欢的歌曲开始混音</string>
|
||||
<string name="home_subtitle_made_for_you">从您喜欢的歌曲开始混听</string>
|
||||
<string name="home_subtitle_new_internet_radio_station">添加新的电台</string>
|
||||
<string name="home_subtitle_new_podcast_channel">添加新的播客频道</string>
|
||||
<plurals name="home_sync_starred_albums_count">
|
||||
<item quantity="one">%d 个待同步专辑</item>
|
||||
<item quantity="other">%d 个待同步专辑</item>
|
||||
</plurals>
|
||||
<string name="home_sync_starred_albums_subtitle">标记为收藏的专辑可离线使用</string>
|
||||
<string name="home_sync_starred_albums_title">同步收藏的专辑</string>
|
||||
<string name="home_sync_starred_artists_subtitle">你收藏的艺术家有未下载的歌曲</string>
|
||||
<string name="home_sync_starred_artists_title">同步收藏的艺术家</string>
|
||||
<plurals name="home_sync_starred_artists_count">
|
||||
<item quantity="one">%d 个待同步艺术家</item>
|
||||
<item quantity="other">%d 个待同步艺术家</item>
|
||||
</plurals>
|
||||
<string name="home_sync_starred_cancel">取消</string>
|
||||
<string name="home_sync_starred_download">下载</string>
|
||||
<string name="home_sync_starred_subtitle">下载这些曲目可能需要大量移动数据</string>
|
||||
<string name="home_sync_starred_title">似乎有一些已收藏的曲目需要同步</string>
|
||||
<plurals name="home_sync_starred_songs_count">
|
||||
<item quantity="one">%d 首待同步歌曲</item>
|
||||
<item quantity="other">%d 首待同步歌曲</item>
|
||||
</plurals>
|
||||
<string name="home_sync_starred_subtitle">下载这些歌曲可能需要大量移动数据流量</string>
|
||||
<string name="home_sync_starred_title">似乎有一些收藏的歌曲需要同步</string>
|
||||
<string name="home_title_best_of">最佳</string>
|
||||
<string name="home_title_discovery">发现</string>
|
||||
<string name="home_title_discovery_shuffle_all_button">全部随机播放</string>
|
||||
<string name="home_title_flashback">闪回</string>
|
||||
<string name="home_title_discovery_shuffle_all_button">随机播放全部</string>
|
||||
<string name="home_title_flashback">重温旧曲</string>
|
||||
<string name="home_title_internet_radio_station">网络广播电台</string>
|
||||
<string name="home_title_last_month">上月</string>
|
||||
<string name="home_title_last_played">最近播放</string>
|
||||
<string name="home_title_last_played_see_all_button">查看全部</string>
|
||||
<string name="home_title_last_week">上周</string>
|
||||
<string name="home_title_last_year">去年</string>
|
||||
<string name="home_title_made_for_you">为您定制</string>
|
||||
<string name="home_title_most_played">最常播放</string>
|
||||
<string name="home_title_most_played_see_all_button">查看全部</string>
|
||||
@@ -119,7 +195,7 @@
|
||||
<string name="home_title_starred_albums_see_all_button">查看全部</string>
|
||||
<string name="home_title_starred_artists">★ 收藏的艺术家</string>
|
||||
<string name="home_title_starred_artists_see_all_button">查看全部</string>
|
||||
<string name="home_title_starred_tracks">★ 收藏的曲目</string>
|
||||
<string name="home_title_starred_tracks">★ 收藏的歌曲</string>
|
||||
<string name="home_title_starred_tracks_see_all_button">查看全部</string>
|
||||
<string name="home_title_top_songs">你最喜欢的歌曲</string>
|
||||
<string name="label_dot_separator" translatable="false">•</string>
|
||||
@@ -146,31 +222,53 @@
|
||||
<string name="menu_group_by_album">专辑</string>
|
||||
<string name="menu_group_by_artist">艺术家</string>
|
||||
<string name="menu_group_by_genre">流派</string>
|
||||
<string name="menu_group_by_track">曲目</string>
|
||||
<string name="menu_group_by_track">歌曲</string>
|
||||
<string name="menu_group_by_year">年份</string>
|
||||
<string name="menu_home_label">首页</string>
|
||||
<string name="menu_last_month_name">上月</string>
|
||||
<string name="menu_last_week_name">上周</string>
|
||||
<string name="menu_last_year_name">去年</string>
|
||||
<string name="menu_library_label">曲库</string>
|
||||
<string name="menu_pin_button">添加到主页</string>
|
||||
<string name="menu_rate_album">专辑评分</string>
|
||||
<string name="menu_search_button">搜索</string>
|
||||
<string name="menu_settings_button">设置</string>
|
||||
<string name="menu_sort_album_count">专辑数量</string>
|
||||
<string name="menu_sort_artist">艺术家</string>
|
||||
<string name="menu_sort_name">姓名</string>
|
||||
<string name="menu_sort_least_recently_starred">最早收藏</string>
|
||||
<string name="menu_sort_most_played">最多播放</string>
|
||||
<string name="menu_sort_most_recently_starred">最近收藏</string>
|
||||
<string name="menu_sort_name">名称</string>
|
||||
<string name="menu_sort_random">随机</string>
|
||||
<string name="menu_sort_recently_added">最近添加</string>
|
||||
<string name="menu_sort_recently_played">最近播放</string>
|
||||
<string name="menu_sort_year">年份</string>
|
||||
<string name="menu_unpin_button">从主页移除</string>
|
||||
<string name="player_lyrics_download_content_description">下载离线歌词</string>
|
||||
<string name="player_lyrics_download_failure">暂无歌词可供下载。</string>
|
||||
<string name="player_lyrics_download_success">离线歌词已保存。</string>
|
||||
<string name="player_lyrics_downloaded_content_description">已下载的离线歌词</string>
|
||||
<string name="player_playback_speed">%1$.2fx</string>
|
||||
<string name="player_queue_clean_all_button">清空队列</string>
|
||||
<string name="player_queue_load_queue">加载队列</string>
|
||||
<string name="player_queue_save_queue_success">保存队列</string>
|
||||
<string name="player_queue_save_to_playlist">保存队列到播放列表</string>
|
||||
<string name="player_server_priority">服务器优先级</string>
|
||||
<string name="player_transcoding">正在转码</string>
|
||||
<string name="player_transcoding_requested">已请求转码</string>
|
||||
<string name="player_unknown_format">未知格式</string>
|
||||
<string name="playlist_catalogue_title">播放列表目录</string>
|
||||
<string name="playlist_catalogue_title_expanded">浏览播放列表</string>
|
||||
<string name="playlist_chooser_dialog_empty">尚未创建播放列表</string>
|
||||
<string name="playlist_chooser_dialog_negative_button">取消</string>
|
||||
<string name="playlist_chooser_dialog_neutral_button">新建</string>
|
||||
<string name="playlist_chooser_dialog_title">添加到播放列表</string>
|
||||
<string name="playlist_chooser_dialog_toast_add_success">将歌曲添加到播放列表</string>
|
||||
<string name="playlist_chooser_dialog_toast_add_failure">未能将歌曲添加到播放列表</string>
|
||||
<string name="playlist_counted_tracks">%1$d 首曲目 • %2$s</string>
|
||||
<string name="playlist_duration">持续时间 • %1$s</string>
|
||||
<string name="playlist_chooser_dialog_toast_add_success">将歌曲添加到播放列表</string>
|
||||
<string name="playlist_chooser_dialog_toast_all_skipped">所有歌曲已存在,无需重复添加</string>
|
||||
<string name="playlist_counted_tracks">%1$d 首歌曲 • %2$s</string>
|
||||
<string name="playlist_duration">时长 • %1$s</string>
|
||||
<string name="playlist_editor_dialog_action_delete_toast">长按删除</string>
|
||||
<string name="playlist_editor_dialog_hint_name">播放列表名称</string>
|
||||
<string name="playlist_editor_dialog_negative_button">取消</string>
|
||||
<string name="playlist_editor_dialog_neutral_button">删除</string>
|
||||
@@ -189,6 +287,7 @@
|
||||
<string name="podcast_channel_catalogue_title_expanded">浏览频道</string>
|
||||
<string name="podcast_channel_editor_dialog_hint_rss_url">RSS 网址</string>
|
||||
<string name="podcast_channel_editor_dialog_title">播客频道</string>
|
||||
<string name="podcast_channel_not_supported_snackbar">此服务器不支持播客。</string>
|
||||
<string name="podcast_channel_page_title_description_section">描述</string>
|
||||
<string name="podcast_channel_page_title_episode_section">剧集</string>
|
||||
<string name="podcast_channel_page_title_no_episode_available">没有可用的剧集</string>
|
||||
@@ -197,6 +296,8 @@
|
||||
<string name="podcast_info_empty_subtitle">添加频道后,您将在此处找到它</string>
|
||||
<string name="podcast_info_empty_title">未找到播客!</string>
|
||||
<string name="podcast_release_date_duration_formatter">%1$s • %2$s</string>
|
||||
<string name="radio_dialog_not_supported_snackbar">服务器不支持网络电台管理。</string>
|
||||
<string name="radio_editor_dialog_added">已添加电台</string>
|
||||
<string name="radio_editor_dialog_hint_homepage_url">电台主页 URL</string>
|
||||
<string name="radio_editor_dialog_hint_name">电台名称</string>
|
||||
<string name="radio_editor_dialog_hint_stream_url">广播流 URL</string>
|
||||
@@ -204,6 +305,7 @@
|
||||
<string name="radio_editor_dialog_neutral_button">删除</string>
|
||||
<string name="radio_editor_dialog_positive_button">保存</string>
|
||||
<string name="radio_editor_dialog_title">网络广播电台</string>
|
||||
<string name="radio_editor_dialog_updated">已更新电台</string>
|
||||
<string name="radio_station_info_empty_button">单击以隐藏该部分\n重启应用后生效</string>
|
||||
<string name="radio_station_info_empty_subtitle">添加广播电台后,您可以在此处找到它</string>
|
||||
<string name="radio_station_info_empty_title">没有找到电台!</string>
|
||||
@@ -212,10 +314,14 @@
|
||||
<string name="rating_dialog_title">评分</string>
|
||||
<string name="search_hint">搜索标题、艺术家或专辑</string>
|
||||
<string name="search_info_minimum_characters">输入至少三个字符</string>
|
||||
<string name="search_sort_summary">启用后将按时间排序搜索,关闭则按名称排序。</string>
|
||||
<string name="search_sort_title">按时间排序最近搜索</string>
|
||||
<string name="search_title_album">专辑</string>
|
||||
<string name="search_title_artist">艺术家</string>
|
||||
<string name="search_title_song">歌曲</string>
|
||||
<string name="server_signup_dialog_action_delete_toast">长按删除</string>
|
||||
<string name="server_signup_dialog_action_low_security">低安全性</string>
|
||||
<string name="server_signup_dialog_hint_local_address">本地 URL</string>
|
||||
<string name="server_signup_dialog_hint_name">服务器名称</string>
|
||||
<string name="server_signup_dialog_hint_password">密码</string>
|
||||
<string name="server_signup_dialog_hint_url">服务器地址</string>
|
||||
@@ -231,84 +337,118 @@
|
||||
<string name="server_unreachable_dialog_title">服务器无法访问</string>
|
||||
<string name="settings_about_summary">Tempus 是 Subsonic 的开源轻量级音乐客户端,专为 Android 设计和构建。</string>
|
||||
<string name="settings_about_title">关于</string>
|
||||
<string name="settings_album_detail">显示专辑详情</string>
|
||||
<string name="settings_album_detail_summary">启用后将在专辑页显示流派、歌曲数量等信息</string>
|
||||
<string name="settings_allow_playlist_duplicates">允许添加重复歌曲到播放列表</string>
|
||||
<string name="settings_allow_playlist_duplicates_summary">启用后则添加到播放列表时将不再检查重复内容。</string>
|
||||
<string name="settings_always_on_display">保持屏幕常亮</string>
|
||||
<string name="settings_app_equalizer">均衡器</string>
|
||||
<string name="settings_app_equalizer_summary">打开内置均衡器</string>
|
||||
<string name="settings_artist_sort_by_album_count">按专辑数量排序艺术家</string>
|
||||
<string name="settings_artist_sort_by_album_count_summary">启用后按专辑数量排序;关闭则按名称排序。</string>
|
||||
<string name="settings_audio_quality">显示音频质量</string>
|
||||
<string name="settings_audio_quality_summary">显示歌曲的码率和音频格式。</string>
|
||||
<string name="settings_audio_transcode_download_format">转码格式</string>
|
||||
<string name="settings_audio_transcode_download_priority_summary">如果启用,Tempus 将不会强制使用下面的转码设置下载曲目。</string>
|
||||
<string name="settings_audio_transcode_download_priority_summary">启用后 Tempus 将不会强制使用下面的转码设置下载歌曲。</string>
|
||||
<string name="settings_audio_transcode_download_priority_title">优先考虑服务器上用于流式传输的设置</string>
|
||||
<string name="settings_audio_transcode_download_summary">如果启用,Tempus 将下载转码后的曲目。</string>
|
||||
<string name="settings_audio_transcode_download_title">下载转码后的曲目</string>
|
||||
<string name="settings_audio_transcode_estimate_content_length_summary">如果启用,将发送请求到服务器以查询曲目的估计持续时间。</string>
|
||||
<string name="settings_audio_transcode_download_summary">启用后 Tempus 将下载转码后的歌曲。</string>
|
||||
<string name="settings_audio_transcode_download_title">下载转码后的歌曲</string>
|
||||
<string name="settings_audio_transcode_estimate_content_length_summary">启用后将发送请求到服务器以查询歌曲的估计持续时间。</string>
|
||||
<string name="settings_audio_transcode_estimate_content_length_title">估计内容长度</string>
|
||||
<string name="settings_audio_transcode_format_download">用于下载的转码格式</string>
|
||||
<string name="settings_audio_transcode_format_mobile">移动数据下的转码格式</string>
|
||||
<string name="settings_audio_transcode_format_wifi">Wi-Fi 下的转码格式</string>
|
||||
<string name="settings_audio_transcode_priority_summary">如果启用,Tempus 将不会强制使用下面的转码设置流式传输曲目。</string>
|
||||
<string name="settings_audio_transcode_priority_summary">启用后 Tempus 将不会强制使用下面的转码设置流式传输歌曲。</string>
|
||||
<string name="settings_audio_transcode_priority_title">优先考虑服务器转码设置</string>
|
||||
<string name="settings_audio_transcode_priority_toast">曲目转码设置优先级设置为服务器</string>
|
||||
<string name="settings_audio_transcode_priority_toast">歌曲转码设置优先级设置为服务器</string>
|
||||
<string name="settings_auto_download_lyrics">自动下载歌词</string>
|
||||
<string name="settings_auto_download_lyrics_summary">自动保存可用歌词,以便离线时查看。</string>
|
||||
<string name="settings_buffering_strategy">缓存策略</string>
|
||||
<string name="settings_buffering_strategy_summary">为了使更改生效,您必须手动重新启动应用程序。</string>
|
||||
<string name="settings_continuous_play_summary">允许在播放列表结束后,播放相似的曲目。</string>
|
||||
<string name="settings_choose_download_folder">选择一个音乐下载目录</string>
|
||||
<string name="settings_clear_download_folder">清空下载文件夹</string>
|
||||
<string name="settings_continuous_play_summary">允许在播放列表结束后,播放相似的歌曲。</string>
|
||||
<string name="settings_continuous_play_title">连续播放</string>
|
||||
<string name="settings_covers_cache">图片缓存大小</string>
|
||||
<string name="settings_data_saving_mode_summary">为了减少数据消耗,请避免下载封面。</string>
|
||||
<string name="settings_data_saving_mode_title">限制移动数据使用</string>
|
||||
<string name="settings_delete_download_storage_summary">继续当前操作将导致所有已保存的项目被永久删除。</string>
|
||||
<string name="settings_delete_download_storage_title">删除已保存的项目</string>
|
||||
<string name="settings_download_folder_cleared">下载文件夹已清除。</string>
|
||||
<string name="settings_download_folder_set">已设置下载文件夹</string>
|
||||
<string name="settings_download_storage_title">下载存储</string>
|
||||
<string name="settings_system_equalizer_summary">调整音频设置</string>
|
||||
<string name="settings_system_equalizer_title">系统均衡器</string>
|
||||
<string name="settings_github_link">https://github.com/eddyizm/tempus</string>
|
||||
<string name="settings_github_summary">关注开发进展</string>
|
||||
<string name="settings_github_title">Github</string>
|
||||
<string name="settings_github_update">更新</string>
|
||||
<string name="settings_github_update_summary">GitHub 版本默认会自动检查 APK 更新。您可以关闭此开关以禁用自动检查。</string>
|
||||
<string name="settings_github_update_title">请访问 Github 以检查更新</string>
|
||||
<string name="settings_image_size">设置图像分辨率</string>
|
||||
<string name="settings_item_rating">显示评分</string>
|
||||
<string name="settings_item_rating_summary">启用后则显示项目的评分和收藏状态。</string>
|
||||
<string name="settings_language">语言</string>
|
||||
<string name="settings_logout_title">注销登录</string>
|
||||
<string name="settings_max_bitrate_download">用于下载的比特率</string>
|
||||
<string name="settings_max_bitrate_mobile">移动数据下的比特率</string>
|
||||
<string name="settings_max_bitrate_wifi">Wi-Fi 下的比特率</string>
|
||||
<string name="settings_max_bitrate_download">用于下载的码率</string>
|
||||
<string name="settings_max_bitrate_mobile">移动数据下的码率</string>
|
||||
<string name="settings_max_bitrate_wifi">Wi-Fi 下的码率</string>
|
||||
<string name="settings_media_cache">媒体文件缓存大小</string>
|
||||
<string name="settings_music_directory">显示音乐目录</string>
|
||||
<string name="settings_music_directory_summary">如果启用,则显示音乐目录部分。 请注意,要使文件夹导航正常工作,服务器必须支持此功能。</string>
|
||||
<string name="settings_music_directory_summary">启用后则显示音乐目录部分。 请注意,要使文件夹导航正常工作,服务器必须支持此功能。</string>
|
||||
<string name="settings_podcast">显示播客</string>
|
||||
<string name="settings_podcast_summary">如果启用,则显示播客部分。</string>
|
||||
<string name="settings_audio_quality">显示音频质量</string>
|
||||
<string name="settings_audio_quality_summary">显示曲目的比特率和音频格式。</string>
|
||||
<string name="settings_item_rating">显示评分</string>
|
||||
<string name="settings_item_rating_summary">如果启用,则显示项目的评分和收藏状态。</string>
|
||||
<string name="settings_podcast_summary">启用后则显示播客部分。</string>
|
||||
<string name="settings_queue_syncing_countdown">同步定时器</string>
|
||||
<string name="settings_queue_syncing_summary">如果启用,将允许当前用户保存其播放队列,并能够在打开应用程序时加载保存状态。</string>
|
||||
<string name="settings_queue_syncing_summary">启用后将允许当前用户保存其播放队列,并能够在打开应用程序时加载保存状态。</string>
|
||||
<string name="settings_queue_syncing_title">同步当前用户的播放队列</string>
|
||||
<string name="settings_radio">显示广播</string>
|
||||
<string name="settings_radio_summary">如果启用,则显示电台部分。</string>
|
||||
<string name="settings_radio">显示电台</string>
|
||||
<string name="settings_radio_summary">启用后,则显示电台部分。</string>
|
||||
<string name="settings_replay_gain">设置播放增益模式</string>
|
||||
<string name="settings_rounded_corner">圆角</string>
|
||||
<string name="settings_rounded_corner_size">圆角大小</string>
|
||||
<string name="settings_rounded_corner_size_summary">设置圆角的大小。</string>
|
||||
<string name="settings_rounded_corner_summary">如果启用,则为所有渲染的封面设置圆角。 更改将在应用重新启动后生效。</string>
|
||||
<string name="settings_rounded_corner_summary">启用后则为所有渲染的封面设置圆角。更改将在应用重新启动后生效。</string>
|
||||
<string name="settings_scan_result">正在扫描:已发现 %1$d 首歌曲</string>
|
||||
<string name="settings_scan_title">扫描曲库</string>
|
||||
<string name="settings_scrobble_title">启用音乐记录</string>
|
||||
<string name="settings_set_download_folder">设置下载文件夹</string>
|
||||
<string name="settings_share_title">启用音乐共享</string>
|
||||
<string name="settings_show_mini_shuffle_button">显示随机按钮</string>
|
||||
<string name="settings_show_mini_shuffle_button_summary">启用后,在迷你播放器中显示随机播放按钮,并移除收藏按钮。</string>
|
||||
<string name="settings_song_rating">显示歌曲评分</string>
|
||||
<string name="settings_song_rating_summary">启用后歌曲详情页将显示五星评分。\n\n*需重启应用后生效</string>
|
||||
<string name="settings_streaming_cache_size">播放缓存大小</string>
|
||||
<string name="settings_streaming_cache_storage_title">缓存目录设置</string>
|
||||
<string name="settings_sub_summary_scrobble">请注意,音乐记录同时也依赖于服务器是否能够接收这些数据。</string>
|
||||
<string name="settings_summary_skip_min_star_rating">收听电台,即时混合和随机播放时,低于特定评分的曲目将会被忽略。</string>
|
||||
<string name="settings_summary_replay_gain">播放增益(Replay gain)允许您通过调整音轨的音量,以获得始终如一的聆听体验。 仅当曲目标签包含必要的元数据时,此设置才有效。</string>
|
||||
<string name="settings_summary_replay_gain">播放增益(Replay gain)允许您通过调整音轨的音量,以获得始终如一的聆听体验。 仅当歌曲标签包含必要的元数据时,此设置才有效。</string>
|
||||
<string name="settings_summary_scrobble">音乐记录(Scrobbling)允许您的设备将您收听的歌曲的相关信息发送到音乐服务器。 这些信息有助于基于您的音乐偏好生成个性化推荐。</string>
|
||||
<string name="settings_summary_share">允许用户通过链接共享音乐。 该功能需要服务器端支持并启用,并且仅限于单个曲目、专辑和队列。</string>
|
||||
<string name="settings_summary_syncing">返回当前用户的播放队列状态。 这包括播放队列中的曲目、正在播放的曲目以及曲目播放进度。需要服务器支持此功能。</string>
|
||||
<string name="settings_summary_share">允许用户通过链接共享音乐。 该功能需要服务器端支持并启用,并且仅限于单首歌曲、专辑和队列。</string>
|
||||
<string name="settings_summary_skip_min_star_rating">收听电台,即时混合和随机播放时,低于特定评分的歌曲将会被忽略。</string>
|
||||
<string name="settings_summary_streaming_cache_size">%1$s \n已使用: %2$s MiB</string>
|
||||
<string name="settings_summary_transcoding">转码模式优先级设置。 如果设置为“播放原始”,文件的比特率将不会更改。</string>
|
||||
<string name="settings_summary_transcoding_download">下载转码后的媒体。 如果启用,将不会下载原始数据,而是使用以下设置。\n如果“用于下载的转码格式”设置为“下载原始”,则文件的比特率不会更改。</string>
|
||||
<string name="settings_summary_transcoding_estimate_content_length">当文件即时转码时,客户端通常不会显示曲目长度。 可以向支持该功能的服务器发送请求,估计正在播放的曲目的持续时间,但可能响应变慢。</string>
|
||||
<string name="settings_sync_starred_tracks_for_offline_use_summary">如果启用,将下载已收藏的曲目以供离线使用。</string>
|
||||
<string name="settings_sync_starred_tracks_for_offline_use_title">同步已收藏的曲目以供离线使用</string>
|
||||
<string name="settings_summary_syncing">返回当前用户的播放队列状态。 这包括播放队列中的歌曲、正在播放的歌曲以及歌曲播放进度。需要服务器支持此功能。</string>
|
||||
<string name="settings_summary_transcoding">转码模式优先级设置。 如果设置为“播放原始”,文件的码率将不会更改。</string>
|
||||
<string name="settings_summary_transcoding_download">下载转码后的媒体。 启用后将不会下载原始数据,而是使用以下设置。\n如果“用于下载的转码格式”设置为“下载原始”,则文件的码率不会更改。</string>
|
||||
<string name="settings_summary_transcoding_estimate_content_length">当文件即时转码时,客户端通常不会显示歌曲长度。 可以向支持该功能的服务器发送请求,估计正在播放的歌曲的持续时间,但可能响应变慢。</string>
|
||||
<string name="settings_support_discussion_link">https://github.com/eddyizm/tempus/discussions</string>
|
||||
<string name="settings_support_summary">加入社区讨论并获取帮助</string>
|
||||
<string name="settings_support_title">用户支持</string>
|
||||
<string name="settings_sync_starred_albums_for_offline_use_summary">启用后将下载收藏的专辑以供离线使用。</string>
|
||||
<string name="settings_sync_starred_albums_for_offline_use_title">下载收藏的专辑以供离线使用</string>
|
||||
<string name="settings_sync_starred_artists_for_offline_use_summary">启用后将自动下载收藏的艺术家以供离线使用。</string>
|
||||
<string name="settings_sync_starred_artists_for_offline_use_title">同步收藏的艺术家以供离线使用</string>
|
||||
<string name="settings_sync_starred_tracks_for_offline_use_summary">启用后将下载收藏的歌曲以供离线使用。</string>
|
||||
<string name="settings_sync_starred_tracks_for_offline_use_title">同步收藏的歌曲以供离线使用</string>
|
||||
<string name="settings_system_equalizer_summary">调整音频设置</string>
|
||||
<string name="settings_system_equalizer_title">系统均衡器</string>
|
||||
<string name="settings_system_language">系统语言</string>
|
||||
<string name="settings_theme">主题</string>
|
||||
<string name="settings_title_data">数据</string>
|
||||
<string name="settings_title_general">通用</string>
|
||||
<string name="settings_title_playlist">播放列表</string>
|
||||
<string name="settings_title_rating">评分</string>
|
||||
<string name="settings_title_replay_gain">播放增益</string>
|
||||
<string name="settings_title_scrobble">音乐记录</string>
|
||||
<string name="settings_title_skip_min_star_rating">根据评分忽略歌曲</string>
|
||||
<string name="settings_title_share">分享</string>
|
||||
<string name="settings_title_skip_min_star_rating">根据评分忽略歌曲</string>
|
||||
<string name="settings_title_skip_min_star_rating_dialog">根据歌曲评分筛选:</string>
|
||||
<string name="settings_title_syncing">同步</string>
|
||||
<string name="settings_title_transcoding">转码</string>
|
||||
<string name="settings_title_transcoding_download">转码下载</string>
|
||||
@@ -321,6 +461,7 @@
|
||||
<string name="share_bottom_sheet_copy_link">复制链接</string>
|
||||
<string name="share_bottom_sheet_delete">删除分享</string>
|
||||
<string name="share_bottom_sheet_update">更新分享</string>
|
||||
<string name="share_no_expiration">永不过期</string>
|
||||
<string name="share_subtitle_item">到期日期:%1$s</string>
|
||||
<string name="share_unsupported_error">不支持分享或未启用</string>
|
||||
<string name="share_update_dialog_hint_description">描述</string>
|
||||
@@ -341,63 +482,69 @@
|
||||
<string name="song_bottom_sheet_remove">移除</string>
|
||||
<string name="song_bottom_sheet_share">分享</string>
|
||||
<string name="song_list_page_downloaded">已下载</string>
|
||||
<string name="song_list_page_most_played">最常播放的曲目</string>
|
||||
<string name="song_list_page_recently_added">最近添加的曲目</string>
|
||||
<string name="song_list_page_recently_played">最近播放的曲目</string>
|
||||
<string name="song_list_page_starred">已收藏的曲目</string>
|
||||
<string name="song_list_page_top">%1$s 的热门曲目</string>
|
||||
<string name="song_list_page_most_played">最常播放的歌曲</string>
|
||||
<string name="song_list_page_recently_added">最近添加的歌曲</string>
|
||||
<string name="song_list_page_recently_played">最近播放的歌曲</string>
|
||||
<string name="song_list_page_starred">已收藏的歌曲</string>
|
||||
<string name="song_list_page_top">%1$s 的热门歌曲</string>
|
||||
<string name="song_list_page_year">年份 %1$d</string>
|
||||
<string name="song_subtitle_formatter">%1$s • %2$s %3$s</string>
|
||||
<plurals name="songs_download_started">
|
||||
<item quantity="one">正在下载 %d 首歌曲</item>
|
||||
<item quantity="other">正在下载 %d 首歌曲</item>
|
||||
</plurals>
|
||||
<string name="starred_album_sync_dialog_summary">下载收藏的专辑可能会消耗大量移动数据流量。</string>
|
||||
<string name="starred_album_sync_dialog_title">同步收藏的专辑</string>
|
||||
<string name="starred_artist_sync_dialog_summary">下载收藏的艺术家可能会消耗大量移动数据流量。</string>
|
||||
<string name="starred_artist_sync_dialog_title">同步收藏的艺术家</string>
|
||||
<string name="starred_sync_dialog_negative_button">取消</string>
|
||||
<string name="starred_sync_dialog_neutral_button">继续</string>
|
||||
<string name="starred_sync_dialog_positive_button">继续并下载</string>
|
||||
<string name="starred_sync_dialog_summary">下载收藏曲目可能需要大量数据。</string>
|
||||
<string name="starred_sync_dialog_title">同步已收藏的曲目</string>
|
||||
<string name="starred_sync_dialog_summary">下载收藏的歌曲可能会消耗大量移动数据流量。</string>
|
||||
<string name="starred_sync_dialog_title">同步收藏的歌曲</string>
|
||||
<string name="streaming_cache_storage_dialog_sub_summary">要使更改生效,请重新启动应用程序。</string>
|
||||
<string name="streaming_cache_storage_dialog_summary">切换缓存文件的存储路径可能会导致原位置存储的缓存文件被清空。</string>
|
||||
<string name="streaming_cache_storage_dialog_title">选择存储位置</string>
|
||||
<string name="streaming_cache_storage_external_dialog_positive_button">外部</string>
|
||||
<string name="streaming_cache_storage_internal_dialog_negative_button">内部</string>
|
||||
<string name="support_url">https://ko-fi.com/eddyizm</string>
|
||||
<string name="track_info_album">专辑</string>
|
||||
<string name="track_info_artist">艺术家</string>
|
||||
<string name="track_info_bitrate">比特率</string>
|
||||
<string name="track_info_bit_depth">位深</string>
|
||||
<string name="track_info_bitrate">码率</string>
|
||||
<string name="track_info_content_type">内容类型</string>
|
||||
<string name="track_info_dialog_positive_button">确定</string>
|
||||
<string name="track_info_dialog_title">曲目信息</string>
|
||||
<string name="track_info_dialog_title">歌曲信息</string>
|
||||
<string name="track_info_disc_number">碟片编号</string>
|
||||
<string name="track_info_duration">持续时间</string>
|
||||
<string name="track_info_genre">流派</string>
|
||||
<string name="track_info_path">路径</string>
|
||||
<string name="track_info_sampling_rate">采样率</string>
|
||||
<string name="track_info_size">大小</string>
|
||||
<string name="track_info_suffix">后缀</string>
|
||||
<string name="track_info_summary_downloaded_file">该文件已使用 Subsonic API 下载。 文件的编码和比特率与源文件一致。</string>
|
||||
<string name="track_info_summary_full_transcode">本应用将请求服务器对文件进行转码并修改其比特率。 用户请求的编解码器是%1$s,比特率为%2$s。 对所选格式的文件的编码和比特率的任何潜在更改都将由服务器处理,服务器可能支持也可能不支持该操作。</string>
|
||||
<string name="track_info_summary_original_file">本应用只会读取服务器提供的原始文件。 本应用将明确向服务器请求具有原始源比特率的未转码文件。</string>
|
||||
<string name="track_info_summary_server_prioritized">要播放的文件质量取决于服务器设置。 本应用不会强制选择任何用于潜在转码的编码和比特率。</string>
|
||||
<string name="track_info_summary_transcoding_bitrate">本应用将请求服务器修改文件的比特率。 用户请求的比特率为%1$s,而源文件的编码将保持不变。 对所选格式的文件比特率的任何更改都将由服务器完成,服务器可能支持也可能不支持该操作。</string>
|
||||
<string name="track_info_summary_transcoding_codec">本应用将请求服务器对文件进行转码。 用户请求的编解码器是%1$s,而比特率将与源文件相同。 将文件转码为所选格式的可能性取决于服务器,因为它可能支持也可能不支持该操作。</string>
|
||||
<string name="track_info_summary_downloaded_file">该文件已使用 Subsonic API 下载。 文件的编码和码率与源文件一致。</string>
|
||||
<string name="track_info_summary_full_transcode">本应用将请求服务器对文件进行转码并修改其码率。 用户请求的编解码器是%1$s,码率为%2$s。 对所选格式的文件的编码和码率的任何潜在更改都将由服务器处理,服务器可能支持也可能不支持该操作。</string>
|
||||
<string name="track_info_summary_original_file">本应用只会读取服务器提供的原始文件。 本应用将明确向服务器请求具有原始源码率的未转码文件。</string>
|
||||
<string name="track_info_summary_server_prioritized">要播放的文件质量取决于服务器设置。 本应用不会强制选择任何用于潜在转码的编码和码率。</string>
|
||||
<string name="track_info_summary_transcoding_bitrate">本应用将请求服务器修改文件的码率。 用户请求的码率为%1$s,而源文件的编码将保持不变。 对所选格式的文件码率的任何更改都将由服务器完成,服务器可能支持也可能不支持该操作。</string>
|
||||
<string name="track_info_summary_transcoding_codec">本应用将请求服务器对文件进行转码。 用户请求的编解码器是%1$s,而码率将与源文件相同。 将文件转码为所选格式的可能性取决于服务器,因为它可能支持也可能不支持该操作。</string>
|
||||
<string name="track_info_title">标题</string>
|
||||
<string name="track_info_track_number">曲目编号</string>
|
||||
<string name="track_info_track_number">歌曲编号</string>
|
||||
<string name="track_info_transcoded_content_type">转码内容类型</string>
|
||||
<string name="track_info_transcoded_suffix">转码后缀</string>
|
||||
<string name="track_info_year">年份</string>
|
||||
<string name="streaming_cache_storage_external_dialog_positive_button">外部</string>
|
||||
<string name="streaming_cache_storage_internal_dialog_negative_button">内部</string>
|
||||
<string name="undraw_page">unDraw</string>
|
||||
<string name="undraw_thanks">特别感谢 unDraw,没有它提供的插图,我们的应用不可能会如此精美。</string>
|
||||
<string name="undraw_url">https://undraw.co/</string>
|
||||
<string name="album_page_release_date_label">发布于 %1$s</string>
|
||||
<string name="disc_titlefull">第 %1$s 张光盘 - %2$s</string>
|
||||
<string name="disc_titleless">第 %1$s 张光盘</string>
|
||||
<string name="download_shuffle_all_subtitle">随机播放</string>
|
||||
<string name="github_update_dialog_negative_button">稍后提醒</string>
|
||||
<string name="github_update_dialog_positive_button">现在下载</string>
|
||||
<string name="github_update_dialog_title">有可用更新</string>
|
||||
<string name="home_rearrangement_dialog_negative_button">取消</string>
|
||||
<string name="home_rearrangement_dialog_neutral_button">重置</string>
|
||||
<string name="home_rearrangement_dialog_positive_button">保存</string>
|
||||
<string name="home_title_last_month">上个月</string>
|
||||
<string name="home_title_last_year">去年</string>
|
||||
<string name="menu_last_week_name">上周</string>
|
||||
<string name="menu_last_month_name">上个月</string>
|
||||
<string name="menu_pin_button">添加到主屏幕</string>
|
||||
<string name="menu_unpin_button">从主屏幕移除</string>
|
||||
<string name="playlist_editor_dialog_action_delete_toast">长按删除</string>
|
||||
<string name="server_signup_dialog_action_delete_toast">长按删除</string>
|
||||
<string name="server_signup_dialog_hint_local_address">本地 URL</string>
|
||||
<string name="widget_content_desc_album_art">专辑封面</string>
|
||||
<string name="widget_content_desc_next">下一首</string>
|
||||
<string name="widget_content_desc_play_pause">播放或暂停</string>
|
||||
<string name="widget_content_desc_prev">上一首</string>
|
||||
<string name="widget_content_desc_repeat">更改循环模式</string>
|
||||
<string name="widget_content_desc_shuffle">切换随机播放</string>
|
||||
<string name="widget_label">Tempus 小组件</string>
|
||||
<string name="widget_not_playing">未播放</string>
|
||||
<string name="widget_placeholder_subtitle">打开 Tempus</string>
|
||||
<string name="widget_time_duration_placeholder">0:00</string>
|
||||
<string name="widget_time_elapsed_placeholder">0:00</string>
|
||||
</resources>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<string name="artist_list_page_downloaded">Downloaded artists</string>
|
||||
<string name="artist_list_page_starred">Starred artists</string>
|
||||
<string name="artist_list_page_title">Artists</string>
|
||||
<string name="artist_no_artist_info_toast">No additional artist info</string>
|
||||
<string name="artist_page_radio_button">Radio</string>
|
||||
<string name="artist_page_shuffle_button">Shuffle</string>
|
||||
<string name="artist_page_switch_layout_button">Switch layout</string>
|
||||
@@ -51,6 +52,8 @@
|
||||
<string name="battery_optimization_negative_button">Ignore</string>
|
||||
<string name="battery_optimization_neutral_button">Don\'t ask again</string>
|
||||
<string name="battery_optimization_positive_button">Disable</string>
|
||||
<string name="bottom_sheet_generating_instant_mix">Generating instant mix...</string>
|
||||
<string name="bottom_sheet_problem_generating_instant_mix">Could not retrieve tracks from subsonic server.</string>
|
||||
<string name="connection_alert_dialog_negative_button">Cancel</string>
|
||||
<string name="connection_alert_dialog_neutral_button">Enable data saver</string>
|
||||
<string name="connection_alert_dialog_positive_button">OK</string>
|
||||
@@ -61,7 +64,7 @@
|
||||
<string name="delete_download_storage_dialog_positive_button">Continue</string>
|
||||
<string name="delete_download_storage_dialog_summary">Please be aware that continuing with this action will result in the permanent deletion of all saved items downloaded from all servers.</string>
|
||||
<string name="delete_download_storage_dialog_title">Delete saved items</string>
|
||||
<string name="description_empty_title">No description available</string>
|
||||
<string name="description_empty_title">No lyrics available</string>
|
||||
<string name="disc_titlefull">Disc %1$s - %2$s</string>
|
||||
<string name="disc_titleless">Disc %1$s</string>
|
||||
<string name="download_directory_dialog_negative_button">Cancel</string>
|
||||
@@ -133,6 +136,10 @@
|
||||
<string name="home_sync_starred_albums_subtitle">Albums marked with a star will be available offline</string>
|
||||
<string name="home_sync_starred_artists_title">Starred Artists Sync</string>
|
||||
<string name="home_sync_starred_artists_subtitle">You have starred artists with music not downloaded</string>
|
||||
<plurals name="home_sync_starred_songs_count">
|
||||
<item quantity="one">%d song needs sync</item>
|
||||
<item quantity="other">%d songs need sync</item>
|
||||
</plurals>
|
||||
<string name="home_title_best_of">Best of</string>
|
||||
<string name="home_title_discovery">Discovery</string>
|
||||
<string name="home_title_discovery_shuffle_all_button">Shuffle all</string>
|
||||
@@ -252,6 +259,7 @@
|
||||
<string name="podcast_channel_catalogue_title_expanded">Browse Channels</string>
|
||||
<string name="podcast_channel_editor_dialog_hint_rss_url">RSS Url</string>
|
||||
<string name="podcast_channel_editor_dialog_title">Podcast Channel</string>
|
||||
<string name="podcast_channel_not_supported_snackbar">Podcasts are not supported by this server.</string>
|
||||
<string name="podcast_channel_page_title_description_section">Description</string>
|
||||
<string name="podcast_channel_page_title_episode_section">Episodes</string>
|
||||
<string name="podcast_channel_page_title_no_episode_available">No episodes available</string>
|
||||
@@ -266,10 +274,13 @@
|
||||
<string name="radio_editor_dialog_negative_button">Cancel</string>
|
||||
<string name="radio_editor_dialog_neutral_button">Delete</string>
|
||||
<string name="radio_editor_dialog_positive_button">Save</string>
|
||||
<string name="radio_editor_dialog_added">Radio station added</string>
|
||||
<string name="radio_editor_dialog_updated">Radio station updated</string>
|
||||
<string name="radio_editor_dialog_title">Internet Radio Station</string>
|
||||
<string name="radio_station_info_empty_button">Click to hide the section\nThe effects will be visible on restart</string>
|
||||
<string name="radio_station_info_empty_subtitle">Once you add a radio station, you\'ll find it here</string>
|
||||
<string name="radio_station_info_empty_title">No stations found!</string>
|
||||
<string name="radio_dialog_not_supported_snackbar">Internet radio management are not supported by this server.</string>
|
||||
<string name="rating_dialog_negative_button">Cancel</string>
|
||||
<string name="rating_dialog_positive_button">Save</string>
|
||||
<string name="rating_dialog_title">Rate</string>
|
||||
@@ -539,4 +550,7 @@
|
||||
<string name="folder_play_collecting">Collecting songs from folder…</string>
|
||||
<string name="folder_play_playing">Playing %d songs</string>
|
||||
<string name="folder_play_no_songs">No songs found in folder</string>
|
||||
|
||||
<string name="search_sort_title">Sort recent searches chronologically</string>
|
||||
<string name="search_sort_summary">If enabled, sort searches chronologically. Sort by name if disabled.</string>
|
||||
</resources>
|
||||
|
||||
@@ -122,6 +122,12 @@
|
||||
android:summary="@string/settings_artist_sort_by_album_count_summary"
|
||||
android:key="artist_sort_by_album_count" />
|
||||
|
||||
<SwitchPreference
|
||||
android:title="@string/search_sort_title"
|
||||
android:defaultValue="false"
|
||||
android:summary="@string/search_sort_summary"
|
||||
android:key="sort_search_chronologically" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/settings_title_playlist">
|
||||
|
||||
4
fastlane/metadata/android/en-US/changelogs/10.txt
Normal file
4
fastlane/metadata/android/en-US/changelogs/10.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
* fix: updates starred syncing downloads to user defined directory
|
||||
* fix: handle empty albums and null mappings
|
||||
* feat: integrate sort recent searches chronologically
|
||||
* feat: add heart to artist/album pages, fixed artist cover art failing
|
||||
3
fastlane/metadata/android/en-US/changelogs/11.txt
Normal file
3
fastlane/metadata/android/en-US/changelogs/11.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
* fix: checks preference and writes files externally, updates the ui when downloading from the directories
|
||||
* chore: Update description_empty_title in English, Italian, French, Polish and Spanish
|
||||
* feat: added regular playlist to home view
|
||||
6
fastlane/metadata/android/en-US/changelogs/12.txt
Normal file
6
fastlane/metadata/android/en-US/changelogs/12.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
* fix: give user feedback when trying to add podcast/radio on unsupported backends
|
||||
* docs: Clarify Android Auto enablement
|
||||
* fix: instant mix gets a big refactor, with cascading fallbacks to produce a larger queue
|
||||
* chore(i18n): add missing keys, update Chinese translation and alphabetize
|
||||
* chore(i18n): Update Polish translation
|
||||
* feat: Ability to toggle visibility of artist biography
|
||||
@@ -11,6 +11,7 @@ Features
|
||||
- Scrobbling Integration: Optionally integrate Tempus with Last.fm or Listenbrainz.org to scrobble your played tracks, gather music insights, and further personalize your music recommendations, if supported by your Subsonic server.
|
||||
- Podcasts and Radio: If your Subsonic server supports it, listen to podcasts and radio shows directly within Tempus, expanding your audio entertainment options.
|
||||
- Transcoding Support: Activate transcoding of tracks on your Subsonic server, allowing you to set a transcoding profile for optimized streaming directly from the app. This feature requires support from your Subsonic server.
|
||||
- Instant Mix: Full refactor of instant mix function which leverages subsonics similar songs by artist/album and randomSongs endpoints to server a larger play queue more reliably.
|
||||
- Multiple Libraries: Tempus handles multi-library setups gracefully. They are displayed as Library folders.
|
||||
- Equalizer: Option to use in app equalizer.
|
||||
- Widget: New widget to keeping the basic controls on your screen at all times.
|
||||
|
||||
Reference in New Issue
Block a user