style: lambda to explicit

This commit is contained in:
antonio 2023-06-21 10:51:20 +02:00
parent 76c53bd502
commit aee791b0c3
3 changed files with 36 additions and 19 deletions

View file

@ -230,21 +230,29 @@ public class AlbumRepository {
public MutableLiveData<List<Integer>> getDecades() {
MutableLiveData<List<Integer>> decades = new MutableLiveData<>();
getFirstAlbum(first -> getLastAlbum(last -> {
if (first != -1 && last != -1) {
List<Integer> decadeList = new ArrayList();
getFirstAlbum(new DecadesCallback() {
@Override
public void onLoadYear(int first) {
getLastAlbum(new DecadesCallback() {
@Override
public void onLoadYear(int last) {
if (first != -1 && last != -1) {
List<Integer> decadeList = new ArrayList();
int startDecade = first - (first % 10);
int lastDecade = last - (last % 10);
int startDecade = first - (first % 10);
int lastDecade = last - (last % 10);
while (startDecade <= lastDecade) {
decadeList.add(startDecade);
startDecade = startDecade + 10;
}
while (startDecade <= lastDecade) {
decadeList.add(startDecade);
startDecade = startDecade + 10;
}
decades.setValue(decadeList);
decades.setValue(decadeList);
}
}
});
}
}));
});
return decades;
}

View file

@ -12,6 +12,7 @@ import com.cappielloantonio.tempo.R;
import com.cappielloantonio.tempo.databinding.ItemPlayerQueueSongBinding;
import com.cappielloantonio.tempo.glide.CustomGlideRequest;
import com.cappielloantonio.tempo.interfaces.ClickCallback;
import com.cappielloantonio.tempo.interfaces.MediaIndexCallback;
import com.cappielloantonio.tempo.service.MediaManager;
import com.cappielloantonio.tempo.subsonic.models.Child;
import com.cappielloantonio.tempo.util.Constants;
@ -52,13 +53,16 @@ public class PlayerSongQueueAdapter extends RecyclerView.Adapter<PlayerSongQueue
.build()
.into(holder.item.queueSongCoverImageView);
MediaManager.getCurrentIndex(mediaBrowserListenableFuture, index -> {
if (position < index) {
holder.item.queueSongTitleTextView.setAlpha(0.2f);
holder.item.queueSongSubtitleTextView.setAlpha(0.2f);
} else {
holder.item.queueSongTitleTextView.setAlpha(1.0f);
holder.item.queueSongSubtitleTextView.setAlpha(1.0f);
MediaManager.getCurrentIndex(mediaBrowserListenableFuture, new MediaIndexCallback() {
@Override
public void onRecovery(int index) {
if (position < index) {
holder.item.queueSongTitleTextView.setAlpha(0.2f);
holder.item.queueSongSubtitleTextView.setAlpha(0.2f);
} else {
holder.item.queueSongTitleTextView.setAlpha(1.0f);
holder.item.queueSongSubtitleTextView.setAlpha(1.0f);
}
}
});
}

View file

@ -131,7 +131,12 @@ public class HomeTabRadioFragment extends Fragment implements ClickCallback, Rad
@Override
public void onInternetRadioStationLongClick(Bundle bundle) {
RadioEditorDialog dialog = new RadioEditorDialog(() -> radioViewModel.getInternetRadioStations(getViewLifecycleOwner()));
RadioEditorDialog dialog = new RadioEditorDialog(new RadioCallback() {
@Override
public void onDismiss() {
radioViewModel.getInternetRadioStations(getViewLifecycleOwner());
}
});
dialog.setArguments(bundle);
dialog.show(activity.getSupportFragmentManager(), null);
}