mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Set the final strings and the titles of the songs to be synchronized in the home alert
This commit is contained in:
parent
b0b5fc2172
commit
c77e23af13
3 changed files with 24 additions and 8 deletions
|
|
@ -57,6 +57,7 @@ import com.google.android.gms.cast.framework.CastButtonFactory;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -267,17 +268,19 @@ public class HomeFragment extends Fragment implements ClickCallback {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(List<Child> songs) {
|
public void onChanged(List<Child> songs) {
|
||||||
if (songs != null) {
|
if (songs != null) {
|
||||||
boolean showAlert = false;
|
|
||||||
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
DownloaderManager manager = DownloadUtil.getDownloadTracker(requireContext());
|
||||||
|
List<String> toSync = new ArrayList<>();
|
||||||
|
|
||||||
for (Child song : songs) {
|
for (Child song : songs) {
|
||||||
if (!manager.isDownloaded(song.getId())) {
|
if (!manager.isDownloaded(song.getId())) {
|
||||||
showAlert = true;
|
toSync.add(song.getTitle());
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showAlert) bind.homeSyncStarredCard.setVisibility(View.VISIBLE);
|
if (!toSync.isEmpty()) {
|
||||||
|
bind.homeSyncStarredCard.setVisibility(View.VISIBLE);
|
||||||
|
bind.homeSyncStarredTracksToSync.setText(String.join(", ", toSync));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
homeViewModel.getAllStarredTracks().removeObserver(this);
|
homeViewModel.getAllStarredTracks().removeObserver(this);
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,19 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_title" />
|
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/home_sync_starred_tracks_to_sync"
|
||||||
|
style="@style/TitleSmall"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:text="@string/home_sync_starred_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_subtitle" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
@ -104,7 +117,7 @@
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_subtitle">
|
app:layout_constraintTop_toBottomOf="@+id/home_sync_starred_tracks_to_sync">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/home_sync_starred_cancel"
|
android:id="@+id/home_sync_starred_cancel"
|
||||||
|
|
@ -127,7 +140,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_constraintGuide_percent="0.70" />
|
app:layout_constraintGuide_percent="0.90" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@
|
||||||
<string name="genre_catalogue_title">Genre Catalogue</string>
|
<string name="genre_catalogue_title">Genre Catalogue</string>
|
||||||
<string name="genre_catalogue_title_expanded">Browse Genres</string>
|
<string name="genre_catalogue_title_expanded">Browse Genres</string>
|
||||||
<string name="home_subtitle_made_for_you">Start mix from a song you liked</string>
|
<string name="home_subtitle_made_for_you">Start mix from a song you liked</string>
|
||||||
<string name="home_sync_starred_title">Start mix from a song you liked</string>
|
<string name="home_sync_starred_title">Looks like there are some starred tracks to sync</string>
|
||||||
<string name="home_sync_starred_subtitle">Start mix from a song you liked</string>
|
<string name="home_sync_starred_subtitle">Downloading these tracks may involve significant data usage</string>
|
||||||
<string name="home_sync_starred_cancel">Cancel</string>
|
<string name="home_sync_starred_cancel">Cancel</string>
|
||||||
<string name="home_sync_starred_download">Download</string>
|
<string name="home_sync_starred_download">Download</string>
|
||||||
<string name="home_title_flashback">Flashback</string>
|
<string name="home_title_flashback">Flashback</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue