summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/app/fedilab/android/helper/Helper.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/app/fedilab/android/helper/Helper.java')
-rw-r--r--app/src/main/java/app/fedilab/android/helper/Helper.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java
index ceeae75c7..d0ede0a82 100644
--- a/app/src/main/java/app/fedilab/android/helper/Helper.java
+++ b/app/src/main/java/app/fedilab/android/helper/Helper.java
@@ -320,6 +320,7 @@ public class Helper {
public static final int TOOTS_PER_PAGE = 40;
public static final int ACCOUNTS_PER_PAGE = 40;
public static final int NOTIFICATIONS_PER_PAGE = 30;
+ public static final int DEFAULT_VIDEO_CACHE_MB = 100;
public static final String SET_ATTACHMENT_ACTION = "set_attachment_action";
public static final String SET_TOOT_PER_PAGE = "set_toot_per_page";
public static final String SET_THEME = "set_theme";
@@ -435,6 +436,10 @@ public class Helper {
public static final String SET_NITTER_HOST = "set_nitter_host";
public static final String DEFAULT_NITTER_HOST = "nitter.net";
+ public static final String SET_BIBLIOGRAM = "set_bibliogram";
+ public static final String SET_BIBLIOGRAM_HOST = "set_bibliogram_host";
+ public static final String DEFAULT_BIBLIOGRAM_HOST = "bibliogram.art";
+
public static final String SET_NOTIF_VALIDATION = "set_share_validation";
public static final String SET_NOTIF_VALIDATION_FAV = "set_share_validation_fav";
public static final String SET_WIFI_ONLY = "set_wifi_only";
@@ -462,6 +467,7 @@ public class Helper {
public static final String SET_SECURITY_PROVIDER = "set_security_provider";
public static final String SET_ALLOW_STREAM = "set_allow_stream";
public static final String SET_CUSTOM_USER_AGENT = "set_custom_user_agent";
+ public static final String SET_VIDEO_CACHE = "set_video_cache";
//End points
public static final String EP_AUTHORIZE = "/oauth/authorize";
@@ -512,6 +518,8 @@ public class Helper {
public static final Pattern twitterPattern = Pattern.compile("((@[\\w]+)@twitter\\.com)");
public static final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)");
public static final Pattern nitterPattern = Pattern.compile("(mobile\\.|www\\.)?twitter.com([\\w-/]+)");
+ public static final Pattern bibliogramPattern = Pattern.compile("(m\\.|www\\.)?instagram.com(/p/[\\w-/]+)");
+ public static final Pattern ouichesPattern = Pattern.compile("https://ouich\\.es/tag/(\\w+)");
public static final Pattern xmppPattern = Pattern.compile("xmpp:[-a-zA-Z0-9+$&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
//Default values
public final static int DEFAULT_VIDEO_WIDTH = 640;
@@ -1321,9 +1329,9 @@ public class Helper {
if (url.startsWith("/")) {
url = "https://" + account.getInstance() + account.getAvatar();
}
- if( isValidContextForGlide(activity)) {
+ if (isValidContextForGlide(activity)) {
if (!url.equals("null")) {
- if( url.contains(".gif")) {
+ if (url.contains(".gif")) {
Glide.with(navigationView.getContext())
.asGif()
.load(url)
@@ -1339,7 +1347,7 @@ public class Helper {
}
});
- }else{
+ } else {
Glide.with(navigationView.getContext())
.asDrawable()
.load(url)
@@ -1749,14 +1757,14 @@ public class Helper {
String avatarUrl = !disableGif ? accountChoice.getAvatar() : accountChoice.getAvatar_static();
- if( avatarUrl.contains(".gif")) {
+ if (avatarUrl.contains(".gif")) {
Glide.with(finalIcon.getContext())
.asGif()
.load(avatarUrl)
.thumbnail(0.1f)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
.into(finalIcon);
- }else{
+ } else {
Glide.with(activity)
.asDrawable()
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
@@ -1819,17 +1827,17 @@ public class Helper {
if (!accountChoice.getAvatar().startsWith("http"))
accountChoice.setAvatar("https://" + accountChoice.getInstance() + accountChoice.getAvatar());
ImageView itemIconAcc = new ImageView(activity);
- if (isValidContextForGlide(activity) ) {
+ if (isValidContextForGlide(activity)) {
try {
String avatarUrl = !disableGif ? accountChoice.getAvatar() : accountChoice.getAvatar_static();
- if( avatarUrl.contains(".gif")) {
+ if (avatarUrl.contains(".gif")) {
Glide.with(itemIconAcc.getContext())
.asGif()
.load(avatarUrl)
.thumbnail(0.1f)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
.into(itemIconAcc);
- }else{
+ } else {
Glide.with(activity)
.asDrawable()
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(270)))
@@ -2262,10 +2270,8 @@ public class Helper {
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setSupportMultipleWindows(false);
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);
- String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, null);
- if (user_agent != null) {
- webView.getSettings().setUserAgentString(user_agent);
- }
+ String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
+ webView.getSettings().setUserAgentString(user_agent);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
boolean cookies = sharedpreferences.getBoolean(Helper.SET_COOKIES, false);
CookieManager cookieManager = CookieManager.getInstance();
@@ -2993,7 +2999,7 @@ public class Helper {
}
try {
assert url != null;
- if (disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0)) {
+ if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE || disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0)) {
Glide.with(imageView.getContext())
.asDrawable()
.load(url)