/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. package com.googlecode.eyesfree.ocr.client;
  17. import android.content.Intent;
  18. /**
  19. * This class enumerates the Intents made available to application developers
  20. * through the OCR Service.
  21. *
  22. * @author alanv@google.com (Alan Viverette)
  23. */
  24. public final class Intents {
  25. private Intents() {
  26. // This class is not instantiable.
  27. }
  28. public static final class Actions {
  29. /**
  30. * This action is broadcast when the list of installed languages has
  31. * been updated.
  32. */
  33. public static final String LANGUAGES_UPDATED =
  34. "com.googlecode.eyesfree.ocr.action.LANGUAGES_UPDATED";
  35. private Actions() {
  36. // This class is not instantiable.
  37. }
  38. }
  39. public static final class Service {
  40. /**
  41. * Use this to bind to the OCR service. Typically this will only be used
  42. * by the Ocr object.
  43. */
  44. public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.SERVICE";
  45. public static final String CATEGORY = Intent.CATEGORY_DEFAULT;
  46. private Service() {
  47. // This class is not instantiable.
  48. }
  49. }
  50. public static final class Languages {
  51. /**
  52. * Use this to bind to the OCR service. Typically this will only be used
  53. * by the Ocr object.
  54. */
  55. public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.LANGUAGES";
  56. private Languages() {
  57. // This class is not instantiable.
  58. }
  59. }
  60. protected static class BaseCapture {
  61. /**
  62. * The desired picture width as an integer. Use Intent.putExtra(WIDTH,
  63. * width) where width is the desired picture width. If set, you must
  64. * also set the picture height.
  65. */
  66. public static final String EXTRA_WIDTH = "width";
  67. /**
  68. * The desired picture height as an integer. Use Intent.putExtra(HEIGHT,
  69. * height) where height is the desired picture height. If set, you must
  70. * also set the picture width.
  71. */
  72. public static final String EXTRA_HEIGHT = "height";
  73. /**
  74. * Whether the camera light should be used when previewing and taking a
  75. * picture. Use Intent.putExtra(FLASHLIGHT, flashlight) where flashlight
  76. * is a boolean value.
  77. */
  78. public static final String EXTRA_FLASHLIGHT = "flashlight";
  79. /**
  80. * Whether the camera flash should be used when taking a picture. Use
  81. * Intent.putExtra(FLASH_MODE, flashMode) where flashMode is a constant
  82. * from Camera.Parameters.FLASH_
  83. */
  84. public static final String EXTRA_FLASH_MODE = "flash_mode";
  85. /**
  86. * The name of the Intent-extra used to indicate a content resolver Uri
  87. * to be used to store the requested image.
  88. */
  89. public static final String EXTRA_OUTPUT = "output";
  90. }
  91. public static final class Detect extends BaseCapture {
  92. /**
  93. * Send this intent to open the continuous text detection screen.
  94. */
  95. public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.DETECT";
  96. /**
  97. * The name of the Intent-extra used to return the list of text area
  98. * boundaries detected in the requested image.
  99. */
  100. public static final String EXTRA_OUTPUT_BOUNDS = "output_bounds";
  101. private Detect() {
  102. // This class is not instantiable.
  103. }
  104. }
  105. protected static class BaseRecognize {
  106. /**
  107. * The name of the Intent-extra used to indicate an absolute file system
  108. * path from which to read the image to be recognized.
  109. */
  110. public static final String EXTRA_INPUT = "input";
  111. /**
  112. * The name of the Intent-extra used to indicate the recognition
  113. * parameters to be used for recognition.
  114. */
  115. public static final String EXTRA_PARAMETERS = "parameters";
  116. /**
  117. * The name of the Intent-extra used to indicate the results of
  118. * recognition as an ArrayList of Result objects.
  119. */
  120. public static final String EXTRA_RESULTS = "results";
  121. private BaseRecognize() {
  122. // This class is not instantiable.
  123. }
  124. }
  125. public static final class Recognize extends BaseRecognize {
  126. /**
  127. * Send this intent to process an OCR configuration object and receive
  128. * OCR results in return.
  129. */
  130. public static final String ACTION = "com.googlecode.eyesfree.ocr.intent.RECOGNIZE";
  131. private Recognize() {
  132. // This class is not instantiable.
  133. }
  134. }
  135. }