Java Code Examples for android.widget.ImageView.setScaleX()

The following are Jave code examples for showing how to use setScaleX() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GitHub   File: GuidePageActivity2.java   View Source Code Vote up 8 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    r = (int)Math.sqrt(screenW * screenW + screenH * screenH) + 10;

    ImageView earth = (ImageView) findViewById(R.id.earth);
    targetPlanet = (ImageView) findViewById(R.id.planet_target);
    loginLayout = findViewById(R.id.login_layout);

    earth.setY(screenH / 2);
    targetPlanet.setY(-screenH / 2 - screenW / 2);
    targetPlanet.setScaleX(0.25f);
    targetPlanet.setScaleY(0.25f);

    wowo.addTemporarilyInvisibleViews(0, earth, findViewById(R.id.cloud_blue), findViewById(R.id.cloud_red));
    wowo.addTemporarilyInvisibleViews(0, targetPlanet);
    wowo.addTemporarilyInvisibleViews(2, loginLayout, findViewById(R.id.button));
}
 
Example 2
Project: GravityBox   File: CellularTile.java   View Source Code Vote up 7 votes
@Override
public void onCreateTileView(View tileView) throws Throwable {
    super.onCreateTileView(tileView);

    if (isPrimary() && hasField(tileView, "mIconFrame") && !Utils.isOxygenOs35Rom()) {
        mDataOffView = new ImageView(mContext);
        mDataOffView.setImageDrawable(mGbContext.getDrawable(R.drawable.ic_mobile_data_off));
        mDataOffView.setVisibility(View.GONE);
        FrameLayout iconFrame = (FrameLayout) XposedHelpers.getObjectField(tileView, "mIconFrame");
        iconFrame.addView(mDataOffView, FrameLayout.LayoutParams.WRAP_CONTENT,
                FrameLayout.LayoutParams.WRAP_CONTENT);
        if (mScalingFactor != 1f) {
            mDataOffView.setScaleX(mScalingFactor);
            mDataOffView.setScaleY(mScalingFactor);
        }
        if (PhoneWrapper.hasMsimSupport()) {
            FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mDataOffView.getLayoutParams();
            int marginPx = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -4,
                    mContext.getResources().getDisplayMetrics()));
            lp.leftMargin = marginPx;
            lp.topMargin = Math.round(marginPx/2f);
            mDataOffView.setLayoutParams(lp);
        }
    }
}
 
Example 3
Project: SwipeSectorLayout   File: CustomTransformer.java   View Source Code Vote up 7 votes
@Override
public void transformPage(View view, float position) {

    int pageWidth = view.getWidth();
    ImageView imgView = (ImageView)view.findViewById(R.id.img);
    if (position < -1) { // [-Infinity,-1)
        // This page is way off-screen to the left.
    } else if (position <= 0) { // [-1,0]

        view.setAlpha((1 - MIN_ALPHA) * (1 - Math.abs(position)) + MIN_ALPHA);
        float transX = pageWidth * -position;
        view.setTranslationX(transX);
        float scale = (DEFAULT_SCALE - 1.0f) * (1 - Math.abs(position)) + 1;
        imgView.setScaleX(scale);
        imgView.setScaleY(scale);

    } else if (position <= 1) { // (0,1]
        imgView.setAlpha(1.0f);
        imgView.setScaleX(DEFAULT_SCALE);
        imgView.setScaleY(DEFAULT_SCALE);

    } else { // (1,+Infinity]
        // This page is way off-screen to the right.
    }
}
 
Example 4
Project: EasyTransition   File: DetailActivity.java   View Source Code Vote up 7 votes
private void initOtherViews() {
    layoutAbout = (LinearLayout) findViewById(R.id.layout_about);
    layoutAbout.setVisibility(View.VISIBLE);
    layoutAbout.setAlpha(0);
    layoutAbout.setTranslationY(-30);
    layoutAbout.animate()
            .setDuration(300)
            .alpha(1)
            .translationY(0);

    ivAdd = (ImageView) findViewById(R.id.iv_add);
    ivAdd.setVisibility(View.VISIBLE);
    ivAdd.setScaleX(0);
    ivAdd.setScaleY(0);
    ivAdd.animate()
            .setDuration(200)
            .scaleX(1)
            .scaleY(1);
}
 
Example 5
Project: Hotspot-master-devp   File: BitmapCommonUtils.java   View Source Code Vote up 6 votes
public static void setRotation(ImageView view,float degree) {
    view.setRotation(degree);
    if (view.getDrawable() != null) {
        if (degree == 90 || degree == 270) {
            int viewWidth = view.getDrawable().getIntrinsicWidth();// mImageView.getWidth();
            int viewHeight = view.getDrawable().getIntrinsicHeight();//mImageView.getHeight();
            view.setScaleX(viewWidth / (float) viewHeight);
            view.setScaleY(viewHeight / (float) viewHeight);
        } else {
            view.setScaleX(1);
            view.setScaleY(1);
        }
    }
}
 
Example 6
Project: ECardFlow   File: MoveAnimMode.java   View Source Code Vote up 6 votes
@Override
public void transformPage(ImageView ivBg, float position, int direction) {
    ivBg.setScaleX(mScale);
    ivBg.setScaleY(mScale);
    float totalMoveWidth = ivBg.getWidth() * ((mScale - 1) / 2);
    int lastPosition = Math.round(position);
    float mFraction;
    if (lastPosition % 2 == 0) {
        mFraction = -1 * (float) Math.sin(Math.PI * position);
    } else {
        mFraction = (float) Math.sin(Math.PI * position);
    }
    ivBg.setTranslationX(totalMoveWidth * mFraction);
}
 
Example 7
Project: ECardFlow   File: CrossMoveAnimMode.java   View Source Code Vote up 6 votes
@Override
public void transformPage(ImageView ivBg, float position, int direction) {
    ivBg.setScaleX(mScale);
    ivBg.setScaleY(mScale);
    float totalMoveWidth = ivBg.getWidth() * ((mScale - 1) / 2);
    int lastPosition = Math.round(position);
    float mFraction;
    if (lastPosition % 2 == 0) {
        mFraction = -1 * (float) Math.sin(Math.PI * position);
    } else {
        mFraction = (float) Math.sin(Math.PI * position);
    }
    ivBg.setTranslationY(totalMoveWidth * mFraction);
}
 
Example 8
Project: Rey-MusicPlayer   File: FolderAdapter.java   View Source Code Vote up 6 votes
public ItemHolder(View itemView) {
    super(itemView);

    mIconImage = (ImageView) itemView.findViewById(R.id.listViewLeftIcon);

    mTitle = (TextView) itemView.findViewById(R.id.listViewTitleText);
    mSubTitle = (TextView) itemView.findViewById(R.id.listViewSubText);
    duration = (TextView) itemView.findViewById(R.id.listViewRightSubText);
    duration.setVisibility(View.INVISIBLE);

    mTitle.setTypeface(TypefaceHelper.getTypeface(itemView.getContext().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));
    mSubTitle.setTypeface(TypefaceHelper.getTypeface(itemView.getContext().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));

    mOverFlow = (ImageView) itemView.findViewById(R.id.listViewOverflow);

    mOverFlow.setOnClickListener(this);
    mOverFlow.setVisibility(View.VISIBLE);
    mOverFlow.setOnClickListener(this);
    itemView.setOnClickListener(this);

    RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) itemView.getLayoutParams();
    params.height = (int) mApp.convertDpToPixels(72.0f, mContext);
    itemView.setLayoutParams(params);

    mIconImage.setScaleX(0.55f);
    mIconImage.setScaleY(0.55f);

}
 
Example 9
Project: ECardFlow   File: ScaleAnimMode.java   View Source Code Vote up 5 votes
@Override
public void transformPage(ImageView ivBg, float position, int direction) {
    float mFraction = mScaleRate * (float) Math.abs(Math.sin(Math.PI * position));
    ivBg.setScaleX(1 + mFraction);
    ivBg.setScaleY(1 + mFraction);
}