@Override public void onClick(WallpaperPickerActivity a) { CropView c = a.getCropView(); Drawable defaultWallpaper = WallpaperManager.getInstance(a) .getBuiltInDrawable(c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); if (defaultWallpaper == null) { Log.w(TAG, "Null default wallpaper encountered."); c.setTileSource(null, null); return; } c.setTileSource( new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null); c.setScale(1f); c.setTouchEnabled(false); a.setSystemWallpaperVisiblity(false); }
@Override public void onClick(WallpaperPickerActivity a) { BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource( mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); bitmapSource.loadInBackground(); BitmapRegionTileSource source = new BitmapRegionTileSource(a, bitmapSource); CropView v = a.getCropView(); v.setTileSource(source, null); Point wallpaperSize = WallpaperCropActivity.getDefaultWallpaperSize(a.getResources(), a.getWindowManager()); RectF crop = WallpaperCropActivity.getMaxCropRect( source.getImageWidth(), source.getImageHeight(), wallpaperSize.x, wallpaperSize.y, false); v.setScale(wallpaperSize.x / crop.width()); v.setTouchEnabled(false); a.setSystemWallpaperVisiblity(false); }