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
f2346bc7
Commit
f2346bc7
authored
11 years ago
by
Paul Sliwowski
Browse files
Options
Download
Email Patches
Plain Diff
Small refactor on haptic feddback for TimeDailogPicker.
Change-Id: Ic7d4f8d9a3a98a0b11acfde3f69ccba2f3964fe7
parent
fbb04539
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
src/com/android/datetimepicker/time/RadialPickerLayout.java
src/com/android/datetimepicker/time/RadialPickerLayout.java
+7
-6
src/com/android/datetimepicker/time/TimePickerDialog.java
src/com/android/datetimepicker/time/TimePickerDialog.java
+5
-3
No files found.
src/com/android/datetimepicker/time/RadialPickerLayout.java
View file @
f2346bc7
...
...
@@ -38,6 +38,7 @@ import android.view.accessibility.AccessibilityManager;
import
android.view.accessibility.AccessibilityNodeInfo
;
import
android.widget.FrameLayout
;
import
com.android.datetimepicker.HapticFeedbackController
;
import
com.android.datetimepicker.R
;
public
class
RadialPickerLayout
extends
FrameLayout
implements
OnTouchListener
{
...
...
@@ -58,7 +59,7 @@ public class RadialPickerLayout extends FrameLayout implements OnTouchListener {
private
int
mLastValueSelected
;
private
TimePickerDialog
m
Controller
;
private
HapticFeedbackController
mHapticFeedback
Controller
;
private
OnValueSelectedListener
mListener
;
private
boolean
mTimeInitialized
;
private
int
mCurrentHoursOfDay
;
...
...
@@ -161,14 +162,14 @@ public class RadialPickerLayout extends FrameLayout implements OnTouchListener {
* @param initialMinutes
* @param is24HourMode
*/
public
void
initialize
(
Context
context
,
TimePickerDialog
c
ontroller
,
public
void
initialize
(
Context
context
,
HapticFeedbackController
hapticFeedbackC
ontroller
,
int
initialHoursOfDay
,
int
initialMinutes
,
boolean
is24HourMode
)
{
if
(
mTimeInitialized
)
{
Log
.
e
(
TAG
,
"Time has already been initialized."
);
return
;
}
m
Controller
=
c
ontroller
;
m
HapticFeedbackController
=
hapticFeedbackC
ontroller
;
mIs24HourMode
=
is24HourMode
;
mHideAmPm
=
mAccessibilityManager
.
isTouchExplorationEnabled
()?
true
:
mIs24HourMode
;
...
...
@@ -577,7 +578,7 @@ public class RadialPickerLayout extends FrameLayout implements OnTouchListener {
if
(
mIsTouchingAmOrPm
==
AM
||
mIsTouchingAmOrPm
==
PM
)
{
// If the touch is on AM or PM, set it as "touched" after the TAP_TIMEOUT
// in case the user moves their finger quickly.
mController
.
tryVibrate
();
m
HapticFeedback
Controller
.
tryVibrate
();
mDownDegrees
=
-
1
;
mHandler
.
postDelayed
(
new
Runnable
()
{
@Override
...
...
@@ -595,7 +596,7 @@ public class RadialPickerLayout extends FrameLayout implements OnTouchListener {
if
(
mDownDegrees
!=
-
1
)
{
// If it's a legal touch, set that number as "selected" after the
// TAP_TIMEOUT in case the user moves their finger quickly.
mController
.
tryVibrate
();
m
HapticFeedback
Controller
.
tryVibrate
();
mHandler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -650,7 +651,7 @@ public class RadialPickerLayout extends FrameLayout implements OnTouchListener {
if
(
degrees
!=
-
1
)
{
value
=
reselectSelector
(
degrees
,
isInnerCircle
[
0
],
false
,
true
);
if
(
value
!=
mLastValueSelected
)
{
mController
.
tryVibrate
();
m
HapticFeedback
Controller
.
tryVibrate
();
mLastValueSelected
=
value
;
mListener
.
onValueSelected
(
getCurrentItemShowing
(),
value
,
false
);
}
...
...
This diff is collapsed.
Click to expand it.
src/com/android/datetimepicker/time/TimePickerDialog.java
View file @
f2346bc7
...
...
@@ -199,11 +199,14 @@ public class TimePickerDialog extends DialogFragment implements OnValueSelectedL
mAmText
=
amPmTexts
[
0
];
mPmText
=
amPmTexts
[
1
];
mHapticFeedbackController
=
new
HapticFeedbackController
(
getActivity
());
mTimePicker
=
(
RadialPickerLayout
)
view
.
findViewById
(
R
.
id
.
time_picker
);
mTimePicker
.
setOnValueSelectedListener
(
this
);
mTimePicker
.
setOnKeyListener
(
keyboardListener
);
mTimePicker
.
initialize
(
getActivity
(),
this
,
mInitialHourOfDay
,
mInitialMinute
,
mIs24HourMode
);
mTimePicker
.
initialize
(
getActivity
(),
mHapticFeedbackController
,
mInitialHourOfDay
,
mInitialMinute
,
mIs24HourMode
);
int
currentItemShowing
=
HOUR_INDEX
;
if
(
savedInstanceState
!=
null
&&
savedInstanceState
.
containsKey
(
KEY_CURRENT_ITEM_SHOWING
))
{
...
...
@@ -212,7 +215,6 @@ public class TimePickerDialog extends DialogFragment implements OnValueSelectedL
setCurrentItemShowing
(
currentItemShowing
,
false
,
true
,
true
);
mTimePicker
.
invalidate
();
mHapticFeedbackController
=
new
HapticFeedbackController
(
getActivity
());
mHourView
.
setOnClickListener
(
new
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
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