summaryrefslogtreecommitdiffstats
path: root/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-05-13 12:16:11 -0700
committerMatt Garnes <matt@cyngn.com>2015-05-13 12:36:59 -0700
commit394c2e381d9a9cd04f2706e34bf6d3c81e2cbd70 (patch)
tree30d54700318f87e18f6450ab4a818b7ff9f83d8f /WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
parent17b70e9a4eea164d5175caa9136b24820709f47b (diff)
downloadandroid_packages_apps_Trebuchet-394c2e381d9a9cd04f2706e34bf6d3c81e2cbd70.tar.gz
android_packages_apps_Trebuchet-394c2e381d9a9cd04f2706e34bf6d3c81e2cbd70.tar.bz2
android_packages_apps_Trebuchet-394c2e381d9a9cd04f2706e34bf6d3c81e2cbd70.zip
Support override to display Wallpaper preview from left edge.
Add resource config override to display the preview of preloaded resource wallpapers from the left edge to match how they display when set as the wallpaper. Change-Id: I4aef9e1818ec6942c9b41055b5573308db58a1be
Diffstat (limited to 'WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java')
-rwxr-xr-xWallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index e4fa637bc..27f1a53aa 100755
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -94,6 +94,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
private View mSelectedTile;
private boolean mIgnoreNextTap;
+ private boolean mResourcePreviewMoveToLeft = false;
private OnClickListener mThumbnailOnClickListener;
private LinearLayout mWallpapersView;
@@ -231,11 +232,13 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
public static class ResourceWallpaperInfo extends WallpaperTileInfo {
private Resources mResources;
private int mResId;
+ private boolean mMoveToLeft;
- public ResourceWallpaperInfo(Resources res, int resId, Drawable thumb) {
+ public ResourceWallpaperInfo(Resources res, int resId, Drawable thumb, boolean moveToLeft) {
mResources = res;
mResId = resId;
mThumb = thumb;
+ mMoveToLeft = moveToLeft;
}
@Override
public void onClick(WallpaperPickerActivity a) {
@@ -254,6 +257,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
v.setScale(wallpaperSize.x / crop.width());
v.setTouchEnabled(false);
a.setSystemWallpaperVisiblity(false);
+ if (mMoveToLeft) {
+ v.moveToLeft();
+ }
}
@Override
public void onSave(WallpaperPickerActivity a) {
@@ -379,6 +385,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
protected void init() {
setContentView(R.layout.wallpaper_picker);
+ mResourcePreviewMoveToLeft =
+ getResources().getBoolean(R.bool.resource_wallpaper_preview_left_edge);
+
mCropView = (CropView) findViewById(R.id.cropView);
mCropView.setVisibility(View.INVISIBLE);
@@ -1089,7 +1098,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
}
}
if (defaultWallpaperExists) {
- return new ResourceWallpaperInfo(sysRes, resId, new BitmapDrawable(thumb));
+ return new ResourceWallpaperInfo(sysRes, resId,
+ new BitmapDrawable(thumb), mResourcePreviewMoveToLeft);
}
return null;
}
@@ -1151,7 +1161,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
if (thumbRes != 0) {
ResourceWallpaperInfo wallpaperInfo =
- new ResourceWallpaperInfo(res, resId, res.getDrawable(thumbRes));
+ new ResourceWallpaperInfo(res, resId,
+ res.getDrawable(thumbRes), mResourcePreviewMoveToLeft);
known.add(wallpaperInfo);
// Log.d(TAG, "add: [" + packageName + "]: " + extra + " (" + res + ")");
}