mirror of
				https://github.com/KokaKiwi/BarInsta
				synced 2025-11-04 05:25:35 +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
 | 
					    // For loading and tinting drawables on older versions of the platform
 | 
				
			||||||
    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
 | 
					    implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
 | 
				
			||||||
    implementation "androidx.recyclerview:recyclerview:1.2.0-alpha05"
 | 
					    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.swiperefreshlayout:swiperefreshlayout:1.1.0'
 | 
				
			||||||
    implementation "androidx.viewpager2:viewpager2:1.0.0"
 | 
					    implementation "androidx.viewpager2:viewpager2:1.0.0"
 | 
				
			||||||
    implementation "androidx.navigation:navigation-fragment:$nav_version"
 | 
					    implementation "androidx.navigation:navigation-fragment:$nav_version"
 | 
				
			||||||
    implementation "androidx.navigation:navigation-ui:$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 "androidx.preference:preference:$preference_version"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    implementation 'org.jsoup:jsoup:1.13.1'
 | 
					    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.google.android.exoplayer:exoplayer:2.11.1'
 | 
				
			||||||
    implementation 'com.facebook.fresco:fresco:2.3.0'
 | 
					    implementation 'com.facebook.fresco:fresco:2.3.0'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
 | 
					    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
 | 
				
			||||||
    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
 | 
					    implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
 | 
				
			||||||
    implementation 'com.squareup.retrofit2:converter-gson: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;
 | 
					package awais.instagrabber.adapters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.content.Context;
 | 
					 | 
				
			||||||
import android.view.LayoutInflater;
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
import android.view.ViewGroup;
 | 
					import android.view.ViewGroup;
 | 
				
			||||||
@ -8,52 +7,37 @@ import android.view.ViewGroup;
 | 
				
			|||||||
import androidx.annotation.NonNull;
 | 
					import androidx.annotation.NonNull;
 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView;
 | 
					import androidx.recyclerview.widget.RecyclerView;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.bumptech.glide.Glide;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import awais.instagrabber.R;
 | 
					 | 
				
			||||||
import awais.instagrabber.adapters.viewholder.FollowsViewHolder;
 | 
					import awais.instagrabber.adapters.viewholder.FollowsViewHolder;
 | 
				
			||||||
 | 
					import awais.instagrabber.databinding.ItemFollowBinding;
 | 
				
			||||||
