Example usage for android.support.v4.app Fragment getClass

List of usage examples for android.support.v4.app Fragment getClass

Introduction

In this page you can find the example usage for android.support.v4.app Fragment getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.getlantern.firetweet.adapter.support.SupportFixedFragmentStatePagerAdapter.java

@Override
public Object instantiateItem(final ViewGroup container, final int position) {
    final Fragment f = (Fragment) super.instantiateItem(container, position);
    final Bundle savedFragmentState = f != null ? FragmentTrojan.getSavedFragmentState(f) : null;
    if (savedFragmentState != null) {
        savedFragmentState.setClassLoader(f.getClass().getClassLoader());
    }/* w  w  w. j av a2 s.  c o m*/
    return f;
}

From source file:org.mariotaku.twidere.adapter.SupportFixedFragmentStatePagerAdapter.java

@Override
public Object instantiateItem(final ViewGroup container, final int position) {
    final Fragment f = (Fragment) super.instantiateItem(container, position);
    final Bundle savedFragmentState = f != null ? FragmentAccessor.getSavedFragmentState(f) : null;
    if (savedFragmentState != null) {
        savedFragmentState.setClassLoader(f.getClass().getClassLoader());
    }/*from w  w w. jav  a 2 s.com*/
    return f;
}

From source file:com.ap.github.ui.activitys.SimpleFragmentActivity.java

public void setContentFragment(Fragment fragment) {
    getSupportFragmentManager().beginTransaction()
            .add(R.id.containerFrameLayout, fragment, fragment.getClass().getSimpleName())
            .commitAllowingStateLoss();//  w  w  w.  j av  a2 s .  c o  m
}

From source file:org.dalol.orthodoxmezmurmedia.basic.base.BaseActivity.java

protected void replaceFragment(int containerId, Fragment fragment) {
    String tag = fragment.getClass().getSimpleName();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    //transaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
    transaction.replace(containerId, fragment);
    //transaction.addToBackStack(tag);
    //transaction.addToBackStack(null);
    transaction.commit();/*from  ww w  .j  a  v  a2  s  .  co  m*/
}

From source file:com.dalaran.annotation.validator.Validator.java

public boolean validate(Fragment a) {
    Field[] declaredFields = a.getClass().getDeclaredFields();
    boolean valid = false;
    for (Field field : declaredFields) {
        Annotation[] annotations = field.getAnnotations();
        for (Annotation annotation : annotations) {
            if (annotation.annotationType().equals(Length.class)) {
                boolean b = checkToValidate(a, field, (Length) annotation);
                if (b) {
                    valid = b;//from ww w  .  j a  va  2s  . co  m
                }
            }
            if (annotation.annotationType().equals(Email.class)) {
                boolean b = checkToValidateEmail(a, field, (Email) annotation);
                if (b) {
                    valid = b;
                }
            }
            if (annotation.annotationType().equals(EqualsWith.class)) {
                boolean b = checkToValidateEquals(a.getActivity(), field, (EqualsWith) annotation);
                if (b) {
                    valid = b;
                }
            }
        }
    }
    return valid;
}

From source file:org.mythdroid.fragments.RecListFragment.java

private void showDetails() {

    Fragment rdf = null;/*from www  . j  a  v  a2  s  .c  o m*/
    FragmentManager fm = getFragmentManager();
    if (fm == null)
        return;

    FragmentTransaction ft = fm.beginTransaction();

    rdf = RecDetailFragment.newInstance(false, false);

    if (dualPane) {
        Fragment existing = fm.findFragmentById(R.id.recdetails);
        if (existing != null && !existing.getClass().equals(RecDetailFragment.class))
            fm.popBackStackImmediate();
        ft.replace(R.id.recdetails, rdf, rdf.getClass().getSimpleName());
    } else {
        ft.replace(R.id.reclistframe, rdf, rdf.getClass().getSimpleName());
        ft.addToBackStack(null);
    }

    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.commitAllowingStateLoss();

}

From source file:com.ycdyng.onemultitrial.MultiFragment.AFragment.java

private void setInfo() {
    String info = "";
    List<Fragment> currentFragments = getActivity().getSupportFragmentManager().getFragments();
    info += "name           added visible detached removed hidden";
    for (int i = 0; i < currentFragments.size(); i++) {
        Fragment fragment = currentFragments.get(i);
        if (fragment != null) {
            info += "\n" + fragment.getClass().getSimpleName() + "   " + fragment.isAdded() + "     "
                    + fragment.isVisible() + "    " + fragment.isDetached() + "         "
                    + fragment.isRemoving() + "        " + fragment.isHidden();
        }/*from w  ww .  j  a  v a2  s.  c o  m*/
    }
    mInfoTextView.setText(info);
}

From source file:de.vanita5.twittnuker.adapter.support.SupportFixedFragmentStatePagerAdapter.java

@Override
public Object instantiateItem(final ViewGroup container, final int position) {
    final Fragment f = (Fragment) super.instantiateItem(container, position);
    final Bundle savedFragmentState = f != null ? FragmentTrojan.getSavedFragmentState(f) : null;
    if (savedFragmentState != null && f != null) {
        savedFragmentState.setClassLoader(f.getClass().getClassLoader());
    }//from   w ww .j  a va2s .c  o  m
    return f;
}

From source file:siarhei.luskanau.gps.tracker.free.ui.app.AppController.java

private void logDebug() {
    Log.d(TAG, "###########################");
    FragmentManager fragmentManager = activity.getSupportFragmentManager();
    List<Fragment> fragments = fragmentManager.getFragments();
    if (fragments != null) {
        for (Fragment fragment : fragments) {
            if (fragment != null) {
                Log.d(TAG, "FragmentManager.getFragments: " + fragment.getTag() + ": "
                        + fragment.getClass().getSimpleName());
            } else {
                Log.d(TAG, "FragmentManager.getFragments: null");
            }/*from   ww w . j  ava 2 s  .  c o m*/
        }
    }
    for (int i = 0; i < fragmentManager.getBackStackEntryCount(); i++) {
        FragmentManager.BackStackEntry backStackEntry = fragmentManager.getBackStackEntryAt(i);
        Log.d(TAG, "FragmentManager.getBackStackEntryAt: " + i + ": " + backStackEntry.getName());
    }
}

From source file:com.belatrix.events.presentation.ui.base.BelatrixBaseFragment.java

protected void replaceChildFragment(Fragment fragment, int fragmentReplacedId) {
    FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
    String tag = fragment.getClass().getSimpleName();
    transaction.replace(fragmentReplacedId, fragment, tag);
    transaction.commit();/*w  w  w . j av  a 2s.co  m*/
}