An intellij idea plugin for Android to generate MultiType
Item
and ItemViewProvider
easily.
-
The plugin is distributed through the Plugin Manager in IntelliJ. https://plugins.jetbrains.com/plugin/9202
-
Search word
MultiTypeTemplates
: On Mac:Preference -> Plugins -> Browse repositories
-
Or you can download the jar file from MultiTypeTemplates.jar, then
Preferences -> Plugin -> Install plugin from disk...
Right click
your packge/directory - New
- MultiType Item
, then input your name of Item to generate Item and ItemViewProvider files and codes.
Example: If you input "Category", it will generate the Category.java
and CategoryViewProvider.java
:
public class Category implements Item {
}
public class CategoryViewProvider
extends ItemViewProvider<Category, CategoryViewProvider.ViewHolder> {
@NonNull @Override protected ViewHolder onCreateViewHolder(
@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
View root = inflater.inflate(R.layout.item_category, parent, false);
return new ViewHolder(root);
}
@Override protected void onBindViewHolder(
@NonNull ViewHolder holder, @NonNull Category category) {
}
static class ViewHolder extends RecyclerView.ViewHolder {
ViewHolder(View itemView) {
super(itemView);
}
}
}
- drakeet/MultiType An Android library to retrofit multiple item view types