FileDocCategorySizeDatePackage
ZoomControls.javaAPI DocAndroid 5.1 API3760Thu Mar 12 22:22:10 GMT 2015android.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 voidonInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent event)

        super.onInitializeAccessibilityEvent(event);
        event.setClassName(ZoomControls.class.getName());
    
public voidonInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo info)

        super.onInitializeAccessibilityNodeInfo(info);
        info.setClassName(ZoomControls.class.getName());
    
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);