List of usage examples for android.app Activity isDestroyed
public boolean isDestroyed()
From source file:org.onebusaway.android.util.UIUtils.java
/** * Returns true if the activity is still active and dialogs can be managed (i.e., displayed * or dismissed), or false if it is//from w w w .j ava 2 s .c om * not * * @param activity Activity to check for displaying/dismissing a dialog * @return true if the activity is still active and dialogs can be managed, or false if it is * not */ public static boolean canManageDialog(Activity activity) { if (activity == null) { return false; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return !activity.isFinishing() && !activity.isDestroyed(); } else { return !activity.isFinishing(); } }
From source file:io.digibyte.tools.animation.BRAnimator.java
public static void showBreadSignal(Activity activity, String title, String iconDescription, int drawableId, BROnSignalCompletion completion) { fragmentSignal = new FragmentSignal(); Bundle bundle = new Bundle(); bundle.putString(FragmentSignal.TITLE, title); bundle.putString(FragmentSignal.ICON_DESCRIPTION, iconDescription); fragmentSignal.setCompletion(completion); bundle.putInt(FragmentSignal.RES_ID, drawableId); fragmentSignal.setArguments(bundle); FragmentTransaction transaction = activity.getFragmentManager().beginTransaction(); transaction.setCustomAnimations(R.animator.from_bottom, R.animator.to_bottom, R.animator.from_bottom, R.animator.to_bottom);//from w ww.j a v a 2s . c om transaction.add(android.R.id.content, fragmentSignal, fragmentSignal.getClass().getName()); transaction.addToBackStack(null); if (!activity.isDestroyed()) transaction.commit(); }
From source file:io.digibyte.presenter.fragments.FragmentTransactionDetails.java
@Override public void onStop() { super.onStop(); final Activity app = getActivity(); BRAnimator.animateBackgroundDim(backgroundLayout, true); BRAnimator.animateSignalSlide(txViewPager, true, new BRAnimator.OnSlideAnimationEnd() { @Override// ww w .ja v a 2s . c o m public void onAnimationEnd() { if (app != null && !app.isDestroyed()) app.getFragmentManager().popBackStack(); else Log.e(TAG, "onAnimationEnd: app is null"); } }); }
From source file:com.breadwallet.BreadWalletApp.java
public void promptForAuthentication(Activity context, int mode, PaymentRequestEntity requestEntity, String message, String title, PaymentRequestWrapper paymentRequest, boolean forcePasscode) { Log.e(TAG, "promptForAuthentication: " + mode); if (context == null) return;/* ww w . j a v a 2s . c o m*/ KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Activity.KEYGUARD_SERVICE); boolean useFingerPrint = ActivityCompat.checkSelfPermission(this, Manifest.permission.USE_FINGERPRINT) == PackageManager.PERMISSION_GRANTED && mFingerprintManager.isHardwareDetected() && mFingerprintManager.hasEnrolledFingerprints(); if (mode == BRConstants.AUTH_FOR_PAY) { long limit = KeyStoreManager.getSpendLimit(context); long totalSent = BRWalletManager.getInstance(context).getTotalSent(); if (requestEntity != null) if (limit <= totalSent + requestEntity.amount) { useFingerPrint = false; } } if (mode == BRConstants.AUTH_FOR_LIMIT || mode == BRConstants.AUTH_FOR_PHRASE) { useFingerPrint = false; } if (KeyStoreManager.getFailCount(context) != 0) { useFingerPrint = false; } long passTime = KeyStoreManager.getLastPasscodeUsedTime(context); if (passTime + TimeUnit.MILLISECONDS.convert(2, TimeUnit.DAYS) <= System.currentTimeMillis()) { useFingerPrint = false; } if (forcePasscode) useFingerPrint = false; if (keyguardManager.isKeyguardSecure()) { if (useFingerPrint) { // This happens when no fingerprints are registered. FingerprintDialogFragment fingerprintDialogFragment = new FingerprintDialogFragment(); fingerprintDialogFragment.setMode(mode); fingerprintDialogFragment.setPaymentRequestEntity(requestEntity, paymentRequest); fingerprintDialogFragment.setMessage(message); fingerprintDialogFragment.setTitle(message != null ? "" : title); if (!context.isDestroyed()) fingerprintDialogFragment.show(context.getFragmentManager(), FingerprintDialogFragment.class.getName()); } else { PasswordDialogFragment passwordDialogFragment = new PasswordDialogFragment(); passwordDialogFragment.setMode(mode); passwordDialogFragment.setPaymentRequestEntity(requestEntity, paymentRequest); passwordDialogFragment.setVerifyOnlyTrue(); passwordDialogFragment.setMessage(message); if (!context.isDestroyed()) passwordDialogFragment.show(context.getFragmentManager(), PasswordDialogFragment.class.getName()); } } else { showDeviceNotSecuredWarning(context); } }