Java 类android.animation.LayoutTransition 实例源码

项目:lineagex86    文件:ZenModeConditionSelection.java   
public ZenModeConditionSelection(Context context, int zenMode) {
    super(context);
    mContext = context;
    mZenMode = zenMode;
    mConditions = new ArrayList<Condition>();
    setLayoutTransition(new LayoutTransition());
    final int p = mContext.getResources().getDimensionPixelSize(R.dimen.content_margin_left);
    setPadding(p, p, p, 0);
    mNoMan = INotificationManager.Stub.asInterface(
            ServiceManager.getService(Context.NOTIFICATION_SERVICE));
    final RadioButton b = newRadioButton(null);
    b.setText(mContext.getString(com.android.internal.R.string.zen_mode_forever));
    b.setChecked(true);
    for (int i = ZenModeConfig.MINUTE_BUCKETS.length - 1; i >= 0; --i) {
        handleCondition(ZenModeConfig.toTimeCondition(mContext,
                ZenModeConfig.MINUTE_BUCKETS[i], UserHandle.myUserId()));
    }
}
项目:Sortable_tableview_soussidev    文件:TableView.java   
/**
 * Sets the {@link TableView} header visible or hides it.
 *
 * @param visible Whether the {@link TableView} header shall be visible or not.
 */
public void setHeaderVisible(boolean visible, int animationDuration) {
    if (visible && !isHeaderVisible()) {
        if (animationDuration > 0) {
            final Animator moveInAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", 0));
            moveInAnimator.setDuration(animationDuration);
            layoutTransition.setAnimator(LayoutTransition.APPEARING, moveInAnimator);
            setLayoutTransition(layoutTransition);
        } else {
            setLayoutTransition(null);
        }
        addView(tableHeaderView, 0);
    } else if (!visible && isHeaderVisible()) {
        if (animationDuration > 0) {
            final Animator moveOutAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", -tableHeaderView.getHeight()));
            moveOutAnimator.setDuration(animationDuration);
            layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, moveOutAnimator);
            setLayoutTransition(layoutTransition);
        } else {
            setLayoutTransition(null);
        }
        removeView(tableHeaderView);
    }
}
项目:AnimationShowcase    文件:CustomLayoutAnimationsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_custom_layout_animations);


    LayoutTransition layoutTransition = new LayoutTransition();

    ObjectAnimator appearingAnim = ObjectAnimator.ofFloat(null, "rotationY", 0f, 90f, 180f, 270f, 359.9999f);
    appearingAnim.addListener(new AnimatorListenerAdapter() {
        public void onAnimationEnd(Animator anim) {
            View view = (View) ((ObjectAnimator) anim).getTarget();
            view.setRotationY(0f);
        }
    });

    layoutTransition.setAnimator(LayoutTransition.APPEARING, appearingAnim);
    layoutTransition.setDuration(LayoutTransition.APPEARING, 2000L);
    layoutTransition.setStartDelay(LayoutTransition.APPEARING, 0);

    gridContainer.setLayoutTransition(layoutTransition);
}
项目:lock-screen    文件:IndicatorDots.java   
private void initView(Context context) {
    if (mIndicatorType == 0) {
        for (int i = 0; i < mPinLength; i++) {
            View dot = new View(context);
            emptyDot(dot);

            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mDotDiameter,
                    mDotDiameter);
            params.setMargins(mDotSpacing, 0, mDotSpacing, 0);
            dot.setLayoutParams(params);

            addView(dot);
        }
    } else if (mIndicatorType == 2) {
        LayoutTransition layoutTransition = new LayoutTransition();
        layoutTransition.setDuration(DEFAULT_ANIMATION_DURATION);
        layoutTransition.setStartDelay(layoutTransition.APPEARING, 0);
        setLayoutTransition(layoutTransition);
    }
}
项目:LiveGiftLayout    文件:GiftControl.java   
/**
 * @param giftLayoutParent 存放礼物控件的父容器
 * @param giftLayoutNums   礼物控件的数量
 * @return
 */
