@Override public void onDestroy() { mStackManager.onDestroy(); if (mActivity.isFinishing()) { mStackManager.clear(); if (mRiggerTransaction != null) { mRiggerTransaction.removeAll(); } } }
public static BottomDialogFragment showDialog(AppCompatActivity appCompatActivity) { FragmentManager fragmentManager = appCompatActivity.getSupportFragmentManager(); BottomDialogFragment bottomDialogFragment = (BottomDialogFragment) fragmentManager.findFragmentByTag(TAG); if (null == bottomDialogFragment) { bottomDialogFragment = newInstance(); } if (!appCompatActivity.isFinishing() && null != bottomDialogFragment && !bottomDialogFragment.isAdded()) { fragmentManager.beginTransaction() .add(bottomDialogFragment, TAG) .commitAllowingStateLoss(); } return bottomDialogFragment; } }
public static boolean check(@NonNull AppCompatActivity context, @NonNull LicensingCallback cb) { final String key = Config.get().licensingPublicKey(); if (key == null || key.trim().isEmpty()) { LOG("License checking is disabled."); return true; } else if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(KEY_VALID, false)) { LOG("License checking has already been done, and the license check was successful."); return true; } if (BuildConfig.DEBUG) { Toast.makeText(context, "License checking is disabled for this debug build.", Toast.LENGTH_SHORT).show(); return true; } if (context.getContentResolver() == null) { if (!context.isFinishing()) context.finish(); return false; } mProgress = ProgressDialogFragment.show(context, R.string.checking_license); final String deviceId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); // Library calls this when it's done. mLicenseCheckerCallback = new MyLicenseCheckerCallback(context, cb); // Construct the LicenseChecker with a policy. mChecker = new LicenseChecker( context, new ServerManagedPolicy(context, new AESObfuscator(getSalt(context), BuildConfig.APPLICATION_ID, deviceId)), key); mChecker.checkAccess(mLicenseCheckerCallback); return false; }
protected void onPostExecute(GDPRPreperationData result) { if (isCancelled()) { return; } T activity = mActivity.get(); if (activity != null && !activity.isFinishing()) { if (mSetup.requestLocationChecks().length > 0 && result.getLocation() == GDPRLocation.NOT_IN_EAA) { // user does want to not request consent and consider this as consent given, so we save this here GDPRConsentState consentState = new GDPRConsentState(activity, GDPRConsent.AUTOMATIC_PERSONAL_CONSENT, result.getLocation()); GDPR.getInstance().setConsent(consentState); activity.onConsentInfoUpdate(consentState, true); } else { activity.onConsentNeedsToBeRequested(result); } } } }