mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Refactor code to remove usage of Jsoup and Rssparser (#1888)
* Refactor code to remove usage of Jsoup and Rssparser * Use current date for picture of the day
This commit is contained in:
parent
fc30f1b5ec
commit
86e849683a
10 changed files with 154 additions and 58 deletions
|
|
@ -1,7 +1,9 @@
|
|||
package fr.free.nrw.commons.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class DateUtils {
|
||||
public static String getTimeAgo(Date currDate, Date itemDate) {
|
||||
|
|
@ -33,4 +35,10 @@ public class DateUtils {
|
|||
return "0-seconds";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getCurrentDate() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
|
||||
Date date = new Date();
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
15
app/src/main/java/fr/free/nrw/commons/utils/StringUtils.java
Normal file
15
app/src/main/java/fr/free/nrw/commons/utils/StringUtils.java
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package fr.free.nrw.commons.utils;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.Html;
|
||||
|
||||
public class StringUtils {
|
||||
public static String getParsedStringFromHtml(String source) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
return Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
} else {
|
||||
//noinspection deprecation
|
||||
return Html.fromHtml(source).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue