mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-07 00:20:08 +02:00
Speed-up Nitter
This commit is contained in:
parent
8645f6d59b
commit
7e30ba8fb3
6 changed files with 12 additions and 11 deletions
|
@ -115,7 +115,6 @@ public class Nitter implements Serializable {
|
|||
account.avatar = nitterAccount.image.url;
|
||||
account.avatar_static = nitterAccount.image.url;
|
||||
account.url = nitterAccount.image.link;
|
||||
status.account = account;
|
||||
} else {
|
||||
account.id = feedItem.guid;
|
||||
account.acct = feedItem.creator.replace("@", "");
|
||||
|
@ -124,8 +123,8 @@ public class Nitter implements Serializable {
|
|||
account.avatar = "";
|
||||
account.avatar_static = "";
|
||||
account.url = feedItem.link;
|
||||
status.account = account;
|
||||
}
|
||||
status.account = account;
|
||||
|
||||
if (feedItem.description != null) {
|
||||
Pattern imgPattern = Pattern.compile("<img [^>]*src=\"([^\"]+)\"[^>]*>");
|
||||
|
|
|
@ -588,6 +588,9 @@ public class Helper {
|
|||
* @return String
|
||||
*/
|
||||
public static String longDateToString(Date date) {
|
||||
if (date == null) {
|
||||
date = new Date();
|
||||
}
|
||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT, Locale.getDefault());
|
||||
return df.format(date);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ContextAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class);
|
||||
SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class);
|
||||
StatusAdapter.StatusViewHolder holder = (StatusAdapter.StatusViewHolder) viewHolder;
|
||||
statusManagement(context, statusesVM, searchVM, holder, this, statusList, null, status, Timeline.TimeLineEnum.UNKNOWN, false, true);
|
||||
statusManagement(context, statusesVM, searchVM, holder, this, statusList, status, Timeline.TimeLineEnum.UNKNOWN, false, true);
|
||||
//Hide/Show specific view
|
||||
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
|||
}
|
||||
StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class);
|
||||
SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class);
|
||||
statusManagement(context, statusesVM, searchVM, holderStatus, this, null, notificationList, notification.status, Timeline.TimeLineEnum.NOTIFICATION, false, true);
|
||||
statusManagement(context, statusesVM, searchVM, holderStatus, this, null, notification.status, Timeline.TimeLineEnum.NOTIFICATION, false, true);
|
||||
holderStatus.bindingNotification.status.dateShort.setText(Helper.dateDiff(context, notification.created_at));
|
||||
holderStatus.bindingNotification.containerTransparent.setAlpha(.3f);
|
||||
if (getItemViewType(position) == TYPE_MENTION || getItemViewType(position) == TYPE_STATUS || getItemViewType(position) == TYPE_REACTION) {
|
||||
|
|
|
@ -106,7 +106,6 @@ import app.fedilab.android.activities.ProfileActivity;
|
|||
import app.fedilab.android.activities.ReportActivity;
|
||||
import app.fedilab.android.activities.StatusInfoActivity;
|
||||
import app.fedilab.android.client.entities.api.Attachment;
|
||||
import app.fedilab.android.client.entities.api.Notification;
|
||||
import app.fedilab.android.client.entities.api.Poll;
|
||||
import app.fedilab.android.client.entities.api.Reaction;
|
||||
import app.fedilab.android.client.entities.api.Status;
|
||||
|
@ -289,7 +288,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
* @param holder StatusViewHolder
|
||||
* @param adapter RecyclerView.Adapter<RecyclerView.ViewHolder> - General adapter that can be for {@link StatusAdapter} or {@link NotificationAdapter}
|
||||
* @param statusList List<Status>
|
||||
* @param notificationList List<Notification>
|
||||
* @param timelineType Timeline.TimeLineEnum timelineTypeTimeline.TimeLineEnum
|
||||
* @param status {@link Status}
|
||||
*/
|
||||
|
@ -300,7 +298,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
StatusViewHolder holder,
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder> adapter,
|
||||
List<Status> statusList,
|
||||
List<Notification> notificationList,
|
||||
Status status,
|
||||
Timeline.TimeLineEnum timelineType,
|
||||
boolean minified, boolean canBeFederated) {
|
||||
|
@ -935,7 +932,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
holder.binding.visibilitySmall.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.binding.visibilitySmall.setImageResource(ressource);
|
||||
if (displayCounters) {
|
||||
if (displayCounters && canBeFederated) {
|
||||
holder.binding.statusInfo.setVisibility(View.VISIBLE);
|
||||
holder.binding.dateShort.setVisibility(View.GONE);
|
||||
holder.binding.visibilitySmall.setVisibility(View.GONE);
|
||||
|
@ -1940,7 +1937,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
StatusViewHolder holder = (StatusViewHolder) viewHolder;
|
||||
StatusesVM statusesVM = new ViewModelProvider((ViewModelStoreOwner) context).get(StatusesVM.class);
|
||||
SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get(SearchVM.class);
|
||||
statusManagement(context, statusesVM, searchVM, holder, this, statusList, null, status, timelineType, minified, canBeFederated);
|
||||
statusManagement(context, statusesVM, searchVM, holder, this, statusList, status, timelineType, minified, canBeFederated);
|
||||
} else if (viewHolder.getItemViewType() == STATUS_ART) {
|
||||
StatusViewHolder holder = (StatusViewHolder) viewHolder;
|
||||
MastodonHelper.loadPPMastodon(holder.bindingArt.artPp, status.account);
|
||||
|
|
|
@ -226,8 +226,10 @@ public class TimelinesVM extends AndroidViewModel {
|
|||
List<Status> statusList = new ArrayList<>();
|
||||
if (rssResponse != null && rssResponse.mFeedItems != null) {
|
||||
for (Nitter.FeedItem feedItem : rssResponse.mFeedItems) {
|
||||
Status status = Nitter.convert(getApplication(), instance, feedItem);
|
||||
statusList.add(status);
|
||||
if (feedItem.title.startsWith("RT by")) {
|
||||
Status status = Nitter.convert(getApplication(), instance, feedItem);
|
||||
statusList.add(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
statuses.statuses = statusList;
|
||||
|
|
Loading…
Reference in a new issue