本文整理汇总了Java中me.yokeyword.fragmentation.SupportFragment类的典型用法代码示例。如果您正苦于以下问题:Java SupportFragment类的具体用法?Java SupportFragment怎么用?Java SupportFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SupportFragment类属于me.yokeyword.fragmentation包,在下文中一共展示了SupportFragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTargetFragment
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
private SupportFragment getTargetFragment(int item) {
switch (item) {
case Constants.TYPE_ZHIHU:
return mZhihuFragment;
case Constants.TYPE_GANK:
return mGankFragment;
case Constants.TYPE_WECHAT:
return mWechatFragment;
case Constants.TYPE_GOLD:
return mGoldFragment;
case Constants.TYPE_VTEX:
return mVtexFragment;
case Constants.TYPE_LIKE:
return mLikeFragment;
case Constants.TYPE_SETTING:
return mSettingFragment;
case Constants.TYPE_ABOUT:
return mAboutFragment;
}
return mZhihuFragment;
}
示例2: getLayoutView
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
public View getLayoutView() {
coreRecyclerView = new CoreRecyclerView(mContext).init(new GridLayoutManager(mContext, 2),
new BaseQuickAdapter<SectionListBean.DataBean, BaseViewHolder>(R.layout.item_section) {
@Override
protected void convert(BaseViewHolder helper, SectionListBean.DataBean item) {
//Glide在加载GridView等时,由于ImageView和Bitmap实际大小不符合,第一次时加载可能会变形(我这里出现了放大),必须在加载前再次固定ImageView大小
ViewGroup.LayoutParams lp = helper.getView(R.id.section_bg).getLayoutParams();
lp.width = (App.SCREEN_WIDTH - DisplayUtils.dp2px(mContext, 12)) / 2;
lp.height = DisplayUtils.dp2px(mContext, 120);
Glide.with(mContext).load(item.getThumbnail()).crossFade().placeholder(R.drawable.ic_default_cover).into((ImageView) helper.getView(R.id.section_bg));
helper.setText(R.id.section_kind, item.getName())
.setText(R.id.section_des, item.getDescription())
.setOnClickListener(R.id.ll_click, v -> {
((SupportFragment) getParentFragment()).start(SectionListFragment.newInstance(item.getId(), item.getName()));
});
}
});
return coreRecyclerView;
}
示例3: getTargetFragment
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
private SupportFragment getTargetFragment(int item) {
switch (item) {
case Constants.NavigationItem.TYPE_ZHIHU:
return mZhihuFragment;
case Constants.NavigationItem.TYPE_GANK:
return mGankFragment;
case Constants.NavigationItem.TYPE_WECHAT:
return mWechatFragment;
case Constants.NavigationItem.TYPE_NEWS:
return mNewsFragment;
case Constants.NavigationItem.TYPE_LIKE:
return mLikeFragment;
case Constants.NavigationItem.TYPE_SETTING:
return mSettingFragment;
case Constants.NavigationItem.TYPE_ABOUT:
return mAboutFragment;
}
return mZhihuFragment;
}
示例4: onActivityCreated
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SupportFragment firstFragment = findChildFragment(WechatFirstTabFragment.class);
if (firstFragment == null) {
mFragments[FIRST] = WechatFirstTabFragment.newInstance();
mFragments[SECOND] = WechatSecondTabFragment.newInstance();
mFragments[THIRD] = WechatThirdTabFragment.newInstance();
loadMultipleRootFragment(R.id.fl_tab_container, FIRST,
mFragments[FIRST],
mFragments[SECOND],
mFragments[THIRD]);
} else {
// 这里库已经做了Fragment恢复,所有不需要额外的处理了, 不会出现重叠问题
// 这里我们需要拿到mFragments的引用
mFragments[FIRST] = firstFragment;
mFragments[SECOND] = findChildFragment(WechatSecondTabFragment.class);
mFragments[THIRD] = findChildFragment(WechatThirdTabFragment.class);
}
}
示例5: initFragment
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
private void initFragment(){
mFragments = new SupportFragment[3];
HomeFragment homeFragment = new HomeFragment();
ClockFragment clockFragment = new ClockFragment();
MineFragment mineFragment = new MineFragment();
mFragments[0] = homeFragment;
mFragments[1] = clockFragment;
mFragments[2] = mineFragment;
loadMultipleRootFragment(mContentLayout.getId(),0,mFragments);
}
示例6: dispatchSupportVisible
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
private void dispatchSupportVisible(boolean visible) {
mIsSupportVisible = visible;
if (!mNeedDispatch) {
mNeedDispatch = true;
} else {
FragmentManager fragmentManager = mSupportFragment.getChildFragmentManager();
if (fragmentManager != null) {
List<Fragment> childFragments = fragmentManager.getFragments();
if (childFragments != null) {
for (Fragment child : childFragments) {
if (child instanceof SupportFragment && !child.isHidden() && child.getUserVisibleHint()) {
((SupportFragment) child).getVisibleDelegate().dispatchSupportVisible(visible);
}
}
}
}
}
if (visible) {
mSupportFragment.onSupportVisible();
if (mIsFirstVisible) {
mIsFirstVisible = false;
mSupportFragment.onLazyInitView(mSaveInstanceState);
}
} else {
mSupportFragment.onSupportInvisible();
}
}
示例7: onCreate
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.zhihu_activity_main);
SupportFragment firstFragment = findFragment(ZhihuFirstFragment.class);
if (firstFragment == null) {
mFragments[FIRST] = ZhihuFirstFragment.newInstance();
mFragments[SECOND] = ZhihuSecondFragment.newInstance();
mFragments[THIRD] = ZhihuThirdFragment.newInstance();
mFragments[FOURTH] = ZhihuFourthFragment.newInstance();
loadMultipleRootFragment(R.id.fl_container, FIRST,
mFragments[FIRST],
mFragments[SECOND],
mFragments[THIRD],
mFragments[FOURTH]);
} else {
// 这里库已经做了Fragment恢复,所有不需要额外的处理了, 不会出现重叠问题
// 这里我们需要拿到mFragments的引用
mFragments[FIRST] = firstFragment;
mFragments[SECOND] = findFragment(ZhihuSecondFragment.class);
mFragments[THIRD] = findFragment(ZhihuThirdFragment.class);
mFragments[FOURTH] = findFragment(ZhihuFourthFragment.class);
}
initView();
}
示例8: switchContentFragment
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
/**
* 替换加载 内容Fragment
*
* @param fragment
*/
public void switchContentFragment(ContentFragment fragment) {
SupportFragment contentFragment = findChildFragment(ContentFragment.class);
if (contentFragment != null) {
contentFragment.replaceFragment(fragment, false);
}
}
示例9: onCreate
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_general);
if (getTopFragment() == null) {
String uri = getIntent().getStringExtra(Rabbit.KEY_ORIGIN_URI);
SupportFragment fragment = (SupportFragment) Rabbit.from(this)
.obtain(uri)
.mergeExtras(getIntent().getExtras())
.obtain();
loadRootFragment(R.id.common_fragment_container, fragment);
}
}
示例10: onNewIntent
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String uri = intent.getStringExtra(Rabbit.KEY_ORIGIN_URI);
SupportFragment fragment = (SupportFragment) Rabbit.from(this)
.obtain(uri)
.mergeExtras(getIntent().getExtras())
.obtain();
if (getTopFragment() == null) {
loadRootFragment(R.id.common_fragment_container, fragment);
} else {
start(fragment);
}
}
示例11: gotoMine
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
private void gotoMine() {
MineFragment fragment = findFragment(MineFragment.class);
if (fragment == null) {
popTo(WxFragment.class, false, () -> start(MineFragment.newInstance()));
} else {
start(fragment, SupportFragment.SINGLETASK);
}
mNavigationView.setCheckedItem(R.id.menu_mine);
}
示例12: startNewFragment
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
public void startNewFragment(@NonNull SupportFragment supportFragment) {
start(supportFragment);
}
示例13: startNewFragmentWithPop
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
public void startNewFragmentWithPop(@NonNull SupportFragment supportFragment) {
startWithPop(supportFragment);
}
示例14: startNewFragmentForResult
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
@Override
public void startNewFragmentForResult(@NonNull SupportFragment supportFragment, int
requestCode) {
startForResult(supportFragment, requestCode);
}
示例15: VisibleDelegate
import me.yokeyword.fragmentation.SupportFragment; //导入依赖的package包/类
public VisibleDelegate(SupportFragment fragment) {
this.mSupportFragment = fragment;
}