mirror of https://github.com/readrops/Readrops.git
Clean code
This commit is contained in:
parent
aaee34f5de
commit
1ee0f50801
|
@ -170,7 +170,7 @@ public class ItemActivity extends AppCompatActivity {
|
|||
actionButton.setBackgroundTintList(ColorStateList.valueOf(itemWithFeed.getColor()));
|
||||
}
|
||||
|
||||
webView.setItem(itemWithFeed, Utils.getDeviceWidth(this));
|
||||
webView.setItem(itemWithFeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,8 +37,6 @@ public class Folder implements Parcelable, Comparable<Folder> {
|
|||
name = in.readString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.jsoup.select.Elements;
|
|||
public class ReadropsWebView extends WebView {
|
||||
|
||||
private ItemWithFeed itemWithFeed;
|
||||
private int width;
|
||||
|
||||
public ReadropsWebView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
@ -26,9 +25,8 @@ public class ReadropsWebView extends WebView {
|
|||
init();
|
||||
}
|
||||
|
||||
public void setItem(ItemWithFeed itemWithFeed, int width) {
|
||||
public void setItem(ItemWithFeed itemWithFeed) {
|
||||
this.itemWithFeed = itemWithFeed;
|
||||
this.width = width;
|
||||
loadData(getText(), LibUtils.HTML_CONTENT_TYPE, "UTF-8");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.readrops.app.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
|
@ -9,7 +8,6 @@ import android.graphics.PorterDuffColorFilter;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.OvalShape;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
@ -31,7 +29,7 @@ public final class Utils {
|
|||
|
||||
public static final String HTTPS_PREFIX = "https://";
|
||||
|
||||
public static final int AVERAGE_WORDS_PER_MINUTE = 250;
|
||||
private static final int AVERAGE_WORDS_PER_MINUTE = 250;
|
||||
|
||||
public static Bitmap getImageFromUrl(String url) {
|
||||
try {
|
||||
|
@ -52,18 +50,10 @@ public final class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
public static int getDeviceWidth(Activity activity) {
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
|
||||
return displayMetrics.widthPixels;
|
||||
}
|
||||
|
||||
public static double readTimeFromString(String value) {
|
||||
int nbWords = value.split("\\s+").length;
|
||||
double minutes = (double) nbWords / AVERAGE_WORDS_PER_MINUTE;
|
||||
|
||||
return minutes;
|
||||
return (double) nbWords / AVERAGE_WORDS_PER_MINUTE;
|
||||
}
|
||||
|
||||
public static String getCssColor(@ColorInt int color) {
|
||||
|
|
Loading…
Reference in New Issue