https://github.com/birjuvachhani/android-templates
https://github.com/birjuvachhani/android-templates
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/birjuvachhani/android-templates
- Owner: BirjuVachhani
- Created: 2018-02-20T18:15:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-20T19:09:26.000Z (over 7 years ago)
- Last Synced: 2025-02-11T11:56:25.515Z (8 months ago)
- Language: Java
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Android-Templates
How To Use Templates
- To use any template for android studio, download the template.java file and copy it to Android Studio>config>fileTemplates.
- Open android studio, Right click on app folder and go to New. The template will show up there.
- Select the template and it will ask for perameters required in template. fill up perameters and click okay.
- Voila! template code is imported to your project.
RecyclerViewAdapter.java
It is simple template for creating Adapter and ViewHolder for RecyclerView in just few seconds. Following perameters are required to use the template.
-
ADAPTER_NAME: Name of the adapter that will be created. You can give any valid java class name to it. -
VIEWHOLDER_CLASS: Class name for the ViewHolder class required by the RecyclerView Adapter class. -
ITEMHOLDER_CLASS: Class name of the POJO object that holds the data for elements of single row of RecyclerView. -
LAYOUT_RES_ID: It is a valid layout resource ID that is used to inflate single row of RecyclerView.
ViewPagerAdapter.java
This is the template for ViewPager with fragments. This template can be used in situations like when every page of your ViewPager contains same data fields so it can be represented by a single fragment by changing values for views like RecyclerView Items. Following perameters are required to use the template.
-
ADAPTER_NAME: Name of the adapter that will be created. You can give any valid java class name to it. -
ITEM_POJO_CLASS: Class name of the POJO object that holds the data for elements of fragments in ViewPager. -
FRAGEMENT_CLASS: Fragment class name that will be loaded in each page of ViewPager.