summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2012-09-13 14:48:22 -0400
committerChris Wren <cwren@android.com>2012-09-13 15:01:12 -0400
commit651ee92128e1899957758abeeb1c2c669f240093 (patch)
tree1b881567e004ed733e9e6154c469ffc47b0c17bc /src
parentf98687b22f4091083287ab7de7a0f3102bd9c1ba (diff)
downloadandroid_packages_screensavers_PhotoTable-651ee92128e1899957758abeeb1c2c669f240093.tar.gz
android_packages_screensavers_PhotoTable-651ee92128e1899957758abeeb1c2c669f240093.tar.bz2
android_packages_screensavers_PhotoTable-651ee92128e1899957758abeeb1c2c669f240093.zip
add vignetting to the photo table
Change-Id: I329b14ffdc70cc21e16f917fd06a4c2b1f1e27b6
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dreams/phototable/PhotoTable.java15
-rw-r--r--src/com/android/dreams/phototable/PhotoTableDream.java11
2 files changed, 18 insertions, 8 deletions
diff --git a/src/com/android/dreams/phototable/PhotoTable.java b/src/com/android/dreams/phototable/PhotoTable.java
index 0c9c47f..070aab5 100644
--- a/src/com/android/dreams/phototable/PhotoTable.java
+++ b/src/com/android/dreams/phototable/PhotoTable.java
@@ -65,7 +65,6 @@ public class PhotoTable extends FrameLayout {
private final Launcher mLauncher;
private final LinkedList<View> mOnTable;
- private final Dream mDream;
private final int mDropPeriod;
private final int mFastDropPeriod;
private final int mNowDropDelay;
@@ -82,6 +81,7 @@ public class PhotoTable extends FrameLayout {
private final Resources mResources;
private final Interpolator mThrowInterpolator;
private final Interpolator mDropInterpolator;
+ private Dream mDream;
private PhotoLaunchTask mPhotoLaunchTask;
private boolean mStarted;
private boolean mIsLandscape;
@@ -93,11 +93,9 @@ public class PhotoTable extends FrameLayout {
private View mSelected;
private long mSelectedTime;
- public PhotoTable(Dream dream, AttributeSet as) {
- super(dream, as);
- mDream = dream;
+ public PhotoTable(Context context, AttributeSet as) {
+ super(context, as);
mResources = getResources();
- setBackground(mResources.getDrawable(R.drawable.table));
mInset = mResources.getDimensionPixelSize(R.dimen.photo_inset);
mDropPeriod = mResources.getInteger(R.integer.table_drop_period);
mFastDropPeriod = mResources.getInteger(R.integer.fast_drop);
@@ -124,6 +122,11 @@ public class PhotoTable extends FrameLayout {
mStarted = false;
}
+
+ public void setDream(Dream dream) {
+ mDream = dream;
+ }
+
public boolean hasSelection() {
return mSelected != null;
}
@@ -199,7 +202,7 @@ public class PhotoTable extends FrameLayout {
dropOnTable(getSelected());
clearSelection();
} else {
- if (mTapToExit) {
+ if (mTapToExit && mDream != null) {
mDream.finish();
}
}
diff --git a/src/com/android/dreams/phototable/PhotoTableDream.java b/src/com/android/dreams/phototable/PhotoTableDream.java
index 47c672d..f714b9c 100644
--- a/src/com/android/dreams/phototable/PhotoTableDream.java
+++ b/src/com/android/dreams/phototable/PhotoTableDream.java
@@ -15,7 +15,10 @@
*/
package com.android.dreams.phototable;
+import android.content.Context;
import android.service.dreams.Dream;
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
/**
* Example interactive screen saver: flick photos onto a table.
@@ -33,8 +36,12 @@ public class PhotoTableDream extends Dream {
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
- mTable = new PhotoTable(this, null);
- setContentView(mTable);
+ LayoutInflater inflater =
+ (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ ViewGroup view = (ViewGroup) inflater.inflate(R.layout.table, null);
+ PhotoTable table = (PhotoTable) view.findViewById(R.id.table);
+ table.setDream(this);
+ setContentView(view);
lightsOut();
}
}