Fix issue with gif

This commit is contained in:
tom79 2019-08-02 13:41:08 +02:00
parent e0934f94e9
commit 472cc5fa70
23 changed files with 104 additions and 101 deletions

View File

@ -4,7 +4,7 @@ android {
compileSdkVersion 28 compileSdkVersion 28
buildToolsVersion "28.0.3" buildToolsVersion "28.0.3"
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 18
targetSdkVersion 28 targetSdkVersion 28
versionCode 297 versionCode 297
versionName "2.12.1" versionName "2.12.1"
@ -121,6 +121,7 @@ dependencies {
implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1' implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1'
implementation 'com.github.duanhong169:colorpicker:1.1.6' 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' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
} }

View File

@ -124,7 +124,7 @@ public class CustomSharingActivity extends BaseActivity implements OnCustomShari
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null); String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
Account account = new AccountDAO(getApplicationContext(),db).getUniqAccount(userId, instance); 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(); Bundle b = getIntent().getExtras();
Status status = null; Status status = null;
if(b != null) { if(b != null) {

View File

@ -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_name = findViewById(R.id.set_profile_name);
set_profile_description = findViewById(R.id.set_profile_description); set_profile_description = findViewById(R.id.set_profile_description);

View File

@ -130,7 +130,7 @@ public class OwnerChartsActivity extends BaseActivity implements OnRetrieveChart
String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null); String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, null);
Account account = new AccountDAO(getApplicationContext(),db).getUniqAccount(userId, instance); Account account = new AccountDAO(getApplicationContext(),db).getUniqAccount(userId, instance);
if( account != null) { 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() { toolbar_close.setOnClickListener(new View.OnClickListener() {

View File

@ -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(); SQLiteDatabase db = Sqlite.getInstance(OwnerStatusActivity.this, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
Account account = new AccountDAO(OwnerStatusActivity.this,db).getUniqAccount(userId, instance); 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); swipeRefreshLayout = findViewById(R.id.swipeContainer);
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

View File

@ -225,7 +225,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext())); instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext()));
Account account = new AccountDAO(getApplicationContext(), db).getUniqAccount(userId, instance); 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(); Bundle b = getIntent().getExtras();
if(b != null) { if(b != null) {
peertubeInstance = b.getString("peertube_instance", null); peertubeInstance = b.getString("peertube_instance", null);

View File

@ -338,7 +338,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
actionbar_title.setText(account.getAcct()); actionbar_title.setText(account.getAcct());
pp_actionBar = findViewById(R.id.pp_actionBar); pp_actionBar = findViewById(R.id.pp_actionBar);
if( account.getAvatar() != null){ 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); 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() { account_pp.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View File

@ -237,7 +237,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetriev
Toasty.error(ShowConversationActivity.this,getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(ShowConversationActivity.this,getString(R.string.toast_error), Toast.LENGTH_LONG).show();
finish(); finish();
} }
Helper.loadGiF(getApplicationContext(), account.getAvatar_static(), account.getAvatar(), pp_actionBar); Helper.loadGiF(getApplicationContext(), account.getAvatar(), pp_actionBar);
swipeRefreshLayout = findViewById(R.id.swipeContainer); swipeRefreshLayout = findViewById(R.id.swipeContainer);

View File

@ -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 if (sharedContent != null) { //Shared content

View File

@ -99,7 +99,7 @@ public class AccountsAdminListAdapter extends RecyclerView.Adapter implements On
holder.account_ac.setVisibility(View.VISIBLE); holder.account_ac.setVisibility(View.VISIBLE);
holder.report_action_taken.setText(accountAdmin.getIp()); 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 ->{ holder.main_container.setOnClickListener(view ->{

View File

@ -88,7 +88,7 @@ public class AccountsInAListAdapter extends RecyclerView.Adapter implements OnLi
else else
holder.account_ac.setVisibility(View.VISIBLE); holder.account_ac.setVisibility(View.VISIBLE);
//Profile picture //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){ if( actionType == type.CURRENT){
holder.account_action.setImageResource(R.drawable.ic_close); holder.account_action.setImageResource(R.drawable.ic_close);

View File

@ -199,7 +199,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
holder.account_fgc.setText(Helper.withSuffix(account.getFollowing_count())); holder.account_fgc.setText(Helper.withSuffix(account.getFollowing_count()));
holder.account_frc.setText(Helper.withSuffix(account.getFollowers_count())); holder.account_frc.setText(Helper.withSuffix(account.getFollowers_count()));
//Profile picture //Profile picture
Helper.loadGiF(context, account.getAvatar_static(), account.getAvatar(), holder.account_pp); Helper.loadGiF(context, account.getAvatar(), holder.account_pp);
if( account.isMakingAction()){ if( account.isMakingAction()){
holder.account_follow.setEnabled(false); holder.account_follow.setEnabled(false);
}else { }else {

View File

@ -182,7 +182,7 @@ public class ArtListAdapter extends RecyclerView.Adapter implements OnPostAction
Status.makeEmojis(context, this, status); Status.makeEmojis(context, this, status);
if (status.getAccount() != null && status.getAccount().getAvatar() != null) 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) if (status.getArt_attachment() != null)
Glide.with(context) Glide.with(context)

View File

@ -1144,7 +1144,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
} }
//Profile picture //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);
} }

View File

@ -117,7 +117,7 @@ public class PeertubeAdapter extends RecyclerView.Adapter implements OnListActio
.into(holder.peertube_video_image); .into(holder.peertube_video_image);
if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http")) if (account.getAvatar() != null && !account.getAvatar().equals("null") && !account.getAvatar().startsWith("http"))
account.setAvatar("https://" + peertube.getInstance() + account.getAvatar()); 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) { if( peertube.getHeaderType() != null && peertube.getHeaderTypeValue() != null) {

View File

@ -101,7 +101,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
PeertubeVideoNotification videoAction = null; PeertubeVideoNotification videoAction = null;
if( notification.getPeertubeActorFollow() != null){ if( notification.getPeertubeActorFollow() != null){
String profileUrl = Helper.getLiveInstanceWithProtocol(context) + notification.getPeertubeActorFollow().getFollower().getAvatar(); 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(); accountAction =notification.getPeertubeActorFollow().getFollower();
String type = notification.getPeertubeActorFollow().getFollowing().getType(); String type = notification.getPeertubeActorFollow().getFollowing().getType();
String message; String message;
@ -126,7 +126,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
}); });
}else if( notification.getPeertubeComment() != null){ //Comment Notification }else if( notification.getPeertubeComment() != null){ //Comment Notification
String profileUrl = Helper.getLiveInstanceWithProtocol(context) + notification.getPeertubeComment().getPeertubeAccountNotification().getAvatar(); 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(); accountAction = notification.getPeertubeComment().getPeertubeAccountNotification();
videoAction = notification.getPeertubeComment().getPeertubeVideoNotification(); videoAction = notification.getPeertubeComment().getPeertubeVideoNotification();
String message = context.getString(R.string.peertube_comment_on_video,accountAction.getDisplayName(), videoAction.getName()); 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 }else {//Other Notifications
if (notification.getPeertubeVideoNotification() != null && notification.getPeertubeVideoNotification().getPeertubeAccountNotification() != null){ if (notification.getPeertubeVideoNotification() != null && notification.getPeertubeVideoNotification().getPeertubeAccountNotification() != null){
String profileUrl = Helper.getLiveInstanceWithProtocol(context) + notification.getPeertubeVideoNotification().getPeertubeAccountNotification().getAvatar(); 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(); accountAction = notification.getPeertubeVideoNotification().getPeertubeAccountNotification();
videoAction = notification.getPeertubeVideoNotification(); videoAction = notification.getPeertubeVideoNotification();
String message = ""; String message = "";

View File

@ -101,9 +101,9 @@ public class ReportsListAdapter extends RecyclerView.Adapter implements OnRetrie
if( target_account.getAvatar() != null) { 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) { if( target_account.getAcct() != null) {
holder.account_ac.setText(target_account.getAcct()); holder.account_ac.setText(target_account.getAcct());
} }

View File

@ -250,7 +250,7 @@ public class ScheduledTootsListAdapter extends BaseAdapter implements OnPostActi
holder.scheduled_toot_media_count.setVisibility(View.GONE); holder.scheduled_toot_media_count.setVisibility(View.GONE);
holder.scheduled_toot_date_creation.setVisibility(View.GONE); holder.scheduled_toot_date_creation.setVisibility(View.GONE);
holder.scheduled_toot_privacy.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 { }else {
holder.scheduled_toot_pp.setVisibility(View.GONE); holder.scheduled_toot_pp.setVisibility(View.GONE);
} }

View File

@ -2009,13 +2009,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
} }
if (status.getReblog() != null) { if (status.getReblog() != null) {
Helper.loadGiF(context, accountForUrl.getAvatar_static(), accountForUrl.getAvatar(), holder.status_account_profile_boost); Helper.loadGiF(context, 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, status.getAccount().getAvatar(),holder.status_account_profile_boost_by);
holder.status_account_profile_boost.setVisibility(View.VISIBLE); holder.status_account_profile_boost.setVisibility(View.VISIBLE);
holder.status_account_profile_boost_by.setVisibility(View.VISIBLE); holder.status_account_profile_boost_by.setVisibility(View.VISIBLE);
holder.status_account_profile.setVisibility(View.GONE); holder.status_account_profile.setVisibility(View.GONE);
} else { } 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.setVisibility(View.GONE);
holder.status_account_profile_boost_by.setVisibility(View.GONE); holder.status_account_profile_boost_by.setVisibility(View.GONE);
holder.status_account_profile.setVisibility(View.VISIBLE); 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_2.setVisibility(View.GONE);
holder.conversation_pp_3.setVisibility(View.GONE); holder.conversation_pp_3.setVisibility(View.GONE);
holder.conversation_pp_4.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) { } else if (status.getConversationProfilePicture().size() == 2) {
holder.conversation_pp_2_container.setVisibility(View.VISIBLE); holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
holder.conversation_pp_3_container.setVisibility(View.GONE); 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_2.setVisibility(View.VISIBLE);
holder.conversation_pp_3.setVisibility(View.GONE); holder.conversation_pp_3.setVisibility(View.GONE);
holder.conversation_pp_4.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);
Helper.loadGiF(context, status.getConversationProfilePictureStatic().get(1), status.getConversationProfilePicture().get(1), holder.conversation_pp_2); Helper.loadGiF(context, status.getConversationProfilePicture().get(1), holder.conversation_pp_2);
} else if (status.getConversationProfilePicture().size() == 3) { } else if (status.getConversationProfilePicture().size() == 3) {
holder.conversation_pp_4.setVisibility(View.GONE); holder.conversation_pp_4.setVisibility(View.GONE);
holder.conversation_pp_1.setVisibility(View.VISIBLE); 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_4.setVisibility(View.GONE);
holder.conversation_pp_2_container.setVisibility(View.VISIBLE); holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
holder.conversation_pp_3_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.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(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(2), holder.conversation_pp_3);
} else if (status.getConversationProfilePicture().size() == 4) { } else if (status.getConversationProfilePicture().size() == 4) {
holder.conversation_pp_1.setVisibility(View.VISIBLE); holder.conversation_pp_1.setVisibility(View.VISIBLE);
holder.conversation_pp_2.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_4.setVisibility(View.VISIBLE);
holder.conversation_pp_2_container.setVisibility(View.VISIBLE); holder.conversation_pp_2_container.setVisibility(View.VISIBLE);
holder.conversation_pp_3_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.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(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(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(3), holder.conversation_pp_4);
} }
} }

