Example usage for android.app Fragment getClass

List of usage examples for android.app Fragment getClass

Introduction

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

Prototype

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

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.breadwallet.tools.animation.BRAnimator.java

/**
 * Animate the transition on wipe wallet fragment
 */// w ww .  ja v  a2 s.  c  o  m

public static void pressWipeWallet(final MainActivity context, final Fragment to) {
    try {
        if (!wipeWalletOpen) {
            wipeWalletOpen = true;
            FragmentTransaction fragmentTransaction = context.getFragmentManager().beginTransaction();
            fragmentTransaction.replace(R.id.main_layout, to, to.getClass().getName());
            fragmentTransaction.commit();
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    TranslateAnimation trans = new TranslateAnimation(0, 0, 1920, 0);
                    trans.setDuration(500);
                    trans.setInterpolator(new DecelerateOvershootInterpolator(3f, 0.5f));
                    View view = to.getView();
                    if (view != null)
                        view.startAnimation(trans);
                }
            }, 1);

        } else {
            wipeWalletOpen = false;
            FragmentTransaction fragmentTransaction = context.getFragmentManager().beginTransaction();
            fragmentTransaction.setCustomAnimations(R.animator.from_top, R.animator.to_bottom);
            fragmentTransaction.replace(R.id.main_layout, new FragmentSettings(),
                    FragmentSettings.class.getName());
            fragmentTransaction.commit();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.breadwallet.tools.animation.BRAnimator.java

public static void animateSlideToRight(final MainActivity context) {
    try {/* ww  w  .j a va  2s .  co  m*/
        if (!checkTheHorizontalSlideAvailability())
            return;
        final Fragment tmp = previous.pop();
        level--;
        if (level < 1)
            context.setBurgerButtonImage(BRConstants.BURGER);
        if (level == 1)
            context.setBurgerButtonImage(BRConstants.CLOSE);
        FragmentTransaction fragmentTransaction = context.getFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.main_layout, tmp, tmp.getClass().getName());
        fragmentTransaction.commit();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                TranslateAnimation trans = new TranslateAnimation(-MainActivity.screenParametersPoint.x, 0, 0,
                        0);
                trans.setDuration(horizontalSlideDuration);
                trans.setInterpolator(new DecelerateOvershootInterpolator(1f, 0.5f));
                View view = tmp.getView();
                if (view != null)
                    view.startAnimation(trans);
            }
        }, 1);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.breadwallet.tools.animation.BRAnimator.java

/**
 * Animates the fragment transition on button_regular_blue "Settings" pressed
 *//*  w w  w.  j a v a  2  s.com*/
public static void animateSlideToLeft(final MainActivity context, final Fragment to,
        Fragment previousFragment) {
    try {
        if (!checkTheHorizontalSlideAvailability())
            return;
        level++;
        if (level > 1)
            context.setBurgerButtonImage(BRConstants.BACK);
        FragmentTransaction fragmentTransaction = context.getFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.main_layout, to, to.getClass().getName());
        if (previousFragment != null)
            previous.add(previousFragment);
        fragmentTransaction.commit();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                TranslateAnimation trans = new TranslateAnimation(MainActivity.screenParametersPoint.x, 0, 0,
                        0);
                trans.setDuration(horizontalSlideDuration);
                trans.setInterpolator(new DecelerateOvershootInterpolator(1f, 0.5f));
                View view = to.getView();
                if (view != null)
                    view.startAnimation(trans);
            }
        }, 1);
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.ezhuk.cast.MainActivityTest.java

public void testMainActivityTest_DrawerFragment() {
    final Fragment fragment = mMainActivity.getFragmentManager().findFragmentById(R.id.drawer_frame);
    assertEquals(DevicesFragment.class, fragment.getClass());
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

public static void init(final Fragment fragment, final Bundle arguments) {
    try {/*from   w ww .  ja v  a  2s. co  m*/
        init(fragment.getClass(), fragment, arguments);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

public static void init(final Fragment fragment, final SharedPreferences prefs) {
    try {/*from w  ww.jav  a 2  s .  c  o  m*/
        init(fragment.getClass(), fragment, prefs);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

/**
 * Store all retainable fields of a {@link Fragment} in a {@link Bundle}.
 * /*from   w ww. j a  va  2 s.  com*/
 * @param fragment
 *            The {@link Fragment}.
 * @param instanceState
 *            The {@link Bundle} to store the state in.
 */
public static void store(final Fragment fragment, final Bundle instanceState) {
    try {
        storeAndRestore(fragment.getClass(), fragment, instanceState, true /* store */);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

/**
 * Restore all retainable fields of a {@link Fragment} from a {@link Bundle}.
 * //w ww  . j  av a  2s .c  om
 * @param fragment
 *            The {@link Fragment}.
 * @param instanceState
 *            The {@link Bundle} to store the state in.
 */
public static void restore(final Fragment fragment, final Bundle instanceState) {
    try {
        storeAndRestore(fragment.getClass(), fragment, instanceState, false /* restore */);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

public static void persist(final Fragment fragment, final SharedPreferences.Editor editor) {
    try {/*from   w  w  w .j  av a 2s.com*/
        persist(fragment.getClass(), fragment, editor);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:org.dmfs.android.retentionmagic.RetentionMagic.java

public static void init(final android.support.v4.app.Fragment fragment, final Bundle arguments) {
    try {/*from   w  ww . j a v  a 2  s  .c  o m*/
        init(fragment.getClass(), fragment, arguments);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}