-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce class that indicates when the time ago is an approximation
- Loading branch information
1 parent
6ca4c89
commit 3d21ef5
Showing
22 changed files
with
139 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
extractor/src/main/java/org/schabi/newpipe/extractor/localization/DateWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.schabi.newpipe.extractor.localization; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
||
import java.io.Serializable; | ||
import java.util.Calendar; | ||
|
||
/** | ||
* A wrapper class that provides a field to describe if the date is precise or just an approximation. | ||
*/ | ||
public class DateWrapper implements Serializable { | ||
@NonNull private final Calendar date; | ||
private final boolean isApproximation; | ||
|
||
public DateWrapper(@NonNull Calendar date) { | ||
this(date, false); | ||
} | ||
|
||
public DateWrapper(@NonNull Calendar date, boolean isApproximation) { | ||
this.date = date; | ||
this.isApproximation = isApproximation; | ||
} | ||
|
||
/** | ||
* @return the wrapped date. | ||
*/ | ||
@NonNull | ||
public Calendar date() { | ||
return date; | ||
} | ||
|
||
/** | ||
* @return if the date is considered is precise or just an approximation (e.g. service only returns an approximation | ||
* like 2 weeks ago instead of a precise date). | ||
*/ | ||
public boolean isApproximation() { | ||
return isApproximation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.