public GiftControl setGiftLayout(LinearLayout giftLayoutParent, @NonNull int giftLayoutNums) {
    if (giftLayoutNums <= 0) {
        throw new IllegalArgumentException("GiftFrameLayout数量必须大于0");
    }
    if (giftLayoutParent.getChildCount() > 0) {//如果父容器没有子孩子,就进行添加
        return this;
    }
    mGiftLayoutParent = giftLayoutParent;
    mGiftLayoutMaxNums = giftLayoutNums;
    LayoutTransition transition = new LayoutTransition();
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING,
            transition.getAnimator(LayoutTransition.CHANGE_APPEARING));
    transition.setAnimator(LayoutTransition.APPEARING,
            transition.getAnimator(LayoutTransition.APPEARING));
    transition.setAnimator(LayoutTransition.DISAPPEARING,
            transition.getAnimator(LayoutTransition.CHANGE_APPEARING));
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            transition.getAnimator(LayoutTransition.DISAPPEARING));
    mGiftLayoutParent.setLayoutTransition(transition);

    return this;
}
项目:Status    文件:NotificationsIconData.java   
@Override
public void register() {
    super.register();
    notificationLayout = (LinearLayout) getIconView();
    notificationLayout.setPadding(getIconPadding(), 0, getIconPadding(), 0);

    notificationLayout.removeAllViewsInLayout();
    notifications.clear();

    Boolean isIconAnimations = PreferenceUtils.getBooleanPreference(getContext(), PreferenceUtils.PreferenceIdentifier.STATUS_ICON_ANIMATIONS);
    isIconAnimations = isIconAnimations != null ? isIconAnimations : true;

    notificationLayout.setLayoutTransition(isIconAnimations ? new LayoutTransition() : null);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        Intent intent = new Intent(NotificationService.ACTION_GET_NOTIFICATIONS);
        intent.setClass(getContext(), NotificationService.class);
        getContext().startService(intent);
    }
}
项目:FloatText    文件:FloatWebSettingMethod.java   
public static WindowManager.LayoutParams CreateFloatLayout(WindowManager wm, WebView fwv, View tview, FloatLinearLayout layout, float px, float py, boolean show, int width, int height) {
    WindowManager.LayoutParams wmParams = ParamsSet(px, py, fwv, width, height);
    layout.setLayoutTransition(new LayoutTransition());
    layout.setBackgroundColor(Color.parseColor("#303F9F"));
    layout.setOrientation(FloatLinearLayout.VERTICAL);
    layout.setPadding(0, 50, 0, 0);
    layout.setLayout_default_flags(wmParams.flags);
    layout.setTop(true);
    layout.setAddPosition(px, py);
    layout.setFloatLayoutParams(wmParams);
    layout.setAllowlongclick(false);
    layout.changeShowState(show);
    layout.addView(tview);
    layout.addView(fwv);
    if (show) {
        wm.addView(layout, wmParams);
        fwv.reload();
    }
    return wmParams;
}
项目:AndroidAnimationExercise    文件:LayoutAnimationsActivity.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
                    (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                            defaultChangingDisappearingAnim) : null);
}
项目:Android_accordion_view    文件:AccordionView.java   
/***
 * This function is used to prepare the layout after the initialize funciton but is called when the developer PROGRAMATICALLY adds
 * the accordion from the class. Hence, the accordion does not have the UI elements (children) yet
 * @param context
 */
private void prepareLayoutWithoutChildren(Context context) {
    initializeViewWithoutChildren(context);
    partition.setVisibility(isPartitioned ? VISIBLE : INVISIBLE);
    heading.setText(headingString);
    paragraph.setVisibility(VISIBLE);
    //paragraph.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener);
    if (isAnimated) {
        headingLayout.setLayoutTransition(new LayoutTransition());
    } else {
        headingLayout.setLayoutTransition(null);

    }

    if (isExpanded)
        expand();
    else
        collapse();

    setOnClickListenerOnHeading();

}
项目:PinLockView    文件:IndicatorDots.java   
private void initView(Context context) {
    ViewCompat.setLayoutDirection(this, ViewCompat.LAYOUT_DIRECTION_LTR);
    if (mIndicatorType == 0) {
        for (int i = 0; i < mPinLength; i++) {
            View dot = new View(context);
            emptyDot(dot);

            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mDotDiameter,
                    mDotDiameter);
            params.setMargins(mDotSpacing, 0, mDotSpacing, 0);
            dot.setLayoutParams(params);

            addView(dot);
        }
    } else if (mIndicatorType == 2) {
        setLayoutTransition(new LayoutTransition());
    }
}
项目:SortableTableView    文件:TableView.java   
/**
 * Sets the {@link TableView} header visible or hides it.
 *
 * @param visible Whether the {@link TableView} header shall be visible or not.
 */
