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:
Vivek Maskara 2018-09-11 21:14:41 +05:30 committed by GitHub
parent fc30f1b5ec
commit 86e849683a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 154 additions and 58 deletions

View file

@ -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);
}
}

View 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();
}
}
}