Example usage for android.app Activity isTaskRoot

List of usage examples for android.app Activity isTaskRoot

Introduction

In this page you can find the example usage for android.app Activity isTaskRoot.

Prototype

@Override
public boolean isTaskRoot() 

Source Link

Document

Return whether this activity is the root of a task.

Usage

From source file:Main.java

public static boolean isSplashOpenedOverNavigationActivity(final Activity act, final Intent intent) {
    return intent != null && intent.getAction() != null && intent.getAction().equals(Intent.ACTION_MAIN)
            && !act.isTaskRoot() && intent.hasCategory(Intent.CATEGORY_LAUNCHER);
}

From source file:com.github.baoti.pioneer.ui.Navigator.java

public static boolean isTaskRoot(Activity activity) {
    return activity.isTaskRoot();
}

From source file:me.barrasso.android.volume.activities.ConfigurationActivity.java

public static void setupActionBar(Activity activity) {

    // Tint the status bar, if available.
    SystemBarTintManager tintManager = new SystemBarTintManager(activity);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

    ActionBar actionBar = activity.getActionBar();
    if (null != actionBar) {
        actionBar.setIcon(DateUtils.AppIcon());
        actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
        actionBar.setDisplayShowTitleEnabled(true);
    }/*  w  ww .  ja  v a  2s .c o  m*/
}

From source file:net.olejon.spotcommander.MyTools.java

public void navigateUp(final Activity activity) {
    final Intent navigateUpIntent = NavUtils.getParentActivityIntent(activity);

    if (NavUtils.shouldUpRecreateTask(activity, navigateUpIntent) || activity.isTaskRoot()) {
        TaskStackBuilder.create(mContext).addNextIntentWithParentStack(navigateUpIntent).startActivities();
    } else {//from w ww .j  a  va2  s .  c  o  m
        NavUtils.navigateUpFromSameTask(activity);
    }
}

From source file:com.numenta.taurus.chart.AbstractAnomalyChartFragment.java

public void goBack() {
    final Activity activity = getActivity();
    if (activity != null && !activity.isTaskRoot()) {
        final Intent data = new Intent();
        if (_chartData != null) {
            data.putExtra(EXTRA_TYPE, _chartData.getType());
            data.putExtra(EXTRA_ID, _chartData.getId());
            data.putExtra(EXTRA_AGGREGATION, _chartData.getAggregation());
        }//w  w w . j  a  v a 2 s  .  c om

        activity.setResult(Activity.RESULT_OK, data);
        // Go Back
        activity.finish();
    }
}

From source file:com.vuze.android.remote.AndroidUtils.java

public static void showConnectionError(final Activity activity, final String errMsg,
        final boolean allowContinue) {
    if (AndroidUtils.DEBUG) {
        Log.d(TAG, "showConnectionError.string " + AndroidUtils.getCompressedStackTrace());
    }//from w  w  w.j a v a 2s.c o m
    if (activity == null) {
        Log.e(null, "No activity for error message " + errMsg);
        return;
    }
    activity.runOnUiThread(new Runnable() {
        public void run() {
            if (activity.isFinishing()) {
                if (DEBUG) {
                    System.out.println("can't display -- finishing");
                }
                return;
            }
            Builder builder = new AlertDialog.Builder(activity).setTitle(R.string.error_connecting)
                    .setMessage(errMsg).setCancelable(true)
                    .setNegativeButton(R.string.action_logout, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            if (activity.isTaskRoot()) {
                                RemoteUtils.openRemoteList(activity);
                            }
                            activity.finish();
                        }
                    });
            if (allowContinue) {
                builder.setPositiveButton(R.string.button_continue, new OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
            }
            AndroidUtils.openSingleAlertDialog(activity, builder);
        }
    });

}