FileDocCategorySizeDatePackage
ZoomControls.javaAPI DocAndroid 1.5 API3229Wed May 06 22:41:56 BST 2009android.widget

ZoomControls

public class ZoomControls extends LinearLayout
The {@code ZoomControls} class displays a simple set of controls used for zooming and provides callbacks to register for events.

Fields Summary
private final ZoomButton
mZoomIn
private final ZoomButton
mZoomOut
Constructors Summary
public ZoomControls(android.content.Context context)

        this(context, null);
    
public ZoomControls(android.content.Context context, android.util.AttributeSet attrs)

        super(context, attrs);
        setFocusable(false);
        
        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.zoom_controls, this, // we are the parent
                true);
        
        mZoomIn = (ZoomButton) findViewById(R.id.zoomIn);
        mZoomOut = (ZoomButton) findViewById(R.id.zoomOut);
    
Methods Summary
private voidfade(int visibility, float startAlpha, float endAlpha)

        AlphaAnimation anim = new AlphaAnimation(startAlpha, endAlpha);
        anim.setDuration(500);
        startAnimation(anim);
        setVisibility(visibility);
    
public booleanhasFocus()

        return mZoomIn.hasFocus() || mZoomOut.hasFocus();
    
public voidhide()

        fade(View.GONE, 1.0f, 0.0f);
    
public booleanonTouchEvent(android.view.MotionEvent event)

        
        /* Consume all touch events so they don't get dispatched to the view
         * beneath this view.
         */
        return true;
    
public voidsetIsZoomInEnabled(boolean isEnabled)

        mZoomIn.setEnabled(isEnabled);
    
public voidsetIsZoomOutEnabled(boolean isEnabled)

        mZoomOut.setEnabled(isEnabled);
    
public voidsetOnZoomInClickListener(OnClickListener listener)

        mZoomIn.setOnClickListener(listener);
    
public voidsetOnZoomOutClickListener(OnClickListener listener)

        mZoomOut.setOnClickListener(listener);
    
public voidsetZoomSpeed(long speed)

        mZoomIn.setZoomSpeed(speed);
        mZoomOut.setZoomSpeed(speed);
    
public voidshow()

        fade(View.VISIBLE, 0.0f, 1.0f);