FileDocCategorySizeDatePackage
DemoPresentation.javaAPI DocAndroid 5.1 API2843Thu Mar 12 22:22:42 GMT 2015com.android.accessorydisplay.source.presentation

DemoPresentation

public final class DemoPresentation extends android.app.Presentation
The presentation to show on the accessory display.

Note that this display may have different metrics from the display on which the main activity is showing so we must be careful to use the presentation's own {@link Context} whenever we load resources.

Fields Summary
private final com.android.accessorydisplay.common.Logger
mLogger
private android.opengl.GLSurfaceView
mSurfaceView
private CubeRenderer
mRenderer
private android.widget.Button
mExplodeButton
Constructors Summary
public DemoPresentation(android.content.Context context, android.view.Display display, com.android.accessorydisplay.common.Logger logger)

        super(context, display);
        mLogger = logger;
    
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)

        // Be sure to call the super class.
        super.onCreate(savedInstanceState);

        // Get the resources for the context of the presentation.
        // Notice that we are getting the resources from the context of the presentation.
        Resources r = getContext().getResources();

        // Inflate the layout.
        setContentView(R.layout.presentation_content);

        // Set up the surface view for visual interest.
        mRenderer = new CubeRenderer(false);
        mSurfaceView = (GLSurfaceView)findViewById(R.id.surface_view);
        mSurfaceView.setRenderer(mRenderer);

        // Add a button.
        mExplodeButton = (Button)findViewById(R.id.explode_button);
        mExplodeButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRenderer.explode();
            }
        });
    
public booleanonTouchEvent(android.view.MotionEvent event)

        mLogger.log("Received touch event: " + event);
        return super.onTouchEvent(event);