当前位置: 首页>>代码示例>>Java>>正文


Java TileSource类代码示例

本文整理汇总了Java中com.android.photos.views.TiledImageRenderer.TileSource的典型用法代码示例。如果您正苦于以下问题:Java TileSource类的具体用法?Java TileSource怎么用?Java TileSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TileSource类属于com.android.photos.views.TiledImageRenderer包,在下文中一共展示了TileSource类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
@Override
public void onClick(final WallpaperPickerActivity a) {
    a.setWallpaperButtonEnabled(false);
    final BitmapRegionTileSource.ResourceBitmapSource bitmapSource =
            new BitmapRegionTileSource.ResourceBitmapSource(mResources, mResId);
    a.setCropViewTileSource(bitmapSource, false, false, new CropViewScaleProvider() {

        @Override
        public float getScale(TileSource src) {
            Point wallpaperSize = WallpaperUtils.getDefaultWallpaperSize(
                    a.getResources(), a.getWindowManager());
            RectF crop = Utils.getMaxCropRect(
                    src.getImageWidth(), src.getImageHeight(),
                    wallpaperSize.x, wallpaperSize.y, false);
            return wallpaperSize.x / crop.width();
        }
    }, new Runnable() {

        @Override
        public void run() {
            if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) {
                a.setWallpaperButtonEnabled(true);
            }
        }
    });
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:27,代码来源:WallpaperPickerActivity.java

