Fix crashes

This commit is contained in:
Grishka 2022-04-10 19:55:25 +03:00
parent dc11f3cdf1
commit 9b2f50d726
4 changed files with 7 additions and 3 deletions

View File

@ -10,7 +10,7 @@ android {
applicationId "org.joinmastodon.android"
minSdk 23
targetSdk 31
versionCode 22
versionCode 23
versionName "0.1"
}

View File

@ -10,6 +10,7 @@ import java.lang.reflect.InvocationTargetException;
import me.grishka.appkit.imageloader.ImageCache;
import me.grishka.appkit.utils.NetworkUtils;
import me.grishka.appkit.utils.V;
public class MastodonApp extends Application{
@ -19,12 +20,13 @@ public class MastodonApp extends Application{
@Override
public void onCreate(){
super.onCreate();
context=getApplicationContext();
V.setApplicationContext(context);
ImageCache.Parameters params=new ImageCache.Parameters();
params.diskCacheSize=100*1024*1024;
params.maxMemoryCacheSize=Integer.MAX_VALUE;
ImageCache.setParams(params);
NetworkUtils.setUserAgent("MastodonAndroid/"+BuildConfig.VERSION_NAME);
context=getApplicationContext();
PushSubscriptionManager.tryRegisterFCM();
GlobalUserPreferences.load();

View File

@ -109,7 +109,7 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
private static final Pattern MENTION_PATTERN=Pattern.compile("(^|[^\\/\\w])@(([a-z0-9_]+)@[a-z0-9\\.\\-]+[a-z0-9]+)", Pattern.CASE_INSENSITIVE);
// from https://github.com/mastodon/mastodon-ios/blob/main/Mastodon/Helper/MastodonRegex.swift
private static final Pattern AUTO_COMPLETE_PATTERN=Pattern.compile("(?<!\\w)(?:@([a-zA-Z0-9_]+)(@[a-zA-Z0-9_.-]+)?|#([^\\s.]+))|(^\\B:|\\s:)([a-zA-Z0-9_]+)");
private static final Pattern AUTO_COMPLETE_PATTERN=Pattern.compile("(?<!\\w)(?:@([a-zA-Z0-9_]+)(@[a-zA-Z0-9_.-]+)?|#([^\\s.]+)|:([a-zA-Z0-9_]+))");
private static final Pattern HIGHLIGHT_PATTERN=Pattern.compile("(?<!\\w)(?:@([a-zA-Z0-9_]+)(@[a-zA-Z0-9_.-]+)?|#([^\\s.]+))");
private static final String VALID_URL_PATTERN_STRING =

View File

@ -375,6 +375,8 @@ public class ComposeAutocompleteViewController{
@Override
public ImageLoaderRequest getImageRequest(int position, int image){
if(position>=emojis.size())
return null;
return emojis.get(position).request;
}
}