mirror of https://github.com/readrops/Readrops.git
Use a single instance of OkHttp to fetch feeds icons (it's WAY faster)
This commit is contained in:
parent
5a9ba348f7
commit
9a3f3017c4
|
@ -14,12 +14,12 @@ import androidx.annotation.ColorInt;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
|
import com.readrops.readropslibrary.utils.HttpManager;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
@ -35,9 +35,7 @@ public final class Utils {
|
||||||
|
|
||||||
public static Bitmap getImageFromUrl(String url) {
|
public static Bitmap getImageFromUrl(String url) {
|
||||||
try {
|
try {
|
||||||
OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
OkHttpClient okHttpClient = HttpManager.getInstance().getOkHttpClient();
|
||||||
.callTimeout(5, TimeUnit.SECONDS)
|
|
||||||
.build();
|
|
||||||
Request request = new Request.Builder().url(url).build();
|
Request request = new Request.Builder().url(url).build();
|
||||||
|
|
||||||
Response response = okHttpClient.newCall(request).execute();
|
Response response = okHttpClient.newCall(request).execute();
|
||||||
|
@ -100,6 +98,7 @@ public final class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove html tags and trim the text
|
* Remove html tags and trim the text
|
||||||
|
*
|
||||||
* @param text string to clean
|
* @param text string to clean
|
||||||
* @return cleaned text
|
* @return cleaned text
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue