Example usage for android.app Activity isChangingConfigurations

List of usage examples for android.app Activity isChangingConfigurations

Introduction

In this page you can find the example usage for android.app Activity isChangingConfigurations.

Prototype

public boolean isChangingConfigurations() 

Source Link

Document

Check to see whether this activity is in the process of being destroyed in order to be recreated with a new configuration.

Usage

From source file:Main.java

public static boolean isActivityValid(Activity activity) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        return activity != null && !activity.isFinishing() && !activity.isChangingConfigurations();
    else/* w  w w .j  a v a2  s .c  om*/
        return activity != null && !activity.isFinishing();
}

From source file:io.taig.android.mosby.delegate.DialogFragmentMvpDelegateImpl.java

static boolean retainPresenterInstance(Activity activity, Fragment fragment,
        boolean keepPresenterInstanceDuringScreenOrientationChanges, boolean keepPresenterOnBackstack) {

    if (activity.isChangingConfigurations()) {
        return keepPresenterInstanceDuringScreenOrientationChanges;
    }//w  ww .  j  a v  a 2 s. c  o m

    if (activity.isFinishing()) {
        return false;
    }

    if (keepPresenterOnBackstack && BackstackAccessor.isFragmentOnBackStack(fragment)) {
        return true;
    }

    return !fragment.isRemoving();
}

From source file:com.hannesdorfmann.mosby3.mvp.delegate.FragmentMvpDelegateImpl.java

protected boolean retainPresenterInstance() {

    Activity activity = getActivity();
    if (activity.isChangingConfigurations()) {
        return keepPresenterInstanceDuringScreenOrientationChanges;
    }//from w  ww  .  j a  v  a 2s .c  o  m

    if (activity.isFinishing()) {
        return false;
    }

    if (keepPresenterOnBackstack && BackstackAccessor.isFragmentOnBackStack(fragment)) {
        return true;
    }

    return !fragment.isRemoving();
}

From source file:com.hannesdorfmann.mosby3.FragmentMviDelegateImpl.java

private boolean retainPresenterInstance(boolean keepPresenterOnBackstack, Activity activity,
        Fragment fragment) {// w w  w .  j a v a2  s  . c o  m

    if (activity.isChangingConfigurations()) {
        if (keepPresenterDuringScreenOrientationChange) {
            return true;
        }
        return false;
    }

    if (activity.isFinishing()) {
        return false;
    }

    if (keepPresenterOnBackstack && BackstackAccessor.isFragmentOnBackStack(fragment)) {
        return true;
    }

    return !fragment.isRemoving();
}

From source file:com.android.deskclock.RingtonePickerDialogFragment.java

@Override
public void onStop() {
    super.onStop();

    // Stop playing the preview unless we are currently undergoing a configuration change
    // (e.g. orientation).
    final Activity activity = getActivity();
    if (activity != null && !activity.isChangingConfigurations()) {
        RingtonePreviewKlaxon.stop(activity);
    }//from   w  w  w .  ja v a  2s .co  m
}

From source file:com.android.calendar.event.EditEventFragment.java

@Override
public void onPause() {
    Activity act = getActivity();
    if (mSaveOnDetach && act != null && !mIsReadOnly && !act.isChangingConfigurations()
            && mView.prepareForSave()) {
        mOnDone.setDoneCode(Utils.DONE_SAVE);
        mOnDone.run();/*from  w w w. ja v a2 s .  co m*/
    }
    super.onPause();
}

From source file:io.lqd.sdk.Liquid.java

@SuppressLint("NewApi")
private boolean isApplicationInBackground(Activity activity) {
    boolean configurationChanged;
    if (Build.VERSION.SDK_INT < 11) {
        int changingConfigs = activity.getChangingConfigurations();
        configurationChanged = (changingConfigs == Configuration.SCREENLAYOUT_LAYOUTDIR_RTL
                || changingConfigs == Configuration.SCREENLAYOUT_LAYOUTDIR_LTR);
    } else {/*from  w ww  .  ja  va 2  s  .  c  om*/
        configurationChanged = activity.isChangingConfigurations();
    }
    return mAttachedActivities.size() == 0 && !configurationChanged;
}

From source file:com.android.calendar.EventInfoFragment.java

@Override
public void onStop() {
    Activity act = getActivity();
    if (!mEventDeletionStarted && act != null && !act.isChangingConfigurations()) {

        boolean responseSaved = saveResponse();
        boolean eventColorSaved = saveEventColor();
        if (saveReminders() || responseSaved || eventColorSaved) {
            Toast.makeText(getActivity(), R.string.saving_event, Toast.LENGTH_SHORT).show();
        }/* ww w . j  a  va2s  .  c  o m*/
    }
    super.onStop();
}