VirtualDevice.java :  » UnTagged » meteoroid » org » meteoroid » plugin » Android Open Source

Android Open Source » UnTagged » meteoroid 
meteoroid » org » meteoroid » plugin » VirtualDevice.java
package org.meteoroid.plugin;

import java.io.IOException;
import java.util.Properties;

import android.graphics.Canvas;
import android.graphics.Rect;
import android.hardware.SensorEventListener;
import android.view.KeyEvent;
import android.view.MotionEvent;

/**
 * A virtual device is the interaction and visual part besides the
 * hosting Java ME application.
 * 
 * @author highkay
 */
public interface VirtualDevice {
  
  /**
   * See detail in VirtualDeviceManager.loadVirtualDevice(Activity
   * activity).
   * 
   * @param properties
   * @throws IOException
   */
  public void onCreate(Properties properties) throws IOException;
  
  /**
   * Scale the hosting Java ME application into a certain resolution.
   * 
   * @param width
   * @param height
   */
  public void scaleScreen(int width, int height);
  
  /**
   * Call back when the virtual device if destroyed.
   */
  public void onDestroy();
  
  /**
   * @return the orientation of the device
   */
  public int getDeviceOrientation();
  
  /**
   * @return the true width of the android device.
   */
  public int getFullWidth();
  
  /**
   * @return the true height of the android device.
   */
  public int getFullHeight();
  
  /**
   * Turn on some feature comes with the virtual device.
   * 
   * @param FeatureID
   */
  public void turnOnFeature(int FeatureID);
  
  /**
   * Turn of some feature comes with the virtual device.
   * 
   * @param FeatureID
   */
  public void turnOffFeature(int FeatureID);
  
  /**
   * Get the state of some feature comes with the virtual device.
   * 
   * @param FeatureID
   */
  public boolean isFeatureOn(int FeatureID);
  
  /**
   * Some virtual device features name list.
   * 
   * @author highkay
   */
  public interface VirtualDeviceFeatureList {
    public static final int AUDIO = 0xfffffff0;
    public static final int ACCELEROMETERS = 0xfffffff1;
    public static final int VIRTUALKEYBOARD = 0xfffffff2;
    public static final int SMOOTHSCALE = 0xfffffff3;
  }
  
  /**
   * The key event listener worked with virtual device. Recommend to
   * replace the android standard ones.
   * 
   * @author highkay
   */
  public interface KeyEventListener {
    public boolean onKey(KeyEvent event);
  }
  
  /**
   * The motion event listener worked with virtual device. Recommend
   * to replace the android standard ones.
   * 
   * @author highkay
   */
  public interface MotionEventListener {
    public boolean onTouch(MotionEvent event);
  }
  
  /**
   * The trackball event listener worked with virtual device.
   * 
   * @author highkay
   */
  public interface TrackballEventListener {
    public boolean onTrackballEvent(MotionEvent event);
  }
  
  /**
   * The sensor event listener worked with virtual device. Recommend
   * to replace the android standard ones.
   * 
   * @author highkay
   */
  public interface SensorChangeEventListener extends SensorEventListener {
    public void init();
  }
  
  /**
   * The simple gesture worked with virtual device. Recommend to
   * replace the android standard ones.
   * 
   * @author highkay
   */
  public interface SimpleGestureEventListener {
    public static final int GESTURE_SLIDE_UP = 1;
    public static final int GESTURE_SLIDE_DOWN = 2;
    public static final int GESTURE_SLIDE_LEFT = 3;
    public static final int GESTURE_SLIDE_RIGHT = 4;
    
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);
  }
  
  /**
   * The drawable layer worked with virtual device.
   * 
   * @author highkay
   */
  public interface Layer {
    public void onDraw(Canvas canvas, Rect rect);
  }
  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.