mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
fix: shuffle all action
This commit is contained in:
parent
fcb7135c3d
commit
960dd6c76a
4 changed files with 40 additions and 6 deletions
|
|
@ -5,6 +5,7 @@ import android.os.Bundle;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
|
@ -138,6 +139,15 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
|
|||
return true;
|
||||
});
|
||||
|
||||
bind.discoveryTextViewClickable.setOnClickListener(v -> {
|
||||
homeViewModel.getRandomShuffleSample().observe(getViewLifecycleOwner(), songs -> {
|
||||
if (songs.size() > 0) {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
|
||||
activity.setBottomSheetInPeek(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
bind.similarTracksTextViewRefreshable.setOnLongClickListener(v -> {
|
||||
homeViewModel.refreshSimilarSongSample(getViewLifecycleOwner());
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
return dicoverSongSample;
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getRandomShuffleSample() {
|
||||
return songRepository.getRandomSample(100, null, null);
|
||||
}
|
||||
|
||||
public LiveData<List<Chronology>> getGridSongSample(LifecycleOwner owner) {
|
||||
String server = Preferences.getServerId();
|
||||
chronologyRepository.getLastWeek(server).observe(owner, thisGridTopSong::postValue);
|
||||
|
|
|
|||
|
|
@ -113,16 +113,35 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/discovery_text_view_refreshable"
|
||||
style="@style/TitleLarge"
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="@string/home_title_discovery" />
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/discovery_text_view_refreshable"
|
||||
style="@style/TitleLarge"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/home_title_discovery" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/discovery_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/home_title_discovery_shuffle_all_button" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- slideview -->
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@
|
|||
<string name="home_title_discovery">Discovery</string>
|
||||
<string name="home_title_recently_added">Recently added</string>
|
||||
<string name="home_title_recently_added_see_all_button">See all</string>
|
||||
<string name="home_title_discovery_shuffle_all_button">Shuffle all</string>
|
||||
<string name="home_title_starred_albums">★ Starred albums</string>
|
||||
<string name="home_title_starred_albums_see_all_button">See all</string>
|
||||
<string name="home_title_starred_artists">★ Starred artists</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue