summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/ui')
-rw-r--r--src/com/android/gallery3d/ui/AdaptiveBackground.java127
-rw-r--r--src/com/android/gallery3d/ui/AlbumSetView.java4
-rw-r--r--src/com/android/gallery3d/ui/AlbumSlidingWindow.java4
-rw-r--r--src/com/android/gallery3d/ui/BitmapTileProvider.java4
-rw-r--r--src/com/android/gallery3d/ui/BoxBlurFilter.java100
-rw-r--r--src/com/android/gallery3d/ui/Config.java31
-rw-r--r--src/com/android/gallery3d/ui/CustomMenu.java32
-rw-r--r--src/com/android/gallery3d/ui/DialogDetailsView.java4
-rw-r--r--src/com/android/gallery3d/ui/DrawableTexture.java38
-rw-r--r--src/com/android/gallery3d/ui/FilmStripView.java10
-rw-r--r--src/com/android/gallery3d/ui/GLCanvas.java27
-rw-r--r--src/com/android/gallery3d/ui/GLCanvasImpl.java184
-rw-r--r--src/com/android/gallery3d/ui/GLPaint.java23
-rw-r--r--src/com/android/gallery3d/ui/GLRoot.java1
-rw-r--r--src/com/android/gallery3d/ui/GLRootView.java29
-rw-r--r--src/com/android/gallery3d/ui/GLView.java8
-rw-r--r--src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java6
-rw-r--r--src/com/android/gallery3d/ui/Icon.java59
-rw-r--r--src/com/android/gallery3d/ui/OnSelectedListener.java21
-rw-r--r--src/com/android/gallery3d/ui/Paper.java1
-rw-r--r--src/com/android/gallery3d/ui/RawTexture.java54
-rw-r--r--src/com/android/gallery3d/ui/ScrollBarView.java43
-rw-r--r--src/com/android/gallery3d/ui/SelectionManager.java4
-rw-r--r--src/com/android/gallery3d/ui/SlotView.java24
-rw-r--r--src/com/android/gallery3d/ui/StaticBackground.java61
-rw-r--r--src/com/android/gallery3d/ui/Texture.java2
26 files changed, 12 insertions, 889 deletions
diff --git a/src/com/android/gallery3d/ui/AdaptiveBackground.java b/src/com/android/gallery3d/ui/AdaptiveBackground.java
deleted file mode 100644
index d7c99063d..000000000
--- a/src/com/android/gallery3d/ui/AdaptiveBackground.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.LightingColorFilter;
-import android.graphics.Paint;
-
-import com.android.gallery3d.anim.FloatAnimation;
-
-public class AdaptiveBackground extends GLView {
-
- private static final int BACKGROUND_WIDTH = 128;
- private static final int BACKGROUND_HEIGHT = 64;
- private static final int FILTERED_COLOR = 0xffaaaaaa;
- private static final int ANIMATION_DURATION = 500;
-
- private BasicTexture mOldBackground;
- private BasicTexture mBackground;
-
- private final Paint mPaint;
- private Bitmap mPendingBitmap;
- private final FloatAnimation mAnimation =
- new FloatAnimation(0, 1, ANIMATION_DURATION);
-
- public AdaptiveBackground() {
- Paint paint = new Paint();
- paint.setFilterBitmap(true);
- paint.setColorFilter(new LightingColorFilter(FILTERED_COLOR, 0));
- mPaint = paint;
- }
-
- public Bitmap getAdaptiveBitmap(Bitmap bitmap) {
- Bitmap target = Bitmap.createBitmap(
- BACKGROUND_WIDTH, BACKGROUND_HEIGHT, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(target);
- int width = bitmap.getWidth();
- int height = bitmap.getHeight();
- int left = 0;
- int top = 0;
- if (width * BACKGROUND_HEIGHT > height * BACKGROUND_WIDTH) {
- float scale = (float) BACKGROUND_HEIGHT / height;
- canvas.scale(scale, scale);
- left = (BACKGROUND_WIDTH - (int) (width * scale + 0.5)) / 2;
- } else {
- float scale = (float) BACKGROUND_WIDTH / width;
- canvas.scale(scale, scale);
- top = (BACKGROUND_HEIGHT - (int) (height * scale + 0.5)) / 2;
- }
- canvas.drawBitmap(bitmap, left, top, mPaint);
- BoxBlurFilter.apply(target,
- BoxBlurFilter.MODE_REPEAT, BoxBlurFilter.MODE_CLAMP);
- return target;
- }
-
- private void startTransition(Bitmap bitmap) {
- BitmapTexture texture = new BitmapTexture(bitmap);
- if (mBackground == null) {
- mBackground = texture;
- } else {
- if (mOldBackground != null) mOldBackground.recycle();
- mOldBackground = mBackground;
- mBackground = texture;
- mAnimation.start();
- }
- invalidate();
- }
-
- public void setImage(Bitmap bitmap) {
- if (mAnimation.isActive()) {
- mPendingBitmap = bitmap;
- } else {
- startTransition(bitmap);
- }
- }
-
- public void setScrollPosition(int position) {
- if (mScrollX == position) return;
- mScrollX = position;
- invalidate();
- }
-
- @Override
- protected void render(GLCanvas canvas) {
- if (mBackground == null) return;
-
- int height = getHeight();
- float scale = (float) height / BACKGROUND_HEIGHT;
- int width = (int) (BACKGROUND_WIDTH * scale + 0.5f);
- int scroll = mScrollX;
- int start = (scroll / width) * width;
-
- if (mOldBackground == null) {
- for (int i = start, n = scroll + getWidth(); i < n; i += width) {
- mBackground.draw(canvas, i - scroll, 0, width, height);
- }
- } else {
- boolean moreAnimation = mAnimation.calculate(AnimationTime.get());
- float ratio = mAnimation.get();
- for (int i = start, n = scroll + getWidth(); i < n; i += width) {
- canvas.drawMixed(mOldBackground,
- mBackground, ratio, i - scroll, 0, width, height);
- }
- if (moreAnimation) {
- invalidate();
- } else if (mPendingBitmap != null) {
- startTransition(mPendingBitmap);
- mPendingBitmap = null;
- }
- }
- }
-}
diff --git a/src/com/android/gallery3d/ui/AlbumSetView.java b/src/com/android/gallery3d/ui/AlbumSetView.java
index 86398ec9d..577d54e33 100644
--- a/src/com/android/gallery3d/ui/AlbumSetView.java
+++ b/src/com/android/gallery3d/ui/AlbumSetView.java
@@ -146,10 +146,6 @@ public class AlbumSetView extends SlotView {
removeDisplayItem(entry.labelItem);
}
- public int size() {
- return mDataWindow.size();
- }
-
@Override
public void onLayoutChanged(int width, int height) {
updateVisibleRange(0, 0);
diff --git a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
index d64c1f7ed..8d61f934d 100644
--- a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
+++ b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java
@@ -124,10 +124,6 @@ public class AlbumSlidingWindow implements AlbumView.ModelListener {
return mData[slotIndex % mData.length];
}
- public int size() {
- return mSize;
- }
-
public boolean isActiveSlot(int slotIndex) {
return slotIndex >= mActiveStart && slotIndex < mActiveEnd;
}
diff --git a/src/com/android/gallery3d/ui/BitmapTileProvider.java b/src/com/android/gallery3d/ui/BitmapTileProvider.java
index a47337fa2..4ad5412d6 100644
--- a/src/com/android/gallery3d/ui/BitmapTileProvider.java
+++ b/src/com/android/gallery3d/ui/BitmapTileProvider.java
@@ -81,10 +81,6 @@ public class BitmapTileProvider implements TileImageView.Model {
BitmapUtils.recycleSilently(mBackup);
}
- public int getRotation() {
- return 0;
- }
-
public boolean isFailedToLoad() {
return false;
}
diff --git a/src/com/android/gallery3d/ui/BoxBlurFilter.java b/src/com/android/gallery3d/ui/BoxBlurFilter.java
deleted file mode 100644
index 0497a61fa..000000000
--- a/src/com/android/gallery3d/ui/BoxBlurFilter.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-import android.graphics.Bitmap;
-
-
-public class BoxBlurFilter {
- private static final int RED_MASK = 0xff0000;
- private static final int RED_MASK_SHIFT = 16;
- private static final int GREEN_MASK = 0x00ff00;
- private static final int GREEN_MASK_SHIFT = 8;
- private static final int BLUE_MASK = 0x0000ff;
- private static final int RADIUS = 4;
- private static final int KERNEL_SIZE = RADIUS * 2 + 1;
- private static final int NUM_COLORS = 256;
- private static final int[] KERNEL_NORM = new int[KERNEL_SIZE * NUM_COLORS];
-
- public static final int MODE_REPEAT = 1;
- public static final int MODE_CLAMP = 2;
-
- static {
- int index = 0;
- // Build a lookup table from summed to normalized kernel values.
- // The formula: KERNAL_NORM[value] = value / KERNEL_SIZE
- for (int i = 0; i < NUM_COLORS; ++i) {
- for (int j = 0; j < KERNEL_SIZE; ++j) {
- KERNEL_NORM[index++] = i;
- }
- }
- }
-
- private BoxBlurFilter() {
- }
-
- private static int sample(int x, int width, int mode) {
- if (x >= 0 && x < width) return x;
- return mode == MODE_REPEAT
- ? x < 0 ? x + width : x - width
- : x < 0 ? 0 : width - 1;
- }
-
- public static void apply(
- Bitmap bitmap, int horizontalMode, int verticalMode) {
-
- int width = bitmap.getWidth();
- int height = bitmap.getHeight();
- int data[] = new int[width * height];
- bitmap.getPixels(data, 0, width, 0, 0, width, height);
- int temp[] = new int[width * height];
- applyOneDimension(data, temp, width, height, horizontalMode);
- applyOneDimension(temp, data, height, width, verticalMode);
- bitmap.setPixels(data, 0, width, 0, 0, width, height);
- }
-
- private static void applyOneDimension(
- int[] in, int[] out, int width, int height, int mode) {
- for (int y = 0, read = 0; y < height; ++y, read += width) {
- // Evaluate the kernel for the first pixel in the row.
- int red = 0;
- int green = 0;
- int blue = 0;
- for (int i = -RADIUS; i <= RADIUS; ++i) {
- int argb = in[read + sample(i, width, mode)];
- red += (argb & RED_MASK) >> RED_MASK_SHIFT;
- green += (argb & GREEN_MASK) >> GREEN_MASK_SHIFT;
- blue += argb & BLUE_MASK;
- }
- for (int x = 0, write = y; x < width; ++x, write += height) {
- // Output the current pixel.
- out[write] = 0xFF000000
- | (KERNEL_NORM[red] << RED_MASK_SHIFT)
- | (KERNEL_NORM[green] << GREEN_MASK_SHIFT)
- | KERNEL_NORM[blue];
-
- // Slide to the next pixel, adding the new rightmost pixel and
- // subtracting the former leftmost.
- int prev = in[read + sample(x - RADIUS, width, mode)];
- int next = in[read + sample(x + RADIUS + 1, width, mode)];
- red += ((next & RED_MASK) - (prev & RED_MASK)) >> RED_MASK_SHIFT;
- green += ((next & GREEN_MASK) - (prev & GREEN_MASK)) >> GREEN_MASK_SHIFT;
- blue += (next & BLUE_MASK) - (prev & BLUE_MASK);
- }
- }
- }
-}
diff --git a/src/com/android/gallery3d/ui/Config.java b/src/com/android/gallery3d/ui/Config.java
deleted file mode 100644
index 5c5b6210a..000000000
--- a/src/com/android/gallery3d/ui/Config.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-interface DetailsWindowConfig {
- public static final int FONT_SIZE = 18;
- public static final int PREFERRED_WIDTH = 400;
- public static final int LEFT_RIGHT_EXTRA_PADDING = 9;
- public static final int TOP_BOTTOM_EXTRA_PADDING = 9;
- public static final int LINE_SPACING = 5;
- public static final int FIRST_LINE_SPACING = 18;
-}
-
-interface TextButtonConfig {
- public static final int HORIZONTAL_PADDINGS = 16;
- public static final int VERTICAL_PADDINGS = 5;
-}
diff --git a/src/com/android/gallery3d/ui/CustomMenu.java b/src/com/android/gallery3d/ui/CustomMenu.java
index de2367e60..c3dd4530f 100644
--- a/src/com/android/gallery3d/ui/CustomMenu.java
+++ b/src/com/android/gallery3d/ui/CustomMenu.java
@@ -85,38 +85,6 @@ public class CustomMenu implements OnMenuItemClickListener {
mListener = listener;
}
- public MenuItem findMenuItem(int id) {
- MenuItem item = null;
- for (DropDownMenu menu : mMenus) {
- item = menu.findItem(id);
- if (item != null) return item;
- }
- return item;
- }
-
- public void setMenuItemAppliedEnabled(int id, boolean applied, boolean enabled,
- boolean updateTitle) {
- MenuItem item = null;
- for (DropDownMenu menu : mMenus) {
- item = menu.findItem(id);
- if (item != null) {
- item.setCheckable(true);
- item.setChecked(applied);
- item.setEnabled(enabled);
- if (updateTitle) {
- menu.setTitle(item.getTitle());
- }
- }
- }
- }
-
- public void setMenuItemVisibility(int id, boolean visibility) {
- MenuItem item = findMenuItem(id);
- if (item != null) {
- item.setVisible(visibility);
- }
- }
-
public boolean onMenuItemClick(MenuItem item) {
if (mListener != null) {
return mListener.onMenuItemClick(item);
diff --git a/src/com/android/gallery3d/ui/DialogDetailsView.java b/src/com/android/gallery3d/ui/DialogDetailsView.java
index 580a40edb..60ced031d 100644
--- a/src/com/android/gallery3d/ui/DialogDetailsView.java
+++ b/src/com/android/gallery3d/ui/DialogDetailsView.java
@@ -80,10 +80,6 @@ public class DialogDetailsView implements DetailsViewContainer {
}
}
- public boolean isVisible() {
- return mDialog.isShowing();
- }
-
private void setDetails(MediaDetails details) {
mAdapter = new DetailsAdapter(details);
String title = String.format(
diff --git a/src/com/android/gallery3d/ui/DrawableTexture.java b/src/com/android/gallery3d/ui/DrawableTexture.java
deleted file mode 100644
index 5c3964d5c..000000000
--- a/src/com/android/gallery3d/ui/DrawableTexture.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-
-// DrawableTexture is a texture whose content is from a Drawable.
-public class DrawableTexture extends CanvasTexture {
-
- private final Drawable mDrawable;
-
- public DrawableTexture(Drawable drawable, int width, int height) {
- super(width, height);
- mDrawable = drawable;
- }
-
- @Override
- protected void onDraw(Canvas canvas, Bitmap backing) {
- mDrawable.setBounds(0, 0, mWidth, mHeight);
- mDrawable.draw(canvas);
- }
-}
diff --git a/src/com/android/gallery3d/ui/FilmStripView.java b/src/com/android/gallery3d/ui/FilmStripView.java
index e6ed49b6e..ed288afee 100644
--- a/src/com/android/gallery3d/ui/FilmStripView.java
+++ b/src/com/android/gallery3d/ui/FilmStripView.java
@@ -28,8 +28,7 @@ import android.content.Context;
import android.view.MotionEvent;
import android.view.View.MeasureSpec;
-public class FilmStripView extends GLView implements ScrollBarView.Listener,
- UserInteractionListener {
+public class FilmStripView extends GLView implements UserInteractionListener {
@SuppressWarnings("unused")
private static final String TAG = "FilmStripView";
@@ -108,7 +107,6 @@ public class FilmStripView extends GLView implements ScrollBarView.Listener,
addComponent(mAlbumView);
mScrollBarView = new ScrollBarView(activity.getAndroidContext(),
mGripSize, gripWidth);
- mScrollBarView.setListener(this);
addComponent(mScrollBarView);
mAlbumView.setModel(mAlbumDataAdapter);
@@ -239,12 +237,6 @@ public class FilmStripView extends GLView implements ScrollBarView.Listener,
mUIListener.onUserInteraction();
}
- // Called by ScrollBarView
- @Override
- public void onScrollBarPositionChanged(int position) {
- mAlbumView.setScrollPosition(position);
- }
-
public void setFocusIndex(int slotIndex) {
mAlbumView.setFocusIndex(slotIndex);
mAlbumView.makeSlotVisible(slotIndex);
diff --git a/src/com/android/gallery3d/ui/GLCanvas.java b/src/com/android/gallery3d/ui/GLCanvas.java
index 52ce615ae..1359115f8 100644
--- a/src/com/android/gallery3d/ui/GLCanvas.java
+++ b/src/com/android/gallery3d/ui/GLCanvas.java
@@ -37,8 +37,6 @@ public interface GLCanvas {
// Clear the drawing buffers. This should only be used by GLRoot.
public void clearBuffer();
- public void setBlendEnabled(boolean enabled);
-
// Sets and gets the current alpha, alpha must be in [0, 1].
public void setAlpha(float alpha);
public float getAlpha();
@@ -53,12 +51,7 @@ public interface GLCanvas {
public void rotate(float angle, float x, float y, float z);
public void multiplyMatrix(float[] mMatrix, int offset);
- // Modifies the current clip with the specified rectangle.
- // (current clip) = (current clip) intersect (specified rectangle).
- // Returns true if the result clip is non-empty.
- public boolean clipRect(int left, int top, int right, int bottom);
-
- // Pushes the configuration state (matrix, alpha, and clip) onto
+ // Pushes the configuration state (matrix, and alpha) onto
// a private stack.
public void save();
@@ -66,9 +59,8 @@ public interface GLCanvas {
public void save(int saveFlags);
public static final int SAVE_FLAG_ALL = 0xFFFFFFFF;
- public static final int SAVE_FLAG_CLIP = 0x01;
- public static final int SAVE_FLAG_ALPHA = 0x02;
- public static final int SAVE_FLAG_MATRIX = 0x04;
+ public static final int SAVE_FLAG_ALPHA = 0x01;
+ public static final int SAVE_FLAG_MATRIX = 0x02;
// Pops from the top of the stack as current configuration state (matrix,
// alpha, and clip). This call balances a previous call to save(), and is
@@ -93,26 +85,15 @@ public interface GLCanvas {
public void drawMesh(BasicTexture tex, int x, int y, int xyBuffer,
int uvBuffer, int indexBuffer, int indexCount);
- // Draws a texture to the specified rectangle. The "alpha" parameter
- // overrides the current drawing alpha value.
- public void drawTexture(BasicTexture texture,
- int x, int y, int width, int height, float alpha);
-
// Draws a the source rectangle part of the texture to the target rectangle.
public void drawTexture(BasicTexture texture, RectF source, RectF target);
// Draw two textures to the specified rectangle. The actual texture used is
// from * (1 - ratio) + to * ratio
// The two textures must have the same size.
- public void drawMixed(BasicTexture from, BasicTexture to,
- float ratio, int x, int y, int w, int h);
-
public void drawMixed(BasicTexture from, int toColor,
float ratio, int x, int y, int w, int h);
- // Return a texture copied from the specified rectangle.
- public BasicTexture copyTexture(int x, int y, int width, int height);
-
// Gets the underlying GL instance. This is used only when direct access to
// GL is needed.
public GL11 getGLInstance();
@@ -130,4 +111,6 @@ public interface GLCanvas {
// called in the GL thread.
public void deleteRecycledResources();
+ // Dump statistics information and clear the counters. For debug only.
+ public void dumpStatisticsAndClear();
}
diff --git a/src/com/android/gallery3d/ui/GLCanvasImpl.java b/src/com/android/gallery3d/ui/GLCanvasImpl.java
index 8775f0837..1c582853f 100644
--- a/src/com/android/gallery3d/ui/GLCanvasImpl.java
+++ b/src/com/android/gallery3d/ui/GLCanvasImpl.java
@@ -62,7 +62,6 @@ public class GLCanvasImpl implements GLCanvas {
private final GLState mGLState;
private float mAlpha;
- private final Rect mClipRect = new Rect();
private final ArrayList<ConfigState> mRestoreStack =
new ArrayList<ConfigState>();
private ConfigState mRecycledRestoreAction;
@@ -106,7 +105,6 @@ public class GLCanvasImpl implements GLCanvas {
Matrix.translateM(matrix, 0, 0, mHeight, 0);
Matrix.scaleM(matrix, 0, 1, -1, 1);
- mClipRect.set(0, 0, width, height);
gl.glScissor(0, 0, width, height);
}
@@ -115,15 +113,15 @@ public class GLCanvasImpl implements GLCanvas {
mAlpha = alpha;
}
+ public float getAlpha() {
+ return mAlpha;
+ }
+
public void multiplyAlpha(float alpha) {
Utils.assertTrue(alpha >= 0 && alpha <= 1);
mAlpha *= alpha;
}
- public float getAlpha() {
- return mAlpha;
- }
-
private static ByteBuffer allocateDirectNativeOrderBuffer(int size) {
return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());
}
@@ -163,7 +161,6 @@ public class GLCanvasImpl implements GLCanvas {
mGLState.setColorMode(paint.getColor(), mAlpha);
mGLState.setLineWidth(paint.getLineWidth());
- mGLState.setLineSmooth(paint.getAntiAlias());
saveTransform();
translate(x, y);
@@ -181,7 +178,6 @@ public class GLCanvasImpl implements GLCanvas {
mGLState.setColorMode(paint.getColor(), mAlpha);
mGLState.setLineWidth(paint.getLineWidth());
- mGLState.setLineSmooth(paint.getAntiAlias());
saveTransform();
translate(x1, y1);
@@ -314,33 +310,6 @@ public class GLCanvasImpl implements GLCanvas {
return r;
}
- public boolean clipRect(int left, int top, int right, int bottom) {
- float point[] = mapPoints(mMatrixValues, left, top, right, bottom);
-
- // mMatrix could be a rotation matrix. In this case, we need to find
- // the boundaries after rotation. (only handle 90 * n degrees)
- if (point[0] > point[2]) {
- left = (int) point[2];
- right = (int) point[0];
- } else {
- left = (int) point[0];
- right = (int) point[2];
- }
- if (point[1] > point[3]) {
- top = (int) point[3];
- bottom = (int) point[1];
- } else {
- top = (int) point[1];
- bottom = (int) point[3];
- }
- Rect clip = mClipRect;
-
- boolean intersect = clip.intersect(left, top, right, bottom);
- if (!intersect) clip.set(0, 0, 0, 0);
- mGL.glScissor(clip.left, clip.top, clip.width(), clip.height());
- return intersect;
- }
-
private void drawBoundTexture(
BasicTexture texture, int x, int y, int width, int height) {
// Test whether it has been rotated or flipped, if so, glDrawTexiOES
@@ -378,11 +347,7 @@ public class GLCanvasImpl implements GLCanvas {
drawTexture(texture, x, y, width, height, mAlpha);
}
- public void setBlendEnabled(boolean enabled) {
- mBlendEnabled = enabled;
- }
-
- public void drawTexture(BasicTexture texture,
+ private void drawTexture(BasicTexture texture,
int x, int y, int width, int height, float alpha) {
if (width <= 0 || height <= 0) return;
@@ -447,11 +412,6 @@ public class GLCanvasImpl implements GLCanvas {
drawMixed(from, toColor, ratio, x, y, w, h, mAlpha);
}
- public void drawMixed(BasicTexture from, BasicTexture to,
- float ratio, int x, int y, int w, int h) {
- drawMixed(from, to, ratio, x, y, w, h, mAlpha);
- }
-
private boolean bindTexture(BasicTexture texture) {
if (!texture.onBind(this)) return false;
mGLState.setTexture2DEnabled(true);
@@ -532,84 +492,6 @@ public class GLCanvasImpl implements GLCanvas {
mGLState.setTexEnvMode(GL11.GL_REPLACE);
}
- private void drawMixed(BasicTexture from, BasicTexture to,
- float ratio, int x, int y, int width, int height, float alpha) {
-
- if (ratio <= 0) {
- drawTexture(from, x, y, width, height, alpha);
- return;
- } else if (ratio >= 1) {
- drawTexture(to, x, y, width, height, alpha);
- return;
- }
-
- // In the current implementation the two textures must have the
- // same size.
- Utils.assertTrue(from.getWidth() == to.getWidth()
- && from.getHeight() == to.getHeight());
-
- mGLState.setBlendEnabled(mBlendEnabled && (!from.isOpaque()
- || !to.isOpaque() || alpha < OPAQUE_ALPHA));
-
- final GL11 gl = mGL;
- if (!bindTexture(from)) return;
-
- //
- // The formula we want:
- // alpha * ((1 - ratio) * from + ratio * to)
- // The formula that GL supports is in the form of:
- // combo * (modulate * from) + (1 - combo) * to
- //
- // So, we have combo = 1 - alpha * ratio
- // and modulate = alpha * (1f - ratio) / combo
- //
- float comboRatio = 1 - alpha * ratio;
-
- // handle the case that (1 - comboRatio) == 0
- if (alpha < OPAQUE_ALPHA) {
- mGLState.setTextureAlpha(alpha * (1f - ratio) / comboRatio);
- } else {
- mGLState.setTextureAlpha(1f);
- }
-
- gl.glActiveTexture(GL11.GL_TEXTURE1);
- if (!bindTexture(to)) {
- // Disable TEXTURE1.
- gl.glDisable(GL11.GL_TEXTURE_2D);
- // Switch back to the default texture unit.
- gl.glActiveTexture(GL11.GL_TEXTURE0);
- return;
- }
- gl.glEnable(GL11.GL_TEXTURE_2D);
-
- // Interpolate the RGB and alpha values between both textures.
- mGLState.setTexEnvMode(GL11.GL_COMBINE);
- gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_RGB, GL11.GL_INTERPOLATE);
- gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_COMBINE_ALPHA, GL11.GL_INTERPOLATE);
-
- // Specify the interpolation factor via the alpha component of
- // GL_TEXTURE_ENV_COLORs.
- // We don't use the RGB color, so just give them 0s.
- setTextureColor(0, 0, 0, comboRatio);
- gl.glTexEnvfv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, mTextureColor, 0);
-
- // Wire up the interpolation factor for RGB.
- gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_RGB, GL11.GL_CONSTANT);
- gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_RGB, GL11.GL_SRC_ALPHA);
-
- // Wire up the interpolation factor for alpha.
- gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_SRC2_ALPHA, GL11.GL_CONSTANT);
- gl.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_OPERAND2_ALPHA, GL11.GL_SRC_ALPHA);
-
- // Draw the combined texture.
- drawBoundTexture(to, x, y, width, height);
-
- // Disable TEXTURE1.
- gl.glDisable(GL11.GL_TEXTURE_2D);
- // Switch back to the default texture unit.
- gl.glActiveTexture(GL11.GL_TEXTURE0);
- }
-
// TODO: the code only work for 2D should get fixed for 3D or removed
private static final int MSKEW_X = 4;
private static final int MSKEW_Y = 1;
@@ -624,41 +506,6 @@ public class GLCanvasImpl implements GLCanvas {
|| matrix[MSCALE_Y] > eps;
}
- public BasicTexture copyTexture(int x, int y, int width, int height) {
-
- if (isMatrixRotatedOrFlipped(mMatrixValues)) {
- throw new IllegalArgumentException("cannot support rotated matrix");
- }
- float points[] = mapPoints(mMatrixValues, x, y + height, x + width, y);
- x = (int) points[0];
- y = (int) points[1];
- width = (int) points[2] - x;
- height = (int) points[3] - y;
-
- GL11 gl = mGL;
-
- RawTexture texture = RawTexture.newInstance(this);
- gl.glBindTexture(GL11.GL_TEXTURE_2D, texture.getId());
- texture.setSize(width, height);
-
- int[] cropRect = {0, 0, width, height};
- gl.glTexParameteriv(GL11.GL_TEXTURE_2D,
- GL11Ext.GL_TEXTURE_CROP_RECT_OES, cropRect, 0);
- gl.glTexParameteri(GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP_TO_EDGE);
- gl.glTexParameteri(GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP_TO_EDGE);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
- gl.glTexParameterf(GL11.GL_TEXTURE_2D,
- GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
- gl.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0,
- GL11.GL_RGB, x, y, texture.getTextureWidth(),
- texture.getTextureHeight(), 0);
-
- return texture;
- }
-
private static class GLState {
private final GL11 mGL;
@@ -710,16 +557,6 @@ public class GLCanvasImpl implements GLCanvas {
mGL.glLineWidth(width);
}
- public void setLineSmooth(boolean enabled) {
- if (mLineSmooth == enabled) return;
- mLineSmooth = enabled;
- if (enabled) {
- mGL.glEnable(GL11.GL_LINE_SMOOTH);
- } else {
- mGL.glDisable(GL11.GL_LINE_SMOOTH);
- }
- }
-
public void setTextureAlpha(float alpha) {
if (mTextureAlpha == alpha) return;
mTextureAlpha = alpha;
@@ -841,11 +678,6 @@ public class GLCanvasImpl implements GLCanvas {
config.mAlpha = -1;
}
- if ((saveFlags & SAVE_FLAG_CLIP) != 0) {
- config.mRect.set(mClipRect);
- } else {
- config.mRect.left = Integer.MAX_VALUE;
- }
if ((saveFlags & SAVE_FLAG_MATRIX) != 0) {
System.arraycopy(mMatrixValues, 0, config.mMatrix, 0, 16);
@@ -885,12 +717,6 @@ public class GLCanvasImpl implements GLCanvas {
public void restore(GLCanvasImpl canvas) {
if (mAlpha >= 0) canvas.setAlpha(mAlpha);
- if (mRect.left != Integer.MAX_VALUE) {
- Rect rect = mRect;
- canvas.mClipRect.set(rect);
- canvas.mGL.glScissor(
- rect.left, rect.top, rect.width(), rect.height());
- }
if (mMatrix[0] != Float.NEGATIVE_INFINITY) {
System.arraycopy(mMatrix, 0, canvas.mMatrixValues, 0, 16);
}
diff --git a/src/com/android/gallery3d/ui/GLPaint.java b/src/com/android/gallery3d/ui/GLPaint.java
index 9f7b6f1f3..eb75cc51e 100644
--- a/src/com/android/gallery3d/ui/GLPaint.java
+++ b/src/com/android/gallery3d/ui/GLPaint.java
@@ -20,20 +20,9 @@ import com.android.gallery3d.common.Utils;
public class GLPaint {
- public static final int FLAG_ANTI_ALIAS = 0x01;
-
- private int mFlags = 0;
private float mLineWidth = 1f;
private int mColor = 0;
- public int getFlags() {
- return mFlags;
- }
-
- public void setFlags(int flags) {
- mFlags = flags;
- }
-
public void setColor(int color) {
mColor = color;
}
@@ -50,16 +39,4 @@ public class GLPaint {
public float getLineWidth() {
return mLineWidth;
}
-
- public void setAntiAlias(boolean enabled) {
- if (enabled) {
- mFlags |= FLAG_ANTI_ALIAS;
- } else {
- mFlags &= ~FLAG_ANTI_ALIAS;
- }
- }
-
- public boolean getAntiAlias(){
- return (mFlags & FLAG_ANTI_ALIAS) != 0;
- }
}
diff --git a/src/com/android/gallery3d/ui/GLRoot.java b/src/com/android/gallery3d/ui/GLRoot.java
index 24e5794b0..834e85c91 100644
--- a/src/com/android/gallery3d/ui/GLRoot.java
+++ b/src/com/android/gallery3d/ui/GLRoot.java
@@ -28,7 +28,6 @@ public interface GLRoot {
public void registerLaunchedAnimation(CanvasAnimation animation);
public void requestRender();
public void requestLayoutContentPane();
- public boolean hasStencil();
public void lockRenderThread();
public void unlockRenderThread();
diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java
index d11de1229..6429d5a0a 100644
--- a/src/com/android/gallery3d/ui/GLRootView.java
+++ b/src/com/android/gallery3d/ui/GLRootView.java
@@ -67,10 +67,9 @@ public class GLRootView extends GLSurfaceView
private static final int FLAG_NEED_LAYOUT = 2;
private GL11 mGL;
- private GLCanvasImpl mCanvas;
+ private GLCanvas mCanvas;
private GLView mContentView;
- private DisplayMetrics mDisplayMetrics;
private int mFlags = FLAG_NEED_LAYOUT;
private volatile boolean mRenderRequested = false;
@@ -111,15 +110,6 @@ public class GLRootView extends GLSurfaceView
//setDebugFlags(DEBUG_CHECK_GL_ERROR);
}
- public GalleryEGLConfigChooser getEGLConfigChooser() {
- return mEglConfigChooser;
- }
-
- @Override
- public boolean hasStencil() {
- return getEGLConfigChooser().getStencilBits() > 0;
- }
-
@Override
public void registerLaunchedAnimation(CanvasAnimation animation) {
// Register the newly launched animation so that we can set the start
@@ -159,10 +149,6 @@ public class GLRootView extends GLSurfaceView
}
}
- public GLView getContentPane() {
- return mContentView;
- }
-
@Override
public void requestRender() {
if (DEBUG_INVALIDATE) {
@@ -375,19 +361,6 @@ public class GLRootView extends GLSurfaceView
}
}
- public DisplayMetrics getDisplayMetrics() {
- if (mDisplayMetrics == null) {
- mDisplayMetrics = new DisplayMetrics();
- ((Activity) getContext()).getWindowManager()
- .getDefaultDisplay().getMetrics(mDisplayMetrics);
- }
- return mDisplayMetrics;
- }
-
- public GLCanvas getCanvas() {
- return mCanvas;
- }
-
private class IdleRunner implements Runnable {
// true if the idle runner is in the queue
private boolean mActive = false;
diff --git a/src/com/android/gallery3d/ui/GLView.java b/src/com/android/gallery3d/ui/GLView.java
index 7ae980d06..26796b594 100644
--- a/src/com/android/gallery3d/ui/GLView.java
+++ b/src/com/android/gallery3d/ui/GLView.java
@@ -303,14 +303,6 @@ public class GLView {
return mPaddings;
}
- public void setPaddings(Rect paddings) {
- mPaddings.set(paddings);
- }
-
- public void setPaddings(int left, int top, int right, int bottom) {
- mPaddings.set(left, top, right, bottom);
- }
-
public void layout(int left, int top, int right, int bottom) {
boolean sizeChanged = setBounds(left, top, right, bottom);
if (sizeChanged) {
diff --git a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
index 1d50d43f7..0d5643ff9 100644
--- a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
+++ b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java
@@ -30,7 +30,6 @@ import javax.microedition.khronos.egl.EGLDisplay;
class GalleryEGLConfigChooser implements EGLConfigChooser {
private static final String TAG = "GalleryEGLConfigChooser";
- private int mStencilBits;
private final int mConfigSpec[] = new int[] {
EGL10.EGL_RED_SIZE, 5,
@@ -40,10 +39,6 @@ class GalleryEGLConfigChooser implements EGLConfigChooser {
EGL10.EGL_NONE
};
- public int getStencilBits() {
- return mStencilBits;
- }
-
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] numConfig = new int[1];
if (!egl.eglChooseConfig(display, mConfigSpec, null, 0, numConfig)) {
@@ -94,7 +89,6 @@ class GalleryEGLConfigChooser implements EGLConfigChooser {
if (result == null) result = configs[0];
egl.eglGetConfigAttrib(
display, result, EGL10.EGL_STENCIL_SIZE, value);
- mStencilBits = value[0];
logConfig(egl, display, result);
return result;
}
diff --git a/src/com/android/gallery3d/ui/Icon.java b/src/com/android/gallery3d/ui/Icon.java
deleted file mode 100644
index c710859f8..000000000
--- a/src/com/android/gallery3d/ui/Icon.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-import android.content.Context;
-import android.graphics.Rect;
-
-public class Icon extends GLView {
- private final BasicTexture mIcon;
-
- // The width and height requested by the user.
- private int mReqWidth;
- private int mReqHeight;
-
- public Icon(Context context, int iconId, int width, int height) {
- this(context, new ResourceTexture(context, iconId), width, height);
- }
-
- public Icon(Context context, BasicTexture icon, int width, int height) {
- mIcon = icon;
- mReqWidth = width;
- mReqHeight = height;
- }
-
- @Override
- protected void onMeasure(int widthSpec, int heightSpec) {
- MeasureHelper.getInstance(this)
- .setPreferredContentSize(mReqWidth, mReqHeight)
- .measure(widthSpec, heightSpec);
- }
-
- @Override
- protected void render(GLCanvas canvas) {
- Rect p = mPaddings;
-
- int width = getWidth() - p.left - p.right;
- int height = getHeight() - p.top - p.bottom;
-
- // Draw the icon in the center of the space
- int xoffset = p.left + (width - mReqWidth) / 2;
- int yoffset = p.top + (height - mReqHeight) / 2;
-
- mIcon.draw(canvas, xoffset, yoffset, mReqWidth, mReqHeight);
- }
-}
diff --git a/src/com/android/gallery3d/ui/OnSelectedListener.java b/src/com/android/gallery3d/ui/OnSelectedListener.java
deleted file mode 100644
index 2cc5809bf..000000000
--- a/src/com/android/gallery3d/ui/OnSelectedListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-public interface OnSelectedListener {
- public void onSelected(GLView source);
-}
diff --git a/src/com/android/gallery3d/ui/Paper.java b/src/com/android/gallery3d/ui/Paper.java
index ecc415064..830698c4a 100644
--- a/src/com/android/gallery3d/ui/Paper.java
+++ b/src/com/android/gallery3d/ui/Paper.java
@@ -113,7 +113,6 @@ class EdgeAnimation {
private final Interpolator mInterpolator;
private int mState;
- private long mAnimationStartTime;
private float mValue;
private float mValueStart;
diff --git a/src/com/android/gallery3d/ui/RawTexture.java b/src/com/android/gallery3d/ui/RawTexture.java
deleted file mode 100644
index 527880a35..000000000
--- a/src/com/android/gallery3d/ui/RawTexture.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-import javax.microedition.khronos.opengles.GL11;
-
-// RawTexture is used for texture created by glCopyTexImage2D.
-//
-// It will throw RuntimeException in onBind() if used with a different GL
-// context. It is only used internally by copyTexture() in GLCanvas.
-class RawTexture extends BasicTexture {
-
- private RawTexture(GLCanvas canvas, int id) {
- super(canvas, id, STATE_LOADED);
- }
-
- public static RawTexture newInstance(GLCanvas canvas) {
- int[] textureId = new int[1];
- GL11 gl = canvas.getGLInstance();
- gl.glGenTextures(1, textureId, 0);
- return new RawTexture(canvas, textureId[0]);
- }
-
- @Override
- protected boolean onBind(GLCanvas canvas) {
- if (mCanvasRef != canvas) {
- throw new RuntimeException("cannot bind to different canvas");
- }
- return true;
- }
-
- public boolean isOpaque() {
- return true;
- }
-
- @Override
- public void yield() {
- // we cannot free the texture because we have no backup.
- }
-}
diff --git a/src/com/android/gallery3d/ui/ScrollBarView.java b/src/com/android/gallery3d/ui/ScrollBarView.java
index b33f03b07..c4266b6cf 100644
--- a/src/com/android/gallery3d/ui/ScrollBarView.java
+++ b/src/com/android/gallery3d/ui/ScrollBarView.java
@@ -26,10 +26,6 @@ public class ScrollBarView extends GLView {
@SuppressWarnings("unused")
private static final String TAG = "ScrollBarView";
- public interface Listener {
- void onScrollBarPositionChanged(int position);
- }
-
private int mBarHeight;
private int mGripHeight;
@@ -40,7 +36,6 @@ public class ScrollBarView extends GLView {
private int mContentPosition;
private int mContentTotal;
- private Listener mListener;
private NinePatchTexture mScrollBarTexture;
public ScrollBarView(Context context, int gripHeight, int gripWidth) {
@@ -55,10 +50,6 @@ public class ScrollBarView extends GLView {
mGripHeight = gripHeight;
}
- public void setListener(Listener listener) {
- mListener = listener;
- }
-
@Override
protected void onLayout(
boolean changed, int left, int top, int right, int bottom) {
@@ -94,13 +85,6 @@ public class ScrollBarView extends GLView {
mGripPosition = Math.round(r * mContentPosition);
}
- private void notifyContentPositionFromGrip() {
- if (mContentTotal <= 0) return;
- float r = (getWidth() - mGripWidth) / (float) mContentTotal;
- int newContentPosition = Math.round(mGripPosition / r);
- mListener.onScrollBarPositionChanged(newContentPosition);
- }
-
@Override
protected void render(GLCanvas canvas) {
super.render(canvas);
@@ -109,31 +93,4 @@ public class ScrollBarView extends GLView {
int y = (mBarHeight - mGripHeight) / 2;
mScrollBarTexture.draw(canvas, mGripPosition, y, mGripWidth, mGripHeight);
}
-
- // The onTouch() handler is disabled because now we don't want the user
- // to drag the bar (it's an indicator only).
- /*
- @Override
- protected boolean onTouch(MotionEvent event) {
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN: {
- int x = (int) event.getX();
- return (x >= mGripPosition && x < mGripPosition + mGripWidth);
- }
- case MotionEvent.ACTION_MOVE: {
- // Adjust x by mGripWidth / 2 so the center of the grip
- // matches the touch position.
- int x = (int) event.getX() - mGripWidth / 2;
- x = Utils.clamp(x, 0, getWidth() - mGripWidth);
- if (mGripPosition != x) {
- mGripPosition = x;
- notifyContentPositionFromGrip();
- invalidate();
- }
- break;
- }
- }
- return true;
- }
- */
}
diff --git a/src/com/android/gallery3d/ui/SelectionManager.java b/src/com/android/gallery3d/ui/SelectionManager.java
index 2726e8add..f695372fd 100644
--- a/src/com/android/gallery3d/ui/SelectionManager.java
+++ b/src/com/android/gallery3d/ui/SelectionManager.java
@@ -216,8 +216,4 @@ public class SelectionManager {
mSourceMediaSet = set;
mTotal = -1;
}
-
- public MediaSet getSourceMediaSet() {
- return mSourceMediaSet;
- }
}
diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java
index 9a0d5abec..863e66869 100644
--- a/src/com/android/gallery3d/ui/SlotView.java
+++ b/src/com/android/gallery3d/ui/SlotView.java
@@ -143,11 +143,6 @@ public class SlotView extends GLView {
}
@Override
- public boolean removeComponent(GLView view) {
- throw new UnsupportedOperationException();
- }
-
- @Override
protected void onLayout(boolean changeSize, int l, int t, int r, int b) {
if (!changeSize) return;
@@ -415,21 +410,6 @@ public class SlotView extends GLView {
public int rowsLand = -1;
public int rowsPort = -1;
public int slotGap = -1;
-
- static Spec newWithSize(int width, int height) {
- Spec s = new Spec();
- s.slotWidth = width;
- s.slotHeight = height;
- return s;
- }
-
- static Spec newWithRows(int rowsLand, int rowsPort, int slotGap) {
- Spec s = new Spec();
- s.rowsLand = rowsLand;
- s.rowsPort = rowsPort;
- s.slotGap = slotGap;
- return s;
- }
}
public static class Layout {
@@ -489,10 +469,6 @@ public class SlotView extends GLView {
return mSlotHeight;
}
- public int getContentLength() {
- return mContentLength;
- }
-
// Calculate
// (1) mUnitCount: the number of slots we can fit into one column (or row).
// (2) mContentLength: the width (or height) we need to display all the
diff --git a/src/com/android/gallery3d/ui/StaticBackground.java b/src/com/android/gallery3d/ui/StaticBackground.java
deleted file mode 100644
index e7fd003f2..000000000
--- a/src/com/android/gallery3d/ui/StaticBackground.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.ui;
-
-import android.content.Context;
-
-public class StaticBackground extends GLView {
-
- private Context mContext;
- private int mLandscapeResource;
- private int mPortraitResource;
-
- private BasicTexture mBackground;
- private boolean mIsLandscape = false;
-
- public StaticBackground(Context context) {
- mContext = context;
- }
-
- @Override
- protected void onLayout(boolean changeSize, int l, int t, int r, int b) {
- setOrientation(getWidth() >= getHeight());
- }
-
- private void setOrientation(boolean isLandscape) {
- if (mIsLandscape == isLandscape) return;
- mIsLandscape = isLandscape;
- if (mBackground != null) mBackground.recycle();
- mBackground = new ResourceTexture(
- mContext, mIsLandscape ? mLandscapeResource : mPortraitResource);
- invalidate();
- }
-
- public void setImage(int landscapeId, int portraitId) {
- mLandscapeResource = landscapeId;
- mPortraitResource = portraitId;
- if (mBackground != null) mBackground.recycle();
- mBackground = new ResourceTexture(
- mContext, mIsLandscape ? landscapeId : portraitId);
- invalidate();
- }
-
- @Override
- protected void render(GLCanvas canvas) {
- mBackground.draw(canvas, 0, 0, getWidth(), getHeight());
- }
-}
diff --git a/src/com/android/gallery3d/ui/Texture.java b/src/com/android/gallery3d/ui/Texture.java
index 4d1749bb6..2c426f994 100644
--- a/src/com/android/gallery3d/ui/Texture.java
+++ b/src/com/android/gallery3d/ui/Texture.java
@@ -26,14 +26,12 @@ package com.android.gallery3d.ui;
// -- ColorTexture
// -- FadeInTexture
// -- BasicTexture
-// -- RawTexture
// -- UploadedTexture
// -- BitmapTexture
// -- Tile
// -- ResourceTexture
// -- NinePatchTexture
// -- CanvasTexture
-// -- DrawableTexture
// -- StringTexture
//
public interface Texture {