Example usage for android.view View setTag

List of usage examples for android.view View setTag

Introduction

In this page you can find the example usage for android.view View setTag.

Prototype

public void setTag(int key, final Object tag) 

Source Link

Document

Sets a tag associated with this view and a key.

Usage

From source file:com.facebook.litho.MountState.java

private static void unsetAccessibilityDelegate(View view) {
    if (!(view instanceof ComponentHost) && view.getTag(R.id.component_node_info) == null) {
        return;/*from  ww  w  .j a  v a2  s .c  o  m*/
    }
    view.setTag(R.id.component_node_info, null);
    if (!(view instanceof ComponentHost)) {
        ViewCompat.setAccessibilityDelegate(view, null);
    }
}

From source file:com.nadmm.airports.wx.WxCursorAdapter.java

private void setViewHolder(View view) {
    ViewHolder holder = new ViewHolder();
    holder.stationName = (TextView) view.findViewById(R.id.wx_station_name);
    holder.stationId = (TextView) view.findViewById(R.id.wx_station_id);
    holder.stationInfo = (TextView) view.findViewById(R.id.wx_station_info);
    holder.stationInfo2 = (TextView) view.findViewById(R.id.wx_station_info2);
    holder.stationFreq = (TextView) view.findViewById(R.id.wx_station_freq);
    holder.stationPhone = (TextView) view.findViewById(R.id.wx_station_phone);
    holder.stationDistance = (TextView) view.findViewById(R.id.wx_station_distance);
    holder.stationWx = (TextView) view.findViewById(R.id.wx_station_wx);
    holder.stationWx2 = (TextView) view.findViewById(R.id.wx_station_wx2);
    holder.reportAge = (TextView) view.findViewById(R.id.wx_report_age);
    view.setTag(R.id.TAG_VIEW_HOLDER, holder);
}

From source file:com.facebook.litho.MountState.java

/**
 * Store a {@link ComponentAccessibilityDelegate} as a tag in {@code view}. {@link LithoView}
 * contains the logic for setting/unsetting it whenever accessibility is enabled/disabled
 *
 * For non {@link ComponentHost}s/*  w  w  w .j a  va 2s  .co m*/
 * this is only done if any {@link EventHandler}s for accessibility events have been implemented,
 * we want to preserve the original behaviour since {@code view} might have had
 * a default delegate.
 */
private static void setAccessibilityDelegate(View view, NodeInfo nodeInfo) {
    if (!(view instanceof ComponentHost) && !nodeInfo.hasAccessibilityHandlers()) {
        return;
    }

    view.setTag(R.id.component_node_info, nodeInfo);
}

From source file:com.nadmm.airports.ActivityBase.java

protected void registerHideableHeaderView(View hideableHeaderView, int offset) {
    if (!mHideableHeaderViews.contains(hideableHeaderView)) {
        hideableHeaderView.setTag(R.id.AUTOHIDE_OFFSET, offset);
        mHideableHeaderViews.add(hideableHeaderView);
    }//  w w w  . jav  a 2s . com
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 01??(View)??/*w w  w .  j  a v  a  2  s.c o  m*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void fadeIn(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "fadeIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_FADE_IN); // ???
    target.setScaleX(1.0f);
    target.setScaleY(1.0f);
    target.setAlpha(0.0f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 0f, 1f);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 01??(View)??/* w  w w .j a  va 2  s  .  c  o  m*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void zoomIn(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "zoomIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_ZOOM_IN); // ???
    target.setScaleX(0.0f);
    target.setScaleY(0.0f);
    target.setAlpha(1.0f);
    final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 0.01f, 1f);
    final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 0.01f, 1f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 10??(View)??//  w w  w .  j a  v a  2  s  .  c  o m
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void zoomOut(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "zoomIn:target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    target.setVisibility(View.VISIBLE);
    target.setTag(R.id.anim_type, ANIM_ZOOM_OUT); // ???
    target.setScaleX(1.0f);
    target.setScaleY(1.0f);
    target.setAlpha(1.0f);
    final PropertyValuesHolder scale_x = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f);
    final PropertyValuesHolder scale_y = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f);
    final ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(target, scale_x, scale_y);
    objectAnimator.addListener(mAnimatorListener);
    if (BuildCheck.isJellyBeanMR2())
        objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
    objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
    objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
    objectAnimator.start(); // 
}

From source file:com.serenegiant.aceparrot.BaseFragment.java

/**
 * 10??(View)??/*from  www . ja  v a  2s  . c  om*/
 * @param target
 * @param startDelay
 */
@SuppressLint("NewApi")
protected final void fadeOut(final View target, final long duration, final long startDelay) {
    //      if (DEBUG) Log.v(TAG, "fadeOut,target=" + target);
    if (target == null)
        return;
    target.clearAnimation();
    if (target.getVisibility() == View.VISIBLE) {
        target.setTag(R.id.anim_type, ANIM_FADE_OUT); // ??
        target.setScaleX(1.0f);
        target.setScaleY(1.0f);
        target.setAlpha(1.0f);
        final ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "alpha", 1f, 0f);
        objectAnimator.addListener(mAnimatorListener);
        if (BuildCheck.isAndroid4_3())
            objectAnimator.setAutoCancel(true); // API >= 18 ??????Animator????
        objectAnimator.setDuration(duration > 0 ? duration : 500); // 0.5???
        objectAnimator.setStartDelay(startDelay > 0 ? startDelay : 0); // ???
        objectAnimator.start(); // 
    }
}

From source file:com.facebook.litho.MountState.java

static void setComponentClickListener(View v, ComponentClickListener listener) {
    if (v instanceof ComponentHost) {
        ((ComponentHost) v).setComponentClickListener(listener);
    } else {// w  w w  . j  a va  2  s.  co  m
        v.setOnClickListener(listener);
        v.setTag(R.id.component_click_listener, listener);
    }
}

From source file:com.facebook.litho.MountState.java

static void setComponentTouchListener(View v, ComponentTouchListener listener) {
    if (v instanceof ComponentHost) {
        ((ComponentHost) v).setComponentTouchListener(listener);
    } else {/*from  w  w w.ja  va 2 s  .co  m*/
        v.setOnTouchListener(listener);
        v.setTag(R.id.component_touch_listener, listener);
    }
}