Example usage for android.widget ImageView ImageView

List of usage examples for android.widget ImageView ImageView

Introduction

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

Prototype

public ImageView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) 

Source Link

Usage

From source file:kr.popcorn.sharoom.activity.Fragment.Host.H_IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*  ww w  .  ja v  a  2s . com*/
    H_IconPagerAdapter iconAdapter = (H_IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));

        view.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                int index = ((ViewGroup) v.getParent()).indexOfChild(v);

                onPageSelected(index);

                //Log.d("aaa", index + " indicator selected : long click");

                //TODO show alternative tab list to change tab
            }
        });

        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }

    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:kr.baggum.awesomemusic.UI.View.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from  w  ww .j  a  v  a 2 s .  c o  m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));

        // attach click event to tab indicator
        //            view.setOnLongClickListener(new OnLongClickListener() {
        //                @Override
        //                public boolean onLongClick(View v) {
        //                    int index = ((ViewGroup) v.getParent()).indexOfChild(v);
        //
        //                    Log.d("aaa", index + " indicator selected : long click");
        //
        //                    //TODO show alternative tab list to change tab
        //                    return false;
        //                }
        //            });

        view.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                int index = ((ViewGroup) v.getParent()).indexOfChild(v);

                onPageSelected(index);

                //Log.d("aaa", index + " indicator selected : long click");

                //TODO show alternative tab list to change tab
            }
        });

        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:kr.popcorn.sharoom.activity.Fragment.User.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from www  .ja va 2s  .  c  o  m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));

        view.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                int index = ((ViewGroup) v.getParent()).indexOfChild(v);

                onPageSelected(index);

                //Log.d("aaa", index + " indicator selected : long click");

                //TODO show alternative tab list to change tab
            }
        });

        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }

    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:com.tandong.sa.vpic.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from   w w  w.  j  a v  a2  s.  c o m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null,
                getResources().getIdentifier("vpiIconPageIndicatorStyle", "attr", c.getPackageName()));

        view.setImageResource(iconAdapter.getIconResId(i));
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:com.velocityviewpagerindicator.VelocityIconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();//from   w  w  w.ja  v a  2 s  .  c  o  m
    VelocityIconPagerAdapter iconAdapter = (VelocityIconPagerAdapter) mVelocityViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:com.jana.android.ui.view.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from   w  w w  .j a  va 2 s  . co m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));
        view.setPadding(5, 0, 5, 0);
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:app.wenya.sketchbookpro.ui.view.looppager.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from   w w w .j a v  a2s  . c  o m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getPagerCount();
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    lp.leftMargin = 10;
    lp.rightMargin = 10;
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));
        view.setLayoutParams(lp);
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
}

From source file:com.machine.custom.viewpagerindicator.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from   w  w  w  .j a  va  2s. c om*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    if (iconStylesId == 0) {
        iconStylesId = R.attr.focusCricleStyle;
    }
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, iconStylesId);
        view.setImageResource(iconAdapter.getIconResId(i));
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
    //        isTransmit = true;
}

From source file:com.freegeek.android.materialbanner.view.indicator.IconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from w w  w  .j a v  a  2 s  .  c o  m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mViewPager.getAdapter();
    int count = iconAdapter.getCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    setCurrentItem(mSelectedIndex);
    requestLayout();
    invalidate();
}

From source file:com.viewpagerindicator.as.library.indicator.RecyclerIconPageIndicator.java

public void notifyDataSetChanged() {
    mIconsLayout.removeAllViews();/*from   w  w w.jav  a2  s . c  o m*/
    IconPagerAdapter iconAdapter = (IconPagerAdapter) mRecyclerView.getAdapter();
    int count = mRecyclerView.getAdapter().getItemCount();
    for (int i = 0; i < count; i++) {
        ImageView view = new ImageView(getContext(), null, R.attr.vpiIconPageIndicatorStyle);
        view.setImageResource(iconAdapter.getIconResId(i));
        mIconsLayout.addView(view);
    }
    if (mSelectedIndex > count) {
        mSelectedIndex = count - 1;
    }
    requestLayout();
}