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:Main.java

public static void insertEmptyTag(View view) {
    view.setTag(NIGHT_OWL_VIEW_TAG, EMPTY_TAG);
}

From source file:Main.java

public static void setPos(View v, int pos) {
    v.setTag(TAG_POS, pos);
}

From source file:Main.java

public static void setType(View v, int type) {
    v.setTag(TAG_TYPE, type);
}

From source file:Main.java

public static void preventClick(View view, long ts) {
    view.setTag(KEY_PREVENT_TS, System.currentTimeMillis() + ts);
}

From source file:Main.java

public static void setData(View v, Object data) {
    v.setTag(TAG_DATA, data);
}

From source file:Main.java

public static void insertEmptyTag(@NonNull View view) {
    view.setTag(NIGHT_OWL_VIEW_TAG, EMPTY_TAG);
}

From source file:androidx.navigation.Navigation.java

/**
 * Associates a NavController with the given View, allowing developers to use
 * {@link #findNavController(View)} and {@link #findNavController(Activity, int)} with that
 * View or any of its children to retrieve the NavController.
 * <p>/*from   ww  w.j  a va  2  s.  co m*/
 * This is generally called for you by the hosting {@link NavHost}.
 * @param view View that should be associated with the given NavController
 * @param controller The controller you wish to later retrieve via
 *                   {@link #findNavController(View)}
 */
public static void setViewNavController(@NonNull View view, @Nullable NavController controller) {
    view.setTag(R.id.nav_controller_view_tag, controller);
}

From source file:android.support.transition.GhostViewApi14.java

private static void setGhostView(@NonNull View view, GhostViewApi14 ghostView) {
    view.setTag(R.id.ghost_view, ghostView);
}

From source file:com.google.android.gcm.demo.ui.AbstractFragment.java

public static void setValue(View view, String name, String value) {
    if (view == null) {
        return;/*from   w w  w .  jav a 2  s.c  o  m*/
    }
    if (view instanceof TextView) {
        if (name != null && value != null) {
            ((TextView) view).setText(name + " (" + truncateToMediumString(value) + ")");
            view.setTag(R.id.tag_clipboard_value, value);
        } else if (value != null) {
            ((TextView) view).setText(truncateToLongString(value));
            view.setTag(R.id.tag_clipboard_value, value);
        } else {
            ((TextView) view).setText(truncateToLongString(name));
            view.setTag(R.id.tag_clipboard_value, name);
        }
    }
}

From source file:com.github.omadahealth.slidepager.lib.SlideTransformer.java

/**
 * Init the view tags to improve performances ==> it will call {@link android.view.View#findViewById(int)}
 * only once per View.//  w  w  w  .  ja  v  a  2  s.c o m
 *
 * @param view The {@link android.view.View} we want to search for the ids get into {@link #getViewRatios()} as the keys
 */
public static void initTags(View view) {
    List<View> subViews = new ArrayList<>();
    if (getViewRatios() != null) {
        for (Map.Entry<Integer, Ratio> entry : getViewRatios().entrySet()) {
            View subView = view.findViewById(entry.getKey());
            if (subView != null) {
                subViews.add(subView);
            }
        }
    }

    view.setTag(R.id.slide_transformer_tag_key, subViews);
}