import awais.instagrabber.models.ProfileModel;
 | 
					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 ProfileModel[] profileModels;
 | 
				
			||||||
    private final List<Long> admins;
 | 
					    private final List<Long> admins;
 | 
				
			||||||
    private final View.OnClickListener onClickListener;
 | 
					    private final View.OnClickListener onClickListener;
 | 
				
			||||||
    private final LayoutInflater layoutInflater;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public DirectMessageMembersAdapter(final ProfileModel[] profileModels, final List<Long> admins,
 | 
					    public DirectMessageMembersAdapter(final ProfileModel[] profileModels,
 | 
				
			||||||
                                       final Context context, final View.OnClickListener onClickListener) {
 | 
					                                       final List<Long> admins,
 | 
				
			||||||
 | 
					                                       final View.OnClickListener onClickListener) {
 | 
				
			||||||
        this.profileModels = profileModels;
 | 
					        this.profileModels = profileModels;
 | 
				
			||||||
        this.admins = admins;
 | 
					        this.admins = admins;
 | 
				
			||||||
        this.layoutInflater = LayoutInflater.from(context);
 | 
					 | 
				
			||||||
        this.onClickListener = onClickListener;
 | 
					        this.onClickListener = onClickListener;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NonNull
 | 
					    @NonNull
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
 | 
					    public FollowsViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
 | 
				
			||||||
        final View view = layoutInflater.inflate(R.layout.item_follow, parent, false);
 | 
					        final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
 | 
				
			||||||
        return new FollowsViewHolder(view);
 | 
					        final ItemFollowBinding binding = ItemFollowBinding.inflate(layoutInflater, parent, false);
 | 
				
			||||||
 | 
					        return new FollowsViewHolder(binding);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @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 ProfileModel model = profileModels[position];
 | 
				
			||||||
 | 
					        holder.bind(model, admins, onClickListener);
 | 
				
			||||||
        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);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
package awais.instagrabber.adapters;
 | 
					package awais.instagrabber.adapters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.content.Context;
 | 
					 | 
				
			||||||
import android.view.LayoutInflater;
 | 
					import android.view.LayoutInflater;
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
import android.view.ViewGroup;
 | 
					import android.view.ViewGroup;
 | 
				
			||||||
@ -11,13 +10,12 @@ import androidx.annotation.NonNull;
 | 
				
			|||||||
import androidx.annotation.Nullable;
 | 
					import androidx.annotation.Nullable;
 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView;
 | 
					import androidx.recyclerview.widget.RecyclerView;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.bumptech.glide.Glide;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import awais.instagrabber.R;
 | 
					import awais.instagrabber.R;
 | 
				
			||||||
import awais.instagrabber.adapters.viewholder.FollowsViewHolder;
 | 
					import awais.instagrabber.adapters.viewholder.FollowsViewHolder;
 | 
				
			||||||
 | 
					import awais.instagrabber.databinding.ItemFollowBinding;
 | 
				
			||||||
import awais.instagrabber.interfaces.OnGroupClickListener;
 | 
					import awais.instagrabber.interfaces.OnGroupClickListener;
 | 
				
			||||||
import awais.instagrabber.models.FollowModel;
 | 
					import awais.instagrabber.models.FollowModel;
 | 
				
			||||||
import awais.instagrabber.utils.TextUtils;
 | 
					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 View.OnClickListener onClickListener;
 | 
				
			||||||
    private final LayoutInflater layoutInflater;
 | 
					 | 
				
			||||||
    private final ExpandableList expandableList;
 | 
					    private final ExpandableList expandableList;
 | 
				
			||||||
    private final boolean hasManyGroups;
 | 
					    private final boolean hasManyGroups;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public FollowAdapter(final Context context, final View.OnClickListener onClickListener, @NonNull final ArrayList<ExpandableGroup> groups) {
 | 
					    public FollowAdapter(final View.OnClickListener onClickListener, @NonNull final ArrayList<ExpandableGroup> groups) {
 | 
				
			||||||
        this.layoutInflater = LayoutInflater.from(context);
 | 
					 | 
				
			||||||
        this.expandableList = new ExpandableList(groups);
 | 
					        this.expandableList = new ExpandableList(groups);
 | 
				
			||||||
        this.onClickListener = onClickListener;
 | 
					        this.onClickListener = onClickListener;
 | 
				
			||||||
        this.hasManyGroups = groups.size() > 1;
 | 
					        this.hasManyGroups = groups.size() > 1;
 | 
				
			||||||
@ -86,10 +82,15 @@ public final class FollowAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
 | 
					    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
 | 
				
			||||||
        final boolean isGroup = hasManyGroups && viewType == ExpandableListPosition.GROUP;
 | 
					        final boolean isGroup = hasManyGroups && viewType == ExpandableListPosition.GROUP;
 | 
				
			||||||
 | 
					        final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
 | 
				
			||||||
        final View view = layoutInflater.inflate(isGroup ? R.layout.header_follow : R.layout.item_follow, parent, false);
 | 
					        final View view;
 | 
				
			||||||
 | 
					        if (isGroup) {
 | 
				
			||||||
        return isGroup ? new GroupViewHolder(view, this) : new FollowsViewHolder(view);
 | 
					            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
 | 
					    @Override
 | 
				
			||||||
@ -101,21 +102,10 @@ public final class FollowAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 | 
				
			|||||||
            final GroupViewHolder gvh = (GroupViewHolder) holder;
 | 
					            final GroupViewHolder gvh = (GroupViewHolder) holder;
 | 
				
			||||||
            gvh.setTitle(group.getTitle());
 | 
					            gvh.setTitle(group.getTitle());
 | 
				
			||||||
            gvh.toggle(isGroupExpanded(group));
 | 
					            gvh.toggle(isGroupExpanded(group));
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            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);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        final FollowModel model = group.getItems(true).get(hasManyGroups ? listPos.childPos : position);
 | 
				
			||||||
 | 
					        ((FollowsViewHolder) holder).bind(model, onClickListener);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
 | 
				
			|||||||
@ -7,16 +7,14 @@ import android.view.ViewGroup;
 | 
				
			|||||||
import androidx.annotation.NonNull;
 | 
					import androidx.annotation.NonNull;
 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView;
 | 
					import androidx.recyclerview.widget.RecyclerView;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.bumptech.glide.Glide;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import awais.instagrabber.R;
 | 
					import awais.instagrabber.R;
 | 
				
			||||||
import awais.instagrabber.adapters.viewholder.PostMediaViewHolder;
 | 
					import awais.instagrabber.adapters.viewholder.PostMediaViewHolder;
 | 
				
			||||||
 | 
					import awais.instagrabber.databinding.ItemChildPostBinding;
 | 
				
			||||||
import awais.instagrabber.models.BasePostModel;
 | 
					import awais.instagrabber.models.BasePostModel;
 | 
				
			||||||
import awais.instagrabber.models.ViewerPostModel;
 | 
					import awais.instagrabber.models.ViewerPostModel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public final class PostsMediaAdapter extends RecyclerView.Adapter<PostMediaViewHolder> {
 | 
					public final class PostsMediaAdapter extends RecyclerView.Adapter<PostMediaViewHolder> {
 | 
				
			||||||
    private final View.OnClickListener clickListener;
 | 
					    private final View.OnClickListener clickListener;
 | 
				
			||||||
    private LayoutInflater layoutInflater;
 | 
					 | 
				
			||||||
    private ViewerPostModel[] postModels;
 | 
					    private ViewerPostModel[] postModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public PostsMediaAdapter(final ViewerPostModel[] postModels, final View.OnClickListener clickListener) {
 | 
					    public PostsMediaAdapter(final ViewerPostModel[] postModels, final View.OnClickListener clickListener) {
 | 
				
			||||||
@ -27,25 +25,16 @@ public final class PostsMediaAdapter extends RecyclerView.Adapter<PostMediaViewH
 | 
				
			|||||||
    @NonNull
 | 
					    @NonNull
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public PostMediaViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
 | 
					    public PostMediaViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, final int viewType) {
 | 
				
			||||||
        if (layoutInflater == null) layoutInflater = LayoutInflater.from(parent.getContext());
 | 
					        final LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
 | 
				
			||||||
        return new PostMediaViewHolder(layoutInflater.inflate(R.layout.item_child_post, parent, false));
 | 
					        layoutInflater.inflate(R.layout.item_child_post, parent, false);
 | 
				
			||||||
 | 
					        final ItemChildPostBinding binding = ItemChildPostBinding.inflate(layoutInflater, parent, false);
 | 
				
			||||||
 | 
					        return new PostMediaViewHolder(binding);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void onBindViewHolder(@NonNull final PostMediaViewHolder holder, final int position) {
 | 
					    public void onBindViewHolder(@NonNull final PostMediaViewHolder holder, final int position) {
 | 
				
			||||||
        final ViewerPostModel postModel = postModels[position];
 | 
					        final ViewerPostModel postModel = postModels[position];
 | 
				
			||||||
        if (postModel != null) {
 | 
					        holder.bind(postModel, position, clickListener);
 | 
				
			||||||
            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);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setData(final ViewerPostModel[] postModels) {
 | 
					    public void setData(final ViewerPostModel[] postModels) {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +1,45 @@
 | 
				
			|||||||
package awais.instagrabber.adapters.viewholder;
 | 
					package awais.instagrabber.adapters.viewholder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
import android.widget.ImageView;
 | 
					 | 
				
			||||||
import android.widget.TextView;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import androidx.annotation.NonNull;
 | 
					 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView;
 | 
					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 class FollowsViewHolder extends RecyclerView.ViewHolder {
 | 
				
			||||||
    public final ImageView profileImage, isAdmin;
 | 
					 | 
				
			||||||
    public final TextView tvFullName, tvUsername;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public FollowsViewHolder(@NonNull final View itemView) {
 | 
					    private final ItemFollowBinding binding;
 | 
				
			||||||
        super(itemView);
 | 
					
 | 
				
			||||||
        profileImage = itemView.findViewById(R.id.ivProfilePic);
 | 
					    public FollowsViewHolder(final ItemFollowBinding binding) {
 | 
				
			||||||
        tvFullName = itemView.findViewById(R.id.tvFullName);
 | 
					        super(binding.getRoot());
 | 
				
			||||||
        tvUsername = itemView.findViewById(R.id.tvUsername);
 | 
					        this.binding = binding;
 | 
				
			||||||
        isAdmin = itemView.findViewById(R.id.isAdmin);
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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;
 | 
					package awais.instagrabber.adapters.viewholder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.view.View;
 | 
					import android.view.View;
 | 
				
			||||||
import android.widget.ImageView;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import androidx.annotation.NonNull;
 | 
					import androidx.annotation.NonNull;
 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView;
 | 
					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 class PostMediaViewHolder extends RecyclerView.ViewHolder {
 | 
				
			||||||
    public final ImageView icon, isDownloaded, selectedView;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public PostMediaViewHolder(@NonNull final View itemView) {
 | 
					    private final ItemChildPostBinding binding;
 | 
				
			||||||
        super(itemView);
 | 
					
 | 
				
			||||||
        selectedView = itemView.findViewById(R.id.selectedView);
 | 
					    public PostMediaViewHolder(@NonNull final ItemChildPostBinding binding) {
 | 
				
			||||||
        isDownloaded = itemView.findViewById(R.id.isDownloaded);
 | 
					        super(binding.getRoot());
 | 
				
			||||||
        icon = itemView.findViewById(R.id.icon);
 | 
					        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 androidx.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.facebook.drawee.backends.pipeline.Fresco;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import awais.instagrabber.databinding.LayoutDmAnimatedMediaBinding;
 | 
					import awais.instagrabber.databinding.LayoutDmAnimatedMediaBinding;
 | 
				
			||||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
 | 
					import awais.instagrabber.databinding.LayoutDmBaseBinding;
 | 
				
			||||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
 | 
					import awais.instagrabber.models.direct_messages.DirectItemModel;
 | 
				
			||||||
@ -22,8 +24,10 @@ public class DirectMessageAnimatedMediaViewHolder extends DirectMessageItemViewH
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void bindItem(final DirectItemModel directItemModel) {
 | 
					    public void bindItem(final DirectItemModel directItemModel) {
 | 
				
			||||||
        getGlideRequestManager().asGif().load(directItemModel.getAnimatedMediaModel().getGifUrl())
 | 
					        binding.ivAnimatedMessage.setController(Fresco.newDraweeControllerBuilder()
 | 
				
			||||||
                .into(binding.ivAnimatedMessage);
 | 
					                                                      .setUri(directItemModel.getAnimatedMediaModel().getGifUrl())
 | 
				
			||||||
 | 
					                                                      .setAutoPlayAnimations(true)
 | 
				
			||||||
 | 
					                                                      .build());
 | 
				
			||||||
        binding.ivAnimatedMessage.setVisibility(View.VISIBLE);
 | 
					        binding.ivAnimatedMessage.setVisibility(View.VISIBLE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -8,12 +8,8 @@ import androidx.annotation.NonNull;
 | 
				
			|||||||
import androidx.annotation.Nullable;
 | 
					import androidx.annotation.Nullable;
 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView;
 | 
					import androidx.recyclerview.widget.RecyclerView;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.bumptech.glide.Glide;
 | 
					 | 
				
			||||||
import com.bumptech.glide.RequestManager;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import awais.instagrabber.R;
 | 
					 | 
				
			||||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
 | 
					import awais.instagrabber.databinding.LayoutDmBaseBinding;
 | 
				
			||||||
import awais.instagrabber.models.ProfileModel;
 | 
					import awais.instagrabber.models.ProfileModel;
 | 
				
			||||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
 | 
					import awais.instagrabber.models.direct_messages.DirectItemModel;
 | 
				
			||||||
@ -29,19 +25,15 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
 | 
				
			|||||||
    private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel(
 | 
					    private final ProfileModel myProfileHolder = ProfileModel.getDefaultProfileModel(
 | 
				
			||||||
            CookieUtils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE)));
 | 
					            CookieUtils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE)));
 | 
				
			||||||
    private final LayoutDmBaseBinding binding;
 | 
					    private final LayoutDmBaseBinding binding;
 | 
				
			||||||
    private final String strDmYou;
 | 
					 | 
				
			||||||
    private final int itemMargin;
 | 
					    private final int itemMargin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final RequestManager glideRequestManager;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public DirectMessageItemViewHolder(@NonNull final LayoutDmBaseBinding binding, @NonNull final View.OnClickListener onClickListener) {
 | 
					    public DirectMessageItemViewHolder(@NonNull final LayoutDmBaseBinding binding, @NonNull final View.OnClickListener onClickListener) {
 | 
				
			||||||
        super(binding.getRoot());
 | 
					        super(binding.getRoot());
 | 
				
			||||||
        this.binding = binding;
 | 
					        this.binding = binding;
 | 
				
			||||||
        binding.ivProfilePic.setOnClickListener(onClickListener);
 | 
					        binding.ivProfilePic.setOnClickListener(onClickListener);
 | 
				
			||||||
        binding.messageCard.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;
 | 
					        itemMargin = Utils.displayMetrics.widthPixels / 5;
 | 
				
			||||||
        glideRequestManager = Glide.with(itemView);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void bind(final DirectItemModel directItemModel, final List<ProfileModel> users, final List<ProfileModel> leftUsers) {
 | 
					    public void bind(final DirectItemModel directItemModel, final List<ProfileModel> users, final List<ProfileModel> leftUsers) {
 | 
				
			||||||
@ -50,7 +42,7 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        final RecyclerView.LayoutParams itemViewLayoutParams = (RecyclerView.LayoutParams) itemView.getLayoutParams();
 | 
					        final RecyclerView.LayoutParams itemViewLayoutParams = (RecyclerView.LayoutParams) itemView.getLayoutParams();
 | 
				
			||||||
        itemViewLayoutParams.setMargins(type == MESSAGE_OUTGOING ? itemMargin : 0, 0,
 | 
					        itemViewLayoutParams.setMargins(type == MESSAGE_OUTGOING ? itemMargin : 0, 0,
 | 
				
			||||||
                type == MESSAGE_INCOMING ? itemMargin : 0, 0);
 | 
					                                        type == MESSAGE_INCOMING ? itemMargin : 0, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        final ViewGroup messageCardParent = (ViewGroup) binding.messageCard.getParent();
 | 
					        final ViewGroup messageCardParent = (ViewGroup) binding.messageCard.getParent();
 | 
				
			||||||
        binding.contentContainer.setGravity(type == MESSAGE_INCOMING ? Gravity.START : Gravity.END);
 | 
					        binding.contentContainer.setGravity(type == MESSAGE_INCOMING ? Gravity.START : Gravity.END);
 | 
				
			||||||
@ -69,7 +61,7 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
 | 
				
			|||||||
        binding.messageCard.setTag(directItemModel);
 | 
					        binding.messageCard.setTag(directItemModel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (type == MESSAGE_INCOMING && user != null) {
 | 
					        if (type == MESSAGE_INCOMING && user != null) {
 | 
				
			||||||
            glideRequestManager.load(user.getSdProfilePic()).into(binding.ivProfilePic);
 | 
					            binding.ivProfilePic.setImageURI(user.getSdProfilePic());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        bindItem(directItemModel);
 | 
					        bindItem(directItemModel);
 | 
				
			||||||
@ -79,10 +71,6 @@ public abstract class DirectMessageItemViewHolder extends RecyclerView.ViewHolde
 | 
				
			|||||||
        this.binding.messageCard.addView(view);
 | 
					        this.binding.messageCard.addView(view);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public RequestManager getGlideRequestManager() {
 | 
					 | 
				
			||||||
        return glideRequestManager;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public abstract void bindItem(final DirectItemModel directItemModel);
 | 
					    public abstract void bindItem(final DirectItemModel directItemModel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Nullable
 | 
					    @Nullable
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@ public class DirectMessageLinkViewHolder extends DirectMessageItemViewHolder {
 | 
				
			|||||||
        if (TextUtils.isEmpty(linkImageUrl)) {
 | 
					        if (TextUtils.isEmpty(linkImageUrl)) {
 | 
				
			||||||
            binding.ivLinkPreview.setVisibility(View.GONE);
 | 
					            binding.ivLinkPreview.setVisibility(View.GONE);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            getGlideRequestManager().load(linkImageUrl).into(binding.ivLinkPreview);
 | 
					            binding.ivLinkPreview.setImageURI(linkImageUrl);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (TextUtils.isEmpty(linkContext.getLinkTitle())) {
 | 
					        if (TextUtils.isEmpty(linkContext.getLinkTitle())) {
 | 
				
			||||||
            binding.tvLinkTitle.setVisibility(View.GONE);
 | 
					            binding.tvLinkTitle.setVisibility(View.GONE);
 | 
				
			||||||
 | 
				
			|||||||
@ -34,11 +34,13 @@ public class DirectMessageMediaShareViewHolder extends DirectMessageItemViewHold
 | 
				
			|||||||
        final DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
 | 
					        final DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
 | 
				
			||||||
        final ProfileModel modelUser = mediaModel.getUser();
 | 
					        final ProfileModel modelUser = mediaModel.getUser();
 | 
				
			||||||
        if (modelUser != null) {
 | 
					        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();
 | 
					        final MediaItemType modelMediaType = mediaModel.getMediaType();
 | 
				
			||||||
        binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
 | 
					        binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
 | 
				
			||||||
                || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
					                                               || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -24,9 +24,9 @@ public class DirectMessageMediaViewHolder extends DirectMessageItemViewHolder {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void bindItem(final DirectItemModel directItemModel) {
 | 
					    public void bindItem(final DirectItemModel directItemModel) {
 | 
				
			||||||
        final DirectItemModel.DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
 | 
					        final DirectItemModel.DirectItemMediaModel mediaModel = directItemModel.getMediaModel();
 | 
				
			||||||
        getGlideRequestManager().load(mediaModel.getThumbUrl()).into(binding.ivMediaPreview);
 | 
					        binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
 | 
				
			||||||
        final MediaItemType modelMediaType = mediaModel.getMediaType();
 | 
					        final MediaItemType modelMediaType = mediaModel.getMediaType();
 | 
				
			||||||
        binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
 | 
					        binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO
 | 
				
			||||||
                || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
					                                               || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -4,8 +4,6 @@ import android.view.View;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import androidx.annotation.NonNull;
 | 
					import androidx.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.bumptech.glide.Glide;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import awais.instagrabber.databinding.LayoutDmBaseBinding;
 | 
					import awais.instagrabber.databinding.LayoutDmBaseBinding;
 | 
				
			||||||
import awais.instagrabber.databinding.LayoutDmProfileBinding;
 | 
					import awais.instagrabber.databinding.LayoutDmProfileBinding;
 | 
				
			||||||
import awais.instagrabber.models.ProfileModel;
 | 
					import awais.instagrabber.models.ProfileModel;
 | 
				
			||||||
@ -27,9 +25,8 @@ public class DirectMessageProfileViewHolder extends DirectMessageItemViewHolder
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void bindItem(final DirectItemModel directItemModel) {
 | 
					    public void bindItem(final DirectItemModel directItemModel) {
 | 
				
			||||||
        final ProfileModel profileModel = directItemModel.getProfileModel();
 | 
					        final ProfileModel profileModel = directItemModel.getProfileModel();
 | 
				
			||||||
        Glide.with(binding.profileInfo)
 | 
					        if (profileModel == null) return;
 | 
				
			||||||
                .load(profileModel.getSdProfilePic())
 | 
					        binding.profileInfo.setImageURI(profileModel.getSdProfilePic());
 | 
				
			||||||
                .into(binding.profileInfo);
 | 
					 | 
				
			||||||
        binding.btnOpenProfile.setTag(profileModel);
 | 
					        binding.btnOpenProfile.setTag(profileModel);
 | 
				
			||||||
        binding.tvFullName.setText(profileModel.getName());
 | 
					        binding.tvFullName.setText(profileModel.getName());
 | 
				
			||||||
        binding.profileInfoText.setText(profileModel.getUsername());
 | 
					        binding.profileInfoText.setText(profileModel.getUsername());
 | 
				
			||||||
 | 
				
			|||||||
@ -73,8 +73,8 @@ public class DirectMessageRavenMediaViewHolder extends DirectMessageItemViewHold
 | 
				
			|||||||
                final MediaItemType mediaType = mediaModel.getMediaType();
 | 
					                final MediaItemType mediaType = mediaModel.getMediaType();
 | 
				
			||||||
                textRes = -1;
 | 
					                textRes = -1;
 | 
				
			||||||
                binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
 | 
					                binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
 | 
				
			||||||
                        mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
					                                                       mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
				
			||||||
                getGlideRequestManager().load(mediaModel.getThumbUrl()).into(binding.ivMediaPreview);
 | 
					                binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (textRes != -1) {
 | 
					        if (textRes != -1) {
 | 
				
			||||||
 | 
				
			|||||||
@ -41,8 +41,8 @@ public class DirectMessageReelShareViewHolder extends DirectMessageItemViewHolde
 | 
				
			|||||||
            binding.mediaExpiredIcon.setVisibility(View.VISIBLE);
 | 
					            binding.mediaExpiredIcon.setVisibility(View.VISIBLE);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
 | 
					            binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ||
 | 
				
			||||||
                    mediaType == MediaItemType.MEDIA_TYPE_SLIDER ? View.VISIBLE : View.GONE);
 | 
					                                                   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)) {
 | 
					            if (!TextUtils.isEmpty(text)) {
 | 
				
			||||||
                binding.tvMessage.setText(text);
 | 
					                binding.tvMessage.setText(text);
 | 
				
			||||||
                binding.tvMessage.setVisibility(View.VISIBLE);
 | 
					                binding.tvMessage.setVisibility(View.VISIBLE);
 | 
				
			||||||
            }
 | 
					            } else {
 | 
				
			||||||
            else {
 | 
					 | 
				
			||||||
                final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia();
 | 
					                final DirectItemModel.DirectItemMediaModel reelShareMedia = reelShare.getMedia();
 | 
				
			||||||
                final MediaItemType mediaType = reelShareMedia.getMediaType();
 | 
					                final MediaItemType mediaType = reelShareMedia.getMediaType();
 | 
				
			||||||
                binding.typeIcon.setVisibility(mediaType == MediaItemType.MEDIA_TYPE_VIDEO ? View.VISIBLE : View.GONE);
 | 
					                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,15 +345,9 @@ public final class FollowViewerFragment extends Fragment implements SwipeRefresh
 | 
				
			|||||||
            final ExpandableGroup group = new ExpandableGroup(type, followModels);
 | 
					            final ExpandableGroup group = new ExpandableGroup(type, followModels);
 | 
				
			||||||
            groups.add(group);
 | 
					            groups.add(group);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        adapter = new FollowAdapter(clickListener, groups);
 | 
				
			||||||
        try {
 | 
					        adapter.toggleGroup(0);
 | 
				
			||||||
            adapter = new FollowAdapter(requireContext(), clickListener, groups);
 | 
					        binding.rvFollow.setAdapter(adapter);
 | 
				
			||||||
            adapter.toggleGroup(0);
 | 
					 | 
				
			||||||
            binding.rvFollow.setAdapter(adapter);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        catch (IllegalStateException e) {
 | 
					 | 
				
			||||||
            // do nothing
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void stopCurrentExecutor() {
 | 
					    public void stopCurrentExecutor() {
 | 
				
			||||||
 | 
				
			|||||||
@ -72,12 +72,12 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
 | 
				
			|||||||
            final boolean amAdmin = adminList.contains(Long.parseLong(userIdFromCookie));
 | 
					            final boolean amAdmin = adminList.contains(Long.parseLong(userIdFromCookie));
 | 
				
			||||||
            final DirectMessageMembersAdapter memberAdapter = new DirectMessageMembersAdapter(threadModel.getUsers(),
 | 
					            final DirectMessageMembersAdapter memberAdapter = new DirectMessageMembersAdapter(threadModel.getUsers(),
 | 
				
			||||||
                                                                                              adminList,
 | 
					                                                                                              adminList,
 | 
				
			||||||
                                                                                              requireContext(),
 | 
					 | 
				
			||||||
                                                                                              amAdmin ? clickListener : basicClickListener);
 | 
					                                                                                              amAdmin ? clickListener : basicClickListener);
 | 
				
			||||||
            userList.setAdapter(memberAdapter);
 | 
					            userList.setAdapter(memberAdapter);
 | 
				
			||||||
            if (threadModel.getLeftUsers() != null && threadModel.getLeftUsers().length > 0) {
 | 
					            if (threadModel.getLeftUsers() != null && threadModel.getLeftUsers().length > 0) {
 | 
				
			||||||
                leftTitle.setVisibility(View.VISIBLE);
 | 
					                leftTitle.setVisibility(View.VISIBLE);
 | 
				
			||||||
                final DirectMessageMembersAdapter leftAdapter = new DirectMessageMembersAdapter(threadModel.getLeftUsers(), null, requireContext(),
 | 
					                final DirectMessageMembersAdapter leftAdapter = new DirectMessageMembersAdapter(threadModel.getLeftUsers(),
 | 
				
			||||||
 | 
					                                                                                                null,
 | 
				
			||||||
                                                                                                basicClickListener);
 | 
					                                                                                                basicClickListener);
 | 
				
			||||||
                leftUserList.setAdapter(leftAdapter);
 | 
					                leftUserList.setAdapter(leftAdapter);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,6 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
					<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
					    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_width="@dimen/slider_item_size"
 | 
				
			||||||
    android:layout_height="@dimen/slider_item_size"
 | 
					    android:layout_height="@dimen/slider_item_size"
 | 
				
			||||||
    android:layout_marginStart="2dp"
 | 
					    android:layout_marginStart="2dp"
 | 
				
			||||||
@ -12,10 +11,9 @@
 | 
				
			|||||||
    android:layout_marginBottom="4dp"
 | 
					    android:layout_marginBottom="4dp"
 | 
				
			||||||
    android:clickable="true"
 | 
					    android:clickable="true"
 | 
				
			||||||
    android:focusable="true"
 | 
					    android:focusable="true"
 | 
				
			||||||
    android:foreground="?android:selectableItemBackground"
 | 
					    android:foreground="?android:selectableItemBackground">
 | 
				
			||||||
    tools:viewBindingIgnore="true">
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.AppCompatImageView
 | 
					    <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
        android:id="@+id/icon"
 | 
					        android:id="@+id/icon"
 | 
				
			||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="match_parent" />
 | 
					        android:layout_height="match_parent" />
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,12 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?xml version="1.0" encoding="utf-8"?>
 | 
				
			||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
					<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 | 
				
			||||||
    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
					    xmlns:app="http://schemas.android.com/apk/res-auto"
 | 
				
			||||||
    xmlns:tools="http://schemas.android.com/tools"
 | 
					 | 
				
			||||||
    android:layout_width="match_parent"
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
    android:layout_height="wrap_content"
 | 
					    android:layout_height="wrap_content"
 | 
				
			||||||
    android:foreground="?android:selectableItemBackground"
 | 
					    android:foreground="?android:selectableItemBackground"
 | 
				
			||||||
    android:padding="8dp"
 | 
					    android:padding="8dp">
 | 
				
			||||||
    tools:viewBindingIgnore="true">
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.AppCompatImageView
 | 
					    <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
        android:id="@+id/ivProfilePic"
 | 
					        android:id="@+id/ivProfilePic"
 | 
				
			||||||
        android:layout_width="60dp"
 | 
					        android:layout_width="60dp"
 | 
				
			||||||
        android:layout_height="60dp"
 | 
					        android:layout_height="60dp"
 | 
				
			||||||
@ -47,8 +45,8 @@
 | 
				
			|||||||
        android:id="@+id/isAdmin"
 | 
					        android:id="@+id/isAdmin"
 | 
				
			||||||
        android:layout_width="20dp"
 | 
					        android:layout_width="20dp"
 | 
				
			||||||
        android:layout_height="60dp"
 | 
					        android:layout_height="60dp"
 | 
				
			||||||
        android:layout_gravity="right"
 | 
					        android:layout_gravity="end"
 | 
				
			||||||
        android:scaleType="fitCenter"
 | 
					        android:scaleType="fitCenter"
 | 
				
			||||||
        app:srcCompat="@drawable/ic_star"
 | 
					        android:visibility="gone"
 | 
				
			||||||
        android:visibility="gone"/>
 | 
					        app:srcCompat="@drawable/ic_star" />
 | 
				
			||||||
</FrameLayout>
 | 
					</FrameLayout>
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="utf-8"?>
 | 
					<?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:id="@+id/ivAnimatedMessage"
 | 
				
			||||||
    android:layout_width="wrap_content"
 | 
					    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,11 +13,11 @@
 | 
				
			|||||||
        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
 | 
					        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
 | 
				
			||||||
        android:textColor="?android:textColorPrimary" />
 | 
					        android:textColor="?android:textColorPrimary" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.AppCompatImageView
 | 
					    <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
        android:id="@+id/ivLinkPreview"
 | 
					        android:id="@+id/ivLinkPreview"
 | 
				
			||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="@dimen/dm_link_image_size"
 | 
					        android:layout_height="@dimen/dm_link_image_size"
 | 
				
			||||||
        android:scaleType="centerCrop"/>
 | 
					        android:scaleType="centerCrop" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.AppCompatTextView
 | 
					    <androidx.appcompat.widget.AppCompatTextView
 | 
				
			||||||
        android:id="@+id/tvLinkTitle"
 | 
					        android:id="@+id/tvLinkTitle"
 | 
				
			||||||
@ -39,7 +39,7 @@
 | 
				
			|||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="wrap_content"
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
        android:layout_gravity="start|fill_horizontal"
 | 
					        android:layout_gravity="start|fill_horizontal"
 | 
				
			||||||
        android:maxLines="2"
 | 
					 | 
				
			||||||
        android:ellipsize="end"
 | 
					        android:ellipsize="end"
 | 
				
			||||||
 | 
					        android:maxLines="2"
 | 
				
			||||||
        android:padding="4dp" />
 | 
					        android:padding="4dp" />
 | 
				
			||||||
</LinearLayout>
 | 
					</LinearLayout>
 | 
				
			||||||
@ -4,12 +4,12 @@
 | 
				
			|||||||
    android:layout_width="match_parent"
 | 
					    android:layout_width="match_parent"
 | 
				
			||||||
    android:layout_height="wrap_content">
 | 
					    android:layout_height="wrap_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.AppCompatImageView
 | 
					    <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
        android:id="@+id/ivMediaPreview"
 | 
					        android:id="@+id/ivMediaPreview"
 | 
				
			||||||
        android:layout_width="wrap_content"
 | 
					        android:layout_width="wrap_content"
 | 
				
			||||||
        android:maxHeight="@dimen/dm_media_img_max_height"
 | 
					 | 
				
			||||||
        android:layout_height="wrap_content"
 | 
					        android:layout_height="wrap_content"
 | 
				
			||||||
        android:adjustViewBounds="true" />
 | 
					        android:adjustViewBounds="true"
 | 
				
			||||||
 | 
					        android:maxHeight="@dimen/dm_media_img_max_height" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <androidx.appcompat.widget.AppCompatImageView
 | 
					    <androidx.appcompat.widget.AppCompatImageView
 | 
				
			||||||
        android:id="@+id/typeIcon"
 | 
					        android:id="@+id/typeIcon"
 | 
				
			||||||
 | 
				
			|||||||
@ -18,12 +18,12 @@
 | 
				
			|||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="wrap_content">
 | 
					        android:layout_height="wrap_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.AppCompatImageView
 | 
					        <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
            android:id="@+id/ivMediaPreview"
 | 
					            android:id="@+id/ivMediaPreview"
 | 
				
			||||||
            android:layout_width="wrap_content"
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
            android:maxHeight="@dimen/dm_media_img_max_height"
 | 
					 | 
				
			||||||
            android:layout_height="wrap_content"
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
            android:adjustViewBounds="true" />
 | 
					            android:adjustViewBounds="true"
 | 
				
			||||||
 | 
					            android:maxHeight="@dimen/dm_media_img_max_height" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.AppCompatImageView
 | 
					        <androidx.appcompat.widget.AppCompatImageView
 | 
				
			||||||
            android:id="@+id/typeIcon"
 | 
					            android:id="@+id/typeIcon"
 | 
				
			||||||
 | 
				
			|||||||
@ -16,12 +16,12 @@
 | 
				
			|||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="wrap_content">
 | 
					        android:layout_height="wrap_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.AppCompatImageView
 | 
					        <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
            android:id="@+id/ivMediaPreview"
 | 
					            android:id="@+id/ivMediaPreview"
 | 
				
			||||||
            android:layout_width="wrap_content"
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
            android:maxHeight="@dimen/dm_media_img_max_height"
 | 
					 | 
				
			||||||
            android:layout_height="wrap_content"
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
            android:adjustViewBounds="true" />
 | 
					            android:adjustViewBounds="true"
 | 
				
			||||||
 | 
					            android:maxHeight="@dimen/dm_media_img_max_height" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.AppCompatImageView
 | 
					        <androidx.appcompat.widget.AppCompatImageView
 | 
				
			||||||
            android:id="@+id/typeIcon"
 | 
					            android:id="@+id/typeIcon"
 | 
				
			||||||
 | 
				
			|||||||
@ -9,12 +9,12 @@
 | 
				
			|||||||
        android:layout_width="match_parent"
 | 
					        android:layout_width="match_parent"
 | 
				
			||||||
        android:layout_height="wrap_content">
 | 
					        android:layout_height="wrap_content">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.AppCompatImageView
 | 
					        <com.facebook.drawee.view.SimpleDraweeView
 | 
				
			||||||
            android:id="@+id/ivMediaPreview"
 | 
					            android:id="@+id/ivMediaPreview"
 | 
				
			||||||
            android:layout_width="wrap_content"
 | 
					            android:layout_width="wrap_content"
 | 
				
			||||||
            android:maxHeight="@dimen/dm_media_img_max_height"
 | 
					 | 
				
			||||||
            android:layout_height="wrap_content"
 | 
					            android:layout_height="wrap_content"
 | 
				
			||||||
            android:adjustViewBounds="true" />
 | 
					            android:adjustViewBounds="true"
 | 
				
			||||||
 | 
					            android:maxHeight="@dimen/dm_media_img_max_height" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <androidx.appcompat.widget.AppCompatImageView
 | 
					        <androidx.appcompat.widget.AppCompatImageView
 | 
				
			||||||
            android:id="@+id/typeIcon"
 | 
					            android:id="@+id/typeIcon"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user