private void switchContent(Fragment fragment, boolean addToStack) {
   hideFragments(getSupportFragmentManager().beginTransaction())
       .show(fragment)
       .commitAllowingStateLoss();
   if (addToStack && (fragmentsStack.isEmpty() || fragmentsStack.peek() != fragment.getId())) {
     fragmentsStack.push(fragment.getId());
   }
   currentFragment = fragment;
   updateHeader(fragment);
 }
Example #2
0
 public View onCreateView(String str, Context context, AttributeSet attributeSet) {
   int i = 0;
   Fragment fragment = null;
   if (!"fragment".equals(str)) {
     return super.onCreateView(str, context, attributeSet);
   }
   String attributeValue = attributeSet.getAttributeValue(fragment, "class");
   TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C0012i.f123a);
   if (attributeValue == null) {
     attributeValue = obtainStyledAttributes.getString(0);
   }
   int resourceId = obtainStyledAttributes.getResourceId(1, -1);
   String string = obtainStyledAttributes.getString(2);
   obtainStyledAttributes.recycle();
   if (fragment != null) {
     i = fragment.getId();
   }
   if (i == -1 && resourceId == -1 && string == null) {
     throw new IllegalArgumentException(
         attributeSet.getPositionDescription()
             + ": Must specify unique android:id, android:tag, or have a parent with an id for "
             + attributeValue);
   }
   if (resourceId != -1) {
     fragment = this.f111b.m112a(resourceId);
   }
   if (fragment == null && string != null) {
     fragment = this.f111b.m114a(string);
   }
   if (fragment == null && i != -1) {
     fragment = this.f111b.m112a(i);
   }
   if (C0016n.f132a) {
     Log.v(
         "FragmentActivity",
         "onCreateView: id=0x"
             + Integer.toHexString(resourceId)
             + " fname="
             + attributeValue
             + " existing="
             + fragment);
   }
   if (fragment == null) {
     Fragment a = Fragment.m11a((Context) this, attributeValue);
     a.f47o = true;
     a.f55w = resourceId != 0 ? resourceId : i;
     a.f56x = i;
     a.f57y = string;
     a.f48p = true;
     a.f51s = this.f111b;
     a.m18a((Activity) this, attributeSet, a.f36d);
     this.f111b.m126a(a, true);
     fragment = a;
   } else if (fragment.f48p) {
     throw new IllegalArgumentException(
         attributeSet.getPositionDescription()
             + ": Duplicate id 0x"
             + Integer.toHexString(resourceId)
             + ", tag "
             + string
             + ", or parent id 0x"
             + Integer.toHexString(i)
             + " with another fragment for "
             + attributeValue);
   } else {
     fragment.f48p = true;
     if (!fragment.f20C) {
       fragment.m18a((Activity) this, attributeSet, fragment.f36d);
     }
     this.f111b.m135b(fragment);
   }
   if (fragment.f26I == null) {
     throw new IllegalStateException("Fragment " + attributeValue + " did not create a view.");
   }
   if (resourceId != 0) {
     fragment.f26I.setId(resourceId);
   }
   if (fragment.f26I.getTag() == null) {
     fragment.f26I.setTag(string);
   }
   return fragment.f26I;
 }
 private int getIdForFragment(Fragment fragment) {
   return fragment.getId();
 }
Example #4
0
 public int getId() {
   return zzadh.getId();
 }