Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
rockchip_frameworks_opt_datetimepicker
Commits
59d94e4e
Commit
59d94e4e
authored
11 years ago
by
Ruben
Browse files
Options
Download
Email Patches
Plain Diff
Prepare MonthView to support new features in child classes
Change-Id: I56c4b9e8b9ed54e786ea543b5ed728249af56694
parent
94a2de69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
src/com/android/datetimepicker/date/MonthView.java
src/com/android/datetimepicker/date/MonthView.java
+17
-4
No files found.
src/com/android/datetimepicker/date/MonthView.java
View file @
59d94e4e
...
...
@@ -176,7 +176,8 @@ public abstract class MonthView extends View {
protected
int
mNumRows
=
DEFAULT_NUM_ROWS
;
// Optional listener for handling day click actions
private
OnDayClickListener
mOnDayClickListener
;
protected
OnDayClickListener
mOnDayClickListener
;
// Whether to prevent setting the accessibility delegate
private
boolean
mLockAccessibilityDelegate
;
...
...
@@ -530,6 +531,21 @@ public abstract class MonthView extends View {
* @return The day number, or -1 if the position wasn't in a day
*/
public
int
getDayFromLocation
(
float
x
,
float
y
)
{
final
int
day
=
getInternalDayFromLocation
(
x
,
y
);
if
(
day
<
1
||
day
>
mNumCells
)
{
return
-
1
;
}
return
day
;
}
/**
* Calculates the day that the given x position is in, accounting for week
* number.
*
* @param x The x position of the touch event
* @return The day number
*/
protected
int
getInternalDayFromLocation
(
float
x
,
float
y
)
{
int
dayStart
=
mEdgePadding
;
if
(
x
<
dayStart
||
x
>
mWidth
-
mEdgePadding
)
{
return
-
1
;
...
...
@@ -540,9 +556,6 @@ public abstract class MonthView extends View {
int
day
=
column
-
findDayOffset
()
+
1
;
day
+=
row
*
mNumDays
;
if
(
day
<
1
||
day
>
mNumCells
)
{
return
-
1
;
}
return
day
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment