Initial checkin of RIM client from LifeMarks, after initial refactorings and style...
[zxing.git] / rim / src / com / google / zxing / client / rim / AboutScreen.java
diff --git a/rim/src/com/google/zxing/client/rim/AboutScreen.java b/rim/src/com/google/zxing/client/rim/AboutScreen.java
new file mode 100644 (file)
index 0000000..66d4135
--- /dev/null
@@ -0,0 +1,67 @@
+/*\r
+ * Copyright 2008 ZXing authors\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.google.zxing.client.rim;\r
+\r
+import net.rim.device.api.ui.Field;\r
+import net.rim.device.api.ui.FieldChangeListener;\r
+import net.rim.device.api.ui.Manager;\r
+import net.rim.device.api.ui.Screen;\r
+import net.rim.device.api.ui.Ui;\r
+import net.rim.device.api.ui.UiEngine;\r
+import net.rim.device.api.ui.DrawStyle;\r
+import net.rim.device.api.ui.component.ButtonField;\r
+import net.rim.device.api.ui.component.LabelField;\r
+import net.rim.device.api.ui.container.MainScreen;\r
+import net.rim.device.api.ui.container.VerticalFieldManager;\r
+\r
+/**\r
+ * The screen used to display the application 'about' information.\r
+ *\r
+ * This code was contributed by LifeMarks.\r
+ *\r
+ * @author Matt York (matt@lifemarks.mobi)\r
+ */\r
+final class AboutScreen extends MainScreen {\r
+\r
+  AboutScreen() {\r
+    setTitle(new LabelField("ZXing - About", DrawStyle.ELLIPSIS | USE_ALL_WIDTH));\r
+    Manager vfm = new VerticalFieldManager(FIELD_HCENTER);\r
+    Field title = new LabelField("ZXing - BlackBerry Client", FIELD_HCENTER);\r
+    Field uri = new LabelField("http://code.google.com/p/zxing/", FIELD_HCENTER);\r
+    vfm.add(title);\r
+    vfm.add(uri);\r
+    Field okButton = new ButtonField("OK", FIELD_HCENTER | ButtonField.CONSUME_CLICK);\r
+    okButton.setChangeListener(new ButtonListener(this));\r
+    vfm.add(okButton);\r
+    add(vfm);\r
+  }\r
+\r
+  /**\r
+   * Used to close the screen when the ok button is pressed.\r
+   */\r
+  private static class ButtonListener implements FieldChangeListener {\r
+    private final Screen screen;\r
+    private ButtonListener(Screen screen) {\r
+      this.screen = screen;\r
+    }\r
+    public void fieldChanged(Field field, int context) {\r
+      UiEngine ui = Ui.getUiEngine();\r
+      ui.popScreen(screen);\r
+    }\r
+  }\r
+\r
+}\r