Update appkit image loader
This commit is contained in:
parent
81ac72e4eb
commit
f5961c8077
|
@ -90,7 +90,7 @@ dependencies {
|
|||
implementation 'me.grishka.litex:viewpager:1.0.0'
|
||||
implementation 'me.grishka.litex:viewpager2:1.0.0'
|
||||
implementation 'me.grishka.litex:palette:1.0.0'
|
||||
implementation 'me.grishka.appkit:appkit:1.3.0'
|
||||
implementation 'me.grishka.appkit:appkit:1.4.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.9'
|
||||
implementation 'org.jsoup:jsoup:1.14.3'
|
||||
implementation 'com.squareup:otto:1.3.8'
|
||||
|
|
|
@ -36,6 +36,8 @@ import java.util.stream.Collectors;
|
|||
import me.grishka.appkit.api.Callback;
|
||||
import me.grishka.appkit.api.ErrorResponse;
|
||||
import me.grishka.appkit.imageloader.ImageCache;
|
||||
import me.grishka.appkit.imageloader.ImageLoaderCallback;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.V;
|
||||
|
||||
|
@ -103,6 +105,24 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
}
|
||||
|
||||
private void notify(Context context, PushNotification pn, String accountID, org.joinmastodon.android.model.Notification notification){
|
||||
if(TextUtils.isEmpty(pn.icon)){
|
||||
doNotify(context, pn, accountID, notification, null);
|
||||
}else{
|
||||
ImageCache.getInstance(context).get(new UrlImageLoaderRequest(pn.icon, V.dp(50), V.dp(50)), null, new ImageLoaderCallback(){
|
||||
@Override
|
||||
public void onImageLoaded(ImageLoaderRequest req, Drawable image){
|
||||
doNotify(context, pn, accountID, notification, image);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onImageLoadingFailed(ImageLoaderRequest req, Throwable error){
|
||||
doNotify(context, pn, accountID, notification, null);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void doNotify(Context context, PushNotification pn, String accountID, org.joinmastodon.android.model.Notification notification, Drawable avatar){
|
||||
NotificationManager nm=context.getSystemService(NotificationManager.class);
|
||||
Account self=AccountSessionManager.getInstance().getAccount(accountID).self;
|
||||
String accountName="@"+self.username+"@"+AccountSessionManager.getInstance().getAccount(accountID).domain;
|
||||
|
@ -136,7 +156,6 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
.setPriority(Notification.PRIORITY_DEFAULT)
|
||||
.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
|
||||
}
|
||||
Drawable avatar=ImageCache.getInstance(context).get(new UrlImageLoaderRequest(pn.icon, V.dp(50), V.dp(50)));
|
||||
Intent contentIntent=new Intent(context, MainActivity.class);
|
||||
contentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
contentIntent.putExtra("fromNotification", true);
|
||||
|
|
|
@ -36,7 +36,6 @@ import me.grishka.appkit.fragments.WindowInsetsAwareFragment;
|
|||
import me.grishka.appkit.imageloader.ImageLoaderRecyclerAdapter;
|
||||
import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
|
||||
import me.grishka.appkit.imageloader.ListImageLoaderWrapper;
|
||||
import me.grishka.appkit.imageloader.RecyclerViewDelegate;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.BindableViewHolder;
|
||||
import me.grishka.appkit.utils.CubicBezierInterpolator;
|
||||
|
@ -72,7 +71,7 @@ public class ProfileAboutFragment extends Fragment implements WindowInsetsAwareF
|
|||
list.setItemAnimator(new BetterItemAnimator());
|
||||
list.setDrawSelectorOnTop(true);
|
||||
list.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
imgLoader=new ListImageLoaderWrapper(getActivity(), list, new RecyclerViewDelegate(list), null);
|
||||
imgLoader=new ListImageLoaderWrapper(getActivity(), list, list, null);
|
||||
list.setAdapter(adapter=new AboutAdapter());
|
||||
list.setPadding(0, V.dp(16), 0, 0);
|
||||
list.setClipToPadding(false);
|
||||
|
|
|
@ -36,7 +36,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import me.grishka.appkit.imageloader.ImageLoaderRecyclerAdapter;
|
||||
import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
|
||||
import me.grishka.appkit.imageloader.ListImageLoaderWrapper;
|
||||
import me.grishka.appkit.imageloader.RecyclerViewDelegate;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.BindableViewHolder;
|
||||
|
@ -82,7 +81,7 @@ public class CustomEmojiPopupKeyboard extends PopupKeyboard{
|
|||
});
|
||||
list.setLayoutManager(lm);
|
||||
list.setPadding(V.dp(16), 0, V.dp(16), 0);
|
||||
imgLoader=new ListImageLoaderWrapper(activity, list, new RecyclerViewDelegate(list), null);
|
||||
imgLoader=new ListImageLoaderWrapper(activity, list, list, null);
|
||||
|
||||
for(EmojiCategory category:emojis)
|
||||
adapter.addAdapter(new SingleCategoryAdapter(category));
|
||||
|
|
|
@ -44,7 +44,6 @@ import me.grishka.appkit.api.ErrorResponse;
|
|||
import me.grishka.appkit.imageloader.ImageLoaderRecyclerAdapter;
|
||||
import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
|
||||
import me.grishka.appkit.imageloader.ListImageLoaderWrapper;
|
||||
import me.grishka.appkit.imageloader.RecyclerViewDelegate;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.BindableViewHolder;
|
||||
|
@ -70,7 +69,7 @@ public class AccountSwitcherSheet extends BottomSheet{
|
|||
accounts=AccountSessionManager.getInstance().getLoggedInAccounts().stream().map(WrappedAccount::new).collect(Collectors.toList());
|
||||
|
||||
list=new UsableRecyclerView(activity);
|
||||
imgLoader=new ListImageLoaderWrapper(activity, list, new RecyclerViewDelegate(list), null);
|
||||
imgLoader=new ListImageLoaderWrapper(activity, list, list, null);
|
||||
list.setClipToPadding(false);
|
||||
list.setLayoutManager(new LinearLayoutManager(activity));
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ public class UiUtils{
|
|||
public View getView(){
|
||||
return view;
|
||||
}
|
||||
}, null, new UrlImageLoaderRequest(emoji.getKey().url, emojiSize, emojiSize), null, false, true);
|
||||
}, null, new UrlImageLoaderRequest(emoji.getKey().url, emojiSize, emojiSize), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ import me.grishka.appkit.api.ErrorResponse;
|
|||
import me.grishka.appkit.imageloader.ImageLoaderRecyclerAdapter;
|
||||
import me.grishka.appkit.imageloader.ImageLoaderViewHolder;
|
||||
import me.grishka.appkit.imageloader.ListImageLoaderWrapper;
|
||||
import me.grishka.appkit.imageloader.RecyclerViewDelegate;
|
||||
import me.grishka.appkit.imageloader.requests.ImageLoaderRequest;
|
||||
import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest;
|
||||
import me.grishka.appkit.utils.BindableViewHolder;
|
||||
|
@ -123,7 +122,7 @@ public class ComposeAutocompleteViewController{
|
|||
}
|
||||
});
|
||||
|
||||
imgLoader=new ListImageLoaderWrapper(activity, list, new RecyclerViewDelegate(list), null);
|
||||
imgLoader=new ListImageLoaderWrapper(activity, list, list, null);
|
||||
}
|
||||
|
||||
public void setText(String text){
|
||||
|
|
Loading…
Reference in New Issue