Comments (17)
bump
got the same problem, goToDate isn't working
from android-week-view.
Got same problem. goToDate is not working as expected.
from android-week-view.
same problem.. Goto works only for date within present month.. other month it wont work.. plz fix
from android-week-view.
That is weird, with me it doesn't work, even for the current month.
Also, I made it work by multiplying the dateDifference with a value, but that only "works" for devices with the same screen.
Unfortunatelly I don't have enough time to go through the code and try to find out what the real problem is. One thing is for sure though, the width is being calculated wrongly
from android-week-view.
Hi folks!
I was able to 'solve' the issue through a work around. I am calling init every in the goToDate method.
- replace the call to init() in the constructor with this
mToday = Calendar.getInstance();
mToday.set(Calendar.HOUR_OF_DAY, 0);
mToday.set(Calendar.MINUTE, 0);
mToday.set(Calendar.SECOND, 0);
init();
- delete the code that sets the mToday variable in the init() method
- replace the goToDate method with this one:
public void goToDate(Calendar date) {
mToday = date;
init();
}
- replace the two occurences of
boolean sameDay = isSameDay(day, mToday);
with
boolean sameDay = isSameDay(day, Calendar.getInstance());
Not pretty, but it does the job.
from android-week-view.
where is method edit()??? can u share the work around library? that's working for you..
from android-week-view.
Sorry, I meant init!
It is easy enough to apply the work around, don't think I should share it...
from android-week-view.
when i call init(date) in method goToDate method i get this error -->The method init() in the type WeekView is not applicable for the arguments (Calendar)
from android-week-view.
Sorry, I was still changing the fix and copy pasted the wrong version.
I edited my post again, it should be alright now.
I might make a pull request because I did other fixes, but it will take time because I will have to trim out the changes I made to best fit my project.
from android-week-view.
Thanks for the response. i did exactly has you instructed but hard luck it dint work. :-(
from android-week-view.
I need to check on this, but when I was hacking on the library, I think I fixed it when adding some brackets to https://github.com/alamkanak/Android-Week-View/blob/master/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1204
changing:
int dateDifference = (int) (date.getTimeInMillis() - today.getTimeInMillis()) / (1000 * 60 * 60 * 24);
to
int dateDifference = (int) ((date.getTimeInMillis() - today.getTimeInMillis()) / (1000 * 60 * 60 * 24));
I'll soon be working some more on the library, and if this is the solution, I will make a PR (if nobody has done it yet by then)
from android-week-view.
I checked it now, that solves the problem indeed. I'm currently playing with some other stuff, I'll make a PR after that's done.
from android-week-view.
@alamkanak This problem should be fixed and this issue can be closed.
from android-week-view.
this doesn't work for me.
I checked and mWidthPerDay is 0 when the goToDate is called
edit: apparently I am calling goToDate too soon
from android-week-view.
@Hugo-Pereira my PR #53 will fix that
from android-week-view.
Problem fixed. See #69
from android-week-view.
Do a single and very simple change:
Replace this
mRefreshEvents = true;
with
mRefreshEvents = false;
Method goToDate(Calendar date) should looks like:
public void goToDate(Calendar date) {
mScroller.forceFinished(true);
date.set(Calendar.HOUR_OF_DAY, 0);
date.set(Calendar.MINUTE, 0);
date.set(Calendar.SECOND, 0);
mRefreshEvents = false;
Calendar today = Calendar.getInstance();
today.set(Calendar.HOUR_OF_DAY, 0);
today.set(Calendar.MINUTE, 0);
today.set(Calendar.SECOND, 0);
int dateDifference = (int) (date.getTimeInMillis() - today.getTimeInMillis()) / (1000 * 60 * 60 * 24);
mCurrentOrigin.x = - dateDifference * (mWidthPerDay + mColumnGap);
invalidate();
}
from android-week-view.
Related Issues (20)
- How to show the event that starts at Today 11PM and ends at Tomorrow morning 5AM HOT 1
- Accessibility/Talkback implementation of WeekView and its Events
- How to navigate to particular date HOT 1
- How can I hide or clear the header area?
- How to use this in Kotlin project? HOT 1
- Unable to display events
- Auto scroll to current hour?
- use firebase with Android-week-View HOT 2
- Events issue
- Name of event is repeated 3 times HOT 1
- Using a deprecated clipRect() in 1.2.6 HOT 2
- How to add new column in Day View?
- AAPT: error: duplicate value for resource 'attr/textStyle' with config ''.
- Is there a recent Kotlin Sample I can see to understand how this code is implemented HOT 2
- How can we change the **todayHeaderText** date format
- Is it possible to add event in normal date format?
- Is it possible to highlight weekends?
- Need to use Android X as its conflicting dependencies with recent android version
- Change X-axis and y-axis, and vertical scrolling to specific range
- Not integrated Lib
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 android-week-view.