@Love_Soni I can explain the approach:
Step 1: Capture the calendar bounds.
Hint : Use element.getSize() and element.getLocation() for determining this.
Look at the highlighted rectangular section from my previous post comment Example : [30,576] [1050,1476] .
Step 2. Find out the Horizontal Width factor.
The width of calendar view is 1050…all dates are maintaining equal distance from each other. So if you divide the width by 7 then you will get the width factor. Example : total_width : 1050 width_factor=1050/7 =150
Step 3. Measure the Horizontal Coordinate(X Coordinate) for each column.
We have 7 column in a date calendar. Now If you want to tap on any date in 5th column then multiply width_factor * 5. i.e. 150 * 5= 750.(X Coordinate)
To add some precision use (width_factor * column_number) - element.getLocation().x.
(150 * 5)-30=720 (Final X Coordinate)
Step 4. Measure the Vertical Coordinate(Y Coordinate) for each Row.
The total height of Calendar view is 1476… Dates are square boxes of 150 x 150…Number of Rows are 5. With the use of these data you can easily determine Y coordinate.
This way you can tap on any date by using coordinates.
However, you have to look on several other things along with this implementation such as :
- Compare current date with the date of departure and restrict the users based on this.
- Handling of scrolls for the cases when the date of departure has couple of months.