/TalkBack/src/com/google/android/marvin/talkback/speechrules/NodeSpeechRule.java

http://eyes-free.googlecode.com/ · Java · 45 lines · 9 code · 4 blank · 32 comment · 0 complexity · 659955db07ecf55ac8090cd8b1640774 MD5 · raw file

  1. /*
  2. * Copyright (C) 2011 The Android Open Source Project
  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.google.android.marvin.talkback.speechrules;
  17. import android.content.Context;
  18. import android.view.accessibility.AccessibilityEvent;
  19. import android.view.accessibility.AccessibilityNodeInfo;
  20. interface NodeSpeechRule {
  21. /**
  22. * Determines whether this rule should process the specified node.
  23. * @param node The node to filter.
  24. *
  25. * @return {@code true} if this rule should process the node.
  26. */
  27. public boolean accept(AccessibilityNodeInfo node);
  28. /**
  29. * Processes the specified node and returns text to speak, or {@code null}
  30. * if the node should not be spoken.
  31. *
  32. * @param context The parent context.
  33. * @param node The node to process.
  34. * @param event The source event, may be {@code null} when called with
  35. * non-source nodes.
  36. * @return A spoken description, or {@code null} if the node should not be
  37. * spoken.
  38. */
  39. public CharSequence
  40. format(Context context, AccessibilityNodeInfo node, AccessibilityEvent event);
  41. }