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(final Object tag) 

Source Link

Document

Sets the tag associated with this view.

Usage

From source file:com.baksoy.sunshine.ForecastAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    // Choose the layout type
    int viewType = getItemViewType(cursor.getPosition());
    int layoutId = -1;
    switch (viewType) {
    case VIEW_TYPE_TODAY: {
        layoutId = R.layout.list_item_forecast_today;
        break;/*from   w ww. j  a v a  2 s  .c  o  m*/
    }
    case VIEW_TYPE_FUTURE_DAY: {
        layoutId = R.layout.list_item_forecast;
        break;
    }
    }

    View view = LayoutInflater.from(context).inflate(layoutId, parent, false);

    ViewHolder viewHolder = new ViewHolder(view);
    view.setTag(viewHolder);

    return view;
}

From source file:com.jackie.sunshine.app.ForecastAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    int viewType = getItemViewType(cursor.getPosition());
    int layoutId;
    if (viewType == VIEW_TYPE_TODAY) {
        layoutId = R.layout.list_item_forecast_today;
    } else {//from  www  . j a v  a  2  s  .c  o  m
        layoutId = R.layout.list_item_forecast;
    }
    View view = LayoutInflater.from(context).inflate(layoutId, parent, false);
    ViewHolder viewHolder = new ViewHolder(view);
    view.setTag(viewHolder);

    return view;
}

From source file:com.enadein.carlogbook.adapter.CarAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    CarHolder holder = new CarHolder();
    LayoutInflater inflater = LayoutInflater.from(context);
    View listItem = inflater.inflate(R.layout.car_item, null);

    holder.nameView = (TextView) listItem.findViewById(R.id.carItem);
    holder.activeView = (ImageView) listItem.findViewById(R.id.activeItem);
    listItem.setTag(holder);

    return listItem;
}

From source file:com.gsma.rcs.ri.messaging.adapter.GroupDeliveryInfoCursorAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    final View view = mInflater.inflate(R.layout.delivery_info_item, parent, false);
    // Save columns indexes and children views in cache
    view.setTag(new ViewHolder(view, cursor));
    return view;/*from w  w  w.  ja v a 2 s  .  com*/
}

From source file:com.lastsoft.plog.PlayersFragment_Groups.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_players, container, false);
    rootView.setTag(TAG);

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);
    RecyclerFastScroller fastScroller = (RecyclerFastScroller) rootView.findViewById(R.id.fastscroller);
    fastScroller.attachRecyclerView(mRecyclerView);
    //VerticalRecyclerViewFastScroller fastScroller = (VerticalRecyclerViewFastScroller) rootView.findViewById(R.id.fastscroller);

    // Connect the recycler to the scroller (to let the scroller scroll the list)
    //fastScroller.setRecyclerView(mRecyclerView, null);

    // Connect the scroller to the recycler (to let the recycler scroll the scroller's handle)
    //mRecyclerView.setOnScrollListener(fastScroller.getOnScrollListener());

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(mActivity);

    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }/*from   w  ww. j  a va 2s  .c  o m*/
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new GroupAdapter(mActivity, this, MainActivity.CurrentYear);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}

From source file:cardstream.CardStreamFragment.java

/**
 * Add a visible, dismissible card to the card stream.
 *
 * @param card/*w w  w. j a  v  a 2  s . co  m*/
 */
public void addCard(Card card) {
    final String tag = card.getTag();

    if (!mVisibleCards.containsKey(tag) && !mHiddenCards.containsKey(tag)) {
        final View view = card.getView();
        view.setTag(tag);
        mHiddenCards.put(tag, card);
    }
}

From source file:com.example.facebookfriendviewer.adapters.ViewCursorAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    final ViewHolder holder;
    LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    View view = inflater.inflate(viewLayout, null, false);

    holder = new ViewHolder();
    holder.image = (ImageView) view.findViewById(R.id.picture);
    holder.name = (TextView) view.findViewById(R.id.name);
    view.setTag(holder);
    return view;/*from   w w w . ja  v a 2 s  .c  o m*/
}

From source file:com.zrquan.mobile.widget.viewpager.ImagePagerAdapter.java

@Override
public View getView(int position, View view, ViewGroup container) {
    ViewHolder holder;//w  w w.  j av  a 2  s. com
    if (view == null) {
        holder = new ViewHolder();
        view = holder.imageView = new RoundedImageView(context);
        view.setTag(holder);
    } else {
        holder = (ViewHolder) view.getTag();
    }

    float roundPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4,
            context.getResources().getDisplayMetrics());

    holder.imageView.setCornerRadius((float) roundPx);
    holder.imageView.mutateBackground(true);
    holder.imageView.setImageResource(imageIdList.get(getPosition(position)));
    holder.imageView.setScaleType(RoundedImageView.ScaleType.FIT_XY);
    return view;
}

From source file:com.groksolutions.grok.mobile.metric.MetricListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = super.onCreateView(inflater, container, savedInstanceState);
    // Attach fragment to list view
    View list = root.findViewById(android.R.id.list);
    list.setTag(this);
    return root;/* w w  w  . j  av a 2 s .com*/
}

From source file:com.quuzz.tbg.recyclerview.RecyclerViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.recycler_view_frag, container, false);
    rootView.setTag(TAG);

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());

    mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }//from   w ww.  j  a va  2s.  co m
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new CustomAdapter(getActivity());
    mRecyclerView.setAdapter(mAdapter);

    //        mLinearLayoutRadioButton = (RadioButton) rootView.findViewById(R.id.linear_layout_rb);
    //        mLinearLayoutRadioButton.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                setRecyclerViewLayoutManager(LayoutManagerType.LINEAR_LAYOUT_MANAGER);
    //            }
    //        });
    //
    //        mGridLayoutRadioButton = (RadioButton) rootView.findViewById(R.id.grid_layout_rb);
    //        mGridLayoutRadioButton.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                setRecyclerViewLayoutManager(LayoutManagerType.GRID_LAYOUT_MANAGER);
    //            }
    //        });
    return rootView;
}