mirror of
https://github.com/readrops/Readrops.git
synced 2025-01-30 18:34:54 +01:00
Replace drawer feeds icons by their favicon
This commit is contained in:
parent
3efb023d56
commit
c4d00fe2e1
@ -40,10 +40,10 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test:runner:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.8.0'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
|
||||
implementation "com.github.bumptech.glide:okhttp3-integration:4.8.0"
|
||||
implementation("com.github.bumptech.glide:recyclerview-integration:4.8.0") {
|
||||
implementation 'com.github.bumptech.glide:glide:4.9.0'
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
|
||||
implementation "com.github.bumptech.glide:okhttp3-integration:4.9.0"
|
||||
implementation("com.github.bumptech.glide:recyclerview-integration:4.9.0") {
|
||||
// Excludes the support library because it's already included by Glide.
|
||||
transitive = false
|
||||
}
|
||||
|
@ -1,10 +1,16 @@
|
||||
package com.readrops.app.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.mikepenz.materialdrawer.AccountHeader;
|
||||
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
|
||||
import com.mikepenz.materialdrawer.Drawer;
|
||||
@ -94,6 +100,21 @@ public class DrawerManager {
|
||||
.withIcon(color != 0 ? drawableWithColor(color) : drawableWithColor(activity.getResources().getColor(R.color.colorPrimary)))
|
||||
.withIdentifier(feed.getId());
|
||||
|
||||
Glide.with(activity)
|
||||
.load(feed.getIconUrl())
|
||||
.into(new CustomTarget<Drawable>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
|
||||
secondaryDrawerItem.withIcon(resource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
secondaryDrawerItems.add(secondaryDrawerItem);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user