Remove boilerplate for simple adapter inside recycler view
Perfect match with using MVVM and databinding
Initialize adapter
TAdapter tad = new TAdapter
(R.layout.fragment_hotlist_item, HotListViewModel.class);
Initialize it like usual
recyclerView.setAdapter(tad);
You can also add filter rule
tad.addFilterRule(new YourFilter(tad.getNotify()));
But unfortunately you only can used one variable name "viewModel" for now
We can improve it later :)
Cheers
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.nirwannursabda:hampang-adapter:0.1.0'
}
Copyright 2018 Tech Atmosphere
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.