Fix issue with gif
This commit is contained in:
parent
e0934f94e9
commit
472cc5fa70
|
@ -4,7 +4,7 @@ android {
|
|||
compileSdkVersion 28
|
||||
buildToolsVersion "28.0.3"
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 28
|
||||
versionCode 297
|
||||
versionName "2.12.1"
|
||||
|
@ -121,6 +121,7 @@ dependencies {
|
|||
implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1'
|
||||
implementation 'com.github.duanhong169:colorpicker:1.1.6'
|
||||
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.0.0'
|
||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:1.0.1'
|
||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
|
||||
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class CustomSharingActivity extends BaseActivity implements OnCustomShari
|
|||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||
Account account = new AccountDAO(getApplicationContext(),db).getUniqAccount(userId, instance);
|
||||
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
Bundle b = getIntent().getExtras();
|
||||
Status status = null;
|
||||
if(b != null) {
|
||||
|
|
|
@ -158,7 +158,7 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
|
|||
|
||||
|
||||
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
|
||||
set_profile_name = findViewById(R.id.set_profile_name);
|
||||
set_profile_description = findViewById(R.id.set_profile_description);
|
||||
|
|
|
@ -130,7 +130,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
|
|||
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
|
||||
Account account = new AccountDAO(getApplicationContext(),db).getUniqAccount(userId, instance);
|
||||
if( account != null) {
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
}
|
||||
|
||||
toolbar_close.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -189,7 +189,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
|
|||
SQLiteDatabase db = Sqlite.getInstance(OwnerStatusActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
Account account = new AccountDAO(OwnerStatusActivity.this,db).getUniqAccount(userId, instance);
|
||||
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
|
||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
|
|
|
@ -225,7 +225,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
|
|||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext()));
|
||||
Account account = new AccountDAO(getApplicationContext(), db).getUniqAccount(userId, instance);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), my_pp);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), my_pp);
|
||||
Bundle b = getIntent().getExtras();
|
||||
if(b != null) {
|
||||
peertubeInstance = b.getString("peertube_instance", null);
|
||||
|
|
|
@ -338,7 +338,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
actionbar_title.setText(account.getAcct());
|
||||
pp_actionBar = findViewById(R.id.pp_actionBar);
|
||||
if( account.getAvatar() != null){
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
|
||||
}
|
||||
final AppBarLayout appBar = findViewById(R.id.appBar);
|
||||
|
@ -740,6 +740,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
});
|
||||
}
|
||||
}
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), account_pp);
|
||||
account_pp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -237,7 +237,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetriev
|
|||
Toasty.error(ShowConversationActivity.this,getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
}
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
|
||||
|
||||
swipeRefreshLayout = findViewById(R.id.swipeContainer);
|
||||
|
|
|
@ -693,7 +693,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
|
|||
|
||||
|
||||
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar);
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
|
||||
|
||||
|
||||
if (sharedContent != null) { //Shared content
|
||||
|
|
|
@ -99,7 +99,7 @@ public class AccountsAdminListAdapter extends RecyclerView.Adapter implements On
|
|||
holder.account_ac.setVisibility(View.VISIBLE);
|
||||
|
||||
holder.report_action_taken.setText(accountAdmin.getIp());
|
||||
Helper.loadGiF(context, account.getAvatar_static(), account.getAvatar(), holder.account_pp);
|
||||
Helper.loadGiF(context, account.getAvatar(), holder.account_pp);
|
||||
|
||||
|
||||
holder.main_container.setOnClickListener(view ->{
|
||||
|
|
|
@ -88,7 +88,7 @@ public class AccountsInAListAdapter extends RecyclerView.Adapter implements OnLi
|
|||
else
|
||||
holder.account_ac.setVisibility(View.VISIBLE);
|
||||
//Profile picture
|
||||
Helper.loadGiF(context, account.getAvatar_static(), account.getAvatar(), holder.account_pp);
|
||||
Helper.loadGiF(context, account.getAvatar(), holder.account_pp);
|
||||
|
||||
if( actionType == type.CURRENT){
|
||||
holder.account_action.setImageResource(R.drawable.ic_close);
|
||||
|
|
|
@ -199,7 +199,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
|
|||
holder.account_fgc.setText(Helper.withSuffix(account.getFollowing_count()));
|
||||
holder.account_frc.setText(Helper.withSuffix(account.getFollowers_count()));
|
||||
//Profile picture
|
||||
Helper.loadGiF(context, account.getAvatar_static(), account.getAvatar(), holder.account_pp);
|
||||
Helper.loadGiF(context, account.getAvatar(), holder.account_pp);
|
||||
if( account.isMakingAction()){
|
||||
holder.account_follow.setEnabled(false);
|
||||
}else {
|
||||
|
|
|
@ -182,7 +182,7 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
|
|||
Status.makeEmojis(context, this, status);
|
||||
|
||||
if (status.getAccount() != null && status.getAccount().getAvatar() != null)
|
||||
Helper.loadGiF(context, status.getAccount().getAvatar_static(), status.getAccount().getAvatar(), holder.art_pp);
|
||||
Helper.loadGiF(context, status.getAccount().getAvatar(), holder.art_pp);
|
||||
|
||||
if (status.getArt_attachment() != null)
|
||||
Glide.with(context)
|
||||
|
|
|
@ -1144,7 +1144,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
|||
}
|
||||
|
||||
//Profile picture
|
||||
Helper.loadGiF(context, notification.getAccount().getAvatar_static(), notification.getAccount().getAvatar(), holder.notification_account_profile);
|
||||
Helper.loadGiF(context, notification.getAccount().getAvatar(), holder.notification_account_profile);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter implements OnListActio
|
|||
.into(holder.peertube_video_image);
|
||||
if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http"))
|
||||
account.setAvatar("https://" + peertube.getInstance() + account.getAvatar());
|
||||
Helper.loadGiF(context, account.getAvatar_static(), account.getAvatar(), holder.peertube_profile);
|
||||
Helper.loadGiF(context, account.getAvatar(), holder.peertube_profile);
|
||||
|
||||
|
||||
if( peertube.getHeaderType() != null && peertube.getHeaderTypeValue() != null) {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
|
|||
PeertubeVideoNotification videoAction = null;
|
||||
if( notification.getPeertubeActorFollow() != null){
|
||||
String profileUrl = Helper.getLiveInstanceWithProtocol(context) + notification.getPeertubeActorFollow().getFollower().getAvatar();
|
||||
Helper.loadGiF(context,profileUrl, profileUrl, holder.peertube_notif_pp);
|
||||
Helper.loadGiF(context,profileUrl, holder.peertube_notif_pp);
|
||||
accountAction =notification.getPeertubeActorFollow().getFollower();
|
||||
String type = notification.getPeertubeActorFollow().getFollowing().getType();
|
||||
String message;
|
||||
|
@ -126,7 +126,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
|
|||
});
|
||||
}else if( notification.getPeertubeComment() != null){ //Comment Notification
|
||||
String profileUrl = Helper.getLiveInstanceWithProtocol(context) + notification.getPeertubeComment().getPeertubeAccountNotification().getAvatar();
|
||||
Helper.loadGiF(context, profileUrl, profileUrl, holder.peertube_notif_pp);
|
||||
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
||||
accountAction = notification.getPeertubeComment().getPeertubeAccountNotification();
|
||||
videoAction = notification.getPeertubeComment().getPeertubeVideoNotification();
|
||||
String message = context.getString(R.string.peertube_comment_on_video,accountAction.getDisplayName(), videoAction.getName());
|
||||
|
@ -148,7 +148,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
|
|||
}else {//Other Notifications
|
||||
if (notification.getPeertubeVideoNotification() != null && notification.getPeertubeVideoNotification().getPeertubeAccountNotification() != null){
|
||||
String profileUrl = Helper.getLiveInstanceWithProtocol(context) + notification.getPeertubeVideoNotification().getPeertubeAccountNotification().getAvatar();
|
||||
Helper.loadGiF(context, profileUrl, profileUrl, holder.peertube_notif_pp);
|
||||
Helper.loadGiF(context, profileUrl, holder.peertube_notif_pp);
|
||||
accountAction = notification.getPeertubeVideoNotification().getPeertubeAccountNotification();
|
||||
videoAction = notification.getPeertubeVideoNotification();
|
||||
String message = "";
|
||||
|
|
|
@ -101,9 +101,9 @@ public class ReportsListAdapter extends RecyclerView.Adapter implements OnRetrie
|
|||
|
||||
|
||||
if( target_account.getAvatar() != null) {
|
||||
Helper.loadGiF(context, target_account.getAvatar_static(), target_account.getAvatar(), holder.account_pp);
|
||||
Helper.loadGiF(context, target_account.getAvatar(), holder.account_pp);
|
||||
}
|
||||
Helper.loadGiF(context, account.getAvatar_static(), account.getAvatar(), holder.account_pp_reporter);
|
||||
Helper.loadGiF(context, account.getAvatar(), holder.account_pp_reporter);
|
||||
if( target_account.getAcct() != null) {
|
||||
holder.account_ac.setText(target_account.getAcct());
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ public class ScheduledTootsListAdapter extends BaseAdapter implements OnPostActi
|
|||
holder.scheduled_toot_media_count.setVisibility(View.GONE);
|
||||
holder.scheduled_toot_date_creation.setVisibility(View.GONE);
|
||||
holder.scheduled_toot_privacy.setVisibility(View.GONE);
|
||||
Helper.loadGiF(context, storedStatus.getStatus().getAccount().getAvatar_static(), storedStatus.getStatus().getAccount().getAvatar(), holder.scheduled_toot_pp);
|
||||
Helper.loadGiF(context, storedStatus.getStatus().getAccount().getAvatar(), holder.scheduled_toot_pp);
|
||||
}else {
|
||||
holder.scheduled_toot_pp.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
@ -2009,13 +2009,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
}
|
||||
|
||||
if (status.getReblog() != null) {
|
||||
Helper.loadGiF(context, accountForUrl.getAvatar_static(), accountForUrl.getAvatar(), holder.status_account_profile_boost);
|
||||
Helper.loadGiF(context, status.getAccount().getAvatar_static(), status.getAccount().getAvatar(),holder.status_account_profile_boost_by);
|
||||
Helper.loadGiF(context, accountForUrl.getAvatar(), holder.status_account_profile_boost);
|
||||
Helper.loadGiF(context, status.getAccount().getAvatar(),holder.status_account_profile_boost_by);
|
||||
holder.status_account_profile_boost.setVisibility(View.VISIBLE);
|
||||
holder.status_account_profile_boost_by.setVisibility(View.VISIBLE);
|
||||
holder.status_account_profile.setVisibility(View.GONE);
|
||||
} else {
|
||||
Helper.loadGiF(context, accountForUrl.getAvatar_static(), accountForUrl.getAvatar(), holder.status_account_profile);
|
||||
Helper.loadGiF(context, accountForUrl.getAvatar(), holder.status_account_profile);
|
||||
holder.status_account_profile_boost.setVisibility(View.GONE);
|
||||
holder.status_account_profile_boost_by.setVisibility(View.GONE);
|
||||
holder.status_account_profile.setVisibility(View.VISIBLE);
|
||||
|
@ -2031,7 +2031,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.conversation_pp_2.setVisibility(View.GONE);
|
||||
holder.conversation_pp_3.setVisibility(View.GONE);
|
||||
holder.conversation_pp_4.setVisibility(View.GONE);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(0), status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
} else if (status.getConversationProfilePicture().size() == 2) {
|
||||
holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
|
||||
holder.conversation_pp_3_container.setVisibility(View.GONE);
|
||||
|
@ -2039,8 +2039,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.conversation_pp_2.setVisibility(View.VISIBLE);
|
||||
holder.conversation_pp_3.setVisibility(View.GONE);
|
||||
holder.conversation_pp_4.setVisibility(View.GONE);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(0), status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(1), status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
|
||||
} else if (status.getConversationProfilePicture().size() == 3) {
|
||||
holder.conversation_pp_4.setVisibility(View.GONE);
|
||||
holder.conversation_pp_1.setVisibility(View.VISIBLE);
|
||||
|
@ -2049,9 +2049,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.conversation_pp_4.setVisibility(View.GONE);
|
||||
holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
|
||||
holder.conversation_pp_3_container.setVisibility(View.VISIBLE);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(0), status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(1), status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(2), status.getConversationProfilePicture().get(2), holder.conversation_pp_3);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(2), holder.conversation_pp_3);
|
||||
} else if (status.getConversationProfilePicture().size() == 4) {
|
||||
holder.conversation_pp_1.setVisibility(View.VISIBLE);
|
||||
holder.conversation_pp_2.setVisibility(View.VISIBLE);
|
||||
|
@ -2059,10 +2059,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.conversation_pp_4.setVisibility(View.VISIBLE);
|
||||
holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
|
||||
holder.conversation_pp_3_container.setVisibility(View.VISIBLE);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(0), status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(1), status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(2), status.getConversationProfilePicture().get(2), holder.conversation_pp_3);
|
||||
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(3), status.getConversationProfilePicture().get(3), holder.conversation_pp_4);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(0), holder.conversation_pp_1);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(2), holder.conversation_pp_3);
|
||||
Helper.loadGiF(context, status.getConversationProfilePicture().get(3), holder.conversation_pp_4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SuggestionsAdapter extends RecyclerView.Adapter {
|
|||
holder.suggestion_image.setVisibility(View.GONE);
|
||||
}else{
|
||||
holder.suggestion_content.setText(suggestion.getContent());
|
||||
Helper.loadGiF(context, suggestion.getImageUrl(), suggestion.getImageUrl(), holder.suggestion_image);
|
||||
Helper.loadGiF(context, suggestion.getImageUrl(), holder.suggestion_image);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ import android.text.TextPaint;
|
|||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
|
@ -1632,7 +1633,7 @@ public class Helper {
|
|||
* @param account Account for the profile picture
|
||||
*/
|
||||
public static void loadPictureIcon(final Activity activity, Account account, final ImageView imageView){
|
||||
loadGiF(activity,account.getAvatar_static(), account.getAvatar(), imageView);
|
||||
loadGiF(activity,account.getAvatar(), imageView);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2025,7 +2026,7 @@ public class Helper {
|
|||
account.makeAccountNameEmoji(activity, ((BaseMainActivity)activity), account);
|
||||
username.setText(String.format("@%s",account.getUsername() + "@" + account.getInstance()));
|
||||
displayedName.setText(account.getdisplayNameSpan(), TextView.BufferType.SPANNABLE);
|
||||
loadGiF(activity, account.getAvatar_static(), account.getAvatar(), profilePicture);
|
||||
loadGiF(activity, account.getAvatar(), profilePicture);
|
||||
String urlHeader = account.getHeader();
|
||||
if( urlHeader.startsWith("/") ){
|
||||
urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader();
|
||||
|
@ -3115,72 +3116,67 @@ public class Helper {
|
|||
return String.format(Locale.getDefault(), "%s:%s",strMin,strSec);
|
||||
}
|
||||
|
||||
public static void loadGiF(final Context context, String urlStatic, String url, final ImageView imageView){
|
||||
public static void loadGiF(final Context context, String url, final ImageView imageView){
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
|
||||
if( url == null){
|
||||
url = urlStatic;
|
||||
}
|
||||
if (context instanceof FragmentActivity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((FragmentActivity) context).isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( urlStatic != null && urlStatic.startsWith("/")){
|
||||
url = Helper.getLiveInstanceWithProtocol(context) + url;
|
||||
urlStatic = Helper.getLiveInstanceWithProtocol(context) + urlStatic;
|
||||
}
|
||||
if( urlStatic == null || urlStatic.equals("null")|| urlStatic.equals("false") || urlStatic.contains("missing.png") || urlStatic.contains(".svg")) {
|
||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
try {
|
||||
Glide.with(imageView.getContext())
|
||||
.load(R.drawable.missing)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return;
|
||||
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||
try {
|
||||
Glide.with(imageView.getContext())
|
||||
.load(R.drawable.missing_peertube)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return;
|
||||
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
|
||||
try {
|
||||
Glide.with(imageView.getContext())
|
||||
.load(R.drawable.gnu_default_avatar)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!disableGif && url.endsWith(".gif")) {
|
||||
try {
|
||||
Glide.with(imageView.getContext())
|
||||
.asGif()
|
||||
.load(url)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.load(urlStatic)
|
||||
.into(imageView);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
Glide.with(imageView.getContext())
|
||||
.asDrawable()
|
||||
.load(url)
|
||||
//.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
|
||||
e.printStackTrace();
|
||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
|
||||
Glide.with(imageView.getContext())
|
||||
.asDrawable()
|
||||
.load(R.drawable.missing)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
|
||||
Glide.with(imageView.getContext())
|
||||
.asDrawable()
|
||||
.load(R.drawable.missing_peertube)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
|
||||
Glide.with(imageView.getContext())
|
||||
.asDrawable()
|
||||
.load(R.drawable.gnu_default_avatar)
|
||||
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
|
||||
.into(imageView);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
imageView.setClipToOutline(true);
|
||||
}
|
||||
imageView.setBackgroundResource(R.drawable.rounded_corner_10);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(new SimpleTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
if( !disableGif) {
|
||||
resource.setVisible(true, true);
|
||||
imageView.setImageDrawable(resource);
|
||||
}else{
|
||||
resource.setVisible(true, true);
|
||||
Bitmap bitmap = drawableToBitmap(resource.getCurrent());
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
imageView.setClipToOutline(true);
|
||||
}
|
||||
imageView.setBackgroundResource(R.drawable.rounded_corner_10);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage URLs to open (built-in or external app)
|
||||
* @param context Context
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
<corners android:radius="5dp" />
|
||||
</shape>
|
|
@ -58,7 +58,7 @@
|
|||
android:layout_width="130dp"
|
||||
android:layout_height="130dp"
|
||||
app:layout_scrollFlags="scroll"
|
||||
android:background="@drawable/circle_background_white"
|
||||
|
||||
android:layout_centerInParent="true"
|
||||
android:contentDescription="@string/profile_picture" />
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
|
|
Loading…
Reference in New Issue