View File

@ -76,7 +76,7 @@ public class SuggestionsAdapter extends RecyclerView.Adapter {
holder.suggestion_image.setVisibility(View.GONE); holder.suggestion_image.setVisibility(View.GONE);
}else{ }else{
holder.suggestion_content.setText(suggestion.getContent()); holder.suggestion_content.setText(suggestion.getContent());
Helper.loadGiF(context, suggestion.getImageUrl(), suggestion.getImageUrl(), holder.suggestion_image); Helper.loadGiF(context, suggestion.getImageUrl(), holder.suggestion_image);
} }
} }

View File

@ -83,6 +83,7 @@ import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.style.ClickableSpan; import android.text.style.ClickableSpan;
import android.text.style.ImageSpan;
import android.text.style.URLSpan; import android.text.style.URLSpan;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
@ -1632,7 +1633,7 @@ public class Helper {
* @param account Account for the profile picture * @param account Account for the profile picture
*/ */
public static void loadPictureIcon(final Activity activity, Account account, final ImageView imageView){ 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); account.makeAccountNameEmoji(activity, ((BaseMainActivity)activity), account);
username.setText(String.format("@%s",account.getUsername() + "@" + account.getInstance())); username.setText(String.format("@%s",account.getUsername() + "@" + account.getInstance()));
displayedName.setText(account.getdisplayNameSpan(), TextView.BufferType.SPANNABLE); displayedName.setText(account.getdisplayNameSpan(), TextView.BufferType.SPANNABLE);
loadGiF(activity, account.getAvatar_static(), account.getAvatar(), profilePicture); loadGiF(activity, account.getAvatar(), profilePicture);
String urlHeader = account.getHeader(); String urlHeader = account.getHeader();
if( urlHeader.startsWith("/") ){ if( urlHeader.startsWith("/") ){
urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader(); urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader();
@ -3115,72 +3116,67 @@ public class Helper {
return String.format(Locale.getDefault(), "%s:%s",strMin,strSec); 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); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false); boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
if( url == null){ Glide.with(imageView.getContext())
url = urlStatic; .asDrawable()
} .load(url)
if (context instanceof FragmentActivity) { //.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && ((FragmentActivity) context).isDestroyed()) { .listener(new RequestListener<Drawable>() {
return; @Override
} public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
} return false;
if( urlStatic != null && urlStatic.startsWith("/")){ }
url = Helper.getLiveInstanceWithProtocol(context) + url; @Override
urlStatic = Helper.getLiveInstanceWithProtocol(context) + urlStatic; public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
} e.printStackTrace();
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) {
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) { Glide.with(imageView.getContext())
try { .asDrawable()
Glide.with(imageView.getContext()) .load(R.drawable.missing)
.load(R.drawable.missing) .apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10))) .into(imageView);
.into(imageView); }else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){
} catch (Exception ignored) { Glide.with(imageView.getContext())
} .asDrawable()
return; .load(R.drawable.missing_peertube)
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE){ .apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
try { .into(imageView);
Glide.with(imageView.getContext()) }else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){
.load(R.drawable.missing_peertube) Glide.with(imageView.getContext())
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10))) .asDrawable()
.into(imageView); .load(R.drawable.gnu_default_avatar)
} catch (Exception ignored) { .apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
} .into(imageView);
return; }
}else if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.GNU || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.FRIENDICA){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
try { imageView.setClipToOutline(true);
Glide.with(imageView.getContext()) }
.load(R.drawable.gnu_default_avatar) imageView.setBackgroundResource(R.drawable.rounded_corner_10);
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10))) return false;
.into(imageView); }
} catch (Exception ignored) { })
} .into(new SimpleTarget<Drawable>() {
return; @Override
} public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
} if( !disableGif) {
if (!disableGif && url.endsWith(".gif")) { resource.setVisible(true, true);
try { imageView.setImageDrawable(resource);
Glide.with(imageView.getContext()) }else{
.asGif() resource.setVisible(true, true);
.load(url) Bitmap bitmap = drawableToBitmap(resource.getCurrent());
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10))) imageView.setImageBitmap(bitmap);
.into(imageView); }
} catch (Exception ignored) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
} imageView.setClipToOutline(true);
} else { }
try { imageView.setBackgroundResource(R.drawable.rounded_corner_10);
Glide.with(context) }
.asBitmap() });
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.load(urlStatic)
.into(imageView);
} catch (Exception ignored) {
}
}
} }
/** /**
* Manage URLs to open (built-in or external app) * Manage URLs to open (built-in or external app)
* @param context Context * @param context Context

View File

@ -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>

View File

@ -58,7 +58,7 @@
android:layout_width="130dp" android:layout_width="130dp"
android:layout_height="130dp" android:layout_height="130dp"
app:layout_scrollFlags="scroll" app:layout_scrollFlags="scroll"
android:background="@drawable/circle_background_white"
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:contentDescription="@string/profile_picture" /> android:contentDescription="@string/profile_picture" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton