mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2025-10-03 09:49:21 +02:00
Remove use of Optional
This commit is contained in:
parent
da1ccfd842
commit
804d3776f7
1 changed files with 6 additions and 8 deletions
|
@ -20,7 +20,6 @@ import org.schabi.newpipe.extractor.stream.StreamInfo;
|
|||
import org.schabi.newpipe.util.Localization;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class DescriptionFragment extends BaseDescriptionFragment {
|
||||
|
||||
|
@ -68,13 +67,12 @@ public class DescriptionFragment extends BaseDescriptionFragment {
|
|||
@Override
|
||||
protected void setupMetadata(final LayoutInflater inflater,
|
||||
final LinearLayout layout) {
|
||||
Optional.ofNullable(streamInfo)
|
||||
.map(StreamInfo::getUploadDate)
|
||||
.ifPresentOrElse(
|
||||
wrapper -> binding.detailUploadDateView
|
||||
.setText(Localization.formatDate(wrapper.offsetDateTime())),
|
||||
() -> binding.detailUploadDateView.setVisibility(View.GONE)
|
||||
);
|
||||
final var date = streamInfo != null ? streamInfo.getUploadDate() : null;
|
||||
if (date != null) {
|
||||
binding.detailUploadDateView.setText(Localization.formatDate(date.offsetDateTime()));
|
||||
} else {
|
||||
binding.detailUploadDateView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (streamInfo == null) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue