Example usage for android.widget ImageView getTag

List of usage examples for android.widget ImageView getTag

Introduction

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

Prototype

@ViewDebug.ExportedProperty
public Object getTag() 

Source Link

Document

Returns this view's tag.

Usage

From source file:com.github.tetravex_android.activity.HowToActivity.java

/**
 * Sets the page indicator dots at the bottom of the screen to indicate which page is displayed
 *
 * @param pageIndex the index of the page currently displayed
 *//*from  w w  w.  j  ava 2  s . c  om*/
private void setIndicatorDots(int pageIndex) {
    // set the indicator dot for the correct page
    LinearLayout dotGroup = (LinearLayout) findViewById(R.id.how_to_pager_dots);
    for (int i = 0; i < dotGroup.getChildCount(); i++) {
        ImageView view = (ImageView) dotGroup.getChildAt(i);
        String tagString = (String) view.getTag();
        int tagId = Integer.valueOf(tagString);

        if (tagId == pageIndex) {
            view.setImageResource(R.drawable.pager_dot_on);
        } else {
            view.setImageResource(R.drawable.pager_dot_off);
        }
    }
}

From source file:com.zhongyun.viewer.utils.VideoListImage.java

public void requestJpeg(String url, ImageView imageview, String cid) {
    if (url == null) {
        return;//w ww  .  ja  va2s .co  m
    }
    if (imageview.getTag() != null && imageview.getTag().equals(url)) {
        Bitmap bitMap = filesCache.get(url);
        if (null != bitMap) {
            imageview.setImageBitmap(bitMap);
            return;
        } else {
            if (null == getBitmapFromFile(imageview, url)) {
                long reqId = media.requestJpegFile(Long.valueOf(cid), url, this);
                viewMap.put(reqId, new LoadImage(imageview, url));
                return;
            }
        }
    }
}

From source file:com.github.tetravex_android.activity.HiScoreActivity.java

/**
 * Sets the page indicator dots at the bottom of the screen to indicate which page is displayed
 *
 * @param pageIndex the index of the page currently displayed
 *///from w  w w .  j a v  a2 s .  c om
private void setIndicatorDots(int pageIndex) {
    // set the indicator dot for the correct page
    LinearLayout dotGroup = (LinearLayout) findViewById(R.id.hi_score_dot_ll);
    for (int i = 0; i < dotGroup.getChildCount(); i++) {
        ImageView view = (ImageView) dotGroup.getChildAt(i);
        String tagString = (String) view.getTag();
        int tagId = Integer.valueOf(tagString);

        if (tagId == pageIndex) {
            view.setImageResource(R.drawable.pager_dot_on);
        } else {
            view.setImageResource(R.drawable.pager_dot_off);
        }
    }
}

From source file:com.dp.chapter01.part1.ImageLoader.java

public void displayImage(final String url, final ImageView imageView) {
    imageView.setTag(url);// w w  w.  j  av  a 2 s .  c  om
    mExecutorService.submit(new Runnable() {

        @Override
        public void run() {
            Bitmap bitmap = downloadImage(url);
            if (bitmap == null) {
                return;
            }
            if (imageView.getTag().equals(url)) {
                updateImageView(imageView, bitmap);
            }
            mImageCache.put(url, bitmap);
        }
    });
}

From source file:com.glabs.homegenie.adapters.MediaRendererWidgetAdapter.java

