Example usage for android.support.v4.app NavUtils PARENT_ACTIVITY

List of usage examples for android.support.v4.app NavUtils PARENT_ACTIVITY

Introduction

In this page you can find the example usage for android.support.v4.app NavUtils PARENT_ACTIVITY.

Prototype

String PARENT_ACTIVITY

To view the source code for android.support.v4.app NavUtils PARENT_ACTIVITY.

Click Source Link

Usage

From source file:net.lp.actionbarpoirot.helpers.DualNavUtils.java

static String getParentActivityNameInner(Context context, final ActivityInfo info) {// This would not have been necessary if
    // we could just write the info.metaData
    // in/* ww w. j a  v  a  2 s.  c o m*/
    // UiUtilities.enableDisableActivities().
    // If somehow the regular Jelly Bean parentActivityName was specified
    // anyway, use that.
    String parentActivity = getParentActivityNameFlag(info);
    if (parentActivity != null) {
        if (parentActivity.charAt(0) == '.') {
            parentActivity = context.getPackageName() + parentActivity;
        }
        if (PoirotWindow.DEBUG)
            Log.w(PoirotWindow.TAG, "parentActivityNameNative=" + parentActivity + " , info.name=" + info.name);
        return parentActivity;
    }

    if (info.metaData == null)
        return null;

    // If somehow the regular android.support.PARENT_ACTIVITY was specified
    // anyway, use that.
    parentActivity = info.metaData.getString(NavUtils.PARENT_ACTIVITY);
    if (parentActivity != null) {
        if (parentActivity.charAt(0) == '.') {
            parentActivity = context.getPackageName() + parentActivity;
        }
        if (PoirotWindow.DEBUG)
            Log.w(PoirotWindow.TAG,
                    "parentActivityNameSupport=" + parentActivity + " , info.name=" + info.name);
        return parentActivity;
    }

    // Get the advised parentActivities for both phone and tablet, from our
    // own metadata, and set it in stone in the real flag and compat
    // metadata.
    if (UiUtilities.isHoneycombTablet(context)) {
        parentActivity = info.metaData.getString(DualNavUtils.METADATA_PARENT_ACTIVITY_NAME_ON_TABLET);
        if (parentActivity != null) {
            if (parentActivity.charAt(0) == '.') {
                parentActivity = context.getPackageName() + parentActivity;
            }
            if (PoirotWindow.DEBUG)
                Log.w(PoirotWindow.TAG,
                        "parentActivityNameOnTablet=" + parentActivity + " , info.name=" + info.name);
            return parentActivity;
        } else {
            if (PoirotWindow.DEBUG)
                Log.w(PoirotWindow.TAG, "parentActivityNameOnTablet=null, info.name=" + info.name);
        }
    } else {
        parentActivity = info.metaData.getString(DualNavUtils.METADATA_PARENT_ACTIVITY_NAME_ON_PHONE);
        if (parentActivity != null) {
            if (parentActivity.charAt(0) == '.') {
                parentActivity = context.getPackageName() + parentActivity;
            }
            if (PoirotWindow.DEBUG)
                Log.w(PoirotWindow.TAG,
                        "parentActivityNameOnPhone=" + parentActivity + " , info.name=" + info.name);
            return parentActivity;
        } else {
            if (PoirotWindow.DEBUG)
                Log.w(PoirotWindow.TAG, "parentActivityNameOnPhone=null, info.name=" + info.name);
        }
    }
    return null;
}