Merge pull request #8635 from Isira-Seneviratne/Use_stream_sort

Use stream sorting.
This commit is contained in:
Stypox 2022-07-20 11:06:56 +02:00 committed by GitHub
commit b4aee4b196
2 changed files with 8 additions and 19 deletions

View file

@ -30,10 +30,6 @@ import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils;
import org.schabi.newpipe.util.external_communication.TextLinkifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import icepick.State;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
@ -209,16 +205,14 @@ public class DescriptionFragment extends BaseFragment {
final ItemMetadataTagsBinding itemBinding =
ItemMetadataTagsBinding.inflate(inflater, layout, false);
final List<String> tags = new ArrayList<>(streamInfo.getTags());
Collections.sort(tags);
for (final String tag : tags) {
streamInfo.getTags().stream().sorted().forEach(tag -> {
final Chip chip = (Chip) inflater.inflate(R.layout.chip,
itemBinding.metadataTagsChips, false);
chip.setText(tag);
chip.setOnClickListener(this::onTagClick);
chip.setOnLongClickListener(this::onTagLongClick);
itemBinding.metadataTagsChips.addView(chip);
}
});
layout.addView(itemBinding.getRoot());
}