@Override
public void updateViewModel() {

    if (_module.View == null)
        return;/*from   www.  ja v a2 s . co m*/

    _updateRendererDisplayData();

    TextView title = (TextView) _module.View.findViewById(R.id.titleText);
    TextView subtitle = (TextView) _module.View.findViewById(R.id.subtitleText);
    TextView infotext = (TextView) _module.View.findViewById(R.id.infoText);

    title.setText(_module.getDisplayName());
    infotext.setVisibility(View.GONE);

    subtitle.setText(Control.getUpnpDisplayName(_module));
    //
    if (_module.getParameter("UPnP.StandardDeviceType") != null
            && !_module.getParameter("UPnP.StandardDeviceType").Value.trim().equals("")) {
        infotext.setText(_module.getParameter("UPnP.StandardDeviceType").Value);
        infotext.setVisibility(View.VISIBLE);
    }
    //
    final ImageView image = (ImageView) _module.View.findViewById(R.id.iconImage);
    if (image.getTag() == null && !(image.getDrawable() instanceof AsyncImageDownloadTask.DownloadedDrawable)) {
        AsyncImageDownloadTask asyncDownloadTask = new AsyncImageDownloadTask(image, true,
                new AsyncImageDownloadTask.ImageDownloadListener() {
                    @Override
                    public void imageDownloadFailed(String imageUrl) {
                    }

                    @Override
                    public void imageDownloaded(String imageUrl, Bitmap downloadedImage) {
                        image.setTag("CACHED");
                    }
                });
        asyncDownloadTask.download(Control.getHgBaseHttpAddress() + getModuleIcon(_module), image);
    }
}

From source file:de.questmaster.fatremote.fragments.RemoteFragment.java

@Override
public void onClick(View v) {

    // show button again
    EditText text = (EditText) c.findViewById(R.id.enterText);
    if (text.getVisibility() == View.VISIBLE) {
        hideKeyboard();//from   w  w  w .j a v  a2 s .co m
    }

    // solve to code
    if (v instanceof ImageView) {
        ImageView bv = (ImageView) v; // NOSONAR
        String t = (String) bv.getTag();

        if (t.equals("text")) {
            showKeyboard();
            return;
        } else {
            keyCode = Integer.decode(t).shortValue();
        }
    }
    keyModifier = 0x00;

    // send keyCode
    invokeSend();
}

From source file:com.owncloud.android.ui.adapter.UserListAdapter.java

@Override
public boolean shouldCallGeneratedCallback(String tag, Object callContext) {
    if (callContext instanceof ImageView) {
        ImageView iv = (ImageView) callContext;
        return String.valueOf(iv.getTag()).equals(tag);
    }/* w w  w . jav a 2s .c  om*/
    return false;
}

From source file:fr.paug.droidcon.util.LPreviewUtilsBase.java

public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate,
        int resIdChecked) {

    final int imageResId = isCheck ? resIdChecked : R.drawable.add_schedule_button_icon_unchecked;

    if (imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();// ww w .  java 2s.  c o  m
            imageView.setAlpha(1f);
        }
    }

    if (allowAnimate && isCheck) {
        int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

From source file:com.google.samples.apps.iosched.util.LPreviewUtilsBase.java

public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate) {
    final int imageResId = isCheck ? R.drawable.add_schedule_button_icon_checked
            : R.drawable.add_schedule_button_icon_unchecked;

    if (imageView.getTag() != null) {
        if (imageView.getTag() instanceof Animator) {
            Animator anim = (Animator) imageView.getTag();
            anim.end();//from   w  w  w  .j  a v  a2 s .c  om
            imageView.setAlpha(1f);
        }
    }

    if (allowAnimate && isCheck) {
        int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime);

        Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f);
        outAnimator.setDuration(duration / 2);
        outAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setImageResource(imageResId);
            }
        });

        AnimatorSet inAnimator = new AnimatorSet();
        outAnimator.setDuration(duration);
        inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f),
                ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f));

        AnimatorSet set = new AnimatorSet();
        set.playSequentially(outAnimator, inAnimator);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                imageView.setTag(null);
            }
        });
        imageView.setTag(set);
        set.start();
    } else {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                imageView.setImageResource(imageResId);
            }
        });
    }
}

From source file:org.cyanogenmod.theme.chooser.AudiblePreviewFragment.java

private void stopMediaPlayers() {
    if (mContent == null)
        return;//w  w  w  .  j  a v a2 s .co m
    final int numChildern = mContent.getChildCount();
    for (int i = 0; i < numChildern; i++) {
        ImageView iv = (ImageView) mContent.getChildAt(i).findViewById(R.id.btn_play_pause);
        if (iv != null) {
            iv.setImageResource(android.R.drawable.ic_media_play);
            MediaPlayer mp = (MediaPlayer) iv.getTag();
            if (mp != null && mp.isPlaying()) {
                mp.pause();
                mp.seekTo(0);
            }
        }
    }
}