Example usage for android.view ViewGroup getId

List of usage examples for android.view ViewGroup getId

Introduction

In this page you can find the example usage for android.view ViewGroup getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

From source file:com.holo.fileexplorer.FileFragmentPagerAdapter.java

/**
 * This function is the reason why this class is a full copy of
 * FragmentPagerAdapter and not an implementation. The app required the
 * ability to call functions on each FileListFragment from the main class.
 * This function needed to be able to reference mFragmentManger.
 * /* w ww.  j a  va2 s  .  c  o  m*/
 * @param container 
 * @param position
 * @return FileListFragment
 */
public FileListFragment getFragment(ViewGroup container, int position) {
    String name = makeFragmentName(container.getId(), position);
    FileListFragment fragment = (FileListFragment) mFragmentManager.findFragmentByTag(name);
    return fragment;
}

From source file:au.com.connectedteam.adapter.CustomFragmentPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    mContainerId = container.getId();
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }//from w  w w .  j  a  v  a  2s.  co m

    final long itemId = getItemId(position);

    // Do we already have this fragment?
    String name = makeFragmentName(container.getId(), itemId);
    Fragment fragment = mFragmentManager.findFragmentByTag(name);
    if (fragment != null) {
        if (DEBUG)
            Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
        mCurTransaction.attach(fragment);
    } else {
        fragment = makeFragment(position);
        if (DEBUG)
            Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
        mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), itemId));
    }
    if (fragment != mCurrentPrimaryItem) {
        fragment.setMenuVisibility(false);
        fragment.setUserVisibleHint(false);
    }

    return fragment;
}

From source file:com.brandroidtools.filemanager.adapters.NavigationFragmentPagerAdapter.java

/**
 * This function is the reason why this class is a full copy of
 * FragmentPagerAdapter and not an implementation. The app required the
 * ability to call functions on each FileListFragment from the main class.
 * This function needed to be able to reference mFragmentManger.
 *
 * @param container/* w w w .j av  a2s  .co  m*/
 * @param position
 * @return FileListFragment
 */
public NavigationFragment getFragment(ViewGroup container, int position) {
    String name = makeFragmentName(container.getId(), position);
    NavigationFragment fragment = (NavigationFragment) mFragmentManager.findFragmentByTag(name);
    return fragment;
}

From source file:am.util.viewpager.adapter.FragmentRemovePagerAdapter.java

@Override
public void startUpdate(ViewGroup container) {
    mViewGroupId = container.getId();
    if (mViewGroupId == View.NO_ID) {
        throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
    }/*from  ww w. jav  a  2s .  c  o  m*/
}

From source file:am.project.x.widget.FragmentRemovePagerAdapter.java

@Override
public void startUpdate(@NonNull ViewGroup container) {
    mViewGroupId = container.getId();
    if (mViewGroupId == View.NO_ID) {
        throw new IllegalStateException("ViewPager with adapter " + this + " requires a view id");
    }/*from  ww  w .  j  a  va  2 s. co m*/
}

From source file:com.just.agentweb.AgentWebUtils.java

static WebParentLayout getWebParentLayoutByWebView(WebView webView) {
    ViewGroup mViewGroup = null;
    if (!(webView.getParent() instanceof ViewGroup)) {
        throw new IllegalStateException("please check webcreator's create method was be called ?");
    }/*  w  w w.  j  a  v  a 2  s  .co m*/
    mViewGroup = (ViewGroup) webView.getParent();
    AbsAgentWebUIController mAgentWebUIController;
    while (mViewGroup != null) {

        LogUtils.i(TAG, "ViewGroup:" + mViewGroup);
        if (mViewGroup.getId() == R.id.web_parent_layout_id) {
            WebParentLayout mWebParentLayout = (WebParentLayout) mViewGroup;
            LogUtils.i(TAG, "found WebParentLayout");
            return mWebParentLayout;
        } else {
            ViewParent mViewParent = mViewGroup.getParent();
            if (mViewParent instanceof ViewGroup) {
                mViewGroup = (ViewGroup) mViewParent;
            } else {
                mViewGroup = null;
            }
        }
    }
    throw new IllegalStateException("please check webcreator's create method was be called ?");
}

From source file:is.hello.go99.example.adapter.FragmentPagerAdapter.java

@SuppressLint("CommitTransaction")
@Override/*from w w w.jav  a  2  s.  c  om*/
public Object instantiateItem(ViewGroup container, int position) {
    if (currentTransaction == null) {
        this.currentTransaction = fragmentManager.beginTransaction();
    }

    final String tag = makeFragmentTag(container.getId(), getItemId(position));
    Fragment fragment = fragmentManager.findFragmentByTag(tag);
    if (fragment != null) {
        if (fragment.isDetached()) {
            currentTransaction.attach(fragment);
        }
    } else {
        fragment = createFragment(position);
        currentTransaction.add(container.getId(), fragment, tag);
    }

    if (fragment != currentFragment) {
        fragment.setMenuVisibility(false);
        fragment.setUserVisibleHint(false);
    }

    return fragment;
}

From source file:com.airbitz.adapters.FragmentPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }/*from  ww  w.ja v  a  2 s  .  c o  m*/

    // Do we already have this fragment?
    String name = makeFragmentName(container.getId(), position);
    Fragment fragment = mFragmentManager.findFragmentByTag(name);
    if (fragment != null) {
        if (DEBUG)
            Log.v(TAG, "Attaching item #" + position + ": f=" + fragment);
        mCurTransaction.attach(fragment);
    } else {
        fragment = getItem(position);
        if (DEBUG)
            Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
        mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), position));
    }
    if (fragment != mCurrentPrimaryItem) {
        fragment.setMenuVisibility(false);
    }

    return fragment;
}

From source file:org.tigase.mobile.MyFragmentPageAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }/*from   w  w w  .  j a v  a 2s.co m*/

    // Do we already have this fragment?
    String name = makeFragmentName(container.getId(), position);
    Fragment fragment = mFragmentManager.findFragmentByTag(name);

    if (refreshRoster && fragment instanceof RosterFragment) {
        refreshRoster = false;
        mCurTransaction.detach(fragment);
        fragment = null;
    }

    if (fragment != null) {
        if (DEBUG)
            Log.v(TAG, "Attaching item #" + position + ": f=" + fragment);
        mCurTransaction.attach(fragment);
    } else {
        fragment = getItem(position);
        if (DEBUG)
            Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
        int containerId = container.getId();
        String fragmentName = makeFragmentName(container.getId(), position);
        mCurTransaction.add(containerId, fragment, fragmentName);
    }
    if (fragment != mCurrentPrimaryItem) {
        fragment.setMenuVisibility(false);
        fragment.setUserVisibleHint(false);
    }

    return fragment;
}

From source file:android.support.v13.app.FragmentPagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }/*from   w  ww.j  av  a2 s. co m*/

    // Do we already have this fragment?
    String name = makeFragmentName(container.getId(), position);
    Fragment fragment = mFragmentManager.findFragmentByTag(name);
    if (fragment != null) {
        if (DEBUG)
            Log.v(TAG, "Attaching item #" + position + ": f=" + fragment);
        mCurTransaction.attach(fragment);
    } else {
        fragment = getItem(position);
        if (DEBUG)
            Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
        mCurTransaction.add(container.getId(), fragment, makeFragmentName(container.getId(), position));
    }
    if (fragment != mCurrentPrimaryItem) {
        FragmentCompat.setMenuVisibility(fragment, false);
        FragmentCompat.setUserVisibleHint(fragment, false);
    }

    return fragment;
}