本文整理汇总了Java中android.support.v4.app.Fragment.isResumed方法的典型用法代码示例。如果您正苦于以下问题:Java Fragment.isResumed方法的具体用法?Java Fragment.isResumed怎么用?Java Fragment.isResumed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.Fragment
的用法示例。
在下文中一共展示了Fragment.isResumed方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchBackPress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 处理fragment回退键
* <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p>
* <p>具体示例见FragmentActivity</p>
*
* @param fragmentManager fragment管理器
* @return 是否消费回退事件
*/
public static boolean dispatchBackPress(@NonNull FragmentManager fragmentManager) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null || fragments.isEmpty()) return false;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null
&& fragment.isResumed()
&& fragment.isVisible()
&& fragment.getUserVisibleHint()
&& fragment instanceof OnBackClickListener
&& ((OnBackClickListener) fragment).onBackClick()) {
return true;
}
}
return false;
}
示例2: getTopShowFragmentIsInStack
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 根据栈参数获取顶层可见fragment
*
* @param fragmentManager fragment管理器
* @param parentFragment 父fragment
* @param isInStack 是否是栈中的
* @return 栈中顶层可见fragment
*/
private static Fragment getTopShowFragmentIsInStack(@NonNull final FragmentManager fragmentManager,
final Fragment parentFragment,
final boolean isInStack) {
List<Fragment> fragments = getFragments(fragmentManager);
if (fragments.isEmpty()) return parentFragment;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint()) {
if (isInStack) {
if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, true);
}
} else {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, false);
}
}
}
return parentFragment;
}
示例3: dispatchBackPress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 处理fragment回退键
* <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p>
* <p>具体示例见FragmentActivity</p>
*
* @param fragmentManager fragment管理器
* @return 是否消费回退事件
*/
public static boolean dispatchBackPress(@NonNull final FragmentManager fragmentManager) {
List<Fragment> fragments = getFragments(fragmentManager);
if (fragments == null || fragments.isEmpty()) return false;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null
&& fragment.isResumed()
&& fragment.isVisible()
&& fragment.getUserVisibleHint()
&& fragment instanceof OnBackClickListener
&& ((OnBackClickListener) fragment).onBackClick()) {
return true;
}
}
return false;
}
示例4: getTopShowFragmentIsInStack
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 根据栈参数获取顶层可见fragment
*
* @param fragmentManager fragment管理器
* @param parentFragment 父fragment
* @param isInStack 是否是栈中的
* @return 栈中顶层可见fragment
*/
private static Fragment getTopShowFragmentIsInStack(@NonNull FragmentManager fragmentManager,
Fragment parentFragment,
boolean isInStack) {
List<Fragment> fragments = getFragments(fragmentManager);
if (fragments.isEmpty()) return parentFragment;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint()) {
if (isInStack) {
if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, true);
}
} else {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, false);
}
}
}
return parentFragment;
}
示例5: getTopShowFragmentIsInStack
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 根据栈参数获取顶层可见fragment
*
* @param fragmentManager fragment管理器
* @param parentFragment 父fragment
* @param isInStack 是否是栈中的
* @return 栈中顶层可见fragment
*/
private static Fragment getTopShowFragmentIsInStack(@NonNull FragmentManager fragmentManager,
Fragment parentFragment,
boolean isInStack) {
List<Fragment> fragments = getFragments(fragmentManager);
if (fragments.isEmpty())
return parentFragment;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint()) {
if (isInStack) {
if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, true);
}
} else {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, false);
}
}
}
return parentFragment;
}
示例6: dispatchBackPress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 处理fragment回退键
* <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p>
* <p>具体示例见FragmentActivity</p>
*
* @param fragmentManager fragment管理器
* @return 是否消费回退事件
*/
public static boolean dispatchBackPress(@NonNull FragmentManager fragmentManager) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null || fragments.isEmpty())
return false;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null
&& fragment.isResumed()
&& fragment.isVisible()
&& fragment.getUserVisibleHint()
&& fragment instanceof OnBackClickListener
&& ((OnBackClickListener) fragment).onBackClick()) {
return true;
}
}
return false;
}
示例7: onBackPressed
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static boolean onBackPressed(@NonNull final FragmentManager fm) {
List<Fragment> fragments = getFragments(fm);
if (fragments == null || fragments.isEmpty()) {
return false;
}
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
//@formatter:off
if (fragment != null &&
fragment.isResumed() &&
fragment.isVisible() &&
fragment.getUserVisibleHint() &&
fragment instanceof OnBackClickListener &&
((OnBackClickListener) fragment)
.onBackClick())
{
return true;
}
//@formatter:on
}
return false;
}
示例8: getTopShowFragmentIsInStack
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* Get the top-level visible fragment based on the stack parameters
*
* @param fragmentManager fragment manager
* @param parentFragment parent fragment
* @param isInStack Whether it is in the stack
* @return The top of the stack is visible
*/
private static Fragment getTopShowFragmentIsInStack(@NonNull FragmentManager fragmentManager,
Fragment parentFragment,
boolean isInStack) {
List<Fragment> fragments = getFragments(fragmentManager);
if (fragments.isEmpty())
return parentFragment;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint()) {
if (isInStack) {
if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, true);
}
} else {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, false);
}
}
}
return parentFragment;
}
示例9: dispatchBackPress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* Handle the fragment back key
* <p>If fragment implements the OnBackClickListener interface, returns {@code true}: indicates that the consumer has returned the key event, otherwise it is not consumed</p>
* <p>See FragmentActivity for specific examples</p>
*
* @param fragmentManager fragment manager
* @return Whether to consume back events
*/
public static boolean dispatchBackPress(@NonNull FragmentManager fragmentManager) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null || fragments.isEmpty())
return false;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null
&& fragment.isResumed()
&& fragment.isVisible()
&& fragment.getUserVisibleHint()
&& fragment instanceof OnBackClickListener
&& ((OnBackClickListener) fragment).onBackClick()) {
return true;
}
}
return false;
}
示例10: dispatchBackPress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 处理fragment回退键
* <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p>
* <p>具体示例见FragmentActivity</p>
*
* @param fragmentManager fragment管理器
* @return 是否消费回退事件
*/
public static boolean dispatchBackPress(@NonNull final FragmentManager fragmentManager) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null || fragments.isEmpty()) return false;
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null
&& fragment.isResumed()
&& fragment.isVisible()
&& fragment.getUserVisibleHint()
&& fragment instanceof OnBackClickListener
&& ((OnBackClickListener) fragment).onBackClick()) {
return true;
}
}
return false;
}
示例11: getTopShowFragmentIsInStack
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 根据栈参数获取顶层可见fragment
*
* @param fragmentManager fragment管理器
* @param parentFragment 父fragment
* @param isInStack 是否是栈中的
* @return 栈中顶层可见fragment
*/
private static Fragment getTopShowFragmentIsInStack(@NonNull FragmentManager fragmentManager,
Fragment parentFragment,
boolean isInStack) {
List<Fragment> fragments = getFragments(fragmentManager);
if (fragments.isEmpty()) {
return parentFragment;
}
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null && fragment.isResumed() && fragment.isVisible() && fragment.getUserVisibleHint()) {
if (isInStack) {
if (fragment.getArguments().getBoolean(ARGS_IS_ADD_STACK)) {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, true);
}
} else {
return getTopShowFragmentIsInStack(fragment.getChildFragmentManager(), fragment, false);
}
}
}
return parentFragment;
}
示例12: dispatchBackPress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
/**
* 处理fragment回退键
* <p>如果fragment实现了OnBackClickListener接口,返回{@code true}: 表示已消费回退键事件,反之则没消费</p>
* <p>具体示例见FragmentActivity</p>
*
* @param fragmentManager fragment管理器
* @return 是否消费回退事件
*/
public static boolean dispatchBackPress(@NonNull FragmentManager fragmentManager) {
List<Fragment> fragments = fragmentManager.getFragments();
if (fragments == null || fragments.isEmpty()) {
return false;
}
for (int i = fragments.size() - 1; i >= 0; --i) {
Fragment fragment = fragments.get(i);
if (fragment != null
&& fragment.isResumed()
&& fragment.isVisible()
&& fragment.getUserVisibleHint()
&& fragment instanceof OnBackClickListener
&& ((OnBackClickListener) fragment).onBackClick()) {
return true;
}
}
return false;
}
示例13: showProgress
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
public static void showProgress(@NonNull final Fragment fragment, final SwipeRefreshLayout swipeRefreshLayout, boolean show) {
if (!fragment.isAdded() || swipeRefreshLayout == null) return;
if (!show) {
swipeRefreshLayout.setRefreshing(false);
return;
}
if (fragment.isResumed()) {
swipeRefreshLayout.setRefreshing(true);
} else {
swipeRefreshLayout.post(() -> swipeRefreshLayout.setRefreshing(true));
}
}
示例14: getActiveFragment
import android.support.v4.app.Fragment; //导入方法依赖的package包/类
private static ISupportFragment getActiveFragment(FragmentManager fragmentManager, ISupportFragment parentFragment) {
List<Fragment> fragmentList = FragmentationHack.getActiveFragments(fragmentManager);
if (fragmentList == null) {
return parentFragment;
}
for (int i = fragmentList.size() - 1; i >= 0; i--) {
Fragment fragment = fragmentList.get(i);
if (fragment instanceof ISupportFragment) {
if (fragment.isResumed() && !fragment.isHidden() && fragment.getUserVisibleHint()) {
return getActiveFragment(fragment.getChildFragmentManager(), (ISupportFragment) fragment);
}
}
}
return parentFragment;
}