X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fpackages-apps-Gallery2.git;a=blobdiff_plain;f=src%2Fcom%2Fcooliris%2Fmedia%2FLayer.java;fp=src%2Fcom%2Fcooliris%2Fmedia%2FLayer.java;h=22ba4ebf2210720b73521d7ff858520726645cb3;hp=0000000000000000000000000000000000000000;hb=c145d41ec9e768e61042d0e765d2aa4cca93574d;hpb=e927ab54062112c88aa17afb90657f4e7f54e529 diff --git a/src/com/cooliris/media/Layer.java b/src/com/cooliris/media/Layer.java new file mode 100644 index 000000000..22ba4ebf2 --- /dev/null +++ b/src/com/cooliris/media/Layer.java @@ -0,0 +1,85 @@ +package com.cooliris.media; + +import javax.microedition.khronos.opengles.GL11; + +import android.view.MotionEvent; + +public abstract class Layer { + float mX = 0f; + float mY = 0f; + float mWidth = 0; + float mHeight = 0; + boolean mHidden = false; + + public final float getX() { + return mX; + } + + public final float getY() { + return mY; + } + + public final void setPosition(float x, float y) { + mX = x; + mY = y; + } + + public final float getWidth() { + return mWidth; + } + + public final float getHeight() { + return mHeight; + } + + public final void setSize(float width, float height) { + if (mWidth != width || mHeight != height) { + mWidth = width; + mHeight = height; + onSizeChanged(); + } + } + + public boolean isHidden() { + return mHidden; + } + + public void setHidden(boolean hidden) { + if (mHidden != hidden) { + mHidden = hidden; + onHiddenChanged(); + } + } + + public abstract void generate(RenderView view, RenderView.Lists lists); + + // Returns true if something is animating. + public boolean update(RenderView view, float frameInterval) { + return false; + } + + public void renderOpaque(RenderView view, GL11 gl) { + } + + public void renderBlended(RenderView view, GL11 gl) { + } + + public boolean onTouchEvent(MotionEvent event) { + return false; + } + + // Allows subclasses to further constrain the hit test defined by layer + // bounds. + public boolean containsPoint(float x, float y) { + return true; + } + + protected void onSurfaceCreated(RenderView view, GL11 gl) { + } + + protected void onSizeChanged() { + } + + protected void onHiddenChanged() { + } +}