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.homerunsb.navigationdrawertest.CompanyListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.i(TAG, "onCreateView()");

    View rootView = inflater.inflate(R.layout.fragment_item_layout, container, false);
    rootView.setTag(TAG);

    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.rv_itemList);
    mLayoutManager = new LinearLayoutManager(getActivity());
    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  v  a 2  s.c o  m*/
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    Log.i(TAG, "mCompanyDataItems size () " + mCompanyDataItems.size());
    mCompanyAdapter = new CompanyListAdapter(mCompanyDataItems);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mCompanyAdapter);
    mRecyclerView.setNestedScrollingEnabled(false);

    setRecyclerViewLayoutManager(LayoutManagerType.GRID_LAYOUT_MANAGER);

    return rootView;
}

From source file:com.gigamole.neon.adapters.PlayerPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view;

    switch (position) {
    case Constants.COVER_PAGE:
    default:/* ww  w .  ja v  a  2 s.c om*/
        view = new SlideImageView(this.context);
        view.setTag(Constants.COVER_PAGE_TAG);
        ((SlideImageView) view).setAxis(SlideImageView.Axis.VERTICAL);
        ((SlideImageView) view).setSource(R.drawable.stub);
        break;
    case Constants.BAR_PAGE:
        view = new BarVisualizerView(this.context);
        view.setTag(Constants.BAR_PAGE_TAG);
        break;
    case Constants.GD_PAGE:
        view = new GravityDefiedVisualizerView(this.context);
        view.setTag(Constants.GD_PAGE_TAG);
        break;
    case Constants.SEA_PAGE:
        view = new SeaBreathVisualizerView(this.context);
        view.setTag(Constants.SEA_PAGE_TAG);
        break;
    case Constants.PULSE_PAGE:
        view = new PulseVisualizerView(this.context);
        view.setTag(Constants.PULSE_PAGE_TAG);
        break;
    }

    container.addView(view);

    return view;
}

From source file:com.acbelter.directionalcarousel.page.PageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (container == null) {
        return null;
    }/*w w w. j a v a  2 s.  c om*/

    if (container.getClass() != CarouselViewPager.class) {
        throw new IllegalArgumentException("PageFragment must be attached to " + "CarouselViewPager.");
    }

    int pageLayoutId = getArguments().getInt("page_layout_id");
    PageLayout pageLayout = (PageLayout) inflater.inflate(pageLayoutId, container, false);
    if (pageLayout == null) {
        throw new IllegalStateException("PageFragment root layout must have id " + "R.id.page.");
    }

    CarouselConfig config = CarouselConfig.getInstance();
    float scale;
    if (config.scrollScalingMode == CarouselConfig.SCROLL_MODE_BIG_CURRENT
            || config.scrollScalingMode == CarouselConfig.SCROLL_MODE_BIG_ALL) {
        scale = config.smallScale;
    } else {
        scale = config.bigScale;
    }
    pageLayout.setScaleBoth(scale);

    if (config.orientation == CarouselConfig.VERTICAL) {
        pageLayout.setRotation(-90);
    }

    T item = getArguments().getParcelable("item");
    View pageContent = setupPage(pageLayout, item);
    if (pageContent != null) {
        pageContent.setOnTouchListener((CarouselViewPager) container);
        pageContent.setTag(item);
    }
    return pageLayout;
}

From source file:com.cgf.cardslisttest.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.LINEAR_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }/*  w ww.  jav  a2  s  .co m*/
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new CustomAdapter(mDataset);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    // END_INCLUDE(initializeRecyclerView)

    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;
}

From source file:com.money.manager.ex.currency.list.CurrencyListAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.item_currency, parent, false);

    // holder//from w  w w  . ja v  a 2 s  . c om
    CurrencyListItemViewHolder holder = new CurrencyListItemViewHolder(view);
    // add holder to the view.
    view.setTag(holder);

    return view;
}

From source file:ca.ypg.pdavid.com.yp_dine.fragment.RecyclerViewFragment.java

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

    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.LINEAR_LAYOUT_MANAGER;

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

    //      mAdapter = new CustomAdapter(mDataset);
    // Set CustomAdapter as the adapter for RecyclerView.
    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;
}

From source file:com.rowland.hashtrace.ui.adapters.TweetListAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = LayoutInflater.from(context).inflate(R.layout.listitem, parent, false);

    ViewHolder viewHolder = new ViewHolder(view);

    view.setTag(viewHolder);

    return view;/*from   w w w.  java 2  s. c  om*/
}

From source file:com.sec.omnium.omnikey.UI.Recyclerview.ListFragment.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);

    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);
    mRecyclerView.setHasFixedSize(false);

    // 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.LINEAR_LAYOUT_MANAGER;

    mRecyclerView.setLayoutManager(mLayoutManager);

    //        if (savedInstanceState != null) {
    //            // Restore saved layout manager type.
    //            mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    //        }//www.j a va2 s . c o m
    //        setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new CustomAdapter(mDataset);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setItemAnimator(new FadeInLeftAnimator());

    AlphaInAnimationAdapter alpha = new AlphaInAnimationAdapter(mAdapter);
    mRecyclerView.setAdapter(alpha);
    //        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;
}

From source file:com.armtimes.fragments.FragmentAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = LayoutInflater.from(context).inflate(R.layout.row_single_news_article, parent, false);
    ViewHolder viewHolder = new ViewHolder(view, cursor);
    view.setTag(viewHolder);
    return view;// w  w w.  j a  va 2 s .  c o  m
}

From source file:com.justwayward.reader.view.recyclerview.adapter.BaseViewHolder.java

public BaseViewHolder setTag(int viewId, Object tag) {
    View view = getView(viewId);
    view.setTag(tag);
    return this;
}