Example usage for android.widget TextView setScaleY

List of usage examples for android.widget TextView setScaleY

Introduction

In this page you can find the example usage for android.widget TextView setScaleY.

Prototype

public void setScaleY(float scaleY) 

Source Link

Document

Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width.

Usage

From source file:com.icenler.lib.view.LivingTabsLayout.java

private void setScalePosition(final int position, final float positionOffset, final int oldPosition,
        final int pendingPosition) {
    if (!animationRunning) {
        int newPosition = position;

        float scale = positionOffset;
        if (position == oldPosition) {
            //TODO solve out of bound
            newPosition = position + 1;/*w w w  .  java  2s.c  o m*/
        } else {
            scale = 1 - scale;
        }

        if (pendingPosition != -1) {
            newPosition = pendingPosition;
        }

        final LivingTab newTab = tabs.get(newPosition);
        TextView newTv = newTab.textView;

        newTv.setScaleY(scale);
        newTv.setScaleX(scale);
        ImageView newIv = newTab.iconView;
        float inversedScale = 1 - scale;
        newIv.setScaleY(inversedScale);
        newIv.setScaleX(inversedScale);

        final LivingTab oldTab = tabs.get(oldPosition);
        TextView oldTv = oldTab.textView;
        oldTv.setScaleY(inversedScale);
        oldTv.setScaleX(inversedScale);
        ImageView oldIv = oldTab.iconView;
        oldIv.setScaleY(scale);
        oldIv.setScaleX(scale);
    }
}

From source file:com.lcc.view.LivingTabsLayout.java

private void setScalePosition(final int position, final float positionOffset, final int oldPosition,
        final int pendingPosition) {
    if (!animationRunning) {
        int newPosition = position;

        float scale = positionOffset;
        if (position == oldPosition) {
            newPosition = position + 1;//www  .ja v a  2s .com
        } else {
            scale = 1 - scale;
        }
        if (pendingPosition != -1) {
            newPosition = pendingPosition;

        }

        final LivingTab newTab = tabs.get(newPosition);
        TextView newTv = newTab.textView;

        newTv.setScaleY(scale);
        newTv.setScaleX(scale);
        ImageView newIv = newTab.iconView;
        float inversedScale = 1 - scale;
        newIv.setScaleY(inversedScale);
        newIv.setScaleX(inversedScale);

        final LivingTab oldTab = tabs.get(oldPosition);
        TextView oldTv = oldTab.textView;
        oldTv.setScaleY(inversedScale);
        oldTv.setScaleX(inversedScale);
        ImageView oldIv = oldTab.iconView;
        oldIv.setScaleY(scale);
        oldIv.setScaleX(scale);
    }
}

From source file:com.github.saiff35.livingtabs.LivingTabsLayout.java

private void setScalePosition(final int position, final float positionOffset, final int oldPosition,
        final int pendingPosition) {
    if (!animationRunning) {
        int newPosition = position;

        float scale = positionOffset;
        if (position == oldPosition) {
            //TODO solve out of bound
            newPosition = position + 1;/*from w ww.  j a v  a2 s.  c  om*/

        } else {
            scale = 1 - scale;
        }
        if (pendingPosition != -1) {
            newPosition = pendingPosition;

        }
        final LivingTab newTab = tabs.get(newPosition);
        TextView newTv = newTab.textView;

        newTv.setScaleY(scale);
        newTv.setScaleX(scale);
        ImageView newIv = newTab.iconView;
        float inversedScale = 1 - scale;
        newIv.setScaleY(inversedScale);
        newIv.setScaleX(inversedScale);

        final LivingTab oldTab = tabs.get(oldPosition);
        TextView oldTv = oldTab.textView;
        oldTv.setScaleY(inversedScale);
        oldTv.setScaleX(inversedScale);
        ImageView oldIv = oldTab.iconView;
        oldIv.setScaleY(scale);
        oldIv.setScaleX(scale);
    }
}

From source file:com.icenler.lib.view.LivingTabsLayout.java

@Override
public void setupWithViewPager(@NonNull ViewPager viewPager) {
    final PagerAdapter adapter = viewPager.getAdapter();

    DrawableResIconAdapter drawableResIconAdapter = null;
    DrawableIconAdapter drawableIconAdapter = null;

    boolean isDrawableResAdapter;
    if ((isDrawableResAdapter = adapter instanceof DrawableResIconAdapter)) {
        drawableResIconAdapter = (DrawableResIconAdapter) adapter;
    } else if (adapter instanceof DrawableIconAdapter) {
        drawableIconAdapter = (DrawableIconAdapter) adapter;
    } else {/*  www . j  av  a 2 s. c o m*/
        throw new IllegalArgumentException(
                "ViewPager's adapter must implement either DrawableIconAdapter or DrawableResIconAdapter");
    }
    super.setupWithViewPager(viewPager);

    final int selectedTabPosition = getSelectedTabPosition();
    final int count = adapter.getCount();
    if (tabs == null)
        tabs = new ArrayList<>(count);
    else {
        tabs.clear();
    }
    for (int i = 0; i < count; ++i) {
        Tab t = super.getTabAt(i);
        if (isDrawableResAdapter)
            t.setIcon(drawableResIconAdapter.getIcon(i));
        else
            t.setIcon(drawableIconAdapter.getIcon(i));
        final LivingTab tab = newLivingTab(t);
        //  .setText(adapter.getPageTitle(i))
        //.setIcon(icons.get(i));
        addTab(tab);

        if (i != selectedTabPosition) {
            final TextView textView = tab.textView;
            textView.setScaleY(SCALE_HIDDEN);
            textView.setScaleX(SCALE_HIDDEN);
        } else {
            final ImageView iconView = tab.iconView;
            iconView.setScaleY(SCALE_HIDDEN);
            iconView.setScaleX(SCALE_HIDDEN);
        }
    }

    viewPager.addOnPageChangeListener(new LivingTabsOnPageChangeListener(this));
}

From source file:com.github.saiff35.livingtabs.LivingTabsLayout.java

@Override
public void setupWithViewPager(@NonNull ViewPager viewPager) {

    final PagerAdapter adapter = viewPager.getAdapter();
    DrawableResIconAdapter drawableResIconAdapter = null;
    DrawableIconAdapter drawableIconAdapter = null;
    boolean isDrawableResAdapter;
    if ((isDrawableResAdapter = adapter instanceof DrawableResIconAdapter)) {
        drawableResIconAdapter = (DrawableResIconAdapter) adapter;
    } else if (adapter instanceof DrawableIconAdapter) {
        drawableIconAdapter = (DrawableIconAdapter) adapter;
    } else {//from  www. ja  va  2s .c om
        throw new IllegalArgumentException(
                "ViewPager's adapter must implement either DrawableIconAdapter or DrawableResIconAdapter");
    }
    super.setupWithViewPager(viewPager);

    final int selectedTabPosition = getSelectedTabPosition();
    final int count = adapter.getCount();
    if (tabs == null)
        tabs = new ArrayList<>(count);
    else {
        tabs.clear();
    }
    for (int i = 0; i < count; ++i) {
        Tab t = super.getTabAt(i);
        if (isDrawableResAdapter)
            t.setIcon(drawableResIconAdapter.getIcon(i));
        else
            t.setIcon(drawableIconAdapter.getIcon(i));
        final LivingTab tab = newLivingTab(t);
        //  .setText(adapter.getPageTitle(i))
        //.setIcon(icons.get(i));
        addTab(tab);

        if (i != selectedTabPosition) {
            final TextView textView = tab.textView;
            textView.setScaleY(SCALE_HIDDEN);
            textView.setScaleX(SCALE_HIDDEN);
        } else {
            final ImageView iconView = tab.iconView;
            iconView.setScaleY(SCALE_HIDDEN);
            iconView.setScaleX(SCALE_HIDDEN);
        }
    }

    viewPager.addOnPageChangeListener(new LivingTabsOnPageChangeListener(this));
}

From source file:cn.wander.Utils.views.pageindicator.TabPageIndicator.java

@SuppressLint("NewApi")
private void setTextScale(TextView tv, float scale) {
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        tv.setScaleX(scale);/*from  w w w.j  a  v  a2s  .  c o m*/
        tv.setScaleY(scale);
    }
}

From source file:com.zhejunzhu.ucviewpager.weight.StreamTabIndicator.java

public void clearTabChang(int currentIndex) {
    for (int i = 0; i < mTabLayout.getChildCount(); i++) {
        if (currentIndex == i) {
            continue;
        }//from w  w w  .  j a  v a2s  .  c o  m
        TextView tab = (TextView) mTabLayout.getChildAt(i);
        if (tab != null) {
            tab.setTextColor(mUnSelectColor);
            tab.setScaleX(1);
            tab.setScaleY(1);
        }
    }
}

From source file:com.zhejunzhu.ucviewpager.weight.StreamTabIndicator.java

@Override
public void onPageScrolled(int index, float process, int arg2) {
    LLog.e("indicator onPageScrolled : " + index + "   " + process + "   " + arg2);
    TextView leftTab = (TextView) mTabLayout.getChildAt(index);
    TextView rightTab = (TextView) mTabLayout.getChildAt(index + 1);
    if (leftTab != null) {
        leftTab.setTextColor(Color.rgb((int) (11 + 177 * process), 188, 188));
        leftTab.setScaleX(1 + (1 - process) / 8);
        leftTab.setScaleY(1 + (1 - process) / 8);
    }/*from   w  ww. j  a va2 s .  c  o  m*/
    if (rightTab != null) {
        rightTab.setTextColor(Color.rgb((int) (188 - process * 177), 188, 188));
        rightTab.setScaleX(1 + process / 8);
        rightTab.setScaleY(1 + process / 8);
    }
    if (mListener != null) {
        mListener.onPageScrolled(index, process, arg2);
    }
    if (process == 0f) {
        clearTabChang(index);
    }
}

From source file:com.android.tv.menu.MenuLayoutManager.java

private void setTempTitleView(TextView dest, TextView src) {
    dest.setVisibility(View.VISIBLE);
    dest.setText(src.getText());/*from ww w .java2  s .  c o  m*/
    dest.setTranslationY(0.0f);
    if (src.getVisibility() == View.VISIBLE) {
        dest.setAlpha(src.getAlpha());
        dest.setScaleX(src.getScaleX());
        dest.setScaleY(src.getScaleY());
    } else {
        dest.setAlpha(0.0f);
        dest.setScaleX(1.0f);
        dest.setScaleY(1.0f);
    }
    View parent = (View) src.getParent();
    dest.setLeft(src.getLeft() + parent.getLeft());
    dest.setRight(src.getRight() + parent.getLeft());
    dest.setTop(src.getTop() + parent.getTop());
    dest.setBottom(src.getBottom() + parent.getTop());
}