Example usage for android.animation LayoutTransition LayoutTransition

List of usage examples for android.animation LayoutTransition LayoutTransition

Introduction

In this page you can find the example usage for android.animation LayoutTransition LayoutTransition.

Prototype

public LayoutTransition() 

Source Link

Document

Constructs a LayoutTransition object.

Usage

From source file:org.eyeseetea.malariacare.LoginActivity.java

private void initProgressBar() {
    bar = (CircularProgressBar) findViewById(R.id.progress_bar_circular);
    float progressBarStrokeWidth = getResources().getDimensionPixelSize(R.dimen.progressbar_stroke_width);
    bar.setIndeterminateDrawable(new CircularProgressDrawable.Builder(this)
            .color(ContextCompat.getColor(this, R.color.color_primary_default))
            .style(CircularProgressDrawable.STYLE_ROUNDED).strokeWidth(progressBarStrokeWidth).rotationSpeed(1f)
            .sweepSpeed(1f).build());//from  w  w  w .jav  a 2 s.c  o m
    onPostAnimationListener = new OnPostAnimationListener();

    /* adding transition animations to root layout */
    if (isGreaterThanOrJellyBean()) {
        layoutTransition = new LayoutTransition();
        layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
        layoutTransition.addTransitionListener(onPostAnimationListener);

        RelativeLayout loginLayoutContent = (RelativeLayout) findViewById(
                org.hisp.dhis.client.sdk.ui.R.id.layout_content);
        loginLayoutContent.setLayoutTransition(layoutTransition);
    } else {
        layoutTransitionSlideIn = AnimationUtils.loadAnimation(this, org.hisp.dhis.client.sdk.ui.R.anim.in_up);
        layoutTransitionSlideOut = AnimationUtils.loadAnimation(this,
                org.hisp.dhis.client.sdk.ui.R.anim.out_down);

        layoutTransitionSlideIn.setAnimationListener(onPostAnimationListener);
        layoutTransitionSlideOut.setAnimationListener(onPostAnimationListener);
    }
}

From source file:com.justplay1.shoppist.features.search.widget.FloatingSearchView.java

protected LayoutTransition getDefaultLayoutTransition() {
    return new LayoutTransition();
}

From source file:org.zywx.wbpalmstar.plugin.chatkeyboard.ACEChatKeyboardView.java

/**
 * initLayout Animator/* www . j  av  a 2  s  .  c  o  m*/
 */
private void initLayoutTransition() {
    if (mLayoutTransition != null) {
        return;
    }
    mLayoutTransition = new LayoutTransition();
    mLayoutTransition.setAnimator(LayoutTransition.CHANGE_APPEARING,
            mLayoutTransition.getAnimator(LayoutTransition.CHANGE_APPEARING));
    mLayoutTransition.setAnimator(LayoutTransition.APPEARING, null);
    mLayoutTransition.setAnimator(LayoutTransition.DISAPPEARING, null);
    mLayoutTransition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, null);
    // mLayoutTransition.getAnimator(LayoutTransition.CHANGE_DISAPPEARING));
    mLayoutTransition.addTransitionListener(new TransitionListener() {

        @Override
        public void startTransition(LayoutTransition transition, ViewGroup container, View view,
                int transitionType) {
        }

        @Override
        public void endTransition(LayoutTransition transition, ViewGroup container, View view,
                int transitionType) {
            if (view.getId() == CRes.plugin_chatkeyboard_parent_layout
                    && transitionType == LayoutTransition.CHANGE_APPEARING) {
                goScroll(0);
                jsonKeyBoardShowCallback(isKeyBoardVisible || mPagerLayout.isShown() ? 1 : 0);
            } else if (view.getId() == CRes.plugin_chatkeyboard_pager_layout
                    && transitionType == LayoutTransition.DISAPPEARING) {
                if (!isKeyBoardVisible)
                    backScroll();
                jsonKeyBoardShowCallback(isKeyBoardVisible || mPagerLayout.isShown() ? 1 : 0);
            }
        }
    });
    mParentLayout.setLayoutTransition(mLayoutTransition);
}

From source file:edu.usf.cutr.opentripplanner.android.fragments.MainFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override/*w w w  . j  ava 2  s .  c o  m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View mainView = inflater.inflate(R.layout.main, container, false);

    if (mainView != null) {
        ViewTreeObserver vto = mainView.getViewTreeObserver();

        if (vto != null) {
            vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
                @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
                @Override
                public void onGlobalLayout() {
                    MainFragment.removeOnGlobalLayoutListener(mainView, this);
                    int locationTbEndLocation[] = new int[2];
                    mTbEndLocation.getLocationInWindow(locationTbEndLocation);
                    int locationItinerarySelectionSpinner[] = new int[2];
                    mItinerarySelectionSpinner.getLocationInWindow(locationItinerarySelectionSpinner);
                    int locationBtnHandle[] = new int[2];
                    mBtnHandle.getLocationInWindow(locationBtnHandle);
                    DisplayMetrics metrics = MainFragment.this.getResources().getDisplayMetrics();
                    int windowHeight = metrics.heightPixels;
                    int paddingMargin = MainFragment.this.getResources()
                            .getInteger(R.integer.map_padding_margin);
                    if (mMap != null) {
                        mMap.setPadding(locationBtnHandle[0] + mBtnHandle.getWidth() / 2 + paddingMargin,
                                locationTbEndLocation[1] + mTbEndLocation.getHeight() / 2 + paddingMargin, 0,
                                windowHeight - locationItinerarySelectionSpinner[1] + paddingMargin);
                    }
                }
            });
        } else {
            Log.w(OTPApp.TAG, "Not possible to obtain exact element's positions on screen, some other"
                    + "elements can be misplaced");
        }

        mTbStartLocation = (EditText) mainView.findViewById(R.id.tbStartLocation);
        mTbEndLocation = (EditText) mainView.findViewById(R.id.tbEndLocation);

        mBtnPlanTrip = (ImageButton) mainView.findViewById(R.id.btnPlanTrip);
        mDdlOptimization = (ListView) mainView.findViewById(R.id.spinOptimization);
        mDdlTravelMode = (ListView) mainView.findViewById(R.id.spinTravelMode);

        mBikeTriangleParameters = new RangeSeekBar<Double>(OTPApp.BIKE_PARAMETERS_MIN_VALUE,
                OTPApp.BIKE_PARAMETERS_MAX_VALUE, this.getActivity().getApplicationContext(), R.color.sysRed,
                R.color.sysGreen, R.color.sysBlue, R.drawable.seek_thumb_normal, R.drawable.seek_thumb_pressed);

        // add RangeSeekBar to pre-defined layout
        mBikeTriangleParametersLayout = (ViewGroup) mainView.findViewById(R.id.bikeParametersLayout);

        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.BELOW, R.id.bikeParametersTags);

        mBikeTriangleParametersLayout.addView(mBikeTriangleParameters, params);

        mBtnMyLocation = (ImageButton) mainView.findViewById(R.id.btnMyLocation);

        mBtnDateDialog = (ImageButton) mainView.findViewById(R.id.btnDateDialog);

        mBtnDisplayDirection = (ImageButton) mainView.findViewById(R.id.btnDisplayDirection);

        mNavigationDrawerLeftPane = (ViewGroup) mainView.findViewById(R.id.navigationDrawerLeftPane);
        mPanelDisplayDirection = mainView.findViewById(R.id.panelDisplayDirection);

        mBtnHandle = (ImageButton) mainView.findViewById(R.id.btnHandle);
        mDrawerLayout = (DrawerLayout) mainView.findViewById(R.id.drawerLayout);

        mTbStartLocation.setImeOptions(EditorInfo.IME_ACTION_NEXT);
        mTbEndLocation.setImeOptions(EditorInfo.IME_ACTION_DONE);
        mTbEndLocation.requestFocus();

        mItinerarySelectionSpinner = (Spinner) mainView.findViewById(R.id.itinerarySelection);

        Log.v(OTPApp.TAG, "finish onStart()");

        if (Build.VERSION.SDK_INT > 11) {
            LayoutTransition l = new LayoutTransition();
            ViewGroup mainButtons = (ViewGroup) mainView.findViewById(R.id.content_frame);
            mainButtons.setLayoutTransition(l);
        }

        return mainView;
    } else {
        Log.e(OTPApp.TAG, "Not possible to obtain main view, UI won't be correctly created");
        return null;
    }
}

From source file:cc.flydev.launcher.Workspace.java

private void setupLayoutTransition() {
    // We want to show layout transitions when pages are deleted, to close the gap.
    mLayoutTransition = new LayoutTransition();
    mLayoutTransition.enableTransitionType(LayoutTransition.DISAPPEARING);
    mLayoutTransition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING);
    mLayoutTransition.disableTransitionType(LayoutTransition.APPEARING);
    mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_APPEARING);
    setLayoutTransition(mLayoutTransition);
}

From source file:com.android.mail.ui.ConversationListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
    View rootView = inflater.inflate(R.layout.conversation_list, null);
    mEmptyView = (ConversationListEmptyView) rootView.findViewById(R.id.empty_view);
    mSecurityHoldView = rootView.findViewById(R.id.security_hold_view);
    mSecurityHoldText = (TextView) rootView.findViewById(R.id.security_hold_text);
    mSecurityHoldButton = rootView.findViewById(R.id.security_hold_button);
    mSecurityHoldButton.setOnClickListener(this);
    mLoadingView = rootView.findViewById(R.id.conversation_list_loading_view);
    mListView = (SwipeableListView) rootView.findViewById(R.id.conversation_list_view);
    mListView.setHeaderDividersEnabled(false);
    mListView.setOnItemLongClickListener(this);
    mListView.enableSwipe(mAccount.supportsCapability(AccountCapabilities.UNDO));
    mListView.setListItemSwipedListener(this);
    mListView.setSwipeListener(this);
    mListView.setOnKeyListener(this);
    mListView.setOnItemClickListener(this);

    // For tablets, the default left focus is the mini-drawer
    if (mTabletDevice && mNextFocusStartId == 0) {
        mNextFocusStartId = R.id.mini_drawer;
    }// w  ww.  ja v  a  2  s  .c o  m
    setNextFocusStartOnList();

    // enable animateOnLayout (equivalent of setLayoutTransition) only for >=JB (b/14302062)
    if (Utils.isRunningJellybeanOrLater()) {
        ((ViewGroup) rootView.findViewById(R.id.conversation_list_parent_frame))
                .setLayoutTransition(new LayoutTransition());
    }

    // By default let's show the list view
    showListView();

    if (savedState != null && savedState.containsKey(LIST_STATE_KEY)) {
        mListView.onRestoreInstanceState(savedState.getParcelable(LIST_STATE_KEY));
    }
    mSwipeRefreshWidget = (MailSwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_widget);
    mSwipeRefreshWidget.setColorScheme(R.color.swipe_refresh_color1, R.color.swipe_refresh_color2,
            R.color.swipe_refresh_color3, R.color.swipe_refresh_color4);
    mSwipeRefreshWidget.setOnRefreshListener(this);
    mSwipeRefreshWidget.setScrollableChild(mListView);

    return rootView;
}

From source file:com.aidy.launcher3.ui.workspace.Workspace.java

private void setupLayoutTransition() {
    // We want to show layout transitions when pages are deleted, to close
    // the gap.// ww  w.  java 2 s .c o m
    mLayoutTransition = new LayoutTransition();
    mLayoutTransition.enableTransitionType(LayoutTransition.DISAPPEARING);
    mLayoutTransition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING);
    mLayoutTransition.disableTransitionType(LayoutTransition.APPEARING);
    mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_APPEARING);
    setLayoutTransition(mLayoutTransition);
}

From source file:com.vuze.android.remote.fragment.TorrentListFragment.java

private void setupSideListArea(View view) {
    sideListArea = (LinearLayout) view.findViewById(R.id.sidelist_layout);
    if (sideListArea == null) {
        return;/*from   ww  w.  j a  v a  2 s .  c  o m*/
    }

    FragmentActivity activity = getActivity();
    if (activity instanceof TorrentViewActivity) {
        ((TorrentViewActivity) activity).setBottomToolbarEnabled(false);
        ((TorrentViewActivity) activity).setShowGlobalActionBar(false);
    }

    if (!AndroidUtils.hasTouchScreen()) {
        // Switch SideList width based on focus.  For touch screens, we use
        // touch events.  For non-touch screens (TV) we watch for focus changes
        ViewTreeObserver vto = sideListArea.getViewTreeObserver();
        vto.addOnGlobalFocusChangeListener(new ViewTreeObserver.OnGlobalFocusChangeListener() {

            @Override
            public void onGlobalFocusChanged(View oldFocus, View newFocus) {

                boolean isChildOfSideList = isChildOf(newFocus, sideListArea);
                boolean isHeader = childOrParentHasTag(newFocus, "sideheader");
                if ((sidelistIsExpanded == null || sidelistIsExpanded) && !isChildOfSideList) {
                    //left focus
                    sidelistInFocus = false;
                    expandSideListWidth(false);
                } else if ((sidelistIsExpanded == null || !sidelistIsExpanded) && isHeader
                        && newFocus != listSideFilter) {
                    sidelistInFocus = true;
                    expandSideListWidth(true);
                }
            }
        });
    }

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        LayoutTransition layoutTransition = new LayoutTransition();
        layoutTransition.setDuration(300);
        sideListArea.setLayoutTransition(layoutTransition);
    }

    // Could have used a ExpandableListView.. oh well
    setupExpando(view, R.id.sidesort_header, R.id.sidesort_list);
    setupExpando(view, R.id.sidetag_header, R.id.sidetag_list);
    setupExpando(view, R.id.sidefilter_header, R.id.sidefilter_list);
    setupExpando(view, R.id.sideactions_header, R.id.sideactions_list);

    setupSideFilter(view);
    setupSideTags(view);
    setupSideSort(view);
    setupSideActions(view);
}

From source file:com.ywesee.amiko.MainActivity.java

@TargetApi(16)
void setLayoutTransition() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        LayoutTransition lt = new LayoutTransition();
        lt.enableTransitionType(LayoutTransition.CHANGING);
        lt.setDuration(LayoutTransition.APPEARING, 100 /*500*/);
        lt.setDuration(LayoutTransition.DISAPPEARING, 100);
        mViewHolder.setLayoutTransition(lt);
    }//w  w  w . j  a va2  s.c  o m
}

From source file:com.tct.mail.ui.ConversationListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
    View rootView = inflater.inflate(R.layout.conversation_list, null);
    mEmptyView = (ConversationListEmptyView) rootView.findViewById(R.id.empty_view);
    mLoadingView = rootView.findViewById(R.id.background_view);
    mLoadingView.setVisibility(View.GONE);
    mLoadingView.findViewById(R.id.loading_progress).setVisibility(View.VISIBLE);
    mListView = (SwipeableListView) rootView.findViewById(R.id.conversation_list_view);
    mListView.setHeaderDividersEnabled(false);
    mListView.setOnItemLongClickListener(this);
    mListView.enableSwipe(mAccount.supportsCapability(AccountCapabilities.UNDO));
    mListView.setListItemSwipedListener(this);
    mListView.setSwipeListener(this);
    mListView.setOnKeyListener(this);
    mListView.setOnItemClickListener(this);
    //TS: yanhua.chen 2015-10-28 EMAIL FR_1098700 ADD_S
    mConversationUpdateTimeView = inflater.inflate(R.layout.conversation_update_time_view, null);
    //TS: yanhua.chen 2015-10-28 EMAIL FR_1098700 ADD_E
    if (mNextFocusLeftId != 0) {
        mListView.setNextFocusLeftId(mNextFocusLeftId);
    }/*from   w  w  w . ja  v a 2 s.  co  m*/

    // enable animateOnLayout (equivalent of setLayoutTransition) only for >=JB (b/14302062)
    if (Utils.isRunningJellybeanOrLater()) {
        ((ViewGroup) rootView.findViewById(R.id.conversation_list_parent_frame))
                .setLayoutTransition(new LayoutTransition());
    }

    // By default let's show the list view
    showListView();

    if (savedState != null && savedState.containsKey(LIST_STATE_KEY)) {
        mListView.onRestoreInstanceState(savedState.getParcelable(LIST_STATE_KEY));
    }
    mSwipeRefreshWidget = (MailSwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_widget);
    mSwipeRefreshWidget.setColorScheme(R.color.swipe_refresh_color1, R.color.swipe_refresh_color2,
            R.color.swipe_refresh_color3, R.color.swipe_refresh_color4);
    // TS: tao.gan 2015-09-21 EMAIL FEATURE-559893 ADD_S
    //ProgressEndTarget should twice as toolbar's height.
    setProgressEndTarget(2 * (int) getResources().getDimension(R.dimen.abc_action_bar_default_height_material));
    // TS: tao.gan 2015-09-21 EMAIL FEATURE-559893 ADD_E
    mSwipeRefreshWidget.setOnRefreshListener(this);
    mSwipeRefreshWidget.setScrollableChild(mListView);

    return rootView;
}