android.app.Activity.isTaskRoot()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(388)

本文整理了Java中android.app.Activity.isTaskRoot()方法的一些代码示例,展示了Activity.isTaskRoot()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.isTaskRoot()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:isTaskRoot

Activity.isTaskRoot介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public S isTaskRoot() {
 isNotNull();
 assertThat(actual.isTaskRoot()) //
   .overridingErrorMessage("Expected to be task root but was not task root.") //
   .isTrue();
 return myself;
}

代码示例来源:origin: square/assertj-android

public S isNotTaskRoot() {
 isNotNull();
 assertThat(actual.isTaskRoot()) //
   .overridingErrorMessage("Expected not to be task root but was task root.") //
   .isFalse();
 return myself;
}

代码示例来源:origin: android-hacker/VirtualXposed

ApplicationInfo applicationInfo = baseContext.getApplicationInfo();
PackageManager pm = activity.getPackageManager();
if (intent != null && activity.isTaskRoot()) {
  try {
    String label = applicationInfo.loadLabel(pm) + "";

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldSupportIsTaskRoot() throws Exception {
 Activity activity = Robolectric.setupActivity(Activity.class);
 assertTrue(activity.isTaskRoot()); // as implemented, Activities are considered task roots by default
 shadowOf(activity).setIsTaskRoot(false);
 assertFalse(activity.isTaskRoot());
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @return
 * @see android.app.Activity#isTaskRoot()
 */
public boolean isTaskRoot() {
  return mActivity.isTaskRoot();
}

代码示例来源:origin: iqiyi/Neptune

@Override
public boolean isTaskRoot() {
  return mOriginActivity.isTaskRoot();
}

代码示例来源:origin: Simon-Leeeeeeeee/SLWidget

/**
 * 利用反射将activity转为不透明
 */
private void convertFromTranslucent(Activity activity) {
  if (activity.isTaskRoot()) return;
  try {
    Method convertFromTranslucent = Activity.class.getDeclaredMethod("convertFromTranslucent");
    convertFromTranslucent.setAccessible(true);
    convertFromTranslucent.invoke(activity);
  } catch (Throwable ignored) {
  }
}

代码示例来源:origin: redfish64/TinyTravelTracker

public void exitFromApp(Intent i)
{
  if(activity.isTaskRoot())
  {
    activity.startActivity(i);
    isBackAction = false;
  }
  else {
    exitingFromApp = true;
    exitingFromAppIntent = i;
  }
  activity.finish();
  return;
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Finishes the current activity and goes to the previous activity in the task.
 */
public void finish()
{
  if(!activity.isTaskRoot())
    isNextActionInternal = true;
  
  iGtgActivity.superFinish();
}

代码示例来源:origin: stackoverflow.com

public static void redirectToHomeActivity(Activity activity) {
     if (activity == null || activity.isDestroyed())
       return;
     if (!activity.isTaskRoot()) return;//Return whether this activity is not in the root of a task.
     Intent intent = new Intent(activity, MainScreenActivity.class);
     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);//this is use to start new activity
     activity.startActivity(intent);
   }

代码示例来源:origin: matomo-org/matomo-sdk-android

@Override
public void onActivityStopped(Activity activity) {
  if (activity != null && activity.isTaskRoot()) {
    tracker.dispatch();
  }
}

代码示例来源:origin: matomo-org/piwik-sdk-android

@Override
public void onActivityStopped(Activity activity) {
  if (activity != null && activity.isTaskRoot()) {
    tracker.dispatch();
  }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S isTaskRoot() {
 isNotNull();
 assertThat(actual.isTaskRoot()) //
   .overridingErrorMessage("Expected to be task root but was not task root.") //
   .isTrue();
 return myself;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S isNotTaskRoot() {
 isNotNull();
 assertThat(actual.isTaskRoot()) //
   .overridingErrorMessage("Expected not to be task root but was task root.") //
   .isFalse();
 return myself;
}

代码示例来源:origin: Simon-Leeeeeeeee/SLWidget

if (!isSwipeBackEnabled || mSwipeBackActivity.isTaskRoot()) {
  return;

代码示例来源:origin: redfish64/TinyTravelTracker

public void onPause() {
  forwarded = false;
  
  if(activity.isTaskRoot())
  {
    isBackAction = false;
    exitingFromApp = false;
  }
  
  if(!isNextActionInternal)
  {
    //we want to clear the initial password if the user leaves the app
    EnterNewPasswordPage.passwordInitializedWith = null;
    GTG.setAppPasswordNotEntered();
    
    //they might have went to buy the premium package
    Requirement.NOT_TRIAL_WHEN_PREMIUM_IS_AVAILABLE.reset();
  }
  
  iGtgActivity.doOnPause(state == State.DO_RESUME_CALLED);
}

代码示例来源:origin: jbruchanov/AnUitor

data.put("IsChild", activity.isChild());
data.put("IsDestroyed", activity.isFinishing());
data.put("IsTaskRoot", activity.isTaskRoot());

代码示例来源:origin: darkskygit/VirtualApp

ApplicationInfo applicationInfo = baseContext.getApplicationInfo();
PackageManager pm = activity.getPackageManager();
if (intent != null && activity.isTaskRoot()) {
  try {
    String label = applicationInfo.loadLabel(pm) + "";

代码示例来源:origin: bzsome/VirtualApp-x326

ApplicationInfo applicationInfo = baseContext.getApplicationInfo();
PackageManager pm = activity.getPackageManager();
if (intent != null && activity.isTaskRoot()) {
  try {
    String label = applicationInfo.loadLabel(pm) + "";

代码示例来源:origin: PrivacyApps/document-viewer

private void goUp() {
  // Implementation of the up button from http://developer.android.com/training/implementing-navigation/ancestral.html
  // isTaskRoot() check works around a bug where pressing "up" does nothing when the viewer is launched
  // by tapping on a pdf download notification in the notification list.
  // see: http://stackoverflow.com/questions/19999619/navutils-navigateupto-does-not-start-any-activity
  Activity activity = getActivity();
  Intent upIntent = NavUtils.getParentActivityIntent(activity);
  if (NavUtils.shouldUpRecreateTask(activity, upIntent) || activity.isTaskRoot()) {
    // e.g., this is the case when opening a pdf from the Downloads app and pressing the up button:
    // the ViewerActivity is running in the Downloads task, so the following will start a new task
    // to open the document-viewer library in.
    TaskStackBuilder.create(activity)
        .addNextIntentWithParentStack(upIntent)
        .startActivities();
    getActivity().finish();
  } else {
    // Restart the existing instance of the RecentActivity rather than starting a new one   
    upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    NavUtils.navigateUpTo(activity, upIntent);
  }
}

相关文章

Activity类方法