android.app.Fragment#getView ( )源码实例Demo

下面列出了android.app.Fragment#getView ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: moviedb-android   文件: TVDetails.java
private Scrollable getCurrentScrollable() {
    Fragment fragment = getCurrentFragment();
    if (fragment == null) {
        return null;
    }
    View view = fragment.getView();
    if (view == null) {
        return null;
    }
    switch (mViewPager.getCurrentItem()) {
        case 0:
            return (Scrollable) view.findViewById(R.id.tvdetailsinfo);
        case 1:
            return (Scrollable) view.findViewById(R.id.castList);
        case 2:
            return (Scrollable) view.findViewById(R.id.tvdetailsoverview);
        default:
            return (Scrollable) view.findViewById(R.id.tvdetailsinfo);
    }
}
 
源代码2 项目: moviedb-android   文件: MovieSlideTab.java
private Scrollable getCurrentScrollable() {
    Fragment fragment = getCurrentFragment();
    if (fragment == null) {
        return null;
    }
    View view = fragment.getView();
    if (view == null) {
        return null;
    }
    switch (mViewPager.getCurrentItem()) {
        case 0:
            return (Scrollable) view.findViewById(R.id.movieslist);
        case 1:
            return (Scrollable) view.findViewById(R.id.nowplaying);
        case 2:
            return (Scrollable) view.findViewById(R.id.popular);
        case 3:
            return (Scrollable) view.findViewById(R.id.toprated);
        default:
            return (Scrollable) view.findViewById(R.id.movieslist);
    }
}
 
源代码3 项目: moviedb-android   文件: CastDetails.java
private Scrollable getCurrentScrollable() {
    Fragment fragment = getCurrentFragment();
    if (fragment == null) {
        return null;
    }
    View view = fragment.getView();
    if (view == null) {
        return null;
    }
    switch (mViewPager.getCurrentItem()) {
        case 0:
            return (Scrollable) view.findViewById(R.id.castdetailsinfo);
        case 1:
            return (Scrollable) view.findViewById(R.id.castdetailscredits);
        case 2:
            return (Scrollable) view.findViewById(R.id.castdetailsbiography);
        default:
            return (Scrollable) view.findViewById(R.id.castdetailsinfo);
    }
}
 
源代码4 项目: moviedb-android   文件: TVSlideTab.java
private Scrollable getCurrentScrollable() {
    Fragment fragment = getCurrentFragment();
    if (fragment == null) {
        return null;
    }
    View view = fragment.getView();
    if (view == null) {
        return null;
    }
    switch (mViewPager.getCurrentItem()) {
        case 0:
            return (Scrollable) view.findViewById(R.id.TVOnTheAirList);
        case 1:
            return (Scrollable) view.findViewById(R.id.TVAiringTodayList);
        case 2:
            return (Scrollable) view.findViewById(R.id.TVPopularList);
        case 3:
            return (Scrollable) view.findViewById(R.id.TVTopRatedList);
        default:
            return (Scrollable) view.findViewById(R.id.TVOnTheAirList);
    }
}
 
源代码5 项目: moviedb-android   文件: MovieDetails.java
private Scrollable getCurrentScrollable() {
    Fragment fragment = getCurrentFragment();
    if (fragment == null) {
        return null;
    }
    View view = fragment.getView();
    if (view == null) {
        return null;
    }
    switch (mViewPager.getCurrentItem()) {
        case 0:
            return (Scrollable) view.findViewById(R.id.moviedetailsinfo);
        case 1:
            return (Scrollable) view.findViewById(R.id.castList);
        case 2:
            return (Scrollable) view.findViewById(R.id.moviedetailsoverview);
        default:
            return (Scrollable) view.findViewById(R.id.moviedetailsinfo);
    }
}
 
源代码6 项目: DoraemonKit   文件: AndroidOFragmentRefWatcher.java
@Override
public void onFragmentViewDestroyed(FragmentManager fm, Fragment fragment) {
  View view = fragment.getView();
  if (view != null) {
    refWatcher.watch(view);
  }
}
 
源代码7 项目: delion   文件: Preferences.java
@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
        if (fragment instanceof PreferenceFragment && fragment.getView() != null) {
            // Set list view padding to 0 so dividers are the full width of the screen.
            fragment.getView().findViewById(android.R.id.list).setPadding(0, 0, 0, 0);
        }
    }
}
 
源代码8 项目: Snake   文件: SoftKeyboardHelper.java
public static boolean hideKeyboard(@NonNull Fragment fragment) {
    if(fragment.isDetached() || fragment.isRemoving() || null == fragment.getActivity()) return true;

    InputMethodManager inputMethodManager = (InputMethodManager) fragment.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    View rootView = fragment.getView();
    if(rootView instanceof ViewGroup) {
        View focusedChild = ((ViewGroup)rootView).getFocusedChild();
        if(null != focusedChild) {
            return inputMethodManager.hideSoftInputFromWindow(focusedChild.getWindowToken(), 0);
        }
    }

    return true;
}
 
源代码9 项目: AndroidChromium   文件: Preferences.java
@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
        if (fragment instanceof PreferenceFragment && fragment.getView() != null) {
            // Set list view padding to 0 so dividers are the full width of the screen.
            fragment.getView().findViewById(android.R.id.list).setPadding(0, 0, 0, 0);
        }
    }
}
 
源代码10 项目: 365browser   文件: Preferences.java
@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
        if (fragment instanceof PreferenceFragment && fragment.getView() != null) {
            // Set list view padding to 0 so dividers are the full width of the screen.
            fragment.getView().findViewById(android.R.id.list).setPadding(0, 0, 0, 0);
        }
    }
}
 
源代码11 项目: mirror   文件: MirrorActivity.java
private int getParentId(final Fragment fragment) {
    if (fragment.getView() != null && fragment.getView().getParent() != null) {
        return ((View) fragment.getView().getParent()).getId();
    }
    return 0;
}
 
源代码12 项目: weex   文件: FragmentCompatFramework.java
@Nullable
@Override
public View getView(Fragment fragment) {
  return fragment.getView();
}
 
源代码13 项目: stetho   文件: FragmentCompatFramework.java
@Nullable
@Override
public View getView(Fragment fragment) {
  return fragment.getView();
}
 
@Override public Object instantiateItem(ViewGroup container, int position) {
    // If we already have this item instantiated, there is nothing
    // to do.  This can happen when we are restoring the entire pager
    // from its saved state, where the fragment manager has already
    // taken care of restoring the fragments we previously had instantiated.
    if (mFragments.size() > position) {
        Fragment f = mFragments.get(position);
        if (f != null) {
            int newPos = getItemPosition(f);
            if (position == newPos) {
                if (f.getView() != null && f.getView().getParent() != container) {
                    ((ViewGroup) f.getView().getParent()).removeView(f.getView());
                    container.addView(f.getView());
                }
                return f;
            } else {
                mFragments.remove(position);
                mFragments.ensureCapacity(newPos + 1);
                for (int i = mFragments.size(); i < (newPos +1); i++) {
                    mFragments.add(null);
                }
                mFragments.set(newPos, f);
            }
        }
    }

    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }

    Fragment fragment = getItem(position);
    if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
    if (mSavedState.size() > position) {
        Fragment.SavedState fss = mSavedState.get(position);
        if (fss != null) {
            fragment.setInitialSavedState(fss);
        }
    }
    while (mFragments.size() <= position) {
        mFragments.add(null);
    }
    fragment.setMenuVisibility(false);
    mFragments.set(position, fragment);
    mCurTransaction.add(container.getId(), fragment, getTag(position));

    return fragment;
}