示例2: onLoadRequestComplete

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
protected void onLoadRequestComplete(LoadRequest req, boolean success) {
    mCurrentLoadRequest = null;
    if (success) {
        TileSource oldSrc = mCropView.getTileSource();
        mCropView.setTileSource(req.result, null);
        mCropView.setTouchEnabled(req.touchEnabled);
        if (req.moveToLeft) {
            mCropView.moveToLeft();
        }
        if (req.scaleProvider != null) {
            mCropView.setScale(req.scaleProvider.getScale(req.result));
        }

        // Free last image
        if (oldSrc != null) {
            // Call yield instead of recycle, as we only want to free GL resource.
            // We can still reuse the bitmap for decoding any other image.
            oldSrc.getPreview().yield();
        }
        addReusableBitmap(oldSrc);
    }
    if (req.postExecute != null) {
        req.postExecute.run();
    }
    mProgressView.setVisibility(View.GONE);
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:27,代码来源:WallpaperCropActivity.java

示例3: onLoadRequestComplete

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
protected void onLoadRequestComplete(LoadRequest req, boolean success) {
    mCurrentLoadRequest = null;
    if (success) {
        TileSource oldSrc = mCropView.getTileSource();
        mCropView.setTileSource(req.result, null);
        mCropView.setTouchEnabled(req.touchEnabled);
        if (req.moveToLeft) {
            mCropView.moveToLeft();
        }
        if (req.scaleAndOffsetProvider != null) {
            req.scaleAndOffsetProvider.updateCropView(this, req.result);
        }

        // Free last image
        if (oldSrc != null) {
            // Call yield instead of recycle, as we only want to free GL resource.
            // We can still reuse the bitmap for decoding any other image.
            oldSrc.getPreview().yield();
        }
        addReusableBitmap(oldSrc);
    }
    if (req.postExecute != null) {
        req.postExecute.run();
    }
    mProgressView.setVisibility(View.GONE);
}
 
开发者ID:RunasSudo,项目名称:FLauncher,代码行数:27,代码来源:WallpaperCropActivity.java

示例4: updateCropView

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
public void updateCropView(WallpaperCropActivity a, TileSource src) {
    Point wallpaperSize = WallpaperUtils.getDefaultWallpaperSize(
            a.getResources(), a.getWindowManager());
    RectF crop = Utils.getMaxCropRect(src.getImageWidth(), src.getImageHeight(),
            wallpaperSize.x, wallpaperSize.y, false /* leftAligned */);

    float scale = getScale(wallpaperSize, crop);
    PointF center = a.mCropView.getCenter();

    // Offsets wallpaper preview according to the state it will be displayed in upon
    // returning home. Offset ranges from 0 to 1, where 0 is the leftmost parallax and
    // 1 is the rightmost.
    // Make sure the offset is in the correct range.
    float offset = Math.max(0, Math.min(getParallaxOffset(), 1));
    float screenWidth = a.mCropView.getWidth() / scale;
    center.x = screenWidth / 2 + offset * (crop.width() - screenWidth) + crop.left;
    a.mCropView.setScaleAndCenter(scale, center.x, center.y);
}
 
开发者ID:RunasSudo,项目名称:FLauncher,代码行数:19,代码来源:WallpaperCropActivity.java

示例5: setTileSource

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
public void setTileSource(TileSource source, Runnable isReadyCallback) {
    super.setTileSource(source, isReadyCallback);
    mCenterX = mRenderer.centerX;
    mCenterY = mRenderer.centerY;
    mRotateMatrix.reset();
    mRotateMatrix.setRotate(mRenderer.rotation);
    mInverseRotateMatrix.reset();
    mInverseRotateMatrix.setRotate(-mRenderer.rotation);
    updateMinScale(getWidth(), getHeight(), source, true);
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:11,代码来源:CropView.java

示例6: updateMinScale

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
private void updateMinScale(int w, int h, TileSource source, boolean resetScale) {
    synchronized (mLock) {
        if (resetScale) {
            mRenderer.scale = 1;
        }
        if (source != null) {
            final float[] imageDims = getImageDims();
            final float imageWidth = imageDims[0];
            final float imageHeight = imageDims[1];
            mMinScale = Math.max(w / imageWidth, h / imageHeight);
            mRenderer.scale =
                    Math.max(mMinScale, resetScale ? Float.MIN_VALUE : mRenderer.scale);
        }
    }
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:16,代码来源:CropView.java

示例7: addReusableBitmap

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
@Thunk void addReusableBitmap(TileSource src) {
    synchronized (mReusableBitmaps) {
        if (Utilities.ATLEAST_KITKAT && src instanceof BitmapRegionTileSource) {
            Bitmap preview = ((BitmapRegionTileSource) src).getBitmap();
            if (preview != null && preview.isMutable()) {
                mReusableBitmaps.add(preview);
            }
        }
    }
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:11,代码来源:WallpaperCropActivity.java

示例8: setTileSource

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
public void setTileSource(TileSource source, Runnable isReadyCallback) {
    synchronized (mLock) {
        mRenderer.source = source;
        mRenderer.isReadyCallback = isReadyCallback;
        mRenderer.centerX = source != null ? source.getImageWidth() / 2 : 0;
        mRenderer.centerY = source != null ? source.getImageHeight() / 2 : 0;
        mRenderer.rotation = source != null ? source.getRotation() : 0;
        mRenderer.scale = 0;
        updateScaleIfNecessaryLocked(mRenderer);
    }
    invalidate();
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:13,代码来源:TiledImageView.java

示例9: setTileSource

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
public void setTileSource(TileSource source, Runnable isReadyCallback) {
    if (!IS_SUPPORTED) {
        return;
    }
    synchronized (mLock) {
        mRenderer.source = source;
        mRenderer.isReadyCallback = isReadyCallback;
        mRenderer.centerX = source != null ? source.getImageWidth() / 2 : 0;
        mRenderer.centerY = source != null ? source.getImageHeight() / 2 : 0;
        mRenderer.rotation = source != null ? source.getRotation() : 0;
        mRenderer.scale = 0;
        updateScaleIfNecessaryLocked(mRenderer);
    }
    invalidate();
}
 
开发者ID:Phonemetra,项目名称:TurboLauncher,代码行数:16,代码来源:TiledImageView.java

示例10: getCropViewScaleAndOffsetProvider

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
@Override
protected CropViewScaleAndOffsetProvider getCropViewScaleAndOffsetProvider() {
    if (mExtras != null) {
        return new CropViewScaleAndOffsetProvider() {
            @Override
            public void updateCropView(WallpaperCropActivity a, TileSource src) {
                a.mCropView.setScaleAndCenter(mExtras[0], mExtras[1], mExtras[2]);
            }
        };
    }
    return null;
}
 
开发者ID:RunasSudo,项目名称:FLauncher,代码行数:13,代码来源:SavedWallpaperImages.java

示例11: getTileSource

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
public TileSource getTileSource() {
    return mRenderer.source;
}
 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:4,代码来源:TiledImageView.java

示例12: getScale

import com.android.photos.views.TiledImageRenderer.TileSource; //导入依赖的package包/类
float getScale(TileSource src); 
开发者ID:Mr-lin930819,项目名称:SimplOS,代码行数:2,代码来源:WallpaperCropActivity.java


注:本文中的com.android.photos.views.TiledImageRenderer.TileSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。