public void setHeaderVisible(boolean visible, int animationDuration) {
    if (visible && !isHeaderVisible()) {
        if (animationDuration > 0) {
            final Animator moveInAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", 0));
            moveInAnimator.setDuration(animationDuration);
            layoutTransition.setAnimator(LayoutTransition.APPEARING, moveInAnimator);
            setLayoutTransition(layoutTransition);
        } else {
            setLayoutTransition(null);
        }
        addView(tableHeaderView, 0);
    } else if (!visible && isHeaderVisible()) {
        if (animationDuration > 0) {
            final Animator moveOutAnimator = ObjectAnimator.ofPropertyValuesHolder((Object) null, PropertyValuesHolder.ofFloat("y", -tableHeaderView.getHeight()));
            moveOutAnimator.setDuration(animationDuration);
            layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, moveOutAnimator);
            setLayoutTransition(layoutTransition);
        } else {
            setLayoutTransition(null);
        }
        removeView(tableHeaderView);
    }
}
项目:trainee-om-shop    文件:OForm.java   
private void init(Context context, AttributeSet attrs, int defStyleAttr,
                  int defStyleRes) {
    mFirstModeChange = true;
    mContext = context;
    if (attrs != null) {
        TypedArray types = mContext.obtainStyledAttributes(attrs,
                R.styleable.OForm);
        mModel = types.getString(R.styleable.OForm_modelName);
        mEditable = types.getBoolean(R.styleable.OForm_editableMode,
                false);
        autoUIGenerate = types.getBoolean(R.styleable.OForm_autoUIGenerate, true);
        icon_tint_color = types.getColor(R.styleable.OForm_controlIconTint, -1);
        types.recycle();
    }
    initForm();
    LayoutTransition transition = new LayoutTransition();
    setLayoutTransition(transition);
}
项目:true-sight-dota    文件:AbilityCardView.java   
private void init() {
    setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mPresenter.toggleIsExtended();
        }
    });

    //TODO-beauty: Fix AbilityCard animation so that the image on the card doesn't just jump
    // but animates smoothly like the rest of the card

    LayoutTransition transition = new LayoutTransition();
    transition.enableTransitionType(LayoutTransition.CHANGING);
    transition.setDuration(300);
    setLayoutTransition(transition);

    inflate(getContext(), R.layout.item_ability_info, this);
}
项目:SecureBitcoinWallet    文件:LockFragment.java   
@SuppressLint("NewApi") @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);

  pin = new StringBuffer();
  ;

  if (Build.VERSION.SDK_INT >= 16) {
    int startDelay = 0;
    LayoutTransition transition = new LayoutTransition();
    transition.enableTransitionType(LayoutTransition.CHANGING);
    transition.setStartDelay(LayoutTransition.APPEARING, startDelay);
    transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, startDelay);
    rootLayout.setLayoutTransition(transition);
  }

  if (loadingAnimator != null) {
    loadingAnimator.cancel();
  }
}
项目:vuze-remote-for-android    文件:SideListHelper.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void initHoneyComb() {
    if (!isInDrawer()) {
        parentView.addOnLayoutChangeListener(new View.OnLayoutChangeListener()

        {
            int lastWidth = -1;

            @Override
            public void onLayoutChange(View v, int left, int top, int right,
                    int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                int width = right - left;
                if (width != lastWidth) {
                    lastWidth = width;
                    expandSideListWidth(sidelistInFocus);
                }
            }
        });
    }

    LayoutTransition layoutTransition = new LayoutTransition();
    layoutTransition.setDuration(400);
    sideListArea.setLayoutTransition(layoutTransition);
}
项目:MiBandDecompiled    文件:AnimUtil.java   
private static LayoutTransition a()
{
    LayoutTransition layouttransition = new LayoutTransition();
    layouttransition.setDuration(90L);
    layouttransition.setInterpolator(2, new AccelerateDecelerateInterpolator());
    layouttransition.setInterpolator(3, new AccelerateDecelerateInterpolator());
    ObjectAnimator objectanimator = ObjectAnimator.ofFloat(null, "rotationX", new float[] {
        90F, 0.0F
    }).setDuration(layouttransition.getDuration(2));
    layouttransition.setAnimator(2, objectanimator);
    objectanimator.addListener(new d());
    ObjectAnimator objectanimator1 = ObjectAnimator.ofFloat(null, "rotationX", new float[] {
        0.0F, -90F
    }).setDuration(layouttransition.getDuration(3));
    layouttransition.setAnimator(3, objectanimator1);
    objectanimator1.addListener(new e());
    return layouttransition;
}
项目:ApkLauncher    文件:LayoutAnimations.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
项目:hr    文件:OForm.java   
private void init(Context context, AttributeSet attrs, int defStyleAttr,
                  int defStyleRes) {
    mFirstModeChange = true;
    mContext = context;
    if (attrs != null) {
        TypedArray types = mContext.obtainStyledAttributes(attrs,
                R.styleable.OForm);
        mModel = types.getString(R.styleable.OForm_modelName);
        mEditable = types.getBoolean(R.styleable.OForm_editableMode,
                false);
        autoUIGenerate = types.getBoolean(R.styleable.OForm_autoUIGenerate, true);
        icon_tint_color = types.getColor(R.styleable.OForm_controlIconTint, -1);
        types.recycle();
    }
    initForm();
    LayoutTransition transition = new LayoutTransition();
    setLayoutTransition(transition);
}
项目:android-play-places    文件:CardStreamLinearLayout.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void setCardStreamAnimator( CardStreamAnimator animators ){

    if( animators == null )
        mAnimators = new CardStreamAnimator.EmptyAnimator();
    else
        mAnimators = animators;

    LayoutTransition layoutTransition = getLayoutTransition();

    if( layoutTransition != null ){
        layoutTransition.setAnimator( LayoutTransition.APPEARING,
                mAnimators.getAppearingAnimator(getContext()) );
        layoutTransition.setAnimator( LayoutTransition.DISAPPEARING,
                mAnimators.getDisappearingAnimator(getContext()) );
    }
}
项目:ApiDemos    文件:LayoutAnimations.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
项目:breadwallet-android    文件: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);
    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;
}
项目:AndroidOpenSource    文件:LayoutAnimationTransationActivity.java   
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    // TODO Auto-generated method stub

    mTransation.setAnimator(LayoutTransition.APPEARING, (mAppear
            .isChecked() ? ObjectAnimator.ofFloat(this, "scaleX", 0, 1)
            : null));

    mTransation
            .setAnimator(
                    LayoutTransition.CHANGE_APPEARING,
                    (mChangeAppear.isChecked() ? mTransation
                            .getAnimator(LayoutTransition.CHANGE_APPEARING)
                            : null));
    mTransation.setAnimator(
            LayoutTransition.DISAPPEARING,
            (mDisAppear.isChecked() ? mTransation
                    .getAnimator(LayoutTransition.DISAPPEARING) : null));
    mTransation.setAnimator(
            LayoutTransition.CHANGE_DISAPPEARING,
            (mChangeDisAppear.isChecked() ? mTransation
                    .getAnimator(LayoutTransition.CHANGE_DISAPPEARING)
                    : null));

    mGridLayout.setLayoutTransition(mTransation);
}
项目:Finanvita    文件:OverviewFragment.java   
@Override
public void onViewCreated(View view, Bundle savedInstanceState)
{
    super.onViewCreated(view, savedInstanceState);

    // Get views
    final ListView list_V = (ListView) view.findViewById(R.id.list_V);
    bottomBar_V = view.findViewById(R.id.bottomBar_V);
    final View create_B = view.findViewById(R.id.create_B);

    // Setup
    create_B.setOnClickListener(this);
    bottomBar_V.setVisibility(LayoutType.isTablet(getActivity()) ? View.GONE : View.VISIBLE);
    adapter = new OverviewCardsAdapter(getActivity());
    list_V.setAdapter(adapter);
    list_V.setOnItemClickListener(this);
    list_V.setLayoutTransition(new LayoutTransition());
}
项目:android-money-manager-ex    文件:BaseListFragment.java   
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // set animation
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getListView().setLayoutTransition(new LayoutTransition());
    }
    // saved instance
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SHOWN_TIPS_WILDCARD)) {
        isShowTipsWildcard = savedInstanceState.getBoolean(KEY_SHOWN_TIPS_WILDCARD);
    }

    // set subtitle in actionbar
    String subTitle = getSubTitle();
    if (!(TextUtils.isEmpty(subTitle)) && getActivity() instanceof AppCompatActivity) {
        AppCompatActivity activity = (AppCompatActivity) getActivity();
        if (activity != null) {
            activity.getSupportActionBar().setSubtitle(subTitle);
        }
    }
}
项目:android-money-manager-ex    文件:BaseExpandableListFragment.java   
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    // set animation
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getExpandableListView().setLayoutTransition(new LayoutTransition());
    }
    // saved instance
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(KEY_SHOWN_TIPS_WILDCARD)) {
            isShowTipsWildcard = savedInstanceState.getBoolean(KEY_SHOWN_TIPS_WILDCARD);
        }
    }
    // set subtitle in actionbar
    if (!(TextUtils.isEmpty(getSubTitle()))) {
        AppCompatActivity activity = (AppCompatActivity) getActivity();
        if (activity != null) {
            activity.getSupportActionBar().setSubtitle(getSubTitle());
        }
    }
}
项目:uwaterloo-api    文件:NearbyLocationsFragment.java   
@Nullable
@Override
public View onCreateView(
    final LayoutInflater inflater,
    @Nullable final ViewGroup container,
    @Nullable final Bundle savedInstanceState) {
  final View view = inflater.inflate(R.layout.fragment_nearby_locations, container, false);

  ButterKnife.bind(this, view);

  mRoot.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);

  mAdapter = new NearbyLocationsAdapter(getContext(), new ArrayList<>(), null);
  mLocationsList.setAdapter(mAdapter);

  showError(R.string.error_no_network, !NetworkController.getInstance().isConnected());

  return view;
}
项目:LayoutTransitioningImageView    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // We could have set this in xml by setting android:animateLayoutChanges="true" but it's nice to make it
    // obvious that we're doing it.
    ViewGroup contentView = (ViewGroup) findViewById(R.id.content_view);
    contentView.setLayoutTransition(new LayoutTransition());

    mDummyView = findViewById(R.id.dummy_view);
    mImageView = (LayoutTransitioningImageView) findViewById(R.id.image_view);

    // Default to true. The associated menu toggle is checked.
    mImageView.setShouldSetFrameOnSizeChanged(true);
}
项目:DragAndDropBTWLayouts    文件:DraggableLinearLayoutTouchListener.java   
private void setLayoutTransition(ViewGroup viewGroup) {
    if (Build.VERSION.SDK_INT >= 16) {
        // 14+ will crash when we remove child, because we cannot disable APPEARING & DISAPPEARING
        // it's a big joke
        // TODO: work around it
        LayoutTransition lt = new LayoutTransition();
        if (Build.VERSION.SDK_INT >= 16) {
            lt.disableTransitionType(LayoutTransition.APPEARING);
            lt.enableTransitionType(LayoutTransition.CHANGING);
            lt.disableTransitionType(LayoutTransition.DISAPPEARING);
            lt.enableTransitionType(LayoutTransition.CHANGE_APPEARING);
            lt.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING);
        }
        viewGroup.setLayoutTransition(lt);
    }
}
项目:felix-on-android    文件:LayoutAnimations.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
项目:MEng    文件:LayoutAnimations.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
项目:codeexamples-android    文件:LayoutAnimations.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
项目:JOneTouch    文件:ActionView.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public ActionView(JOneTouchActivity activity, ServerService serverService,
        MyTerminal myTerminal, MyAuthentication myAuthentication,
        ActionService actionService) {

    this.activity = activity;
    this.serverService = serverService;
    this.myTerminal = myTerminal;
    this.myAuthentication = myAuthentication;
    this.actionService = actionService;

    this.mainView = (LinearLayout) activity.getLayoutInflater().inflate(R.layout.action_view_layout, null);
    // FIXME : LayoutTransition is available from HONEYCOMB but the LayoutTransition.CHANGING is available only from JELLY_BEAN
    if (APIUtils.ifAvailableAPI(Build.VERSION_CODES.JELLY_BEAN)) {
        LayoutTransition layoutTransition = new LayoutTransition();
        layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
        this.mainView.setLayoutTransition(layoutTransition);
    }
}
项目:deview-2013-samples    文件:LayoutAnimations.java   
private void setupTransition(LayoutTransition transition) {
    CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
    CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
    CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
    CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
    CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
    transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingAppearingAnim :
                    defaultChangingAppearingAnim) : null);
    transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
            changingDisappearingCB.isChecked() ?
            (customAnimCB.isChecked() ? customChangingDisappearingAnim :
                    defaultChangingDisappearingAnim) : null);
}
项目:otrta    文件:FragmentVendorGrid.java   
private void hideSearch(){
    //set transiontn
    LayoutTransition l = new LayoutTransition();
    l.enableTransitionType(LayoutTransition.DISAPPEARING);
    RelativeLayout rl = (RelativeLayout)getView().findViewById(R.id.rl_vendorlist);
    rl.setLayoutTransition(l);
    //animate
    mActvSearch.setVisibility(View.GONE);
    //set text to ""
    mActvSearch.setText("");

    InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(mActvSearch.getWindowToken(), 0);

    mSearchWasVisible = false;
}
项目:apps-android-wikipedia    文件:ReadingListsFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_reading_lists, container, false);
    unbinder = ButterKnife.bind(this, view);

    searchEmptyView.setEmptyText(R.string.search_reading_lists_no_results);
    readingListView.setLayoutManager(new LinearLayoutManager(getContext()));
    readingListView.setAdapter(adapter);
    readingListView.addItemDecoration(new DrawableItemDecoration(getContext(), R.attr.list_separator_drawable));

    WikipediaApp.getInstance().getBus().register(eventBusMethods);

    contentContainer.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
    emptyContainer.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
    ((ViewGroup)emptyContainer.getChildAt(0)).getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);

    swipeRefreshLayout.setColorSchemeResources(getThemedAttributeId(getContext(), R.attr.colorAccent));
    swipeRefreshLayout.setOnRefreshListener(ReadingListSyncAdapter::manualSyncWithRefresh);
    // TODO: remove when ready.
    if (!ReleaseUtil.isPreBetaRelease()) {
        swipeRefreshLayout.setEnabled(false);
    }
    return view;
}
项目:Fun    文件:FunControl.java   
public FunControl(Builder builder){
    this.funny = builder.funny;
    this.funnyButton = builder.funnyButton;
    this.funnyContainer = builder.viewGroup;
    this.gravityToExpand = builder.gravityToExpand;
    this.widthToExpand = builder.width;

    LayoutTransition layoutTransition = funny.getLayoutTransition();
    layoutTransition.setDuration(builder.animationDuration);
    layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
}
项目:GitHub    文件:LoginFragment.java   
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  loginButton.setMode(ActionProcessButton.Mode.ENDLESS);

  int startDelay = getResources().getInteger(android.R.integer.config_mediumAnimTime) + 100;
  LayoutTransition transition = new LayoutTransition();
  transition.enableTransitionType(LayoutTransition.CHANGING);
  transition.setStartDelay(LayoutTransition.APPEARING, startDelay);
  transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, startDelay);
  loginForm.setLayoutTransition(transition);
}
项目:GitHub    文件:LabelLayout.java   
private void init() {

    View.inflate(getContext(), R.layout.view_label_layout, this);

    LayoutTransition transition = new LayoutTransition();
    transition.enableTransitionType(LayoutTransition.CHANGING);
    this.setLayoutTransition(transition);

    adapter = new LabelAdapter(getContext());
    popUpWindow = new ListPopupWindow(getContext());
    popUpWindow.setAnchorView(this);
    popUpWindow.setAdapter(adapter);
    popUpWindow.setWidth(DimensUtils.dpToPx(getContext(), 140));
    popUpWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
      @Override public void onDismiss() {
        showLabel();
      }
    });
    popUpWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Label label = (Label) adapter.getItem(position);
        if (!label.getName().equals(mail.getLabel())) {
          presenter.setLabel(mail, label.getName());
          popUpWindow.dismiss();
        }
      }
    });

    setOnClickListener(new OnClickListener() {
      @Override public void onClick(View v) {
        loadData(false);
      }
    });
  }
项目:GitHub    文件:LoginFragment.java   
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  loginButton.setMode(ActionProcessButton.Mode.ENDLESS);

  int startDelay = getResources().getInteger(android.R.integer.config_mediumAnimTime) + 100;
  LayoutTransition transition = new LayoutTransition();
  transition.enableTransitionType(LayoutTransition.CHANGING);
  transition.setStartDelay(LayoutTransition.APPEARING, startDelay);
  transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, startDelay);
  loginForm.setLayoutTransition(transition);
}
项目:GitHub    文件:LabelLayout.java   
private void init() {

    View.inflate(getContext(), R.layout.view_label_layout, this);

    LayoutTransition transition = new LayoutTransition();
    transition.enableTransitionType(LayoutTransition.CHANGING);
    this.setLayoutTransition(transition);

    adapter = new LabelAdapter(getContext());
    popUpWindow = new ListPopupWindow(getContext());
    popUpWindow.setAnchorView(this);
    popUpWindow.setAdapter(adapter);
    popUpWindow.setWidth(DimensUtils.dpToPx(getContext(), 140));
    popUpWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
      @Override public void onDismiss() {
        showLabel();
      }
    });
    popUpWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Label label = (Label) adapter.getItem(position);
        if (!label.getName().equals(mail.getLabel())) {
          presenter.setLabel(mail, label.getName());
          popUpWindow.dismiss();
        }
      }
    });

    setOnClickListener(new OnClickListener() {
      @Override public void onClick(View v) {
        loadData(false);
      }
    });
  }