Android Open Source - security-cam Action






From Project

Back to project page security-cam.

License

The source code is released under:

MIT License

If you think the Android project security-cam listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package berlin.reiche.securitas.activities;
/*from  w  w w .  j  av  a2s .c o  m*/
import android.os.Message;
import android.util.SparseArray;

/**
 * Actions that are processed by the activities to update the interface. Each
 * action is associated with a numerical code in order to be compatible with the
 * methods provided by the {@link Message} class.
 * 
 * @author Konrad Reiche
 * 
 */
public enum Action {

  /**
   * Locks the interface in order to prevent further user input.
   */
  LOCK_INTERFACE(1),

  /**
   * Unlocks the interface in order to allow user input again.
   */
  UNLOCK_INTERFACE(2),

  /**
   * Turns the interface state to detection mode.
   */
  SET_DETECTION_MODE(3),

  /**
   * Turns the interface state to idle mode.
   */
  SET_IDLE_MODE(4),

  /**
   * Sets the registration state.
   */
  SET_REGISTERED_ON_SERVER(5),

  /**
   * Creates a notification dialog to inform about a problem.
   */
  REPORT_ERROR(6),

  /**
   * Updates the snapshot image.
   */
  SET_SNAPSHOT(7),

  /**
   * Requests the interface to retrieve the GCM identifier and issue a device
   * registration with the server.
   */
  ISSUE_DEVICE_REGISTRATION(8);

  /**
   * The code is used to translate the mnemonic enumeration constants into an
   * integer which is used by the Android API.
   */
  public final int code;

  /**
   * Default constructor.
   * 
   * @param code
   *            The code is used to translate the mnemonic enumeration
   *            constants into an integer which is used by the Android API.
   */
  Action(int code) {
    this.code = code;
  }

  /**
   * Stores the different code integer values and maps them to their respect
   * {@link Action} enumeration constant. A sparse array is used, which maps
   * integers to objects and is more efficient in the implementation.
   */
  private static final SparseArray<Action> codes;

  static {
    Action[] values = Action.values();
    codes = new SparseArray<Action>(values.length);
    for (Action value : values) {
      codes.put(value.code, value);
    }
  }

  /**
   * @param what
   *            the message code.
   * @return the equivalent enumeration constant.
   */
  public static Action valueOf(int what) {
    Action value = codes.get(what);
    if (value != null) {
      return codes.get(what);
    }
    throw new IllegalArgumentException();
  }

}




Java Source Code List

berlin.reiche.securitas.Client.java
berlin.reiche.securitas.Settings.java
berlin.reiche.securitas.activities.Action.java
berlin.reiche.securitas.activities.LauncherActivity.java
berlin.reiche.securitas.activities.MainActivity.java
berlin.reiche.securitas.activities.SettingsActivity.java
berlin.reiche.securitas.activities.package-info.java
berlin.reiche.securitas.controller.ClientController.java
berlin.reiche.securitas.controller.Controller.java
berlin.reiche.securitas.controller.GCMIntentService.java
berlin.reiche.securitas.controller.GCMReceiver.java
berlin.reiche.securitas.controller.InboxHandler.java
berlin.reiche.securitas.controller.states.ControllerState.java
berlin.reiche.securitas.controller.states.DetectionState.java
berlin.reiche.securitas.controller.states.IdleState.java
berlin.reiche.securitas.controller.states.package-info.java
berlin.reiche.securitas.controller.tasks.BitmapDownloadTask.java
berlin.reiche.securitas.controller.tasks.DetectionRequest.java
berlin.reiche.securitas.controller.tasks.DeviceRegistration.java
berlin.reiche.securitas.controller.tasks.StatusTask.java
berlin.reiche.securitas.controller.tasks.package-info.java
berlin.reiche.securitas.controller.package-info.java
berlin.reiche.securitas.model.ClientModel.java
berlin.reiche.securitas.model.Model.java
berlin.reiche.securitas.model.Protocol.java
berlin.reiche.securitas.model.package-info.java
berlin.reiche.securitas.util.FlushedInputStream.java
berlin.reiche.securitas.util.HttpUtilities.java
berlin.reiche.securitas.util.NotificationDialog.java
berlin.reiche.securitas.util.package-info.java
berlin.reiche.securitas.package-info.java