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


Java Settings类代码示例

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


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

示例1: setImageDrawable

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
@Override
public void setImageDrawable(Drawable dr) {
    super.setImageDrawable(dr);

    // Method setImageDrawable can be called from super constructor,
    // so we have to ensure controller instance is created at this point.
    ensureControllerCreated();

    Settings settings = mController.getSettings();
    int oldW = settings.getImageW(), oldH = settings.getImageH();

    if (dr == null) {
        settings.setImage(0, 0);
    } else if (dr.getIntrinsicWidth() == -1 || dr.getIntrinsicHeight() == -1) {
        settings.setImage(settings.getMovementAreaW(), settings.getMovementAreaH());
    } else {
        settings.setImage(dr.getIntrinsicWidth(), dr.getIntrinsicHeight());
    }

    if (oldW != settings.getImageW() || oldH != settings.getImageH()) {
        mController.resetState();
    }
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:24,代码来源:GestureImageView.java

示例2: ViewHolderItemImage

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
public ViewHolderItemImage(View itemView) {
    super(itemView);
    ButterKnife.bind(this,itemView);

    itemImage.getController().getSettings().enableGestures();

    itemImage.getController().getSettings()
            .setMaxZoom(2f)
            .setPanEnabled(true)
            .setZoomEnabled(true)
            .setDoubleTapEnabled(true)
            .setRotationEnabled(false)
            .setRestrictRotation(false)
            .setOverscrollDistance(0f, 0f)
            .setOverzoomFactor(2f)
            .setFillViewport(false)
            .setFitMethod(Settings.Fit.INSIDE)
            .setGravity(Gravity.CENTER);


}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-End-User-Android-app,代码行数:22,代码来源:AdapterItemImages.java

示例3: onCreateViewHolder

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup container) {


    ViewHolderPaintings holder = new ViewHolderPaintings(container);
    holder.image.getController().enableScrollInViewPager(viewPager);

    holder.image.getController().getSettings()
            .setMaxZoom(2f)
            .setPanEnabled(true)
            .setZoomEnabled(true)
            .setDoubleTapEnabled(true)
            .setRotationEnabled(false)
            .setRestrictRotation(false)
            .setOverscrollDistance(0f, 0f)
            .setOverzoomFactor(2f)
            .setFillViewport(false)
            .setFitMethod(Settings.Fit.INSIDE)
            .setGravity(Gravity.CENTER);

    return holder;
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-End-User-Android-app,代码行数:23,代码来源:ImagePagerAdapter.java

示例4: apply

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
@Override
public void apply(GestureView view) {
    Context context = ((View) view).getContext();
    float overscrollX = isOverscrollXEnabled ? OVERSCROLL : 0f;
    float overscrollY = isOverscrollYEnabled ? OVERSCROLL : 0f;
    float overzoom = isOverzoomEnabled ? Settings.OVERZOOM_FACTOR : 1f;

    view.getController().getSettings()
            .setPanEnabled(isPanEnabled)
            .setZoomEnabled(isZoomEnabled)
            .setDoubleTapEnabled(isZoomEnabled)
            .setRotationEnabled(isRotationEnabled)
            .setRestrictRotation(isRestrictRotation)
            .setOverscrollDistance(context, overscrollX, overscrollY)
            .setOverzoomFactor(overzoom)
            .setExitEnabled(isExitEnabled)
            .setFillViewport(isFillViewport)
            .setFitMethod(fitMethod)
            .setGravity(gravity)
            .setAnimationsDuration(isSlow ? SLOW_ANIMATIONS : Settings.ANIMATIONS_DURATION);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:22,代码来源:SettingsMenu.java

示例5: updateToState

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
private void updateToState() {
    if (mIsToUpdated) {
        return;
    }

    Settings settings = mToController == null ? null : mToController.getSettings();

    if (mToPos == null || settings == null || !settings.hasImageSize()) {
        return;
    }

    // Computing 'To' clip by getting current 'To' image rect in 'To' view coordinates
    // (including view paddings which are not part of viewport)
    mToClip.set(0, 0, settings.getImageW(), settings.getImageH());
    mToState.get(TMP_MATRIX);
    TMP_MATRIX.mapRect(mToClip);

    mToPivotX = mToClip.centerX();
    mToPivotY = mToClip.centerY();

    int paddingLeft = mToPos.viewport.left - mToPos.view.left;
    int paddingTop = mToPos.viewport.top - mToPos.view.top;
    mToClip.offset(paddingLeft, paddingTop);

    mIsToUpdated = true;

    if (GestureDebug.isDebugAnimator()) {
        Log.d(TAG, "'To' state updated");
    }
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:31,代码来源:ViewPositionAnimator.java

示例6: crop

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
/**
 * Crops image drawable into bitmap according to current image position
 */
public static Bitmap crop(Drawable drawable, State state, Settings settings) {
    if (drawable == null) {
        return null;
    }

    float zoom = state.getZoom();

    // Computing crop size for base zoom level (zoom == 1)
    int w = Math.round(settings.getMovementAreaW() / zoom);
    int h = Math.round(settings.getMovementAreaH() / zoom);

    // Crop area coordinates within viewport
    Rect pos = MovementBounds.getMovementAreaWithGravity(settings);

    Matrix matrix = new Matrix();
    state.get(matrix);
    // Scaling to base zoom level (zoom == 1)
    matrix.postScale(1f / zoom, 1f / zoom, pos.left, pos.top);
    // Positioning crop area
    matrix.postTranslate(-pos.left, -pos.top);

    try {
        // Draw drawable into bitmap
        Bitmap dst = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);

        Canvas canvas = new Canvas(dst);
        canvas.concat(matrix);
        drawable.draw(canvas);

        return dst;
    } catch (OutOfMemoryError e) {
        return null; // Not enough memory for cropped bitmap
    }
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:38,代码来源:CropUtils.java

示例7: getPositionWithGravity

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
/**
 * Returns image position within the viewport area with gravity applied,
 * not taking into account image position specified by matrix.
 */
private static Rect getPositionWithGravity(Matrix matrix, Settings settings) {
    RECT_TMP_F.set(0, 0, settings.getImageW(), settings.getImageH());
    matrix.mapRect(RECT_TMP_F);
    final int w = Math.round(RECT_TMP_F.width());
    final int h = Math.round(RECT_TMP_F.height());

    // Calculating image position basing on gravity
    RECT_TMP.set(0, 0, settings.getViewportW(), settings.getViewportH());
    Gravity.apply(settings.getGravity(), w, h, RECT_TMP, RECT_POS);

    return RECT_POS;
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:17,代码来源:MovementBounds.java

示例8: getMovementAreaWithGravity

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
public static Rect getMovementAreaWithGravity(Settings settings) {
    // Calculating movement area position basing on gravity
    RECT_TMP.set(0, 0, settings.getViewportW(), settings.getViewportH());
    Gravity.apply(settings.getGravity(),
            settings.getMovementAreaW(), settings.getMovementAreaH(), RECT_TMP, RECT_MOV_AREA);
    return RECT_MOV_AREA;
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:8,代码来源:MovementBounds.java

示例9: getDefaultPivot

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
public static Point getDefaultPivot(Settings settings) {
    // Calculating movement area position basing on gravity
    Rect movArea = getMovementAreaWithGravity(settings);
    Gravity.apply(settings.getGravity(), 0, 0, movArea, RECT_TMP);
    POINT_PIVOT.set(RECT_TMP.left, RECT_TMP.top);
    return POINT_PIVOT;
}
 
开发者ID:BubbleOctopus,项目名称:Album,代码行数:8,代码来源:MovementBounds.java

示例10: setValuesFrom

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
public void setValuesFrom(Settings settings) {
    isPanEnabled = settings.isPanEnabled();
    isZoomEnabled = settings.isZoomEnabled();
    isRotationEnabled = settings.isRotationEnabled();
    isRestrictRotation = settings.isRestrictRotation();
    isExitEnabled = settings.isExitEnabled();
    isFillViewport = settings.isFillViewport();
    fitMethod = settings.getFitMethod();
    gravity = settings.getGravity();
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:11,代码来源:SettingsMenu.java

示例11: onCreateOptionsMenu

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
public void onCreateOptionsMenu(Menu menu) {
    addBoolMenu(menu, isPanEnabled, R.string.menu_enable_pan);
    addBoolMenu(menu, isZoomEnabled, R.string.menu_enable_zoom);
    addBoolMenu(menu, isRotationEnabled, R.string.menu_enable_rotation);
    addBoolMenu(menu, isRestrictRotation, R.string.menu_restrict_rotation);
    addBoolMenu(menu, isOverscrollXEnabled, R.string.menu_enable_overscroll_x);
    addBoolMenu(menu, isOverscrollYEnabled, R.string.menu_enable_overscroll_y);
    addBoolMenu(menu, isOverzoomEnabled, R.string.menu_enable_overzoom);
    addBoolMenu(menu, isExitEnabled, R.string.menu_enable_exit);
    addBoolMenu(menu, isFillViewport, R.string.menu_fill_viewport);
    addSubMenu(menu, Settings.Fit.values(), fitMethod, R.string.menu_fit_method);
    addSubMenu(menu, GravityType.values(), GravityType.find(gravity), R.string.menu_gravity);
    addBoolMenu(menu, isSlow, R.string.menu_enable_slow);
    addBoolMenu(menu, GestureDebug.isDrawDebugOverlay(), R.string.menu_enable_overlay);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:16,代码来源:SettingsMenu.java

示例12: setImageDrawable

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
@Override
public void setImageDrawable(Drawable drawable) {
    super.setImageDrawable(drawable);

    // Method setImageDrawable can be called from super constructor,
    // so we have to ensure controller instance is created at this point.
    ensureControllerCreated();

    Settings settings = controller.getSettings();

    // Saving old image size
    float oldWidth = settings.getImageW();
    float oldHeight = settings.getImageH();

    // Setting image size
    if (drawable == null) {
        settings.setImage(0, 0);
    } else if (drawable.getIntrinsicWidth() == -1 || drawable.getIntrinsicHeight() == -1) {
        settings.setImage(settings.getMovementAreaW(), settings.getMovementAreaH());
    } else {
        settings.setImage(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    }

    // Getting new image size
    float newWidth = settings.getImageW();
    float newHeight = settings.getImageH();

    if (newWidth > 0f && newHeight > 0f && oldWidth > 0f && oldHeight > 0f) {
        float scaleFactor = Math.min(oldWidth / newWidth, oldHeight / newHeight);
        controller.getStateController().setTempZoomPatch(scaleFactor);
        controller.updateState();
        controller.getStateController().setTempZoomPatch(0f);
    } else {
        controller.resetState();
    }
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:37,代码来源:GestureImageView.java

示例13: updateToState

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
private void updateToState() {
    if (isToUpdated) {
        return;
    }

    Settings settings = toController == null ? null : toController.getSettings();

    if (toPos == null || settings == null || !settings.hasImageSize()) {
        return;
    }

    toState.get(tmpMatrix);

    // 'To' clip is a 'To' image rect in 'To' view coordinates
    toClip.set(0, 0, settings.getImageW(), settings.getImageH());

    // Computing pivot point as center of the image after transformation
    tmpPointArr[0] = toClip.centerX();
    tmpPointArr[1] = toClip.centerY();
    tmpMatrix.mapPoints(tmpPointArr);

    toPivotX = tmpPointArr[0];
    toPivotY = tmpPointArr[1];

    // Computing clip rect in 'To' view coordinates without rotation
    tmpMatrix.postRotate(-toState.getRotation(), toPivotX, toPivotY);
    tmpMatrix.mapRect(toClip);
    toClip.offset(toPos.viewport.left - toPos.view.left, toPos.viewport.top - toPos.view.top);

    // 'To' bounds clip is entire 'To' view rect in 'To' view coordinates
    toBoundsClip.set(0f, 0f, toPos.view.width(), toPos.view.height());

    isToUpdated = true;

    if (GestureDebug.isDebugAnimator()) {
        Log.d(TAG, "'To' state updated");
    }
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:39,代码来源:ViewPositionAnimator.java

示例14: setImageView

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
public void setImageView(GestureImageView imageView) {
    this.imageView = imageView;

    // Setting required parameters
    imageView.getController().getSettings()
            .setFitMethod(Settings.Fit.OUTSIDE)
            .setFillViewport(true);

    update(false);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:11,代码来源:CropAreaView.java

示例15: getImagePosition

import com.alexvasilkov.gestures.Settings; //导入依赖的package包/类
/**
 * Calculates image position (scaled and rotated) within viewport area with gravity applied.
 *
 * @param matrix Image matrix
 * @param settings Image settings
 * @param out Output rectangle
 */
public static void getImagePosition(Matrix matrix, Settings settings, Rect out) {
    tmpRectF.set(0, 0, settings.getImageW(), settings.getImageH());

    matrix.mapRect(tmpRectF);

    final int w = Math.round(tmpRectF.width());
    final int h = Math.round(tmpRectF.height());

    // Calculating image position basing on gravity
    tmpRect1.set(0, 0, settings.getViewportW(), settings.getViewportH());
    Gravity.apply(settings.getGravity(), w, h, tmpRect1, out);
}
 
开发者ID:alexvasilkov,项目名称:GestureViews,代码行数:20,代码来源:GravityUtils.java


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