Some fixes

This commit is contained in:
Thomas 2022-06-29 18:54:08 +02:00
parent 7b3b0a9a0c
commit f8aeada68f
3 changed files with 20 additions and 11 deletions

View file

@ -612,7 +612,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
binding.profilePicture.setOnClickListener(v -> binding.drawerLayout.openDrawer(GravityCompat.START)); binding.profilePicture.setOnClickListener(v -> binding.drawerLayout.openDrawer(GravityCompat.START));
Helper.loadPP(binding.profilePicture, currentAccount); Helper.loadPP(binding.profilePicture, currentAccount);
headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.mastodon_account.username, currentAccount.instance)); headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.mastodon_account.username, currentAccount.instance));
if (currentAccount.mastodon_account.display_name.isEmpty()) { if (currentAccount.mastodon_account.display_name == null || currentAccount.mastodon_account.display_name.isEmpty()) {
currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct; currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct;
} }
headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name); headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name);

View file

@ -348,7 +348,7 @@ public class ProfileActivity extends BaseActivity {
binding.accountMoved.setText(spannableString, TextView.BufferType.SPANNABLE); binding.accountMoved.setText(spannableString, TextView.BufferType.SPANNABLE);
binding.accountMoved.setMovementMethod(LinkMovementMethod.getInstance()); binding.accountMoved.setMovementMethod(LinkMovementMethod.getInstance());
} }
if (account.acct.contains("@")) if (account.acct != null && account.acct.contains("@"))
binding.warningMessage.setVisibility(View.VISIBLE); binding.warningMessage.setVisibility(View.VISIBLE);
else else
binding.warningMessage.setVisibility(View.GONE); binding.warningMessage.setVisibility(View.GONE);

View file

@ -1032,6 +1032,7 @@ 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) {
if (disableGif || (!targetedUrl.endsWith(".gif"))) { if (disableGif || (!targetedUrl.endsWith(".gif"))) {
Glide.with(view.getContext()) Glide.with(view.getContext())
.asDrawable() .asDrawable()
@ -1047,6 +1048,14 @@ public class Helper {
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))) .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
.into(view); .into(view);
} }
} else {
Glide.with(view.getContext())
.asDrawable()
.load(R.drawable.ic_person)
.thumbnail(0.1f)
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
.into(view);
}
} }