List of usage examples for android.app Fragment getActivity
final public Activity getActivity()
From source file:cn.edu.wyu.documentviewer.DocumentsActivity.java
public static DocumentsActivity get(Fragment fragment) { return (DocumentsActivity) fragment.getActivity(); }
From source file:com.google.zxing.integration.android.IntentIntegrator.java
/** * @param fragment {@link Fragment} invoking the integration. * {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead * of an {@link Activity} *///from ww w . j av a2 s . co m @TargetApi(Build.VERSION_CODES.HONEYCOMB) public IntentIntegrator(Fragment fragment) { this.activity = fragment.getActivity(); this.fragment = fragment; }
From source file:com.google.zxing.integration.android.IntentIntegrator.java
/** * @param fragment {@link Fragment} invoking the integration. * {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead * of an {@link Activity} *//*w w w.j av a 2 s .c o m*/ public IntentIntegrator(android.support.v4.app.Fragment fragment) { this.activity = fragment.getActivity(); this.supportFragment = fragment; }
From source file:com.vuze.android.remote.AndroidUtils.java
/** * Same as {@link Activity#runOnUiThread(Runnable)}, except ensures * activity still exists while in UI Thread, before executing runnable *//*from w ww . j av a 2s . c o m*/ public static void runOnUIThread(final android.support.v4.app.Fragment fragment, final Runnable runnable) { Activity activity = fragment.getActivity(); if (activity == null) { return; } activity.runOnUiThread(new Runnable() { @Override public void run() { Activity activity = fragment.getActivity(); if (activity == null) { return; } if (runnable instanceof RunnableWithActivity) { ((RunnableWithActivity) runnable).activity = activity; } runnable.run(); } }); }
From source file:com.RSMSA.policeApp.Dialogues.PaymentConfirmationDialogue.java
public void onAttach(Fragment activity) { super.onAttach(activity.getActivity()); try {// www .ja v a2s. c o m this.mListener = (OnCompleteListener) activity; } catch (final ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnCompleteListener"); } }
From source file:com.breadwallet.presenter.activities.IntroActivity.java
private void animateSlide(final Fragment from, final Fragment to, int direction) { if (to instanceof IntroRecoverWalletFragment) { if (Utils.isUsingCustomInputMethod(to.getActivity())) ((IntroRecoverWalletFragment) to).disableEditText(); }/*from ww w . j a va2 s. c o m*/ int screenWidth = screenParametersPoint.x; int screenHeigth = screenParametersPoint.y; showHideFragments(from, to); TranslateAnimation transFrom = direction == RIGHT ? new TranslateAnimation(0, -screenWidth, 0, 0) : new TranslateAnimation(0, screenWidth, 0, 0); transFrom.setDuration(BRAnimator.horizontalSlideDuration); transFrom.setInterpolator(new DecelerateOvershootInterpolator(1f, 0.5f)); View fromView = from.getView(); if (fromView != null) fromView.startAnimation(transFrom); TranslateAnimation transTo = direction == RIGHT ? new TranslateAnimation(screenWidth, 0, 0, 0) : new TranslateAnimation(-screenWidth, 0, 0, 0); transTo.setDuration(BRAnimator.horizontalSlideDuration); transTo.setInterpolator(new DecelerateOvershootInterpolator(1f, 0.5f)); transTo.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { showHideFragments(to); } @Override public void onAnimationRepeat(Animation animation) { } }); View toView = to.getView(); if (toView != null) toView.startAnimation(transTo); }
From source file:dev.dworks.apps.anexplorer.fragment.DirectoryFragment.java
private static State getDisplayState(Fragment fragment) { return ((DocumentsActivity) fragment.getActivity()).getDisplayState(); }
From source file:com.nutomic.syncthingandroid.util.BarcodeIntentIntegrator.java
/** * @param fragment {@link Fragment} invoking the integration. * {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead * of an {@link Activity}/*from ww w. j a v a2 s . c om*/ */ @TargetApi(11) public BarcodeIntentIntegrator(Fragment fragment) { this.activity = fragment.getActivity(); this.fragment = fragment; this.fragmentV4 = null; initializeConfiguration(); }
From source file:com.google.zxing.integration.android.SupportIntentIntegrator.java
/** * @param fragment {@link Fragment} invoking the integration. * {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead * of an {@link Activity}/* w w w . j ava 2 s . co m*/ */ public SupportIntentIntegrator(Fragment fragment) { this.activity = fragment.getActivity(); this.fragment = fragment; this.fragmentV4 = null; initializeConfiguration(); }
From source file:org.jboss.aerogear.android.pipe.loader.LoaderAdapter.java
public LoaderAdapter(android.support.v4.app.Fragment supportFragment, Context applicationContext, Pipe<T> pipe, String name) {//from w w w .j av a 2 s . co m this.pipe = pipe; this.manager = supportFragment.getActivity().getLoaderManager(); this.requestBuilder = pipe.getRequestBuilder(); this.responseParser = pipe.getResponseParser(); this.applicationContext = applicationContext; this.name = name; this.handler = new Handler(Looper.getMainLooper()); this.supportFragment = supportFragment; }