Search in sources :

Example 66 with ViewGroup

use of android.view.ViewGroup in project platform_frameworks_base by android.

the class SurfaceAndTextureViews method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.surface_texture_views);
    final ViewGroup container = (ViewGroup) findViewById(R.id.container);
    Button toggleButton = (Button) findViewById(R.id.toggleButton);
    mView = new SimpleView(this);
    mView.setId(0);
    mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
    container.addView(mView);
    mSurfaceView = new SimpleSurfaceView(this);
    mSurfaceView.setId(1);
    mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
    container.addView(mSurfaceView);
    mTextureView = new SimpleTextureView(this);
    mTextureView.setId(2);
    mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
    container.addView(mTextureView);
    final TransitionSet transition = new TransitionSet();
    transition.addTransition(new ChangeBounds()).addTransition(new Crossfade().addTarget(0).addTarget(1).addTarget(2));
    toggleButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Scene newScene = new Scene(container);
            newScene.setEnterAction(new Runnable() {

                @Override
                public void run() {
                    if (mView.getWidth() <= SMALL_SIZE) {
                        mView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
                        mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
                        mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE * 2, SMALL_SIZE));
                        mView.mColor = SimpleView.LARGE_COLOR;
                        mSurfaceView.mColor = SimpleSurfaceView.LARGE_COLOR;
                        mTextureView.mColor = SimpleTextureView.LARGE_COLOR;
                    } else {
                        mView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
                        mSurfaceView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
                        mTextureView.setLayoutParams(new LayoutParams(SMALL_SIZE, SMALL_SIZE));
                        mView.mColor = SimpleView.SMALL_COLOR;
                        mSurfaceView.mColor = SimpleSurfaceView.SMALL_COLOR;
                        mTextureView.mColor = SimpleTextureView.SMALL_COLOR;
                    }
                }
            });
            TransitionManager.go(newScene, transition);
        }
    });
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds) Scene(android.transition.Scene) SurfaceView(android.view.SurfaceView) TextureView(android.view.TextureView) View(android.view.View) Button(android.widget.Button) TransitionSet(android.transition.TransitionSet) Crossfade(android.transition.Crossfade)

Example 67 with ViewGroup

use of android.view.ViewGroup in project platform_frameworks_base by android.

the class InterruptionTest method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.interruption);
    ViewGroup sceneRoot = (ViewGroup) findViewById(R.id.sceneRoot);
    mScene1 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_1, this);
    mScene2 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_2, this);
    mScene3 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_3, this);
    mScene4 = Scene.getSceneForLayout(sceneRoot, R.layout.interruption_inner_4, this);
    mScene1RB = (RadioButton) findViewById(R.id.scene1RB);
    mScene2RB = (RadioButton) findViewById(R.id.scene2RB);
    mScene3RB = (RadioButton) findViewById(R.id.scene3RB);
    mScene4RB = (RadioButton) findViewById(R.id.scene4RB);
    ChangeBounds changeBounds1 = new ChangeBounds();
    changeBounds1.addTarget(R.id.button);
    ChangeBounds changeBounds2 = new ChangeBounds();
    changeBounds2.addTarget(R.id.button1);
    mSequencedMove.addTransition(changeBounds1).addTransition(changeBounds2);
    mSequencedMove.setDuration(1000);
}
Also used : ViewGroup(android.view.ViewGroup) ChangeBounds(android.transition.ChangeBounds)

Example 68 with ViewGroup

use of android.view.ViewGroup in project platform_frameworks_base by android.

the class Bridge method getViewIndex.

@Override
public Result getViewIndex(Object viewObject) {
    if (viewObject instanceof View) {
        View view = (View) viewObject;
        ViewParent parentView = view.getParent();
        if (parentView instanceof ViewGroup) {
            Status.SUCCESS.createResult(((ViewGroup) parentView).indexOfChild(view));
        }
        return Status.SUCCESS.createResult();
    }
    throw new IllegalArgumentException("viewObject is not a View");
}
Also used : ViewParent(android.view.ViewParent) ViewGroup(android.view.ViewGroup) View(android.view.View)

Example 69 with ViewGroup

use of android.view.ViewGroup in project platform_frameworks_base by android.

the class RenderSessionImpl method setActiveToolbar.

/**
     * If the root layout is a CoordinatorLayout with an AppBar:
     * Set the title of the AppBar to the title of the activity context.
     */
private void setActiveToolbar(View view, BridgeContext context, SessionParams params) {
    View coordinatorLayout = findChildView(view, DesignLibUtil.CN_COORDINATOR_LAYOUT);
    if (coordinatorLayout == null) {
        return;
    }
    View appBar = findChildView(coordinatorLayout, DesignLibUtil.CN_APPBAR_LAYOUT);
    if (appBar == null) {
        return;
    }
    ViewGroup collapsingToolbar = (ViewGroup) findChildView(appBar, DesignLibUtil.CN_COLLAPSING_TOOLBAR_LAYOUT);
    if (collapsingToolbar == null) {
        return;
    }
    if (!hasToolbar(collapsingToolbar)) {
        return;
    }
    RenderResources res = context.getRenderResources();
    String title = params.getAppLabel();
    ResourceValue titleValue = res.findResValue(title, false);
    if (titleValue != null && titleValue.getValue() != null) {
        title = titleValue.getValue();
    }
    DesignLibUtil.setTitle(collapsingToolbar, title);
}
Also used : ViewGroup(android.view.ViewGroup) RenderResources(com.android.ide.common.rendering.api.RenderResources) ResourceValue(com.android.ide.common.rendering.api.ResourceValue) MenuView(com.android.internal.view.menu.MenuView) View(android.view.View) AdapterView(android.widget.AdapterView) ActionMenuItemView(com.android.internal.view.menu.ActionMenuItemView) IconMenuItemView(com.android.internal.view.menu.IconMenuItemView) ListView(android.widget.ListView) ListMenuItemView(com.android.internal.view.menu.ListMenuItemView) AbsListView(android.widget.AbsListView) ActionMenuView(android.widget.ActionMenuView) ExpandableListView(android.widget.ExpandableListView)

Example 70 with ViewGroup

use of android.view.ViewGroup in project platform_frameworks_base by android.

the class RenderSessionImpl method visit.

/**
     * Visits a {@link View} and its children and generate a {@link ViewInfo} containing the
     * bounds of all the views.
     *
     * @param view the root View
     * @param offset an offset for the view bounds.
     * @param setExtendedInfo whether to set the extended view info in the {@link ViewInfo} object.
     * @param isContentFrame {@code true} if the {@code ViewInfo} to be created is part of the
     *                       content frame.
     *
     * @return {@code ViewInfo} containing the bounds of the view and it children otherwise.
     */
private ViewInfo visit(View view, int offset, boolean setExtendedInfo, boolean isContentFrame) {
    ViewInfo result = createViewInfo(view, offset, setExtendedInfo, isContentFrame);
    if (view instanceof ViewGroup) {
        ViewGroup group = ((ViewGroup) view);
        result.setChildren(visitAllChildren(group, isContentFrame ? 0 : offset, setExtendedInfo, isContentFrame));
    }
    return result;
}
Also used : ViewGroup(android.view.ViewGroup) ViewInfo(com.android.ide.common.rendering.api.ViewInfo)

Aggregations

ViewGroup (android.view.ViewGroup)2327 View (android.view.View)1300 TextView (android.widget.TextView)452 ImageView (android.widget.ImageView)282 ArrayList (java.util.ArrayList)204 ViewParent (android.view.ViewParent)185 ListView (android.widget.ListView)159 LayoutInflater (android.view.LayoutInflater)127 FrameLayout (android.widget.FrameLayout)127 Paint (android.graphics.Paint)126 AdapterView (android.widget.AdapterView)118 LinearLayout (android.widget.LinearLayout)113 AbsListView (android.widget.AbsListView)106 RecyclerView (android.support.v7.widget.RecyclerView)100 Drawable (android.graphics.drawable.Drawable)95 Animator (android.animation.Animator)94 AnimatedView (carbon.animation.AnimatedView)88 ComponentView (carbon.component.ComponentView)88 RippleView (carbon.drawable.ripple.RippleView)88 ShadowView (carbon.shadow.ShadowView)88