Example usage for android.transition Fade IN

List of usage examples for android.transition Fade IN

Introduction

In this page you can find the example usage for android.transition Fade IN.

Prototype

int IN

To view the source code for android.transition Fade IN.

Click Source Link

Document

Fading mode used in #Fade(int) to make the transition operate on targets that are appearing.

Usage

From source file:com.google.samples.apps.ourstreets.fragment.GalleryFragment.java

public GalleryFragment() {
    setReenterTransition(new Fade(Fade.IN));
    setExitTransition(new Fade(Fade.OUT));
}

From source file:syncthing.android.ui.login.ManagePresenter.java

@TargetApi(21)
private void applyFragmentTransitions(Fragment f) {
    if (VersionUtils.hasLollipop()) {
        TransitionSet set = new TransitionSet();
        set.addTransition(new Slide(Gravity.BOTTOM));
        set.addTransition(new Fade(Fade.IN));
        f.setEnterTransition(set);/*w  w w .j a v a  2 s.  c o m*/
    }
}

From source file:com.bullmobi.message.ui.fragments.EasyNotificationFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Resources res = getResources();
    mConfigWidgetPinDuration = res.getInteger(R.integer.config_maxPinTime);
    mConfigWidgetSelectDelay = res.getInteger(R.integer.config_iconSelectDelayMillis);
    ViewConfiguration vc = ViewConfiguration.get(getActivity());
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();

    // Clock widget
    mClockWidget = new ClockWidget(this, this);

    // Media widget
    mMediaController = MediaController2.newInstance(getActivity());
    mMediaWidget = new MediaWidget(this, this);

    // Transitions
    if (Device.hasKitKatApi()) {
        mTransitionJit = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Fade()).addTransition(new ChangeBounds());
        mTransitionSwitchScene = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Fade(Fade.OUT).setDuration(200))
                .addTransition(new Fade(Fade.IN).setStartDelay(80))
                .addTransition(new ChangeBounds().setStartDelay(80));
    }//from  ww  w. j a v a 2s  .co  m

    // Timeout
    mTimeout = isNotDemo() ? mActivityAcd.getTimeout() : new Timeout();
}

From source file:com.achep.acdisplay.ui.fragments.AcDisplayFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Resources res = getResources();
    mConfigWidgetPinDuration = res.getInteger(R.integer.config_maxPinTime);
    mConfigWidgetSelectDelay = res.getInteger(R.integer.config_iconSelectDelayMillis);
    ViewConfiguration vc = ViewConfiguration.get(getActivity());
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();

    // Clock widget
    mClockWidget = getConfig().isCustomWidgetEnabled() ? new HostWidget(this, this)
            : new ClockWidget(this, this);

    // Media widget
    mMediaController = MediaController2.newInstance(getActivity()).asyncWrap();
    mMediaWidget = new MediaWidget(this, this);

    // Transitions
    if (Device.hasKitKatApi()) {
        mTransitionJit = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Fade()).addTransition(new ChangeBounds());
        mTransitionSwitchScene = new TransitionSet().setOrdering(TransitionSet.ORDERING_TOGETHER)
                .addTransition(new Fade(Fade.OUT).setDuration(200))
                .addTransition(new Fade(Fade.IN).setStartDelay(80))
                .addTransition(new ChangeBounds().setStartDelay(80));
    }// ww w.  j  av  a 2  s.  com

    // Timeout
    mTimeout = isNotDemo() ? mActivityAcd.getTimeout() : new Timeout();
}

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

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
    // Inflate the layout for this fragment
    final View v = inflater.inflate(R.layout.alarm_clock, container, false);

    long expandedId = INVALID_ID;
    long[] repeatCheckedIds = null;
    long[] selectedAlarms = null;
    Bundle previousDayMap = null;/*w w  w .  j  a  va2s .c  om*/
    if (savedState != null) {
        expandedId = savedState.getLong(KEY_EXPANDED_ID);
        repeatCheckedIds = savedState.getLongArray(KEY_REPEAT_CHECKED_IDS);
        mRingtoneTitleCache = savedState.getBundle(KEY_RINGTONE_TITLE_CACHE);
        mDeletedAlarm = savedState.getParcelable(KEY_DELETED_ALARM);
        mUndoShowing = savedState.getBoolean(KEY_UNDO_SHOWING);
        selectedAlarms = savedState.getLongArray(KEY_SELECTED_ALARMS);
        previousDayMap = savedState.getBundle(KEY_PREVIOUS_DAY_MAP);
        mSelectedAlarm = savedState.getParcelable(KEY_SELECTED_ALARM);
    }

    mExpandInterpolator = new DecelerateInterpolator(EXPAND_DECELERATION);
    mCollapseInterpolator = new DecelerateInterpolator(COLLAPSE_DECELERATION);

    if (USE_TRANSITION_FRAMEWORK) {
        mAddRemoveTransition = new AutoTransition();
        mAddRemoveTransition.setDuration(ANIMATION_DURATION);

        /// M: Scrap the views in ListView and request layout again, then alarm item will be
        /// attached correctly. This is to avoid the case when some items are not correctly
        ///  attached after animation end  @{
        mAddRemoveTransition.addListener(new Transition.TransitionListenerAdapter() {
            @Override
            public void onTransitionEnd(Transition transition) {
                mAlarmsList.clearScrapViewsIfNeeded();
            }
        });
        /// @}

        mRepeatTransition = new AutoTransition();
        mRepeatTransition.setDuration(ANIMATION_DURATION / 2);
        mRepeatTransition.setInterpolator(new AccelerateDecelerateInterpolator());

        mEmptyViewTransition = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL)
                .addTransition(new Fade(Fade.OUT)).addTransition(new Fade(Fade.IN))
                .setDuration(ANIMATION_DURATION);
    }

    boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
    View menuButton = v.findViewById(R.id.menu_button);
    if (menuButton != null) {
        if (isLandscape) {
            menuButton.setVisibility(View.GONE);
        } else {
            menuButton.setVisibility(View.VISIBLE);
            setupFakeOverflowMenuButton(menuButton);
        }
    }

    mEmptyView = v.findViewById(R.id.alarms_empty_view);

    mMainLayout = (FrameLayout) v.findViewById(R.id.main);
    mAlarmsList = (ListView) v.findViewById(R.id.alarms_list);

    mUndoBar = (ActionableToastBar) v.findViewById(R.id.undo_bar);
    mUndoFrame = v.findViewById(R.id.undo_frame);
    mUndoFrame.setOnTouchListener(this);

    mFooterView = v.findViewById(R.id.alarms_footer_view);
    mFooterView.setOnTouchListener(this);

    mAdapter = new AlarmItemAdapter(getActivity(), expandedId, repeatCheckedIds, selectedAlarms, previousDayMap,
            mAlarmsList);
    mAdapter.registerDataSetObserver(new DataSetObserver() {

        private int prevAdapterCount = -1;

        @Override
        public void onChanged() {

            final int count = mAdapter.getCount();
            if (mDeletedAlarm != null && prevAdapterCount > count) {
                showUndoBar();
            }

            if (USE_TRANSITION_FRAMEWORK && ((count == 0 && prevAdapterCount > 0) || /* should fade  in */
            (count > 0 && prevAdapterCount == 0) /* should fade out */)) {
                TransitionManager.beginDelayedTransition(mMainLayout, mEmptyViewTransition);
            }
            mEmptyView.setVisibility(count == 0 ? View.VISIBLE : View.GONE);

            // Cache this adapter's count for when the adapter changes.
            prevAdapterCount = count;
            super.onChanged();
        }
    });

    if (mRingtoneTitleCache == null) {
        mRingtoneTitleCache = new Bundle();
    }

    mAlarmsList.setAdapter(mAdapter);
    mAlarmsList.setVerticalScrollBarEnabled(true);
    mAlarmsList.setOnCreateContextMenuListener(this);

    if (mUndoShowing) {
        showUndoBar();
    }
    return v;
}