WeekCalendar icon indicating copy to clipboard operation
WeekCalendar copied to clipboard

invisible day number

Open SaraAshourHelmy opened this issue 10 years ago • 6 comments

when open another fragment then back to fragment that contain calendar found the day number invisible must swipe to view again ???

SaraAshourHelmy avatar Dec 23 '15 09:12 SaraAshourHelmy

Could you please share the code where using the calendar. One know issue could me inside fragment where you are using getActivity().getSupportFragment() , replace it will getChildFragmentManager() .

And it is not Calendars issue, Calendar contains fragment and you are using a fragment inside a fragment.

nomanr avatar Dec 23 '15 14:12 nomanr

i am using tabhost and this tabs contains fragments when press to fragment that contain calendar execute this method firt :+1:

private void SetupCalendar() {

    selected_date = Calendar.getInstance();
    updated_date = Calendar.getInstance();
    txtDate_format = new SimpleDateFormat("EEEE MMMM dd, yyyy");
    date_format = new SimpleDateFormat("yyyy-MM-dd");

    // set current date
    // Note calendar start month index from 0 so month number will be -1
    Calendar c = Calendar.getInstance();
    selected_year = c.get(Calendar.YEAR);
    selected_month = c.get(Calendar.MONTH);
    selected_day = c.get(Calendar.DAY_OF_MONTH);

    // set current date in Textview
    String folderName = txtDate_format.format(c.getTime());
    tv_selected_date.setText(folderName);
    tv_selected_date.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ShowCalendar();
        }
    });

    // when click on swipe calendar
    weekCalendar.setOnDateClickListener(new OnDateClickListener() {
        @Override
        public void onDateClick(DateTime dateTime) {

            selected_date.set(Calendar.YEAR, dateTime.getYear());
            selected_date.set(Calendar.MONTH, dateTime.getMonthOfYear());
            selected_date.set(Calendar.DAY_OF_MONTH, dateTime.getDayOfMonth());

            selected_year = dateTime.getYear();
            selected_month = dateTime.getMonthOfYear() - 1;
            selected_day = dateTime.getDayOfMonth();

            try {
                Date folderName1 = date_format.parse(dateTime.toString());
                Log.e("selected_date", selected_date + "");

                tv_selected_date.setText(txtDate_format.format(folderName1));
            } catch (Exception e) {
                Log.e("date error", "" + e);
            }
        }

    });


}

SaraAshourHelmy avatar Jan 11 '16 11:01 SaraAshourHelmy

I get the same problem whenever I put more than one WeekCalendar on a fragment, e.g., I have an adapter where some items contain two WeekCalendars, but only the first one of the whole screen loads the days.

Is this a known issue or is there a limit of how many calendars can you load on the same fragment/activity?

Thank you, if I find anything else that relates to this problem I'll update you!

Edit: When having multiple fragments, each with a calendar, when the one that is showing the days is garbage collected, the next one that loads will be the one that show days.

alexarraiza avatar Jan 11 '16 11:01 alexarraiza

+1, same here!

samarti avatar Feb 19 '16 15:02 samarti

+1 same here!

erichlotto avatar Feb 19 '16 15:02 erichlotto

+1 same here!

HugoMartins avatar Mar 04 '16 15:03 HugoMartins