use of com.pankaj.maukascholars.adapters.FiltersAdapter in project Precisely by Pankaj-Baranwal.
the class Filters method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Constants.toolbar_title = "Filters";
setContentView(R.layout.activity_filters);
if (sp.contains(key)) {
try {
JSONArray jO = new JSONArray(sp.getString(key, ""));
Constants.clickedFilters.clear();
for (int i = 0; i < jO.length(); i++) Constants.clickedFilters.add(jO.getInt(i));
} catch (JSONException e) {
e.printStackTrace();
}
}
setupFilters();
proceed = findViewById(R.id.proceed);
proceed.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (clickedFilters.size() > 0) {
loadActivity(VerticalViewPagerActivity.class);
} else
Toast.makeText(Filters.this, "Please select at least one filter!", Toast.LENGTH_SHORT).show();
}
});
RecyclerView recyclerView = findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(this);
layoutManager.setFlexWrap(FlexWrap.WRAP);
layoutManager.setFlexDirection(FlexDirection.ROW);
layoutManager.setAlignItems(AlignItems.STRETCH);
recyclerView.setLayoutManager(layoutManager);
RecyclerView.Adapter adapter = new FiltersAdapter(this, filters, filters_image_urls);
recyclerView.setAdapter(adapter);
}
Aggregations