Comments (35)
I don't think it has this feature implemented, but it should be not that hard.
You will need to modify it to grab the pinch gesture and changes the "noOfVisibleDays" variable.
Also, to set the days to just display monday to friday u set "noOfVisibleDays" to 5 and "firstDayOfWeek" to 1 (I think).
from android-week-view.
Thanks @caioketo for your answer. But it's not possible to not show the days Saturday and Sunday. The calendar was not built to omit some of the days. This calendar covers only the most common scenarios (i.e. it behaves like a normal week view calendars. e.g. google calendar). I don't think its possible to cover all special case scenarios.
Also can you provide an example app where its possible to zoom/pinch in the week view.
from android-week-view.
@alamkanak my bad, I thought as the variables, it should be able, but didnt test it out.
And for the example, I didnt make it, as for my needs its not usefull, but, if u wants I can try that out.
from android-week-view.
Thank you to you both.
Google Calendar as a pinch vertical zoom in week view. S planner has both axes zoom.
I succeeded in hiding Saturday and Sunday but it causes some day shifting on Monday.
Thank you in advance
from android-week-view.
Thanks @sylvaindd. I think it's a good idea to implement the vertical zoom. The horizontal one may cause some issues here. I'll surely look into it.
from android-week-view.
Yes I think the vertical zoom is enough. Thank you for your answers.
from android-week-view.
@alamkanak the vertical would be changing the "height" of the hours dont?
from android-week-view.
@caioketo yes that's it I guess, I think it just needs the multi touch implementation.
from android-week-view.
@alamkanak I see, right now im at work, so I can't really try it out, but if you want, I can make some tests after I get home.
from android-week-view.
@caioketo did you try it out ?
from android-week-view.
@sylvaindd I havent got time yet, since its not nescessary for what I'm using it, it will take a little long for me to try that.. sorry.
from android-week-view.
I created a method to handle the zoom which is :
mScaleDetector = new ScaleGestureDetector(mContext, new OnScaleGestureListener() {
public void onScaleEnd(ScaleGestureDetector detector) {
}
public boolean onScaleBegin(ScaleGestureDetector detector) {
return true;
}
public boolean onScale(ScaleGestureDetector detector) {
System.out.println(mHourHeight);
if (detector.getScaleFactor() > 1 && mHourHeight < 200) {
mHourHeight += 4 * detector.getScaleFactor();
// Zoom
// mHourHeight += 5;
}
else if (detector.getScaleFactor() < 1 && mHourHeight > 80) {
mHourHeight -= 4 * (detector.getScaleFactor() + 1);
// deZoom
// mHourHeight -= 5;
}
return false;
}
});
And called it in onTouchEvent():
mScaleDetector.onTouchEvent(event);
It's working but it doesn't center the calendar to the position I'm zooming.
I'd like to know if there was a way to center the calendar with X and Y axes ?
Than you
from android-week-view.
Up !
I wanted to know if you started implementing this feature ?
I will realease an application using your library soon and my zoom feature is working but not really smoothly.
Thank you in advance,
from android-week-view.
I've been working on implementing this. Just some slight problems left, but expect a PR soon.
from android-week-view.
HI,
That would be very nice. I kinda upgraded my implementation but it's still not smooth.
Anyway, if you could keep me informed about your implementation, that would be nice.
from android-week-view.
I got it working so it follows the current position in the view.
The two problems I currently still have is that
- it sometimes still starts scrolling while zooming (especially annoying when it comes to horizontal scrolling)
- there should be a dynamic minium hourHeight (that depends on the screenHeight, otherwise the view is sometimes smaller than the available height).
(You'll be able to set the min and max hourHeight manually too btw)
from android-week-view.
I actually managed to resolve this problem :
"otherwise the view is sometimes smaller than the available height"
If you used a ScaleGestureDetector did you return true in onScale and onScaleBegin ?
I had a problem with the scroll and zoom not working correctly together by returning false.
from android-week-view.
I do return true, but I'm not sure what I should do in the onTouch handler. Right now I do
return mScaleDetector.onTouchEvent(event) && mGestureDetector.onTouchEvent(event);
instead of
return mGestureDetector.onTouchEvent(event);
from android-week-view.
I currently do this :
mScaleDetector.onTouchEvent(event);
return mGestureDetector.onTouchEvent(event);
Which I guess is pretty much the same as what you're doing
from android-week-view.
I think your implementation is even better. (in case the first one ever returns false)
from android-week-view.
I have a commit ready, but it's kinda based on some other PR's that I've open. So I'll make a PR whenever I've got a better base to make a clean PR.
You can see the commit 6621e83 on the Quivr-fork however (if you want to see how I've done it)
from android-week-view.
Thanks, but I'll wait the clean PR, I can't make it work right now.
from android-week-view.
Does the last commit really keep the center when zoomed in? Topmost hour remains the same for me not the center.
from android-week-view.
It keeps indeed the top hour not the center.
I think people usually look somewhere on the top of their screen. (about 1/4 from the top). But there's no real data about this, so I went with the easiest option to program (and to maintain!)
from android-week-view.
@caske33 Do you know an easy way of reading the positions of the 2-touch coordinates and keeping the position of that hour fixed? I know the getTimeFromPoint method exists but how to make use of it here? Besides goToHour only sets the top hour.
from android-week-view.
No, not at all.
As I said, I went with the easy option and the one that didn't require a lot of the pixel-fiddling.
from android-week-view.
I see. Well I hope someone does it one day. Thank you for your contribution regarding the vertical zoom.
from android-week-view.
@caske33 Is it possible to limit the HourHeight zoom to vertical zoom only. I would like to perform a horizontal zoom to change the numberOfVisibleDays?
from android-week-view.
Normally it should be only a vertical zoom?
from android-week-view.
@caske33 I used your commit 6621e83 but it works when doing both vertical and horizontal finger zoom.
from android-week-view.
I'm not really sure how to change that 😞. But feel free to do it yourself.
from android-week-view.
Hi there,
There has been a while since I opened this post :o.
I needed the weekview for a new Android project and decided to fork it (with @thelittlefireman) and change it to fit what we needed in order to make it easier to use for our projects.
I gave a look at the zoom I wrote before, and actually managed to make it way better.
What has been changed :
-Disable scrolling while zooming
-Zoom centers where you started the zoom
-It can't no longer make display issues where we could have a blank space before 00AM or 12PM.
It's working just fine for me, I've not tested it a lot tho but it should be ok.
Here is the fork : https://github.com/thelittlefireman/Esirdreamteam-Android-Week-View
If you want to take a look, it's basically only the OnScaleGestureListenerWeekView class that is needed for the zoom.
@obaslan It should do what you wanted :). I'll also try the horizontal zoom to change the number of days visible.
from android-week-view.
@sylvaindd is there any chance that you create pull requests for some of your changes?
i think disabling scrolling while zooming should already be done via mIsZooming
but centering zoom at the starting point would be a cool feature
and if there are display issues that can be fixed i think we should also fix them in this lib
from android-week-view.
@marunjar, it seems like @alamkanak released these features yesterday. I didn't try it, but it looks like it has the same behavior as mine.
from android-week-view.
@sylvaindd Thanks for this contribution.
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.