Java Code Examples for android.support.v4.app.Fragment#onResume()
The following examples show how to use
android.support.v4.app.Fragment#onResume() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FragmentSettingViewModel.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
private void updateRoomListIfNeeded() { try { for (Fragment f : G.fragmentManager.getFragments()) { if (f == null) { continue; } if (f instanceof FragmentMain || f instanceof FragmentCall) { f.onResume(); } } } catch (Exception e) { HelperLog.setErrorLog("fragment setting updateRoomListIfNeeded " + e.toString()); } }
Example 2
Source File: MainActivity.java From 4pdaClient-plus with Apache License 2.0 | 6 votes |
public void showFragment(String tag, boolean onresume) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag); if (fragment == null) { if (App.getInstance().getTabByTag(tag) != null) { TabItem tabItem = App.getInstance().getTabByTag(tag); addTab(tabItem.getTitle(), tabItem.getUrl(), tabItem.getFragment()); return; } transaction.commitAllowingStateLoss(); return; } if (onresume) fragment.onResume(); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).show(fragment); transaction.commitAllowingStateLoss(); }
Example 3
Source File: MainPagerActivity.java From Man-Man with GNU General Public License v3.0 | 6 votes |
/** * A way to notify fragments when they become visible to user in this pager */ @Override public void setPrimaryItem(ViewGroup container, int position, @NonNull Object object) { Fragment newPrimary = (Fragment) object; if(oldPrimary != newPrimary) { if(oldPrimary != null) { oldPrimary.setUserVisibleHint(false); oldPrimary.onPause(); } newPrimary.setUserVisibleHint(true); newPrimary.onResume(); oldPrimary = newPrimary; } super.setPrimaryItem(container, position, object); }
Example 4
Source File: CurrencyListTabsActivity.java From CryptoBuddy with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onPageSelected(int position) { Fragment fragment = mSectionsPagerAdapter.getFragment(position); if (fragment != null) { fragment.onResume(); } }
Example 5
Source File: ZhiHuAdapter.java From CoordinatorLayoutExample with Apache License 2.0 | 5 votes |
@Override public void onCheckedChanged(RadioGroup radioGroup, int checkId) { for (int i = 0; i < radioGroup.getChildCount(); i++) { if (radioGroup.getChildAt(i).getId() == checkId) { // 即将要展示的Fragment Fragment target = mFragmentList.get(i); Fragment currentFragment = getCurrentFragment(); currentFragment.onPause(); FragmentTransaction fragmentTransaction = getFragmentTransaction(); if (target.isAdded()) { target.onResume(); fragmentTransaction.show(target).hide(currentFragment); } else { fragmentTransaction.add(mContentId, target).show(target).hide(currentFragment); } fragmentTransaction.commit(); currentTab = i; if (mFragmentToogleListener != null) { mFragmentToogleListener.onToogleChange(target, currentTab); } } } }
Example 6
Source File: MainActivity.java From 4pdaClient-plus with Apache License 2.0 | 5 votes |
@Override protected void onPostResume() { super.onPostResume(); activityPaused = false; if (App.getInstance().getCurrentFragmentTag() == null) { BrickInfo brickInfo = ListCore.getRegisteredBrick(Preferences.Lists.getLastSelectedList()); if (brickInfo == null) brickInfo = new NewsPagerBrickInfo(); selectItem(brickInfo); } if (tabOnIntent != null) { addTabToList(tabOnIntent.getTitle(), tabOnIntent.getUrl(), tabOnIntent.getTag(), tabOnIntent.getFragment(), true); } if (tabTagForRemove != null) { tryRemoveTab(tabTagForRemove, true); } tabTagForRemove = null; tabOnIntent = null; if (!(String.valueOf(App.getInstance().getCurrentFragmentTag())).equals("null")) { Fragment fragment = getSupportFragmentManager().findFragmentByTag(App.getInstance().getCurrentFragmentTag()); if (fragment != null) { fragment.onResume(); } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { int[] ints = new int[2]; appBarLayout.getLocationOnScreen(ints); if (statusBarHeight != ints[1] && ints[1] != 0) setStatusBarHeight.run(); } }
Example 7
Source File: MainActivity.java From 4pdaClient-plus with Apache License 2.0 | 4 votes |
private void showFragment(FragmentTransaction transaction, String tag) { Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag); fragment.onResume(); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).show(fragment); }