summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/GLZoomIndicator.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-01-28 16:10:19 -0800
committerOwen Lin <owenlin@google.com>2010-02-26 20:26:48 +0800
commit4de149ceb47f2c251f646419907424bfb67d2b64 (patch)
tree6f48682fe065902039bad89d1f3ca90720eca819 /src/com/android/camera/ui/GLZoomIndicator.java
parent02627adfa3d240d817e34af69be8d07e9c66c136 (diff)
downloadLegacyCamera-4de149ceb47f2c251f646419907424bfb67d2b64.zip
LegacyCamera-4de149ceb47f2c251f646419907424bfb67d2b64.tar.gz
LegacyCamera-4de149ceb47f2c251f646419907424bfb67d2b64.tar.bz2
The first runnable version of the new UI.
Implement the new UI with OpenGL (GLSurfaceView). Known issues: * Texture are never freed from GL * Do not consider the density of screen. Currently, the dimensions in mdpi devices are wrong. * It won't work on Sapphire, bug fired: Bug: 2473605 * The action UP event may pass a wrong target. (It should pass to the same target who recive the DOWN action. * Animation is not smooth enough. * Should not allocate objects into heap during rendering path. * The scrollbar in GLListView doesn't match the design * We should calculate our own orientation instead of using the system one. * Regression: "restore to default settings" is removed Change-Id: I93fa45831aa87787dd5ee9e43e270a9d786c5a2a
Diffstat (limited to 'src/com/android/camera/ui/GLZoomIndicator.java')
-rw-r--r--src/com/android/camera/ui/GLZoomIndicator.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/GLZoomIndicator.java b/src/com/android/camera/ui/GLZoomIndicator.java
new file mode 100644
index 0000000..c6612bf
--- /dev/null
+++ b/src/com/android/camera/ui/GLZoomIndicator.java
@@ -0,0 +1,34 @@
+package com.android.camera.ui;
+
+import android.graphics.Color;
+import android.graphics.Rect;
+
+import javax.microedition.khronos.opengles.GL11;
+
+public class GLZoomIndicator extends GLView {
+
+ private final StringTexture mTitle;
+
+ public GLZoomIndicator(String title) {
+ mTitle = StringTexture.newInstance(title, 24, Color.WHITE);
+ }
+
+ @Override
+ protected void onMeasure(int widthSpec, int heightSpec) {
+ new MeasureHelper(this)
+ .setPreferedContentSize(mTitle.getWidth(), mTitle.getHeight())
+ .measure(widthSpec, heightSpec);
+ }
+
+ @Override
+ protected void render(GLRootView root, GL11 gl) {
+ if (mTitle.bind(root, gl)) {
+ Rect p = mPaddings;
+ int width = getWidth() - p.left - p.right;
+ int height = getHeight() - p.top - p.bottom;
+ mTitle.draw(root,
+ p.left + (width - mTitle.getWidth()) / 2,
+ p.top + (height - mTitle.getHeight()) / 2);
+ }
+ }
+}