mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2025-10-03 17:59:41 +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 org.schabi.newpipe.util.Localization;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class DescriptionFragment extends BaseDescriptionFragment {
|
public class DescriptionFragment extends BaseDescriptionFragment {
|
||||||
|
|
||||||
|
@ -68,13 +67,12 @@ public class DescriptionFragment extends BaseDescriptionFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void setupMetadata(final LayoutInflater inflater,
|
protected void setupMetadata(final LayoutInflater inflater,
|
||||||
final LinearLayout layout) {
|
final LinearLayout layout) {
|
||||||
Optional.ofNullable(streamInfo)
|
final var date = streamInfo != null ? streamInfo.getUploadDate() : null;
|
||||||
.map(StreamInfo::getUploadDate)
|
if (date != null) {
|
||||||
.ifPresentOrElse(
|
binding.detailUploadDateView.setText(Localization.formatDate(date.offsetDateTime()));
|
||||||
wrapper -> binding.detailUploadDateView
|
} else {
|
||||||
.setText(Localization.formatDate(wrapper.offsetDateTime())),
|
binding.detailUploadDateView.setVisibility(View.GONE);
|
||||||
() -> binding.detailUploadDateView.setVisibility(View.GONE)
|
}
|
||||||
);
|
|
||||||
|
|
||||||
if (streamInfo == null) {
|
if (streamInfo == null) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue