use of app.insti.activity.MainActivity in project IITB-App by wncc.
the class CalendarFragment method showFab.
/**
* Show the fab if we can make events
*/
private void showFab() {
if (((MainActivity) getActivity()).createEventAccess()) {
fab.show();
NestedScrollView nsv = view.findViewById(R.id.calendar_nsv);
nsv.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (scrollY > oldScrollY)
fab.hide();
else
fab.show();
}
});
// Handle fab click
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CalendarDay day = ((MaterialCalendarView) view.findViewById(R.id.simpleCalendarView)).getSelectedDate();
String date = day.getYear() + "-" + day.getMonth() + "-" + day.getDay();
WebViewFragment webViewFragment = (new WebViewFragment()).withDate(date);
Bundle bundle = new Bundle();
bundle.putString(Constants.WV_TYPE, Constants.WV_TYPE_ADD_EVENT);
webViewFragment.setArguments(bundle);
((MainActivity) getActivity()).updateFragment(webViewFragment);
}
});
}
}
Aggregations