Example usage for android.view View setSelected

List of usage examples for android.view View setSelected

Introduction

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

Prototype

public void setSelected(boolean selected) 

Source Link

Document

Changes the selection state of this view.

Usage

From source file:Main.java

public static void cleanItemSelection(View item) {
    int sdk = android.os.Build.VERSION.SDK_INT;
    if (item != null) {
        item.setSelected(false);
        if (sdk >= Build.VERSION_CODES.HONEYCOMB) {
            deactivate(item);/*ww  w  . j a  va  2  s.co  m*/

        }
        item.setFocusable(false);
    }

}

From source file:com.ruesga.rview.misc.BindingAdapters.java

@BindingAdapter("bindSelected")
public static void bindSelected(View v, boolean selected) {
    v.setSelected(selected);
}

From source file:at.linuxtage.companion.widgets.SlidingTabLayout.java

static void setSelectedCompat(View view, boolean selected) {
    final boolean becomeSelected = selected && !view.isSelected();
    view.setSelected(selected);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN && becomeSelected) {
        // Pre-JB we need to manually send the TYPE_VIEW_SELECTED event
        view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
    }/*from   ww  w.  j ava  2s.  co  m*/
}

From source file:com.zepan.android.widget.TabGroup.java

private void setSelected(View view) {
    for (int i = 0; i < getChildCount(); i++) {
        View v = getChildAt(i);
        v.setSelected(v == view);
    }/*w w w  .  j a  v a2 s.c om*/
}

From source file:com.rastating.droidbeard.fragments.ShowsFragment.java

@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
    view.setSelected(true);
    TVShowSummary show = mAdapter.getItem(position);
    if (show != null) {
        FragmentManager manager = this.getFragmentManager();
        ShowFragment fragment = new ShowFragment();
        fragment.setTvShowSummary(show);
        manager.beginTransaction().replace(R.id.container, fragment).commit();
    }/*from   ww  w .  j a  va2  s.co m*/

    if (floatingActionsMenu != null) {
        floatingActionsMenu.setVisibility(View.INVISIBLE);
    }
}

From source file:com.aniruddhc.xPlod.ui.widgets.ScrollableTabView.java

private void selectTab(int position) {

    for (int i = 0, pos = 0; i < mContainer.getChildCount(); i++, pos++) {
        View tab = mContainer.getChildAt(i);
        tab.setSelected(pos == position);
    }/*from   w  ww  .  j ava  2  s. co  m*/

    View selectedTab = mContainer.getChildAt(position);

    final int w = selectedTab.getMeasuredWidth();
    final int l = selectedTab.getLeft();

    final int x = l - this.getWidth() / 2 + w / 2;

    smoothScrollTo(x, this.getScrollY());

}

From source file:com.andrew.apolloMod.ui.widgets.ScrollableTabView.java

private void selectTab(int position) {

    for (int i = 0, pos = 0; i < mContainer.getChildCount(); i++, pos++) {
        View tab = mContainer.getChildAt(i);
        tab.setSelected(pos == position);
    }/*from   w  w  w  . java 2 s.  c  o  m*/

    View selectedTab = mContainer.getChildAt(position);

    final int w = selectedTab.getMeasuredWidth();
    final int l = selectedTab.getLeft();

    final int x = l - this.getWidth() / 2 + w / 2;
    //? 3tab
    smoothScrollTo(x, this.getScrollY());
    if (BuildConfig.DEBUG) {
        Log.e(TAG, "smothScrollTo : x =" + x + " this.getScrolly() = " + this.getScrollY());
    }

}

From source file:com.saulcintero.moveon.ui.widgets.ScrollableTabView.java

private void selectTab(int position) {
    for (int i = 0, pos = 0; i < mContainer.getChildCount(); i += 2, pos++) {
        View tab = mContainer.getChildAt(i);
        tab.setSelected(pos == position);
    }//from  w  ww .  jav  a  2  s .co m

    View selectedTab = mContainer.getChildAt(position * 2);

    final int w = selectedTab.getMeasuredWidth();
    final int l = selectedTab.getLeft();
    final int x = l - this.getWidth() / 2 + w / 2;

    smoothScrollTo(x, this.getScrollY());
}

From source file:com.acrylicgoat.bcponline.fragments.CPListFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

    v.setSelected(true);
    curPosition = position;/*from  www  .j av a  2 s . c  o  m*/
    prevView = v;
    Category item = (Category) l.getItemAtPosition(position);
    selectPosition();
    if (dualFragments) {
        if (aBar != null) {
            aBar.setSubtitle(item.getName());
        }
        landAdapter.notifyDataSetChanged();
    } else {
        adapter.notifyDataSetChanged();
    }

    String url = item.getUrl();
    ddgSelectedListener.onDDGSelected(url);
}

From source file:com.andrew.apollo.ui.widgets.ScrollableTabView.java

private void selectTab(int position) {

    for (int i = 0, pos = 0; i < mContainer.getChildCount(); i += 2, pos++) {
        View tab = mContainer.getChildAt(i);
        tab.setSelected(pos == position);
    }//from  www  .  j ava2s  .co m

    View selectedTab = mContainer.getChildAt(position * 2);

    final int w = selectedTab.getMeasuredWidth();
    final int l = selectedTab.getLeft();

    final int x = l - this.getWidth() / 2 + w / 2;

    smoothScrollTo(x, this.getScrollY());

}