Java Code Examples for android.view.ViewGroup#setLayoutTransition()

The following examples show how to use android.view.ViewGroup#setLayoutTransition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DebugView.java    From debugdrawer with Apache License 2.0 7 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private static void enableLayoutTransitions(ViewGroup viewGroup) {
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
		// Remove the status bar color. The DrawerLayout is responsible for drawing it from now on.
		LayoutTransition lt = new LayoutTransition();
		lt.enableTransitionType(LayoutTransition.CHANGING);
		viewGroup.setLayoutTransition(lt);
	} else {
		Timber.w("Error enabling LayoutTransitions, only supported for API14+.");
	}
}
 
Example 2
Source File: PropertyAnimationActivity.java    From Android-Animation-Set with Apache License 2.0 6 votes vote down vote up
private void doLayoutAnimator() {
    LayoutTransition layoutTransition = new LayoutTransition();

    layoutTransition.setAnimator(LayoutTransition.APPEARING, getObjectAnimator(false));
    layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, getObjectAnimator(true));
    layoutTransition.setDuration(2000);

    //mPuppet's parentView
    ViewGroup contentView = (ViewGroup) ((ViewGroup) getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0);
    contentView.setLayoutTransition(layoutTransition);
    if (contentView.findViewById(R.id.view_puppet) == null) {
        contentView.addView(mPuppet);
    } else {
        contentView.removeView(mPuppet);
    }
}
 
Example 3
Source File: PropertyAnimationActivity.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
private void doLayoutAnimator() {
    LayoutTransition layoutTransition = new LayoutTransition();

    layoutTransition.setAnimator(LayoutTransition.APPEARING, getObjectAnimator(false));
    layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, getObjectAnimator(true));
    layoutTransition.setDuration(2000);

    //mPuppet's parentView
    ViewGroup contentView = (ViewGroup) ((ViewGroup) getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0);
    contentView.setLayoutTransition(layoutTransition);
    if (contentView.findViewById(R.id.view_puppet) == null) {
        contentView.addView(mPuppet);
    } else {
        contentView.removeView(mPuppet);
    }
}
 
Example 4
Source File: HashtagView.java    From hashtag-view with MIT License 6 votes vote down vote up
private void draw() {
    if (viewMap == null || viewMap.isEmpty()) return;
    removeAllViews();

    List<Integer> keys = new ArrayList<>(viewMap.keySet());
    Collections.sort(keys);

    for (Integer key : keys) {
        ViewGroup rowLayout = getRowLayout(viewMap.get(key).size());
        addView(rowLayout);
        applyDistribution(viewMap.get(key));
        rowLayout.setLayoutTransition(layoutTransition);

        for (ItemData item : viewMap.get(key)) {
            releaseParent(item.view);
            rowLayout.addView(item.view, itemLayoutParams);
        }
    }
    keys.clear();
}
 
Example 5
Source File: AnimUtil.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public static void infoSwitch(ViewGroup viewgroup, ViewGroup viewgroup1)
{
    viewgroup.setLayoutTransition(null);
    viewgroup1.setLayoutTransition(null);
    dismissChildren(viewgroup);
    showChildren(viewgroup1);
}
 
Example 6
Source File: Toolbar.java    From nfcard with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("NewApi")
public Toolbar(ViewGroup toolbar) {

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
		toolbar.setLayoutTransition(new LayoutTransition());

	this.toolbar = toolbar;
}
 
Example 7
Source File: Toolbar.java    From NFCard with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("NewApi")
public Toolbar(ViewGroup toolbar) {

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
		toolbar.setLayoutTransition(new LayoutTransition());

	this.toolbar = toolbar;
}
 
Example 8
Source File: ViewOverlayPreJellybean.java    From Transitions-Everywhere with Apache License 2.0 5 votes vote down vote up
@Override
public void addView(@NonNull View child, int left, int top) {
    if (child.getParent() instanceof ViewGroup) {
        ViewGroup parent = (ViewGroup) child.getParent();
        LayoutTransition layoutTransition = null;
        if (parent.getLayoutTransition() != null) {
            layoutTransition = parent.getLayoutTransition();
            parent.setLayoutTransition(null);
        }
        parent.removeView(child);
        if (layoutTransition != null) {
            parent.setLayoutTransition(layoutTransition);
        }

        if (child.getParent() != null) {
            // LayoutTransition will cause the child to delay removal - cancel it
            ViewGroupUtils.cancelLayoutTransition(parent);
            // fail-safe if view is still attached for any reason
            if (child.getParent() != null && FIELD_VIEW_PARENT != null) {
                ReflectionUtils.setFieldValue(child, FIELD_VIEW_PARENT, null);
            }
        }
        if (child.getParent() != null) {
            return;
        }
    }
    child.setTag(R.id.overlay_layout_params_backup, child.getLayoutParams());
    addView(child, initParams(child, left, top));
    invalidate();
}
 
Example 9
Source File: MainActivity.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	LayoutTransition l = new LayoutTransition();
	l.enableTransitionType(LayoutTransition.CHANGING);
	viewGroup = (ViewGroup) findViewById(R.id.container);
	viewGroup.setLayoutTransition(l);

}
 
Example 10
Source File: ChannelSetupFragment.java    From xipl with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(getLayoutResourceId(), container, false);
    // Make sure this view is focused
    view.requestFocus();
    mProgressBar = (ProgressBar) view.findViewById(R.id.tune_progress);
    mScanningMessage = (TextView) view.findViewById(R.id.tune_description);
    mTitle = (TextView) view.findViewById(R.id.tune_title);
    mBadge = (ImageView) view.findViewById(R.id.tune_icon);
    mChannelHolder = view.findViewById(R.id.channel_holder);
    mCancelButton = (Button) view.findViewById(R.id.tune_cancel);

    ListView channelList = (ListView) view.findViewById(R.id.channel_list);
    mAdapter = new ChannelAdapter();
    channelList.setAdapter(mAdapter);
    channelList.setOnItemClickListener(null);

    ViewGroup progressHolder = (ViewGroup) view.findViewById(R.id.progress_holder);
    LayoutTransition transition = new LayoutTransition();
    transition.enableTransitionType(LayoutTransition.CHANGING);
    progressHolder.setLayoutTransition(transition);

    mCancelButton.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    finishScan();
                }
            });
    mSyncStatusChangedReceiver = new SyncStatusBroadcastReceiver(getInputId(), this);
    LocalBroadcastManager.getInstance(getActivity())
            .registerReceiver(
                    mSyncStatusChangedReceiver,
                    new IntentFilter(EpgSyncJobService.ACTION_SYNC_STATUS_CHANGED));

    mChannelScanLayout = view;
    setChannelListVisibility(false);
    setBackgroundColor(getResources().getColor(android.R.color.holo_blue_dark));
    return view;
}
 
Example 11
Source File: AnimUtil.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static void animInfoSwitch(ViewGroup viewgroup, ViewGroup viewgroup1)
{
    int i1 = 0;
    if (b == null)
    {
        b = a();
    }
    if (c == null)
    {
        c = a();
    }
    viewgroup.setLayoutTransition(b);
    viewgroup1.setLayoutTransition(c);
    viewgroup1.setVisibility(0);
    int j1 = viewgroup.getChildCount();
    int k1 = 0;
    int l1 = 0;
    for (; k1 < j1; k1++)
    {
        View view1 = viewgroup.getChildAt(k1);
        if (k1 * (100 - k1 * 10) > l1)
        {
            l1 = k1 * (100 - k1 * 10);
        }
        viewgroup.postDelayed(new m(view1), l1);
        if (k1 == j1 - 1)
        {
            viewgroup.postDelayed(new b(viewgroup), l1 + 90);
        }
    }

    int i2 = viewgroup1.getChildCount();
    int j2 = 0;
    for (; i1 < i2; i1++)
    {
        View view = viewgroup1.getChildAt(i1);
        if (i1 * (100 - i1 * 10) > j2)
        {
            j2 = i1 * (100 - i1 * 10);
        }
        viewgroup1.postDelayed(new c(view), j2);
    }

}
 
Example 12
Source File: ChannelSetupFragment.java    From androidtv-sample-inputs with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(getLayoutResourceId(), container, false);
    // Make sure this view is focused
    view.requestFocus();
    mProgressBar = (ProgressBar) view.findViewById(R.id.tune_progress);
    mScanningMessage = (TextView) view.findViewById(R.id.tune_description);
    mTitle = (TextView) view.findViewById(R.id.tune_title);
    mBadge = (ImageView) view.findViewById(R.id.tune_icon);
    mChannelHolder = view.findViewById(R.id.channel_holder);
    mCancelButton = (Button) view.findViewById(R.id.tune_cancel);

    ListView channelList = (ListView) view.findViewById(R.id.channel_list);
    mAdapter = new ChannelAdapter();
    channelList.setAdapter(mAdapter);
    channelList.setOnItemClickListener(null);

    ViewGroup progressHolder = (ViewGroup) view.findViewById(R.id.progress_holder);
    LayoutTransition transition = new LayoutTransition();
    transition.enableTransitionType(LayoutTransition.CHANGING);
    progressHolder.setLayoutTransition(transition);

    mCancelButton.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    finishScan();
                }
            });
    mSyncStatusChangedReceiver = new SyncStatusBroadcastReceiver(getInputId(), this);
    LocalBroadcastManager.getInstance(getActivity())
            .registerReceiver(
                    mSyncStatusChangedReceiver,
                    new IntentFilter(EpgSyncJobService.ACTION_SYNC_STATUS_CHANGED));

    mChannelScanLayout = view;
    setChannelListVisibility(false);
    setBackgroundColor(getResources().getColor(android.R.color.holo_blue_dark));
    return view;
}