Example usage for android.widget TabWidget getDescendantFocusability

List of usage examples for android.widget TabWidget getDescendantFocusability

Introduction

In this page you can find the example usage for android.widget TabWidget getDescendantFocusability.

Prototype

@ViewDebug.ExportedProperty(category = "focus", mapping = {
        @ViewDebug.IntToString(from = FOCUS_BEFORE_DESCENDANTS, to = "FOCUS_BEFORE_DESCENDANTS"),
        @ViewDebug.IntToString(from = FOCUS_AFTER_DESCENDANTS, to = "FOCUS_AFTER_DESCENDANTS"),
        @ViewDebug.IntToString(from = FOCUS_BLOCK_DESCENDANTS, to = "FOCUS_BLOCK_DESCENDANTS") })
public int getDescendantFocusability() 

Source Link

Document

Gets the descendant focusability of this view group.

Usage

From source file:com.android.firewall.ui.adapter.MainPagerAdapter.java

public void onPageSelected(int position) {
    TabWidget widget = tabHost.getTabWidget();

    int oldFocus = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    tabHost.setCurrentTab(position);/* w  w w  . j a  v a  2 s  .co m*/

    widget.setDescendantFocusability(oldFocus);
}

From source file:co.uk.alt236.restclient4android.adapters.RequestTabsAdapter.java

@Override
public void onPageSelected(int position) {
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);/*from  w w  w .j  a  v a  2 s.  c o m*/
    widget.setDescendantFocusability(oldFocusability);
}

From source file:com.androidfactorem.visualcv.ui.adapter.FragmentTabAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk./*from  w  w w . j a va2s  .c  om*/
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:br.com.cybereagle.androidlibrary.ui.adapter.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk./*  w w  w .  j a v a2 s.  co m*/
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = tabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    tabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:org.altusmetrum.AltosDroid.TabsAdapter.java

public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.//from w  ww  . j  a va 2s . c  o  m
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:com.github.mobile.ui.fragments.TabsAdapter.java

@Override
public void onPageSelected(final int position) {
    // unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.//from  w  ww .j ava 2  s.  c o  m
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    final TabWidget widget = mTabHost.getTabWidget();
    final int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);
}

From source file:com.yojiokisoft.yumekanow.adapter.MainPagerAdapter.java

/**
 * @see ViewPager.OnPageChangeListener#onPageSelected(int)
 *///from  w ww .ja  va 2s . c  o  m
@Override
public void onPageSelected(int position) {
    TabWidget widget = mTabHost.getTabWidget();

    int oldFocus = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);

    mTabHost.setCurrentTab(position);

    widget.setDescendantFocusability(oldFocus);
}

From source file:br.com.bioscada.apps.biotracks.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    /*//w  w  w  . j ava2s  .c  o  m
     * Unfortunately when TabHost changes the current tab, it kindly also takes
     * care of putting focus on it when not in touch mode. The jerk. This hack
     * tries to prevent this from pulling focus out of our ViewPager.
     */
    TabWidget tabWidget = tabHost.getTabWidget();
    int oldFocusability = tabWidget.getDescendantFocusability();
    tabWidget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    tabHost.setCurrentTab(position);
    tabWidget.setDescendantFocusability(oldFocusability);
}

From source file:com.jtechme.apphub.privileged.views.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk.// w ww.  ja  va  2  s .  c om
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);

    // Scroll the current tab into visibility if needed.
    View tab = widget.getChildTabViewAt(position);
    mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom());
    widget.requestRectangleOnScreen(mTempRect, false);

    // Make sure the scrollbars are visible for a moment after selection
    final View contentView = mTabs.get(position);
    if (contentView instanceof CaffeinatedScrollView) {
        ((CaffeinatedScrollView) contentView).awakenScrollBars();
    }
}

From source file:com.android.packageinstaller.TabsAdapter.java

@Override
public void onPageSelected(int position) {
    // Unfortunately when TabHost changes the current tab, it kindly
    // also takes care of putting focus on it when not in touch mode.
    // The jerk./*from  w  w  w . j  a v a2s . c  om*/
    // This hack tries to prevent this from pulling focus out of our
    // ViewPager.
    TabWidget widget = mTabHost.getTabWidget();
    int oldFocusability = widget.getDescendantFocusability();
    widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
    mTabHost.setCurrentTab(position);
    widget.setDescendantFocusability(oldFocusability);

    // Scroll the current tab into visibility if needed.
    View tab = widget.getChildTabViewAt(position);
    mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom());
    widget.requestRectangleOnScreen(mTempRect, false);

    // Make sure the scrollbars are visible for a moment after selection
    final View contentView = mTabs.get(position).view;
    if (contentView instanceof CaffeinatedScrollView) {
        ((CaffeinatedScrollView) contentView).awakenScrollBars();
    }
}