Example usage for android.transition TransitionManager beginDelayedTransition

List of usage examples for android.transition TransitionManager beginDelayedTransition

Introduction

In this page you can find the example usage for android.transition TransitionManager beginDelayedTransition.

Prototype

public static void beginDelayedTransition(final ViewGroup sceneRoot) 

Source Link

Document

Convenience method to animate, using the default transition, to a new scene defined by all changes within the given scene root between calling this method and the next rendering frame.

Usage

From source file:Main.java

public static void delayTransaction(ViewGroup viewGroup) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        TransitionManager.beginDelayedTransition(viewGroup);
    }// w  w w.  j  a  v  a  2s  .co m
}

From source file:Main.java

public static void beginDelayedTransition(ViewGroup container) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
        TransitionManager.beginDelayedTransition(container);
}

From source file:info.ipeanut.googletrainingcoursedemos.basictransition.BasicTransitionFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (checkedId) {
    case R.id.select_scene_1: {

        // You can start an automatic transition with TransitionManager.go().
        TransitionManager.go(mScene1);/*from  www  .  j  av  a 2s.c  om*/

        break;
    }
    case R.id.select_scene_2: {
        TransitionManager.go(mScene2);
        break;
    }
    case R.id.select_scene_3: {

        // You can also start a transition with a custom TransitionManager.
        mTransitionManagerForScene3.transitionTo(mScene3);

        break;
    }
    case R.id.select_scene_4: {

        // Alternatively, transition can be invoked dynamically without a Scene.
        // For this, we first call TransitionManager.beginDelayedTransition().
        TransitionManager.beginDelayedTransition(mSceneRoot);
        // Then, we can just change view properties as usual.
        View square = mSceneRoot.findViewById(R.id.transition_square);
        ViewGroup.LayoutParams params = square.getLayoutParams();
        int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded);
        params.width = newSize;
        params.height = newSize;
        square.setLayoutParams(params);

        break;
    }
    }
}

From source file:io.plaidapp.ui.DribbbleLogin.java

private void showLoading() {
    TransitionManager.beginDelayedTransition(container);
    message.setVisibility(View.GONE);
    login.setVisibility(View.GONE);
    loading.setVisibility(View.VISIBLE);
}

From source file:com.example.android.basictransition.BasicTransitionFragment.java

@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (checkedId) {
    case R.id.select_scene_1: {
        // BEGIN_INCLUDE(transition_simple)
        // You can start an automatic transition with TransitionManager.go().
        TransitionManager.go(mScene1);/*from  w w w .ja  v  a2 s  .  c  o  m*/
        // END_INCLUDE(transition_simple)
        break;
    }
    case R.id.select_scene_2: {
        TransitionManager.go(mScene2);
        break;
    }
    case R.id.select_scene_3: {
        // BEGIN_INCLUDE(transition_custom)
        // You can also start a transition with a custom TransitionManager.
        mTransitionManagerForScene3.transitionTo(mScene3);
        // END_INCLUDE(transition_custom)
        break;
    }
    case R.id.select_scene_4: {
        // BEGIN_INCLUDE(transition_dynamic)
        // Alternatively, transition can be invoked dynamically without a Scene.
        // For this, we first call TransitionManager.beginDelayedTransition().
        TransitionManager.beginDelayedTransition(mSceneRoot);
        // Then, we can just change view properties as usual.
        View square = mSceneRoot.findViewById(R.id.transition_square);
        ViewGroup.LayoutParams params = square.getLayoutParams();
        int newSize = getResources().getDimensionPixelSize(R.dimen.square_size_expanded);
        params.width = newSize;
        params.height = newSize;
        square.setLayoutParams(params);
        // END_INCLUDE(transition_dynamic)
        break;
    }
    }
}

From source file:io.plaidapp.ui.DribbbleLogin.java

private void showLoading() {
    TransitionManager.beginDelayedTransition(container);
    message.setVisibility(View.GONE);
    login.setVisibility(View.GONE);
    loginFailed.setVisibility(View.GONE);
    loading.setVisibility(View.VISIBLE);
}

From source file:com.achep.acdisplay.ui.widgets.notification.NotificationActions.java

protected void onActionClick(@NonNull View view, @NonNull Action action) {
    if (isRiiShowing()) {
        if (mView != view) {
            // Ignore this click. This may happen because of
            // the animation delays.
            return;
        }/*  w  w w  .  ja va2 s.c  o  m*/
        // Send the callback with performed remote input.

        assert mRemoteInput != null;
        assert mTextable != null;
        CharSequence text = mTextable.getText();
        Check.getInstance().isFalse(TextUtils.isEmpty(text));

        assert text != null;
        sendActionWithRemoteInput(view, action, mRemoteInput, text);
        hideRii();
    } else if ((mRemoteInput = mRemoteInputsMap.get(action)) != null) {
        // Initialize and show the remote input graphic
        // user interface.

        mView = view;
        mTextable = onCreateTextable(mRemoteInput);
        mOnTextChangedListener.onTextChanged(mTextable.getText());

        if (Device.hasKitKatApi() && isLaidOut()) {
            TransitionManager.beginDelayedTransition(this);
        }

        mLayoutParams = (LayoutParams) mView.getLayoutParams();
        LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        mView.setLayoutParams(lp);
        // Hide all other actions
        for (int i = getChildCount() - 1; i >= 0; i--) {
            View v = getChildAt(i);
            if (v != mView)
                v.setVisibility(GONE);
        }
        // Add the textable view
        addView(mTextable.getView(), 0);
        mTextable.getView().requestFocus();

        if (mCallback != null)
            mCallback.onRiiStateChanged(this, true);
    } else {
        sendAction(view, action);
    }
}

From source file:io.plaidapp.ui.DribbbleLogin.java

private void showLogin() {
    TransitionManager.beginDelayedTransition(container);
    message.setVisibility(View.VISIBLE);
    login.setVisibility(View.VISIBLE);
    loading.setVisibility(View.GONE);
}

From source file:io.plaidapp.ui.DesignerNewsLogin.java

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    if (requestCode == PERMISSIONS_REQUEST_GET_ACCOUNTS) {
        TransitionManager.beginDelayedTransition(container);
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            setupAccountAutocomplete();/*from   w ww  . j  a va2  s . c  o  m*/
            username.requestFocus();
            username.showDropDown();
        } else {
            // if permission was denied check if we should ask again in the future (i.e. they
            // did not check 'never ask again')
            if (shouldShowRequestPermissionRationale(Manifest.permission.GET_ACCOUNTS)) {
                setupPermissionPrimer();
            } else {
                // denied & shouldn't ask again. deal with it (_) ( _)>?- (?_)
                TransitionManager.beginDelayedTransition(container);
                permissionPrimer.setVisibility(View.GONE);
            }
        }
    }
}

From source file:io.plaidapp.ui.DesignerNewsLogin.java

@Override
@TargetApi(Build.VERSION_CODES.M)/*  w  ww  .  j av a 2 s .  c o  m*/
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
        @NonNull int[] grantResults) {
    if (requestCode == PERMISSIONS_REQUEST_GET_ACCOUNTS) {
        TransitionManager.beginDelayedTransition(container);
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            setupAccountAutocomplete();
            username.requestFocus();
            username.showDropDown();
        } else {
            // if permission was denied check if we should ask again in the future (i.e. they
            // did not check 'never ask again')
            if (shouldShowRequestPermissionRationale(Manifest.permission.GET_ACCOUNTS)) {
                setupPermissionPrimer();
            } else {
                // denied & shouldn't ask again. deal with it (_) ( _)>?- (?_)
                TransitionManager.beginDelayedTransition(container);
                permissionPrimer.setVisibility(View.GONE);
            }
        }
    }
}