PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/ocr/ocrservice/src/com/googlecode/eyesfree/ocr/client/Intents.java

http://eyes-free.googlecode.com/
Java | 158 lines | 48 code | 23 blank | 87 comment | 0 complexity | dc71e1ac3bfb52fc4d3437a2e74ecb1d MD5 | raw file
  1/*
  2 * Copyright (C) 2011 Google Inc.
  3 *
  4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5 * use this file except in compliance with the License. You may obtain a copy of
  6 * the License at
  7 *
  8 * http://www.apache.org/licenses/LICENSE-2.0
  9 *
 10 * Unless required by applicable law or agreed to in writing, software
 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 13 * License for the specific language governing permissions and limitations under
 14 * the License.
 15 */
 16
 17package com.googlecode.eyesfree.ocr.client;
 18
 19import android.content.Intent;
 20
 21/**
 22 * This class enumerates the Intents made available to application developers
 23 * through the OCR Service.
 24 *
 25 * @author alanv@google.com (Alan Viverette)
 26 */
 27public final class Intents {
 28    private Intents() {
 29        // This class is not instantiable.
 30    }
 31
 32    public static final class Actions {
 33        /**
 34         * This action is broadcast when the list of installed languages has
 35         * been updated.
 36         */
 37        public static final String LANGUAGES_UPDATED =
 38                "com.googlecode.eyesfree.ocr.action.LANGUAGES_UPDATED";
 39
 40        private Actions() {
 41            // This class is not instantiable.
 42        }
 43    }
 44
 45    public static final class Service {
 46        /**
 47         * Use this to bind to the OCR service. Typically this will only be used
 48         * by the Ocr object.
 49         */
 50        public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.SERVICE";
 51        public static final String CATEGORY = Intent.CATEGORY_DEFAULT;
 52
 53        private Service() {
 54            // This class is not instantiable.
 55        }
 56    }
 57
 58    public static final class Languages {
 59        /**
 60         * Use this to bind to the OCR service. Typically this will only be used
 61         * by the Ocr object.
 62         */
 63        public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.LANGUAGES";
 64
 65        private Languages() {
 66            // This class is not instantiable.
 67        }
 68    }
 69
 70    protected static class BaseCapture {
 71        /**
 72         * The desired picture width as an integer. Use Intent.putExtra(WIDTH,
 73         * width) where width is the desired picture width. If set, you must
 74         * also set the picture height.
 75         */
 76        public static final String EXTRA_WIDTH = "width";
 77
 78        /**
 79         * The desired picture height as an integer. Use Intent.putExtra(HEIGHT,
 80         * height) where height is the desired picture height. If set, you must
 81         * also set the picture width.
 82         */
 83        public static final String EXTRA_HEIGHT = "height";
 84
 85        /**
 86         * Whether the camera light should be used when previewing and taking a
 87         * picture. Use Intent.putExtra(FLASHLIGHT, flashlight) where flashlight
 88         * is a boolean value.
 89         */
 90        public static final String EXTRA_FLASHLIGHT = "flashlight";
 91
 92        /**
 93         * Whether the camera flash should be used when taking a picture. Use
 94         * Intent.putExtra(FLASH_MODE, flashMode) where flashMode is a constant
 95         * from Camera.Parameters.FLASH_
 96         */
 97        public static final String EXTRA_FLASH_MODE = "flash_mode";
 98
 99        /**
100         * The name of the Intent-extra used to indicate a content resolver Uri
101         * to be used to store the requested image.
102         */
103        public static final String EXTRA_OUTPUT = "output";
104    }
105
106    public static final class Detect extends BaseCapture {
107        /**
108         * Send this intent to open the continuous text detection screen.
109         */
110        public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.DETECT";
111
112        /**
113         * The name of the Intent-extra used to return the list of text area
114         * boundaries detected in the requested image.
115         */
116        public static final String EXTRA_OUTPUT_BOUNDS = "output_bounds";
117
118        private Detect() {
119            // This class is not instantiable.
120        }
121    }
122
123    protected static class BaseRecognize {
124        /**
125         * The name of the Intent-extra used to indicate an absolute file system
126         * path from which to read the image to be recognized.
127         */
128        public static final String EXTRA_INPUT = "input";
129
130        /**
131         * The name of the Intent-extra used to indicate the recognition
132         * parameters to be used for recognition.
133         */
134        public static final String EXTRA_PARAMETERS = "parameters";
135
136        /**
137         * The name of the Intent-extra used to indicate the results of
138         * recognition as an ArrayList of Result objects.
139         */
140        public static final String EXTRA_RESULTS = "results";
141
142        private BaseRecognize() {
143            // This class is not instantiable.
144        }
145    }
146
147    public static final class Recognize extends BaseRecognize {
148        /**
149         * Send this intent to process an OCR configuration object and receive
150         * OCR results in return.
151         */
152        public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.RECOGNIZE";
153
154        private Recognize() {
155            // This class is not instantiable.
156        }
157    }
158}