animated banner
This commit is contained in:
parent
9a8f85a7f2
commit
b6409aeba4
|
@ -16,6 +16,7 @@ package app.fedilab.android.activities;
|
|||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
@ -278,6 +279,26 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
}
|
||||
if (urlHeader != null && !urlHeader.contains("missing.png")) {
|
||||
|
||||
boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false);
|
||||
if( !disableGif){
|
||||
ImageView banner_pp = findViewById(R.id.banner_pp);
|
||||
Glide.with(getApplicationContext())
|
||||
.load(urlHeader)
|
||||
.into(banner_pp);
|
||||
if( theme == Helper.THEME_LIGHT){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
banner_pp.setImageAlpha(80);
|
||||
}else {
|
||||
banner_pp.setAlpha(80);
|
||||
}
|
||||
}else {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
banner_pp.setImageAlpha(60);
|
||||
}else {
|
||||
banner_pp.setAlpha(60);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Glide.with(getApplicationContext())
|
||||
.asBitmap()
|
||||
.load(urlHeader)
|
||||
|
@ -302,7 +323,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
//Redraws icon for locked accounts
|
||||
final float scale = getResources().getDisplayMetrics().density;
|
||||
|
@ -724,23 +745,16 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
if( url != null && url.startsWith("/")){
|
||||
url = Helper.getLiveInstanceWithProtocol(ShowAccountActivity.this) + url;
|
||||
}
|
||||
if( !disableGif && url != null && url.endsWith(".gif")) {
|
||||
Glide.with(getApplicationContext()).asGif().load(url).apply(RequestOptions.circleCropTransform()).into(account_pp);
|
||||
if( !disableGif ) {
|
||||
Glide.with(getApplicationContext()).load(url).apply(RequestOptions.circleCropTransform()).into(account_pp);
|
||||
}else {
|
||||
Glide.with(getApplicationContext())
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
|
||||
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), Helper.addBorder(resource, account_pp.getContext()));
|
||||
circularBitmapDrawable.setCircular(true);
|
||||
account_pp.setImageDrawable(circularBitmapDrawable);
|
||||
}
|
||||
});
|
||||
.apply(RequestOptions.circleCropTransform())
|
||||
.into(account_pp);
|
||||
}
|
||||
}
|
||||
Helper.loadGiF(getApplicationContext(), account.getAvatar(), account_pp);
|
||||
account_pp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -3120,6 +3120,10 @@ public class Helper {
|
|||
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.startsWith("/")){
|
||||
url = Helper.getLiveInstanceWithProtocol(context) + url;
|
||||
}
|
||||
|
||||
if( disableGif){
|
||||
try {
|
||||
Glide.with(imageView.getContext())
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
android:padding="1dp"
|
||||
android:layout_margin="10dp"
|
||||
android:id="@+id/account_pp"
|
||||
android:background="@drawable/circle_background_white"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="130dp"
|
||||
app:layout_scrollFlags="scroll"
|
||||
|
|
Loading…
Reference in New Issue