Comments (7)
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.
Hello, thank you for your answer, I will check it asap an I will report you if I see something
from horizontal-calendar.
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.
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.
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.
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.
@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)
- if i have been given a month value 7 or anything , how can i point this calendar to that month , what should be my start date , can i use month value to decide pointers position?
- Wrong Date Selected. HOT 7
- Adding events on onDateSelected gives issues
- Multi Language convert Calendar view
- Adding fonts
- Callback for first day of month. HOT 1
- how to Disable Selected date Indicator HOT 2
- Scroll Weekly
- androidx RecyclerView HOT 2
- How to set Locale...
- Current Date selection listener not working HOT 2
- on onDateSelected is not working as it should in a new android androidx based project
- when ever I select a date it automatically goes to next date of the selected Date HOT 2
- Wrong current date in fragment
- jcenter migration please HOT 2
- Calendar Event is not showing in Center
- Unable to find an option where I can set Locale.
- is possible to reconfig disabled dates ? HOT 1
- How i disable previous day selection in calender? HOT 6
- XML Error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from horizontal-calendar.