We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
import android.view.LayoutInflater; //import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide; import com.example.fastfood1.Common.Common; import com.example.fastfood1.Model.CategoryModel; import com.example.fastfood1.R; import com.google.firebase.database.core.Context;
import java.util.List; import java.util.Locale;
import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder;
public class MyCategoriesAdapter extends RecyclerView.Adapter<MyCategoriesAdapter.MyViewHolder> {
Context context; List<CategoryModel> categoryModelList; public MyCategoriesAdapter(Context context, List<CategoryModel> categoryModelList) { this.context = context; this.categoryModelList = categoryModelList; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new MyViewHolder(LayoutInflater.from(context) .inflate(R.layout.layout_category_item, parent, false)); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { Glide.with(context).load(categoryModelList.get(position).getImage()) .into(holder.category_iamge); holder.category_name.setText(new StringBuilder(categoryModelList.get(position).getName())); } @Override public int getItemCount() { return categoryModelList.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { Unbinder unbinder; @BindView(R.id.img_category) ImageView category_iamge; @BindView(R.id.txt_category) TextView category_name; public MyViewHolder(@NonNull View itemView) { super(itemView); unbinder = ButterKnife.bind(this,itemView); } } @Override public int getItemViewType(int position) { if(categoryModelList.size() == 1) { return Common.DEAFAULT_COLUMN_COUNT; } else { if(categoryModelList.size() % 2 == 0) return Common.DEAFAULT_COLUMN_COUNT; else return (position > 1 && position == categoryModelList.size() - 1) ? Common.FULL_WIDTH_COLUMN:Common.DEAFAULT_COLUMN_COUNT; } }
}
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: