mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Migrate from Glide to Fresco
This commit is contained in:
parent
08134ef5f1
commit
e560fd364b
@ -45,24 +45,20 @@ dependencies {
|
||||
// For loading and tinting drawables on older versions of the platform
|
||||
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
|
||||
implementation "androidx.recyclerview:recyclerview:1.2.0-alpha05"
|
||||
implementation 'com.google.android.material:material:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation "androidx.viewpager2:viewpager2:1.0.0"
|
||||
implementation "androidx.navigation:navigation-fragment:$nav_version"
|
||||
implementation "androidx.navigation:navigation-ui:$nav_version"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.0.0"
|
||||
implementation "androidx.constraintlayout:constraintlayout:2.0.1"
|
||||
implementation "androidx.preference:preference:$preference_version"
|
||||
|
||||
|
||||
implementation 'org.jsoup:jsoup:1.13.1'
|
||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||
implementation 'com.github.chrisbanes:PhotoView:v2.0.0'
|
||||
implementation 'com.google.android.exoplayer:exoplayer:2.11.1'
|
||||
implementation 'com.facebook.fresco:fresco:2.3.0'
|
||||
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||||
|
||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package awais.instagrabber.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -8,52 +7,37 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.adapters.viewholder.FollowsViewHolder;
|
||||
import awais.instagrabber.databinding.ItemFollowBinding;
|
||||
import awais.instagrabber.models.ProfileModel;
|
||||
|
||||
public final class DirectMessageMembersAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
public final class DirectMessageMembersAdapter extends RecyclerView.Adapter<FollowsViewHolder> {
|
||||
private final ProfileModel[] profileModels;
|
||||
private final List<Long> admins;
|
||||
private final View.OnClickListener onClickListener;
|
||||
private final LayoutInflater layoutInflater;
|
||||
|
||||
public DirectMessageMembersAdapter(final ProfileModel[] profileModels, final List<Long> admins,
|
||||
final Context context, final View.OnClickListener onClickListener) {
|
||||
public DirectMessageMembersAdapter(final ProfileModel[] profileModels,
|
||||
final List<Long> admins,
|
||||
final View.OnClickListener onClickListener) {
|
||||
this.profileModels = profileModels;
|
||||
this.admins = admins;
|
||||
this.layoutInflater = LayoutInflater.from(context);
|
||||
this.onClickListener = onClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
|
||||
final View view = layoutInflater.inflate(R.layout.item_follow, parent, false);
|
||||
return new FollowsViewHolder(view);
|
||||
public FollowsViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
|
||||
final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
final ItemFollowBinding binding = ItemFollowBinding.inflate(layoutInflater, parent, false);
|
||||
return new FollowsViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, final int position) {
|
||||
public void onBindViewHolder(@NonNull final FollowsViewHolder holder, final int position) {
|
||||
final ProfileModel model = profileModels[position];
|
||||
|
||||
final FollowsViewHolder followHolder = (FollowsViewHolder) holder;
|
||||
if (model != null) {
|
||||
followHolder.itemView.setTag(model);
|
||||
followHolder.itemView.setOnClickListener(onClickListener);
|
||||
|
||||
followHolder.tvUsername.setText(model.getUsername());
|
||||
followHolder.tvFullName.setText(model.getName());
|
||||
|
||||
if (admins != null && admins.contains(Long.parseLong(model.getId())))
|
||||
followHolder.isAdmin.setVisibility(View.VISIBLE);
|
||||
|
||||
Glide.with(layoutInflater.getContext()).load(model.getSdProfilePic()).into(followHolder.profileImage);
|
||||
}
|
||||
holder.bind(model, admins, onClickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package awais.instagrabber.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -11,13 +10,12 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.adapters.viewholder.FollowsViewHolder;
|
||||
import awais.instagrabber.databinding.ItemFollowBinding;
|
||||
import awais.instagrabber.interfaces.OnGroupClickListener;
|
||||
import awais.instagrabber.models.FollowModel;
|
||||
import awais.instagrabber.utils.TextUtils;
|
||||
@ -66,12 +64,10 @@ public final class FollowAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
}
|
||||
};
|
||||
private final View.OnClickListener onClickListener;
|
||||
private final LayoutInflater layoutInflater;
|
||||
private final ExpandableList expandableList;
|
||||
private final boolean hasManyGroups;
|
||||
|
||||
public FollowAdapter(final Context context, final View.OnClickListener onClickListener, @NonNull final ArrayList<ExpandableGroup> groups) {
|
||||
this.layoutInflater = LayoutInflater.from(context);
|
||||
public FollowAdapter(final View.OnClickListener onClickListener, @NonNull final ArrayList<ExpandableGroup> groups) {
|
||||
this.expandableList = new ExpandableList(groups);
|
||||
this.onClickListener = onClickListener;
|
||||
this.hasManyGroups = groups.size() > 1;
|
||||
@ -86,10 +82,15 @@ public final class FollowAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
|
||||
final boolean isGroup = hasManyGroups && viewType == ExpandableListPosition.GROUP;
|
||||
|
||||
final View view = layoutInflater.inflate(isGroup ? R.layout.header_follow : R.layout.item_follow, parent, false);
|
||||
|
||||
return isGroup ? new GroupViewHolder(view, this) : new FollowsViewHolder(view);
|
||||
final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
final View view;
|
||||
if (isGroup) {
|
||||
view = layoutInflater.inflate(R.layout.header_follow, parent, false);
|
||||
return new GroupViewHolder(view, this);
|
||||
} else {
|
||||
final ItemFollowBinding binding = ItemFollowBinding.inflate(layoutInflater, parent, false);
|
||||
return new FollowsViewHolder(binding);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,21 +102,10 @@ public final class FollowAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
final GroupViewHolder gvh = (GroupViewHolder) holder;
|
||||
gvh.setTitle(group.getTitle());
|
||||
gvh.toggle(isGroupExpanded(group));
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
final FollowModel model = group.getItems(true).get(hasManyGroups ? listPos.childPos : position);
|
||||
|
||||
final FollowsViewHolder followHolder = (FollowsViewHolder) holder;
|
||||
if (model != null) {
|
||||
followHolder.itemView.setTag(model);
|
||||
followHolder.itemView.setOnClickListener(onClickListener);
|
||||
|
||||
followHolder.tvUsername.setText(model.getUsername());
|
||||
followHolder.tvFullName.setText(model.getFullName());
|
||||
|
||||
Glide.with(layoutInflater.getContext()).load(model.getProfilePicUrl()).into(followHolder.profileImage);
|
||||
}
|
||||
}
|
||||
((FollowsViewHolder) holder).bind(model, onClickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,16 +7,14 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.adapters.viewholder.PostMediaViewHolder;
|
||||
import awais.instagrabber.databinding.ItemChildPostBinding;
|
||||
import awais.instagrabber.models.BasePostModel;
|
||||
import awais.instagrabber.models.ViewerPostModel;
|
||||
|
||||
public final class PostsMediaAdapter extends RecyclerView.Adapter<PostMediaViewHolder> {
|
||||
private final View.OnClickListener clickListener;
|
||||
private LayoutInflater layoutInflater;
|
||||
private ViewerPostModel[] postModels;
|
||||
|
||||
public PostsMediaAdapter(final ViewerPostModel[] postModels, final View.OnClickListener clickListener) {
|
||||
@ -27,25 +25,16 @@ public final class PostsMediaAdapter extends RecyclerView.Adapter<PostMediaViewH
|
||||
@NonNull
|
||||
@Override
|
||||
public PostMediaViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
|
||||
if (layoutInflater == null) layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
return new PostMediaViewHolder(layoutInflater.inflate(R.layout.item_child_post, parent, false));
|
||||
final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
layoutInflater.inflate(R.layout.item_child_post, parent, false);
|
||||
final ItemChildPostBinding binding = ItemChildPostBinding.inflate(layoutInflater, parent, false);
|
||||
return new PostMediaViewHolder(binding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final PostMediaViewHolder holder, final int position) {
|
||||
final ViewerPostModel postModel = postModels[position];
|
||||
if (postModel != null) {
|
||||
postModel.setPosition(position);
|
||||
|
||||
holder.itemView.setTag(postModel);
|
||||
holder.itemView.setOnClickListener(clickListener);
|
||||
|
||||
holder.selectedView.setVisibility(postModel.isCurrentSlide() ? View.VISIBLE : View.GONE);
|
||||
|
||||
holder.isDownloaded.setVisibility(postModel.isDownloaded() ? View.VISIBLE : View.GONE);
|
||||
|
||||
Glide.with(layoutInflater.getContext()).load(postModel.getSliderDisplayUrl()).into(holder.icon);
|
||||
}
|
||||
holder.bind(postModel, position, clickListener);
|
||||
}
|
||||
|
||||
public void setData(final ViewerPostModel[] postModels) {
|
||||
|
@ -1,23 +1,45 @@
|
||||
package awais.instagrabber.adapters.viewholder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.databinding.ItemFollowBinding;
|
||||
import awais.instagrabber.models.FollowModel;
|
||||
import awais.instagrabber.models.ProfileModel;
|
||||
|
||||
public final class FollowsViewHolder extends RecyclerView.ViewHolder {
|
||||
public final ImageView profileImage, isAdmin;
|
||||
public final TextView tvFullName, tvUsername;
|
||||
|
||||
public FollowsViewHolder(@NonNull final View itemView) {
|
||||
super(itemView);
|
||||
profileImage = itemView.findViewById(R.id.ivProfilePic);
|
||||
tvFullName = itemView.findViewById(R.id.tvFullName);
|
||||
tvUsername = itemView.findViewById(R.id.tvUsername);
|
||||
isAdmin = itemView.findViewById(R.id.isAdmin);
|
||||
private final ItemFollowBinding binding;
|
||||
|
||||
public FollowsViewHolder(final ItemFollowBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void bind(final ProfileModel model,
|
||||
final List<Long> admins,
|
||||
final View.OnClickListener onClickListener) {
|
||||
if (model == null) return;
|
||||
itemView.setTag(model);
|
||||
itemView.setOnClickListener(onClickListener);
|
||||
binding.tvUsername.setText(model.getUsername());
|
||||
binding.tvFullName.setText(model.getName());
|
||||
if (admins != null && admins.contains(Long.parseLong(model.getId()))) {
|
||||
binding.isAdmin.setVisibility(View.VISIBLE);
|
||||
}
|
||||
binding.ivProfilePic.setImageURI(model.getSdProfilePic());
|
||||
}
|
||||
|
||||
public void bind(final FollowModel model,
|
||||
final View.OnClickListener onClickListener) {
|
||||
if (model == null) return;
|
||||
itemView.setTag(model);
|
||||
itemView.setOnClickListener(onClickListener);
|
||||
binding.tvUsername.setText(model.getUsername());
|
||||
binding.tvFullName.setText(model.getFullName());
|
||||
binding.ivProfilePic.setImageURI(model.getProfilePicUrl());
|
||||
}
|
||||
}
|
@ -1,20 +1,29 @@
|
||||
package awais.instagrabber.adapters.viewholder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.databinding.ItemChildPostBinding;
|
||||
import awais.instagrabber.models.ViewerPostModel;
|
||||
|
||||
public final class PostMediaViewHolder extends RecyclerView.ViewHolder {
|
||||
public final ImageView icon, isDownloaded, selectedView;
|
||||
|
||||
public PostMediaViewHolder(@NonNull final View itemView) {
|
||||
super(itemView);
|
||||
selectedView = itemView.findViewById(R.id.selectedView);
|
||||
isDownloaded = itemView.findViewById(R.id.isDownloaded);
|
||||
icon = itemView.findViewById(R.id.icon);
|
||||
private final ItemChildPostBinding binding;
|
||||
|
||||
public PostMediaViewHolder(@NonNull final ItemChildPostBinding binding) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public void bind(final ViewerPostModel model, final int position, final View.OnClickListener clickListener) {
|
||||
if (model == null) return;
|
||||
model.setPosition(position);
|
||||
itemView.setTag(model);
|
||||
itemView.setOnClickListener(clickListener);
|
||||
binding.selectedView.setVisibility(model.isCurrentSlide() ? View.VISIBLE : View.GONE);
|
||||
binding.isDownloaded.setVisibility(model.isDownloaded() ? View.VISIBLE : View.GONE);
|
||||
binding.icon.setImageURI(model.getSliderDisplayUrl());
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
|
||||
import awais.instagrabber.databinding.LayoutDmAnimatedMediaBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
|
||||
@ -22,8 +24,10 @@ public class DirectMessageAnimatedMediaViewHolder extends DirectMessageItemViewH
|
||||
|
||||
@Override
|
||||
public void bindItem(final DirectItemModel directItemModel) {
|
||||
getGlideRequestManager().asGif().load(directItemModel.getAnimatedMediaModel().getGifUrl())
|
||||
.into(binding.ivAnimatedMessage);
|
||||
binding.ivAnimatedMessage.setController(Fresco.newDraweeControllerBuilder()
|
||||
.setUri(directItemModel.getAnimatedMediaModel().getGifUrl())
|
||||
.setAutoPlayAnimations(true)
|
||||
.build());
|
||||
binding.ivAnimatedMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.models.ProfileModel;
|
||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
|
||||
@ -29,19 +25,15 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
|
||||
private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel(
|
||||
CookieUtils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE)));
|
||||
private final LayoutDmBaseBinding binding;
|
||||
private final String strDmYou;
|
||||
private final int itemMargin;
|
||||
|
||||
private final RequestManager glideRequestManager;
|
||||
|
||||
public DirectMessageItemViewHolder(@NonNull final LayoutDmBaseBinding binding, @NonNull final View.OnClickListener onClickListener) {
|
||||
super(binding.getRoot());
|
||||
this.binding = binding;
|
||||
binding.ivProfilePic.setOnClickListener(onClickListener);
|
||||
binding.messageCard.setOnClickListener(onClickListener);
|
||||
strDmYou = binding.getRoot().getContext().getString(R.string.direct_messages_you);
|
||||
// final String strDmYou = binding.getRoot().getContext().getString(R.string.direct_messages_you);
|
||||
itemMargin = Utils.displayMetrics.widthPixels / 5;
|
||||
glideRequestManager = Glide.with(itemView);
|
||||
}
|
||||
|
||||
public void bind(final DirectItemModel directItemModel, final List<ProfileModel> users, final List<ProfileModel> leftUsers) {
|
||||
@ -69,7 +61,7 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
|
||||
binding.messageCard.setTag(directItemModel);
|
||||
|
||||
if (type == MESSAGE_INCOMING && user != null) {
|
||||
glideRequestManager.load(user.getSdProfilePic()).into(binding.ivProfilePic);
|
||||
binding.ivProfilePic.setImageURI(user.getSdProfilePic());
|
||||
}
|
||||
|
||||
bindItem(directItemModel);
|
||||
@ -79,10 +71,6 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
|
||||
this.binding.messageCard.addView(view);
|
||||
}
|
||||
|
||||
public RequestManager getGlideRequestManager() {
|
||||
return glideRequestManager;
|
||||
}
|
||||
|
||||
public abstract void bindItem(final DirectItemModel directItemModel);
|
||||
|
||||
@Nullable
|
||||
|
@ -29,7 +29,7 @@ public class DirectMessageLinkViewHolder extends DirectMessageItemViewHolder {
|
||||
if (TextUtils.isEmpty(linkImageUrl)) {
|
||||
binding.ivLinkPreview.setVisibility(View.GONE);
|
||||
} else {
|
||||
getGlideRequestManager().load(linkImageUrl).into(binding.ivLinkPreview);
|
||||
binding.ivLinkPreview.setImageURI(linkImageUrl);
|
||||
}
|
||||
if (TextUtils.isEmpty(linkContext.getLinkTitle())) {
|
||||
binding.tvLinkTitle.setVisibility(View.GONE);
|
||||
|
@ -34,9 +34,11 @@ public class DirectMessageMediaShareViewHolder extends DirectMessageItemViewHold
|
||||
final DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
|
||||
final ProfileModel modelUser = mediaModel.getUser();
|
||||
if (modelUser != null) {
|
||||
binding.tvMessage.setText(HtmlCompat.fromHtml("<small>" + context.getString(R.string.dms_inbox_media_shared_from, modelUser.getUsername()) + "</small>", FROM_HTML_MODE_COMPACT));
|
||||
binding.tvMessage.setText(HtmlCompat.fromHtml(
|
||||
"<small>" + context.getString(R.string.dms_inbox_media_shared_from, modelUser.getUsername()) + "</small>",
|
||||
FROM_HTML_MODE_COMPACT));
|
||||
}
|
||||
getGlideRequestManager().load(mediaModel.getThumbUrl()).into(binding.ivMediaPreview);
|
||||
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
|
||||
final MediaItemType modelMediaType = mediaModel.getMediaType();
|
||||
binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
|
||||
|| modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
||||
|
@ -24,7 +24,7 @@ public class DirectMessageMediaViewHolder extends DirectMessageItemViewHolder {
|
||||
@Override
|
||||
public void bindItem(final DirectItemModel directItemModel) {
|
||||
final DirectItemModel.DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
|
||||
getGlideRequestManager().load(mediaModel.getThumbUrl()).into(binding.ivMediaPreview);
|
||||
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
|
||||
final MediaItemType modelMediaType = mediaModel.getMediaType();
|
||||
binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
|
||||
|| modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
||||
|
@ -4,8 +4,6 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
|
||||
import awais.instagrabber.databinding.LayoutDmProfileBinding;
|
||||
import awais.instagrabber.models.ProfileModel;
|
||||
@ -27,9 +25,8 @@ public class DirectMessageProfileViewHolder extends DirectMessageItemViewHolder
|
||||
@Override
|
||||
public void bindItem(final DirectItemModel directItemModel) {
|
||||
final ProfileModel profileModel = directItemModel.getProfileModel();
|
||||
Glide.with(binding.profileInfo)
|
||||
.load(profileModel.getSdProfilePic())
|
||||
.into(binding.profileInfo);
|
||||
if (profileModel == null) return;
|
||||
binding.profileInfo.setImageURI(profileModel.getSdProfilePic());
|
||||
binding.btnOpenProfile.setTag(profileModel);
|
||||
binding.tvFullName.setText(profileModel.getName());
|
||||
binding.profileInfoText.setText(profileModel.getUsername());
|
||||
|
@ -74,7 +74,7 @@ public class DirectMessageRavenMediaViewHolder extends DirectMessageItemViewHold
|
||||
textRes = -1;
|
||||
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
|
||||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
||||
getGlideRequestManager().load(mediaModel.getThumbUrl()).into(binding.ivMediaPreview);
|
||||
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
|
||||
}
|
||||
}
|
||||
if (textRes != -1) {
|
||||
|
@ -42,7 +42,7 @@ public class DirectMessageReelShareViewHolder extends DirectMessageItemViewHolde
|
||||
} else {
|
||||
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
|
||||
mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
|
||||
getGlideRequestManager().load(reelShareMedia.getThumbUrl()).into(binding.ivMediaPreview);
|
||||
binding.ivMediaPreview.setImageURI(reelShareMedia.getThumbUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,12 +37,11 @@ public class DirectMessageStoryShareViewHolder extends DirectMessageItemViewHold
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
binding.tvMessage.setText(text);
|
||||
binding.tvMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia();
|
||||
final MediaItemType mediaType = reelShareMedia.getMediaType();
|
||||
binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? View.VISIBLE : View.GONE);
|
||||
getGlideRequestManager().load(reelShareMedia.getThumbUrl()).into(binding.ivMediaPreview);
|
||||
binding.ivMediaPreview.setImageURI(reelShareMedia.getThumbUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
package awais.instagrabber.customviews.helpers;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.RequestManager;
|
||||
|
||||
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_DRAGGING;
|
||||
import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE;
|
||||
|
||||
public class PauseGlideOnFlingScrollListener extends RecyclerView.OnScrollListener {
|
||||
private static final int FLING_JUMP_LOW_THRESHOLD = 80;
|
||||
private static final int FLING_JUMP_HIGH_THRESHOLD = 120;
|
||||
|
||||
private final RequestManager glide;
|
||||
private boolean dragging = false;
|
||||
|
||||
public PauseGlideOnFlingScrollListener(final RequestManager glide) {
|
||||
this.glide = glide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
dragging = newState == SCROLL_STATE_DRAGGING;
|
||||
if (glide.isPaused()) {
|
||||
if (newState == SCROLL_STATE_DRAGGING || newState == SCROLL_STATE_IDLE) {
|
||||
// user is touchy or the scroll finished, show images
|
||||
glide.resumeRequests();
|
||||
} // settling means the user let the screen go, but it can still be flinging
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
if (!dragging) {
|
||||
// TODO can be made better by a rolling average of last N calls to smooth out patterns like a,b,a
|
||||
int currentSpeed = Math.abs(dy);
|
||||
boolean paused = glide.isPaused();
|
||||
if (paused && currentSpeed < FLING_JUMP_LOW_THRESHOLD) {
|
||||
glide.resumeRequests();
|
||||
} else if (!paused && FLING_JUMP_HIGH_THRESHOLD < currentSpeed) {
|
||||
glide.pauseRequests();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -345,16 +345,10 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh
|
||||
final ExpandableGroup group = new ExpandableGroup(type, followModels);
|
||||
groups.add(group);
|
||||
}
|
||||
|
||||
try {
|
||||
adapter = new FollowAdapter(requireContext(), clickListener, groups);
|
||||
adapter = new FollowAdapter(clickListener, groups);
|
||||
adapter.toggleGroup(0);
|
||||
binding.rvFollow.setAdapter(adapter);
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
public void stopCurrentExecutor() {
|
||||
if (currentlyExecuting != null) {
|
||||
|
@ -72,12 +72,12 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
||||
final boolean amAdmin = adminList.contains(Long.parseLong(userIdFromCookie));
|
||||
final DirectMessageMembersAdapter memberAdapter = new DirectMessageMembersAdapter(threadModel.getUsers(),
|
||||
adminList,
|
||||
requireContext(),
|
||||
amAdmin ? clickListener : basicClickListener);
|
||||
userList.setAdapter(memberAdapter);
|
||||
if (threadModel.getLeftUsers() != null && threadModel.getLeftUsers().length > 0) {
|
||||
leftTitle.setVisibility(View.VISIBLE);
|
||||
final DirectMessageMembersAdapter leftAdapter = new DirectMessageMembersAdapter(threadModel.getLeftUsers(), null, requireContext(),
|
||||
final DirectMessageMembersAdapter leftAdapter = new DirectMessageMembersAdapter(threadModel.getLeftUsers(),
|
||||
null,
|
||||
basicClickListener);
|
||||
leftUserList.setAdapter(leftAdapter);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/slider_item_size"
|
||||
android:layout_height="@dimen/slider_item_size"
|
||||
android:layout_marginStart="2dp"
|
||||
@ -12,10 +11,9 @@
|
||||
android:layout_marginBottom="4dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
tools:viewBindingIgnore="true">
|
||||
android:foreground="?android:selectableItemBackground">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
@ -1,14 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:foreground="?android:selectableItemBackground"
|
||||
android:padding="8dp"
|
||||
tools:viewBindingIgnore="true">
|
||||
android:padding="8dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/ivProfilePic"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
@ -47,8 +45,8 @@
|
||||
android:id="@+id/isAdmin"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_gravity="end"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@drawable/ic_star"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_star" />
|
||||
</FrameLayout>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.appcompat.widget.AppCompatImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.facebook.drawee.view.SimpleDraweeView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/ivAnimatedMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
@ -13,7 +13,7 @@
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/ivLinkPreview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dm_link_image_size"
|
||||
@ -39,7 +39,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|fill_horizontal"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:padding="4dp" />
|
||||
</LinearLayout>
|
@ -4,12 +4,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/ivMediaPreview"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
android:adjustViewBounds="true"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/typeIcon"
|
||||
|
@ -18,12 +18,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/ivMediaPreview"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
android:adjustViewBounds="true"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/typeIcon"
|
||||
|
@ -16,12 +16,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/ivMediaPreview"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
android:adjustViewBounds="true"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/typeIcon"
|
||||
|
@ -9,12 +9,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
android:id="@+id/ivMediaPreview"
|
||||
android:layout_width="wrap_content"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
android:adjustViewBounds="true"
|
||||
android:maxHeight="@dimen/dm_media_img_max_height" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/typeIcon"
|
||||
|
Loading…
Reference in New Issue
Block a user