some fixes

This commit is contained in:
Thomas 2022-10-31 11:34:38 +01:00
parent e999abea81
commit dcd5d97cd5
1 changed files with 6 additions and 6 deletions

View File

@ -1096,9 +1096,9 @@ public class Helper {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false); boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar; String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar;
if (targetedUrl != null && Helper.isValidContextForGlide(view.getContext())) { if (targetedUrl != null && Helper.isValidContextForGlide(context)) {
if (disableGif || (!targetedUrl.endsWith(".gif"))) { if (disableGif || (!targetedUrl.endsWith(".gif"))) {
RequestBuilder<Drawable> requestBuilder = Glide.with(view.getContext()) RequestBuilder<Drawable> requestBuilder = Glide.with(context)
.asDrawable() .asDrawable()
.load(targetedUrl) .load(targetedUrl)
.thumbnail(0.1f); .thumbnail(0.1f);
@ -1107,7 +1107,7 @@ public class Helper {
} }
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view); requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view);
} else { } else {
RequestBuilder<GifDrawable> requestBuilder = Glide.with(view.getContext()) RequestBuilder<GifDrawable> requestBuilder = Glide.with(context)
.asGif() .asGif()
.load(targetedUrl) .load(targetedUrl)
.thumbnail(0.1f); .thumbnail(0.1f);
@ -1116,8 +1116,8 @@ public class Helper {
} }
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view); requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view);
} }
} else if (Helper.isValidContextForGlide(view.getContext())) { } else if (Helper.isValidContextForGlide(context)) {
Glide.with(view.getContext()) Glide.with(context)
.asDrawable() .asDrawable()
.load(R.drawable.ic_person) .load(R.drawable.ic_person)
.thumbnail(0.1f) .thumbnail(0.1f)
@ -1286,7 +1286,7 @@ public class Helper {
} }
selectedFileInputStream.close(); selectedFileInputStream.close();
} }
} catch (IOException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());