Fixes issue #118 - Allows to disable GIF avatars in settings
This commit is contained in:
parent
1aa3c2c74b
commit
6f5672120a
|
@ -620,7 +620,22 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
|
|||
|
||||
|
||||
}
|
||||
boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false);
|
||||
if( !disableGif)
|
||||
Glide.with(getApplicationContext()).load(account.getAvatar()).apply(RequestOptions.circleCropTransform()).into(account_pp);
|
||||
else
|
||||
Glide.with(getApplicationContext())
|
||||
.asBitmap()
|
||||
.load(account.getAvatar())
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), Helper.addBorder(resource, account_pp.getContext()));
|
||||
circularBitmapDrawable.setCircular(true);
|
||||
account_pp.setImageDrawable(circularBitmapDrawable);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -149,10 +147,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
|
|||
holder.account_fgc.setText(withSuffix(account.getFollowing_count()));
|
||||
holder.account_frc.setText(withSuffix(account.getFollowers_count()));
|
||||
//Profile picture
|
||||
Glide.with(holder.account_pp.getContext())
|
||||
.load(account.getAvatar())
|
||||
.into(holder.account_pp);
|
||||
|
||||
Helper.loadGiF(context, account.getAvatar(), holder.account_pp);
|
||||
if( account.isMakingAction()){
|
||||
holder.account_follow.setEnabled(false);
|
||||
}else {
|
||||
|
|
|
@ -375,9 +375,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
imParams.height = (int) Helper.convertDpToPixel(30, context);
|
||||
imParams.width = (int) Helper.convertDpToPixel(30, context);
|
||||
holder.status_replies_profile_pictures.addView(imageView, imParams);
|
||||
Glide.with(imageView.getContext())
|
||||
.load(replies.getAccount().getAvatar())
|
||||
.into(imageView);
|
||||
Helper.loadGiF(context, replies.getAccount().getAvatar(), imageView);
|
||||
i++;
|
||||
addedPictures.add(replies.getAccount().getAcct());
|
||||
}
|
||||
|
@ -602,19 +600,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
Helper.absoluteDateTimeReveal(context, holder.status_toot_date, status.getCreated_at());
|
||||
|
||||
if( status.getReblog() != null) {
|
||||
Glide.with(holder.status_account_profile_boost.getContext())
|
||||
.load(ppurl)
|
||||
.into(holder.status_account_profile_boost);
|
||||
Glide.with(holder.status_account_profile_boost_by.getContext())
|
||||
.load(status.getAccount().getAvatar())
|
||||
.into(holder.status_account_profile_boost_by);
|
||||
Helper.loadGiF(context, ppurl, 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{
|
||||
Glide.with(holder.status_account_profile.getContext())
|
||||
.load(ppurl)
|
||||
.into(holder.status_account_profile);
|
||||
Helper.loadGiF(context, ppurl, 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);
|
||||
|
|
|
@ -1675,4 +1675,26 @@ public class Helper {
|
|||
return output;
|
||||
}
|
||||
|
||||
|
||||
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( !disableGif)
|
||||
Glide.with(imageView.getContext())
|
||||
.load(url)
|
||||
.into(imageView);
|
||||
else
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
imageView.setImageBitmap(resource);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue