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);
}
});
}
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);
}
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");
}
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);
}
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;
}
Aggregations