mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
fix: forgot sync album dialog, bump version for release
This commit is contained in:
parent
eaf2710054
commit
6a16159cf0
7 changed files with 184 additions and 2 deletions
|
|
@ -10,8 +10,8 @@ android {
|
||||||
minSdkVersion 24
|
minSdkVersion 24
|
||||||
targetSdk 35
|
targetSdk 35
|
||||||
|
|
||||||
versionCode 29
|
versionCode 30
|
||||||
versionName '3.13.0'
|
versionName '3.14.1'
|
||||||
|
|
||||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,7 @@ public class MainActivity extends BaseActivity {
|
||||||
Preferences.setSkipSilenceMode(false);
|
Preferences.setSkipSilenceMode(false);
|
||||||
Preferences.setDataSavingMode(false);
|
Preferences.setDataSavingMode(false);
|
||||||
Preferences.setStarredSyncEnabled(false);
|
Preferences.setStarredSyncEnabled(false);
|
||||||
|
Preferences.setStarredAlbumsSyncEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetMusicSession() {
|
private void resetMusicSession() {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ import com.cappielloantonio.tempo.service.MediaManager;
|
||||||
import com.cappielloantonio.tempo.service.MediaService;
|
import com.cappielloantonio.tempo.service.MediaService;
|
||||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||||
|
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||||
import com.cappielloantonio.tempo.ui.activity.MainActivity;
|
import com.cappielloantonio.tempo.ui.activity.MainActivity;
|
||||||
import com.cappielloantonio.tempo.ui.adapter.AlbumAdapter;
|
import com.cappielloantonio.tempo.ui.adapter.AlbumAdapter;
|
||||||
import com.cappielloantonio.tempo.ui.adapter.AlbumHorizontalAdapter;
|
import com.cappielloantonio.tempo.ui.adapter.AlbumHorizontalAdapter;
|
||||||
|
|
@ -111,6 +112,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
initSyncStarredView();
|
initSyncStarredView();
|
||||||
|
initSyncStarredAlbumsView();
|
||||||
initDiscoverSongSlideView();
|
initDiscoverSongSlideView();
|
||||||
initSimilarSongView();
|
initSimilarSongView();
|
||||||
initArtistRadio();
|
initArtistRadio();
|
||||||
|
|
@ -314,6 +316,63 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initSyncStarredAlbumsView() {
|
||||||
|
if (Preferences.isStarredAlbumsSyncEnabled()) {
|
||||||
|
homeViewModel.getStarredAlbums(getViewLifecycleOwner()).observeForever(new Observer<List<AlbumID3>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<AlbumID3> albums) {
|
||||||
|
if (albums != null) {
|
||||||
|
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||||
|
List<String> albumsToSync = new ArrayList<>();
|
||||||
|
int albumCount = 0;
|
||||||
|
|
||||||
|
for (AlbumID3 album : albums) {
|
||||||
|
boolean needsSync = false;
|
||||||
|
albumCount++;
|
||||||
|
albumsToSync.add(album.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (albumCount > 0) {
|
||||||
|
bind.homeSyncStarredAlbumsCard.setVisibility(View.VISIBLE);
|
||||||
|
String message = getResources().getQuantityString(
|
||||||
|
R.plurals.home_sync_starred_albums_count,
|
||||||
|
albumCount,
|
||||||
|
albumCount
|
||||||
|
);
|
||||||
|
bind.homeSyncStarredAlbumsToSync.setText(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
homeViewModel.getStarredAlbums(getViewLifecycleOwner()).removeObserver(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
bind.homeSyncStarredAlbumsCancel.setOnClickListener(v -> {
|
||||||
|
bind.homeSyncStarredAlbumsCard.setVisibility(View.GONE);
|
||||||
|
});
|
||||||
|
|
||||||
|
bind.homeSyncStarredAlbumsDownload.setOnClickListener(v -> {
|
||||||
|
homeViewModel.getAllStarredAlbumSongs().observeForever(new Observer<List<Child>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<Child> allSongs) {
|
||||||
|
if (allSongs != null) {
|
||||||
|
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||||
|
|
||||||
|
for (Child song : allSongs) {
|
||||||
|
if (!manager.isDownloaded(song.getId())) {
|
||||||
|
manager.download(MappingUtil.mapDownload(song), new Download(song));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
homeViewModel.getAllStarredAlbumSongs().removeObserver(this);
|
||||||
|
bind.homeSyncStarredAlbumsCard.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void initDiscoverSongSlideView() {
|
private void initDiscoverSongSlideView() {
|
||||||
if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_DISCOVERY)) return;
|
if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_DISCOVERY)) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ public class HomeViewModel extends AndroidViewModel {
|
||||||
private final PlaylistRepository playlistRepository;
|
private final PlaylistRepository playlistRepository;
|
||||||
private final SharingRepository sharingRepository;
|
private final SharingRepository sharingRepository;
|
||||||
|
|
||||||
|
private final StarredAlbumsSyncViewModel albumsSyncViewModel;
|
||||||
|
|
||||||
private final MutableLiveData<List<Child>> dicoverSongSample = new MutableLiveData<>(null);
|
private final MutableLiveData<List<Child>> dicoverSongSample = new MutableLiveData<>(null);
|
||||||
private final MutableLiveData<List<AlbumID3>> newReleasedAlbum = new MutableLiveData<>(null);
|
private final MutableLiveData<List<AlbumID3>> newReleasedAlbum = new MutableLiveData<>(null);
|
||||||
private final MutableLiveData<List<Child>> starredTracksSample = new MutableLiveData<>(null);
|
private final MutableLiveData<List<Child>> starredTracksSample = new MutableLiveData<>(null);
|
||||||
|
|
@ -82,6 +84,8 @@ public class HomeViewModel extends AndroidViewModel {
|
||||||
playlistRepository = new PlaylistRepository();
|
playlistRepository = new PlaylistRepository();
|
||||||
sharingRepository = new SharingRepository();
|
sharingRepository = new SharingRepository();
|
||||||
|
|
||||||
|
albumsSyncViewModel = new StarredAlbumsSyncViewModel(application);
|
||||||
|
|
||||||
setOfflineFavorite();
|
setOfflineFavorite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,6 +170,10 @@ public class HomeViewModel extends AndroidViewModel {
|
||||||
return starredAlbums;
|
return starredAlbums;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<Child>> getAllStarredAlbumSongs() {
|
||||||
|
return albumsSyncViewModel.getAllStarredAlbumSongs();
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<List<ArtistID3>> getStarredArtists(LifecycleOwner owner) {
|
public LiveData<List<ArtistID3>> getStarredArtists(LifecycleOwner owner) {
|
||||||
if (starredArtists.getValue() == null) {
|
if (starredArtists.getValue() == null) {
|
||||||
artistRepository.getStarredArtists(true, 20).observe(owner, starredArtists::postValue);
|
artistRepository.getStarredArtists(true, 20).observe(owner, starredArtists::postValue);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,22 @@ public class StarredAlbumsSyncViewModel extends AndroidViewModel {
|
||||||
return starredAlbums;
|
return starredAlbums;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<Child>> getAllStarredAlbumSongs() {
|
||||||
|
albumRepository.getStarredAlbums(false, -1).observeForever(new Observer<List<AlbumID3>>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(List<AlbumID3> albums) {
|
||||||
|
if (albums != null && !albums.isEmpty()) {
|
||||||
|
collectAllAlbumSongs(albums, starredAlbumSongs::postValue);
|
||||||
|
} else {
|
||||||
|
starredAlbumSongs.postValue(new ArrayList<>());
|
||||||
|
}
|
||||||
|
albumRepository.getStarredAlbums(false, -1).removeObserver(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return starredAlbumSongs;
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<List<Child>> getStarredAlbumSongs(Activity activity) {
|
public LiveData<List<Child>> getStarredAlbumSongs(Activity activity) {
|
||||||
albumRepository.getStarredAlbums(false, -1).observe((LifecycleOwner) activity, albums -> {
|
albumRepository.getStarredAlbums(false, -1).observe((LifecycleOwner) activity, albums -> {
|
||||||
if (albums != null && !albums.isEmpty()) {
|
if (albums != null && !albums.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,98 @@
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<!-- Download/Sync starred albums -->
|
||||||
|
<com.google.android.material.card.MaterialCardView
|
||||||
|
android:id="@+id/home_sync_starred_albums_card"
|
||||||
|
style="?attr/materialCardViewOutlinedStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginHorizontal="16dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="20dp"
|
||||||
|
android:paddingVertical="12dp">
|
||||||
|
|
||||||
|
<!-- Title, secondary and supporting text -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/home_sync_starred_albums_title"
|
||||||
|
style="@style/TitleLarge"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/home_sync_starred_albums_title"
|
||||||
|
android:textAppearance="?attr/textAppearanceTitleMedium"
|
||||||
|
android:textFontWeight="600"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/vertical_guideline_albums"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/home_sync_starred_albums_subtitle"
|
||||||
|
style="@style/TitleMedium"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/home_sync_starred_albums_subtitle"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_albums_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/home_sync_starred_albums_to_sync"
|
||||||
|
style="@style/TitleSmall"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="16dp"
|
||||||
|
android:text="@string/home_sync_starred_albums_subtitle"
|
||||||
|
android:textAppearance="?attr/textAppearanceBodyMedium"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_albums_subtitle" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:gravity="end"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_albums_to_sync">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/home_sync_starred_albums_cancel"
|
||||||
|
style="?attr/materialButtonOutlinedStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:text="@string/home_sync_starred_cancel" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/home_sync_starred_albums_download"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/home_sync_starred_download" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Guideline
|
||||||
|
android:id="@+id/vertical_guideline_albums"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintGuide_percent="0.90" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
<!-- Discover music -->
|
<!-- Discover music -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/home_discover_sector"
|
android:id="@+id/home_discover_sector"
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,8 @@
|
||||||
<string name="home_sync_starred_download">Download</string>
|
<string name="home_sync_starred_download">Download</string>
|
||||||
<string name="home_sync_starred_subtitle">Downloading these tracks may involve significant data usage</string>
|
<string name="home_sync_starred_subtitle">Downloading these tracks may involve significant data usage</string>
|
||||||
<string name="home_sync_starred_title">Looks like there are some starred tracks to sync</string>
|
<string name="home_sync_starred_title">Looks like there are some starred tracks to sync</string>
|
||||||
|
<string name="home_sync_starred_albums_title">Sync Starred Albums</string>
|
||||||
|
<string name="home_sync_starred_albums_subtitle">Albums marked with a star will be available offline</string>
|
||||||
<string name="home_title_best_of">Best of</string>
|
<string name="home_title_best_of">Best of</string>
|
||||||
<string name="home_title_discovery">Discovery</string>
|
<string name="home_title_discovery">Discovery</string>
|
||||||
<string name="home_title_discovery_shuffle_all_button">Shuffle all</string>
|
<string name="home_title_discovery_shuffle_all_button">Shuffle all</string>
|
||||||
|
|
@ -437,4 +439,8 @@
|
||||||
<string name="undraw_page">unDraw</string>
|
<string name="undraw_page">unDraw</string>
|
||||||
<string name="undraw_thanks">A special thanks goes to unDraw without whose illustrations we could not have made this application more beautiful.</string>
|
<string name="undraw_thanks">A special thanks goes to unDraw without whose illustrations we could not have made this application more beautiful.</string>
|
||||||
<string name="undraw_url">https://undraw.co/</string>
|
<string name="undraw_url">https://undraw.co/</string>
|
||||||
|
<plurals name="home_sync_starred_albums_count">
|
||||||
|
<item quantity="one">%d album to sync</item>
|
||||||
|
<item quantity="other">%d albums to sync</item>
|
||||||
|
</plurals>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue