Example usage for android.animation LayoutTransition setDuration

List of usage examples for android.animation LayoutTransition setDuration

Introduction

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

Prototype

public void setDuration(long duration) 

Source Link

Document

Sets the duration to be used by all animations of this transition object.

Usage

From source file:io.digibyte.tools.animation.BRAnimator.java

public static LayoutTransition getDefaultTransition() {
    LayoutTransition itemLayoutTransition = new LayoutTransition();
    itemLayoutTransition.setStartDelay(LayoutTransition.APPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.CHANGE_APPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0);
    itemLayoutTransition.setStartDelay(LayoutTransition.CHANGING, 0);
    itemLayoutTransition.setDuration(100);
    itemLayoutTransition.setInterpolator(LayoutTransition.CHANGING, new OvershootInterpolator(2f));
    Animator scaleUp = ObjectAnimator.ofPropertyValuesHolder((Object) null,
            PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0, 1));
    scaleUp.setDuration(50);/*from  w  w  w.j  av  a  2 s  . com*/
    scaleUp.setStartDelay(50);
    Animator scaleDown = ObjectAnimator.ofPropertyValuesHolder((Object) null,
            PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, 0));
    scaleDown.setDuration(2);
    itemLayoutTransition.setAnimator(LayoutTransition.APPEARING, scaleUp);
    itemLayoutTransition.setAnimator(LayoutTransition.DISAPPEARING, null);
    itemLayoutTransition.enableTransitionType(LayoutTransition.CHANGING);
    return itemLayoutTransition;
}

From source file:br.ufrgs.ufrgsmapas.libs.SearchBox.java

/**
 * Create a searchbox with params and a style
 * @param context Context/*from   ww  w  .ja  va2 s.  co  m*/
 * @param attrs Attributes
 * @param defStyle Style
 */
public SearchBox(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    inflate(context, R.layout.searchbox, this);
    this.searchOpen = false;
    this.isMic = true;
    this.materialMenu = (MaterialMenuView) findViewById(R.id.material_menu_button);
    this.logo = (TextView) findViewById(R.id.logo);
    this.search = (EditText) findViewById(R.id.search);
    this.results = (ListView) findViewById(R.id.results);
    this.context = context;
    this.pb = (ProgressBar) findViewById(R.id.pb);
    this.mic = (ImageView) findViewById(R.id.mic);
    this.drawerLogo = (ImageView) findViewById(R.id.drawer_logo);

    mCollator = Collator.getInstance(new Locale("pt", "BR"));
    mCollator.setStrength(Collator.PRIMARY);

    materialMenu.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (searchOpen) {
                toggleSearch();
            } else {
                if (menuListener != null)
                    menuListener.onMenuClick();
            }
        }

    });
    resultList = new ArrayList<SearchResult>();
    results.setAdapter(new SearchAdapter(context, resultList));
    animate = true;
    isVoiceRecognitionIntentSupported = isIntentAvailable(context,
            new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH));
    logo.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleSearch();
        }

    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        RelativeLayout searchRoot = (RelativeLayout) findViewById(R.id.search_root);
        LayoutTransition lt = new LayoutTransition();
        lt.setDuration(100);
        searchRoot.setLayoutTransition(lt);
    }
    searchables = new ArrayList<SearchResult>();
    search.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
                search(getSearchText());
                return true;
            }
            return false;
        }
    });
    search.setOnKeyListener(new OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                if (TextUtils.isEmpty(getSearchText())) {
                    toggleSearch();
                } else {
                    search(getSearchText());
                }
                return true;
            }
            return false;
        }
    });
    logoText = "Logo";
    micStateChanged();
    mic.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (voiceRecognitionListener != null) {
                voiceRecognitionListener.onClick();
            } else {
                micClick();
            }
        }
    });
}

From source file:info.bartowski.easteregg.MLand.java

public void setScoreFieldHolder(ViewGroup vg) {
    mScoreFields = vg;/*from   w  ww. jav  a  2s.  co  m*/
    if (vg != null) {
        final LayoutTransition lt = new LayoutTransition();
        lt.setDuration(250);
        mScoreFields.setLayoutTransition(lt);
    }
    for (Player p : mPlayers) {
        mScoreFields.addView(p.mScoreField,
                new MarginLayoutParams(MarginLayoutParams.WRAP_CONTENT, MarginLayoutParams.MATCH_PARENT));
    }
}

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  w w  w .ja  v a  2s. 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);
}