Commit ec8fa297 authored by Varun Patil's avatar Varun Patil

Show fab after load on calendar

parent 33caa649
......@@ -105,16 +105,18 @@ public class CalendarFragment extends BaseFragment {
}
});
// Handle fab click
fab.setOnClickListener(new View.OnClickListener() {
return view;
}
@Override
public void onClick(View v) {
AddEventFragment addEventFragment = new AddEventFragment();
((MainActivity) getActivity()).updateFragment(addEventFragment);
public void onStart() {
super.onStart();
updateEvents(CalendarDay.today(), true);
}
});
// Show the fab if we can make events
/** 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);
......@@ -125,27 +127,28 @@ public class CalendarFragment extends BaseFragment {
else fab.show();
}
});
}
return view;
}
// Handle fab click
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onStart() {
super.onStart();
updateEvents(CalendarDay.today(), true);
public void onClick(View v) {
AddEventFragment addEventFragment = new AddEventFragment();
((MainActivity) getActivity()).updateFragment(addEventFragment);
}
});
}
}
/** Convert CalendarDay to Date */
public Date toDate(CalendarDay date) throws ParseException {
private Date toDate(CalendarDay date) throws ParseException {
String sdate = date.getDay() + "/" + date.getMonth() + "/" + date.getYear();
Date showDate = new SimpleDateFormat("dd/M/yyyy").parse(sdate);
return showDate;
}
/** Decorator for Calendar */
public class EventDecorator implements DayViewDecorator {
private class EventDecorator implements DayViewDecorator {
private final int color = getResources().getColor(R.color.colorAccent);
private final int white = getResources().getColor(R.color.primaryTextColor);
private final HashSet<CalendarDay> dates;
......@@ -234,6 +237,9 @@ public class CalendarFragment extends BaseFragment {
// Select today's date
final MaterialCalendarView matCalendarView = view.findViewById(R.id.simpleCalendarView);
matCalendarView.setSelectedDate(CalendarDay.today());
// Show the fab
showFab();
}
// Generate the decorators
......
......@@ -77,7 +77,7 @@
android:layout_margin="16dp"
android:src="@drawable/ic_add_black_24dp"
android:tint="@android:color/black"
android:visibility="gone" />
android:visibility="invisible" />
<include layout="@layout/loading_panel" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment