Comments (1)
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;
}
}
}
from android-flat-button.
Related Issues (20)
- Clicking on a button which is close to another one causes animation to be played on both buttons HOT 3
- AndroidStudio1.5 can't build
- FButton not working on android 4.4 HOT 2
- Color not changing HOT 5
- Dependencies Error
- Problems with LinearLayout weights
- how implement gradient color HOT 1
- Issue with ConstraintLayout
- android studio 3.0 can't build HOT 2
- Error inflating class info.hoang8f.widget.FButton HOT 73
- Error inflating class info.hoang8f.widget.FButton
- Error inflating class info.hoang8f.widget.FButton
- Drawable alignment
- Needs to be refresh and migrate to AndroidX
- uses or overrides a deprecated API
- ERROR: Unable to resolve dependency for ':app@debug/compileClasspath':Could not resolve com.github.jd-alexander:android-flat-button:v1.1.
- i have this error and cause my progam to crash HOT 1
- Fbutton is not showing animation on click in fragment
- Issue in importing the library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-flat-button.