Giter VIP home page Giter VIP logo

Comments (7)

muraee avatar muraee commented on May 28, 2024

Hello @mp205

If I understand correctly, goToday() method will select 26th January instead of 22nd January which is today, unfortunately I can't reproduce this bug although I used your code exactly, please try to post the steps u made to reproduce this bug.

Regarding End and Start Dates, there is no error here, this is the normal behavior of the calendar to render 2 days before and after the range, as the selected date should be always centered on the screen.
Please note that these extra 2 days are not selectable.

from horizontal-calendar.

mp205 avatar mp205 commented on May 28, 2024

Hello, thank you for your answer, I will check it asap an I will report you if I see something

from horizontal-calendar.

mp205 avatar mp205 commented on May 28, 2024

Hello again,
so I think, I figured it out. I have wrapped the calendar inside a LinearLayout, which had visibility set to gone, and I am displaying calendar after a button click.

Now, when I set LinearLayout's visibility to visible, everything is fine.

I just set it to visible, and I hide it instantly after the creation of calendar, in fragment's onCreateView method, so I get the expected result.

from horizontal-calendar.

muraee avatar muraee commented on May 28, 2024

Glad it worked out for you, actually HorizontalCalendar starts invisible then goes to visible after it finishes initialization so this might be the problem you faced.
I think setting the visibilty of your LinearLayout to invisible instead of gone will also work for you without hiding it in OnCreateView, since gone will not process any children at all.

from horizontal-calendar.

mp205 avatar mp205 commented on May 28, 2024

I unfortunately cannot set invisible to layout, because it works as an overlay on other elements, so I would not be able to click other content behind it.
But now everything works great :)

from horizontal-calendar.

ArchanaKumari029 avatar ArchanaKumari029 commented on May 28, 2024

correct date is getting selected but the thing is you have to use AppBarLayout and toolbar then it will work properly as library is showing.

from horizontal-calendar.

kadirgodil avatar kadirgodil commented on May 28, 2024

@Mulham-Raee On picking a date in horizontal calendar its picking a wrong date. For example I am selecting 28th December but its returning time for 27th December and the data stored for the timestamp of 28 will be shown on 29 selected next day its incrementing by oneday automatically .Working fine on horizontal scrolling
Here's My code

private void Calendar() {
Calendar startDate = Calendar.getInstance();
startDate.add(Calendar.DATE, -6);

    Calendar endDate = Calendar.getInstance();
    Date mEndDate = endDate.getTime();
    endDate.setTime(mEndDate);
    horizontalCalendar = new HorizontalCalendar.Builder(view, R.id.calendarView).range(startDate, endDate).datesNumberOnScreen(3).build();
 

    horizontalCalendar.setCalendarListener(new HorizontalCalendarListener() {
        @Override
        public void onDateSelected(Calendar date, int position) {
            //do something
            long dates = date.getTimeInMillis();
            Log.d("DATECHECK","Date : " + date.getTimeInMillis());
            Log.d("DATECHECK","Date : " + Myutils.Util.getToday());
            todayoffset = db.getSteps(dates);
            if (todayoffset >=0) {
                totalsteps.setText(formatter.format(todayoffset));
                float stepsize = prefs.getFloat("stepsize_value", ProfileFragment.DEFAULT_STEP_SIZE);
                float distance_total = (todayoffset) * stepsize;
                if (prefs.getString("stepsize_unit", ProfileFragment.DEFAULT_STEP_UNIT).equals("cm")) {
                    distance_total /= 100000;
                    unit = "km";

                } else {
                    distance_total /= 5280;
                    unit = "mile";

                }
                totldistance.setText(formatter.format(distance_total));
                totalCalories.setText(formatter.format(todayoffset * 0.04));
            } else {
                totalsteps.setText("0");
                totldistance.setText("0");
                totalCalories.setText("0");
            }
        }
    });
    horizontalCalendar.refresh();
}

from horizontal-calendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.