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
packages_screensavers_PhotoTable
Commits
a924553f
Commit
a924553f
authored
12 years ago
by
Chris Wren
Browse files
Options
Download
Email Patches
Plain Diff
support dpads in story mode.
Bug: 8572945 Change-Id: Icabd1fc61ec7c3c5b6a2f5ef94641eb7c8deb1c3
parent
88d80f44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
13 deletions
+28
-13
res/values/config.xml
res/values/config.xml
+3
-0
src/com/android/dreams/phototable/KeyboardInterpreter.java
src/com/android/dreams/phototable/KeyboardInterpreter.java
+21
-2
src/com/android/dreams/phototable/PhotoTable.java
src/com/android/dreams/phototable/PhotoTable.java
+4
-11
No files found.
res/values/config.xml
View file @
a924553f
...
...
@@ -100,5 +100,8 @@
<!-- Enable story mode. -->
<bool
name=
"enable_story_mode"
>
true
</bool>
<!-- Duration ion milliseconds for the pickup animation. -->
<integer
name=
"photo_pickup_duration"
>
1000
</integer>
</resources>
This diff is collapsed.
Click to expand it.
src/com/android/dreams/phototable/KeyboardInterpreter.java
View file @
a924553f
...
...
@@ -27,15 +27,17 @@ public class KeyboardInterpreter {
private
static
final
boolean
DEBUG
=
false
;
private
final
PhotoTable
mTable
;
private
final
long
mBounce
;
private
long
mLastDeckNavigation
;
public
KeyboardInterpreter
(
PhotoTable
table
)
{
mBounce
=
2000
;
// TODO: remove this once latencies in lower layers are removed.
mTable
=
table
;
}
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
final
View
focus
=
mTable
.
getFocus
();
boolean
consumed
=
true
;
Log
.
d
(
TAG
,
"down: "
+
keyCode
);
if
(
mTable
.
hasSelection
())
{
switch
(
keyCode
)
{
case
KeyEvent
.
KEYCODE_ENTER
:
...
...
@@ -44,6 +46,23 @@ public class KeyboardInterpreter {
mTable
.
setFocus
(
mTable
.
getSelection
());
mTable
.
clearSelection
();
break
;
case
KeyEvent
.
KEYCODE_DPAD_RIGHT
:
case
KeyEvent
.
KEYCODE_L
:
if
((
System
.
currentTimeMillis
()
-
mLastDeckNavigation
)
>
mBounce
)
{
mLastDeckNavigation
=
System
.
currentTimeMillis
();
mTable
.
selectPrevious
();
}
break
;
case
KeyEvent
.
KEYCODE_DPAD_LEFT
:
case
KeyEvent
.
KEYCODE_H
:
if
((
System
.
currentTimeMillis
()
-
mLastDeckNavigation
)
>
mBounce
)
{
mLastDeckNavigation
=
System
.
currentTimeMillis
();
mTable
.
selectNext
();
}
break
;
default
:
if
(
DEBUG
)
Log
.
d
(
TAG
,
"dropped unexpected: "
+
keyCode
);
consumed
=
false
;
...
...
This diff is collapsed.
Click to expand it.
src/com/android/dreams/phototable/PhotoTable.java
View file @
a924553f
...
...
@@ -94,6 +94,7 @@ public class PhotoTable extends FrameLayout {
private
final
EdgeSwipeDetector
mEdgeSwipeDetector
;
private
final
KeyboardInterpreter
mKeyboardInterpreter
;
private
final
boolean
mStoryModeEnabled
;
private
final
long
mPickUpDuration
;
private
DreamService
mDream
;
private
PhotoLaunchTask
mPhotoLaunchTask
;
private
LoadNaturalSiblingTask
mLoadOnDeckTasks
[];
...
...
@@ -120,6 +121,7 @@ public class PhotoTable extends FrameLayout {
mTableRatio
=
mResources
.
getInteger
(
R
.
integer
.
table_ratio
)
/
1000000
f
;
mImageRotationLimit
=
(
float
)
mResources
.
getInteger
(
R
.
integer
.
max_image_rotation
);
mThrowSpeed
=
mResources
.
getDimension
(
R
.
dimen
.
image_throw_speed
);
mPickUpDuration
=
mResources
.
getInteger
(
R
.
integer
.
photo_pickup_duration
);
mThrowRotation
=
(
float
)
mResources
.
getInteger
(
R
.
integer
.
image_throw_rotatioan
);
mTableCapacity
=
mResources
.
getInteger
(
R
.
integer
.
table_capacity
);
mRedealCount
=
mResources
.
getInteger
(
R
.
integer
.
redeal_count
);
...
...
@@ -604,11 +606,6 @@ public class PhotoTable extends FrameLayout {
float
x
=
(
getWidth
()
-
photoWidth
)
/
2
f
;
float
y
=
(
getHeight
()
-
photoHeight
)
/
2
f
;
View
selected
=
getSelection
();
float
selectedWidth
=
selected
.
getWidth
();
float
selectedHeight
=
selected
.
getHeight
();
float
selectedScale
=
Math
.
min
(
getHeight
()
/
photoHeight
,
getWidth
()
/
photoWidth
);
float
offset
=
(((
float
)
mWidth
+
scale
*
(
photoWidth
-
2
f
*
mInset
))
/
2
f
);
x
+=
(
slot
==
NEXT
?
1
f
:
-
1
f
)
*
offset
;
...
...
@@ -619,7 +616,7 @@ public class PhotoTable extends FrameLayout {
.
scaleY
(
scale
)
.
x
(
x
)
.
y
(
y
)
.
setDuration
(
1000
)
.
setDuration
(
mPickUpDuration
)
.
setInterpolator
(
new
DecelerateInterpolator
(
2
f
));
}
}
...
...
@@ -784,10 +781,6 @@ public class PhotoTable extends FrameLayout {
float
dx
=
x
-
x0
;
float
dy
=
y
-
y0
;
float
dist
=
(
float
)
(
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
));
int
duration
=
(
int
)
(
1000
f
*
dist
/
600
f
);
duration
=
Math
.
max
(
duration
,
500
);
photo
.
setRotation
(
wrapAngle
(
photo
.
getRotation
()));
log
(
"animate it"
);
...
...
@@ -799,7 +792,7 @@ public class PhotoTable extends FrameLayout {
.
scaleY
(
scale
)
.
x
(
x
)
.
y
(
y
)
.
setDuration
(
d
uration
)
.
setDuration
(
mPickUpD
uration
)
.
setInterpolator
(
new
DecelerateInterpolator
(
2
f
))
.
withEndAction
(
new
Runnable
()
{
@Override
...
...
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