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

The following examples show how to use android.view.ViewGroup#invalidate() . These examples are extracted from open source projects. 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 Project: star-zone-android   File: DotWidget.java    License: Apache License 2.0 6 votes vote down vote up
private void addDot(View target) {
    ViewGroup.LayoutParams targetViewParams = target.getLayoutParams();
    ViewGroup.LayoutParams newTargetViewParams = new ViewGroup.LayoutParams(targetViewParams.width, targetViewParams.height);
    targetViewParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    targetViewParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    //new一个容器
    container = new FrameLayout(getContext());
    container.setClipToPadding(false);

    ViewGroup parent = (ViewGroup) target.getParent();
    int index = parent.indexOfChild(target);
    //去掉目标view
    parent.removeView(target);
    //添加容器
    parent.addView(container, index, targetViewParams);

    //容器添加目标view
    container.addView(target, newTargetViewParams);
    setVisibility(GONE);
    //容器添加本view(红点)
    container.addView(this);
    parent.invalidate();
}
 
Example 2
private void triggerViewsReady(final ArrayMap<String, View> sharedElements) {
    if (mAreViewsReady) {
        return;
    }
    mAreViewsReady = true;
    final ViewGroup decor = getDecor();
    // Ensure the views have been laid out before capturing the views -- we need the epicenter.
    if (decor == null || (decor.isAttachedToWindow() &&
            (sharedElements.isEmpty() || !sharedElements.valueAt(0).isLayoutRequested()))) {
        viewsReady(sharedElements);
    } else {
        mViewsReadyListener = OneShotPreDrawListener.add(decor, () -> {
            mViewsReadyListener = null;
            viewsReady(sharedElements);
        });
        decor.invalidate();
    }
}
 
Example 3
Source Project: MiBandDecompiled   File: BadgeView.java    License: Apache License 2.0 6 votes vote down vote up
private void a(View view)
{
    android.view.ViewGroup.LayoutParams layoutparams = view.getLayoutParams();
    android.view.ViewParent viewparent = view.getParent();
    FrameLayout framelayout = new FrameLayout(i);
    if (view instanceof TabWidget)
    {
        View view1 = ((TabWidget)view).getChildTabViewAt(q);
        j = view1;
        ((ViewGroup)view1).addView(framelayout, new android.view.ViewGroup.LayoutParams(-1, -1));
        setVisibility(8);
        framelayout.addView(this);
        return;
    } else
    {
        ViewGroup viewgroup = (ViewGroup)viewparent;
        int i1 = viewgroup.indexOfChild(view);
        viewgroup.removeView(view);
        viewgroup.addView(framelayout, i1, layoutparams);
        framelayout.addView(view);
        setVisibility(8);
        framelayout.addView(this);
        viewgroup.invalidate();
        return;
    }
}
 
Example 4
private void startExitTransition() {
    Transition transition = getExitTransition();
    ViewGroup decorView = getDecor();
    if (transition != null && decorView != null && mTransitioningViews != null) {
        setTransitioningViewsVisiblity(View.VISIBLE, false);
        TransitionManager.beginDelayedTransition(decorView, transition);
        setTransitioningViewsVisiblity(View.INVISIBLE, false);
        decorView.invalidate();
    } else {
        transitionStarted();
    }
}
 
Example 5
Source Project: letv   File: BottomRedPointView.java    License: Apache License 2.0 5 votes vote down vote up
private void applyTo(View target) {
    LayoutParams lp = target.getLayoutParams();
    ViewParent parent = target.getParent();
    FrameLayout container = new FrameLayout(this.context);
    ViewGroup group = (ViewGroup) parent;
    int index = group.indexOfChild(target);
    group.removeView(target);
    group.addView(container, index, lp);
    container.addView(target);
    container.addView(this);
    group.invalidate();
}
 
Example 6
Source Project: BoardView   File: BoardAdapter.java    License: Apache License 2.0 5 votes vote down vote up
public void removeColumn(int index){
    BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(index);
    ViewGroup group = ((ViewGroup) item.getParent());
    ((ViewGroup)item.getParent()).removeView(item);
    columns.remove(index);
    group.invalidate();
}
 
Example 7
Source Project: FamilyChat   File: ParallaxTransformer.java    License: Apache License 2.0 5 votes vote down vote up
private void bringViewToFront(View view) {
    ViewGroup group = (ViewGroup) view.getParent();
    int index = group.indexOfChild(view);
    if (index != group.getChildCount() - 1) {
        view.bringToFront();
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
            view.requestLayout();
            group.invalidate();
        }
    }
}
 
Example 8
Source Project: umeng_community_android   File: BadgeView.java    License: MIT License 5 votes vote down vote up
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {
            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container,
                    new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);
        } else {
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
Example 9
Source Project: android-project-wo2b   File: BadgeView.java    License: Apache License 2.0 4 votes vote down vote up
private void applyTo(View target)
{

	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);

	if (target instanceof TabWidget)
	{

		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;

		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

		this.setVisibility(View.GONE);
		container.addView(this);

	}
	else
	{

		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);

		group.removeView(target);
		group.addView(container, index, lp);

		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);

		group.invalidate();

	}

}
 
Example 10
Source Project: FloatingView   File: TrashView.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Clear the animation garbage of the target view.
 */
private static void clearClippedChildren(ViewGroup viewGroup) {
    viewGroup.setClipChildren(true);
    viewGroup.invalidate();
    viewGroup.setClipChildren(false);
}
 
Example 11
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 12
Source Project: RefreshActionItem   File: BadgeView.java    License: Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 13
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {

            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container,
                    new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);

        } else {

            // TODO verify that parent is indeed a ViewGroup
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }
 
Example 14
Source Project: xmpp   File: BadgeView.java    License: Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 15
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container,
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent;
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 16
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 17
Source Project: BigApp_Discuz_Android   File: BadgeView.java    License: Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 18
Source Project: RefreshActionItem   File: BadgeView.java    License: Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 19
Source Project: android-common-utils   File: BadgeView.java    License: Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {
	
	LayoutParams lp = target.getLayoutParams();
	ViewParent parent = target.getParent();
	FrameLayout container = new FrameLayout(context);
	
	if (target instanceof TabWidget) {
		
		// set target to the relevant tab child container
		target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
		this.target = target;
		
		((ViewGroup) target).addView(container, 
				new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
		
		this.setVisibility(View.GONE);
		container.addView(this);
		
	} else {
		
		// TODO verify that parent is indeed a ViewGroup
		ViewGroup group = (ViewGroup) parent; 
		int index = group.indexOfChild(target);
		
		group.removeView(target);
		group.addView(container, index, lp);
		
		container.addView(target);

		this.setVisibility(View.GONE);
		container.addView(this);
		
		group.invalidate();
		
	}
	
}
 
Example 20
Source Project: android-discourse   File: BadgeView.java    License: Apache License 2.0 3 votes vote down vote up
private void applyTo(View target) {

        LayoutParams lp = target.getLayoutParams();
        ViewParent parent = target.getParent();
        FrameLayout container = new FrameLayout(context);

        if (target instanceof TabWidget) {

            // set target to the relevant tab child container
            target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
            this.target = target;

            ((ViewGroup) target).addView(container, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

            this.setVisibility(View.GONE);
            container.addView(this);

        } else {

            // TODO verify that parent is indeed a ViewGroup
            ViewGroup group = (ViewGroup) parent;
            int index = group.indexOfChild(target);

            group.removeView(target);
            group.addView(container, index, lp);

            container.addView(target);

            this.setVisibility(View.GONE);
            container.addView(this);

            group.invalidate();

        }

    }