コード例 #1
0
  public void process(Activity activity) {
    final TouchScreenFactory touchScreenFactory = TouchScreenFactory.getInstance();

    touchScreenFactory.setTouch(this.isTouch(activity));

    touchScreenFactory.setMultiTouch(this.isMultiTouch(activity));

    touchScreenFactory.setMultiTouchDistinct(this.isMultiTouchDistinct(activity));

    Configuration configuration = activity.getResources().getConfiguration();

    int touchScreen = configuration.touchscreen;

    if (touchScreen == Configuration.TOUCHSCREEN_FINGER) {
      touchScreenFactory.setTouchScreenType(TouchScreenTypeFactory.getInstance().FINGER);

      if (!touchScreenFactory.isTouch()) {
        // LogUtil.put(LogFactory.getInstance("Not Really Exception: This indicates that a touch
        // screen does exist but is not API8 so we will try it", this,
        // CommonStrings.getInstance().PROCESS));
        PreLogUtil.put(
            "Not Really Exception: This indicates that a touch screen does exist but is not API8 so we will try it",
            this,
            CommonStrings.getInstance().PROCESS);

        touchScreenFactory.setTouch(true);
      }
    } else if (touchScreen == Configuration.TOUCHSCREEN_STYLUS) {
      touchScreenFactory.setTouchScreenType(TouchScreenTypeFactory.getInstance().STYLUS);

      if (!touchScreenFactory.isTouch()) {
        // LogUtil.put(LogFactory.getInstance("Not Really Exception: This indicates that a touch
        // screen does exist but is not API8 so we will try it", this,
        // CommonStrings.getInstance().PROCESS));

        PreLogUtil.put(
            "Not Really Exception: This indicates that a touch screen does exist but is not API8 so we will try it",
            this,
            CommonStrings.getInstance().PROCESS);

        touchScreenFactory.setTouch(true);
      }
    } else if (touchScreen == Configuration.TOUCHSCREEN_NOTOUCH) {
      touchScreenFactory.setTouchScreenType(TouchScreenTypeFactory.getInstance().NOTOUCH);
    } else if (touchScreen == Configuration.TOUCHSCREEN_UNDEFINED) {
      touchScreenFactory.setTouchScreenType(TouchScreenTypeFactory.getInstance().UNDEFINED);
    }

    // LogUtil.put(LogFactory.getInstance(touchScreenFactory.toString(), this,
    // CommonStrings.getInstance().PROCESS));
    PreLogUtil.put(touchScreenFactory.toString(), this, CommonStrings.getInstance().PROCESS);
  }
コード例 #2
0
ファイル: Globals.java プロジェクト: Chiur/AllBinary-Platform
  public static void init(ClassLoader classLoader, String pathString)
        // throws Exception
      {
    AppUrlGlobals appUrlGlobals = new AppUrlGlobals();
    appUrlGlobals.setWebappPath(pathString);
    abcs.globals.URLGLOBALS.init(appUrlGlobals);

    WebappClassLoaderInfo.setLoader(classLoader);

    StringMaker stringBuffer = new StringMaker();

    stringBuffer.append("Setting Up AllBinary System Configuration Args: ");
    stringBuffer.append(pathString);
    stringBuffer.append(" ClassLoader: ");
    stringBuffer.append(classLoader.getClass().getName());

    LogUtil.put(
        LogFactory.getInstance(
            stringBuffer.toString(), instance, CommonStrings.getInstance().INIT));

    final StringValidationUtil stringValidationUtil = StringValidationUtil.getInstance();

    if (stringValidationUtil.isEmpty(pathString)) {

      stringBuffer.delete(0, stringBuffer.length());

      stringBuffer.append("No Path Provided. Using Process Path: ");
      stringBuffer.append(pathString);
      stringBuffer.append(CommonSeps.getInstance().SPACE);
      stringBuffer.append(CommonSeps.getInstance().EQUALS);
      stringBuffer.append(CommonSeps.getInstance().SPACE);
      stringBuffer.append(abcs.globals.URLGLOBALS.getWebappPath());

      // pathString = WebappPathCmdLineFile.getPath("./");
      LogUtil.put(
          LogFactory.getInstance(
              stringBuffer.toString(), instance, CommonStrings.getInstance().INIT));
    }

    stringBuffer.delete(0, stringBuffer.length());

    stringBuffer.append("Webapp Path Set To: ");
    stringBuffer.append(abcs.globals.URLGLOBALS.getWebappPath());

    LogUtil.put(
        LogFactory.getInstance(
            stringBuffer.toString(), instance, CommonStrings.getInstance().INIT));
  }
コード例 #3
0
    public void run() {

      threadStarted();

      while (true)
      // while (!isInterrupted())
      {

        Runnable task = null;
        try {
          task = getTask();
          runningTask = true;

          startTask(task);

        } catch (InterruptedException ex) {
          LogUtil.put(
              LogFactory.getInstance(INTERRUPT_EXCEPTION, this, CommonStrings.getInstance().RUN));
          break;
        }

        if (task == null) {
          break;
        }
        /*
        else
        {
        PreLogUtil.put("Running: " + task, this, CommonStrings.getInstance().RUN);
        }
         */

        try {
          task.run();
          completedTask(task);
          runningTask = false;
        } catch (Exception e) {
          LogUtil.put(
              LogFactory.getInstance(
                  CommonStrings.getInstance().EXCEPTION_LABEL + task,
                  this,
                  CommonStrings.getInstance().RUN,
                  e));
        }
      }

      threadStopped();
    }
コード例 #4
0
  // @Override
  public void onStart(Intent intent, int startid) {
    // Toast.makeText(this, "Music Service Started", Toast.LENGTH_LONG).show();

    onStartCommand(intent);

    // PreLogUtil.put(CommonStrings.getInstance().START, this, "onStart");
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "onStart"));
  }
コード例 #5
0
  // @Override
  public IBinder onBind(Intent intent) {

    // Toast.makeText(this, "Music Bind", Toast.LENGTH_LONG).show();

    // PreLogUtil.put(CommonStrings.getInstance().START, this, "onBind");
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "onBind"));

    // songId = intent.getIntExtra("SONG", AndroidResources.raw.angels_we_have_heard);
    return null;
  }
コード例 #6
0
  // @Override
  public void onDestroy() {
    // Toast.makeText(this, "Music Service Stopped", Toast.LENGTH_LONG).show();

    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "onDestroy"));
    // PreLogUtil.put(CommonStrings.getInstance().START, this, "onDestroy");

    if (player != null) {
      player.stop();
      player.reset();
      player.release();
    }
  }
コード例 #7
0
  public void onStartCommand(Intent intent) {
    // PreLogUtil.put(CommonStrings.getInstance().START, this, "onStartCommand");
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "onStartCommand"));

    songId = intent.getIntExtra("SONG", -1);

    if (songId != -1) {
      System.gc();

      player = MediaPlayer.create(this, songId);
      player.setLooping(false);

      player.start();
    }
  }
コード例 #8
0
  public void closeAll() throws Exception {
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "closeAll"));

    Sound[] soundInterfaceArray = soundsFactoryInterface.getSoundInterfaceArray();

    ProgressCanvas progressCanvas = ProgressCanvasFactory.getInstance();

    for (int index = 0; index < soundInterfaceArray.length; index++) {
      if (soundInterfaceArray[index] != null) {
        Player player = soundInterfaceArray[index].getPlayer();
        if (player != null) {
          player.close();

          progressCanvas.addPortion(100, "Closing Sound: ", index);
        }
      }
    }
  }
コード例 #9
0
  public void init() throws Exception {
    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().START, this, CommonStrings.getInstance().INIT));

    CommonStrings commonStrings = CommonStrings.getInstance();
    final String SOUND = " Sound: ";

    ProgressCanvas progressCanvas = ProgressCanvasFactory.getInstance();

    soundsFactoryInterface.init();

    Sound[] soundInterfaceArray = soundsFactoryInterface.getSoundInterfaceArray();

    final String INIT_SOUND = "Initializing Sound: ";

    final SmallIntegerSingletonFactory smallIntegerSingletonFactory =
        SmallIntegerSingletonFactory.getInstance();

    for (int i = 0; i < soundInterfaceArray.length; i++) {

      final Sound soundInterface = soundInterfaceArray[i];

      if (soundInterface != null) {
        Integer indexInteger = smallIntegerSingletonFactory.getInstance(i);
        String indexString = indexInteger.toString();

        StringBuilder stringBuffer = new StringBuilder();

        stringBuffer.append(commonStrings.INDEX_LABEL);
        stringBuffer.append(indexString);
        stringBuffer.append(SOUND);
        stringBuffer.append(soundInterface.getClass().getName());

        LogUtil.put(
            LogFactory.getInstance(
                stringBuffer.toString(), this, CommonStrings.getInstance().INIT));

        soundInterface.init();

        progressCanvas.addPortion(100, INIT_SOUND + indexString);
      }
    }

    soundsFactoryInterface.setInitialized(true);

    LogUtil.put(
        LogFactory.getInstance(
            CommonStrings.getInstance().END, this, CommonStrings.getInstance().INIT));
  }
コード例 #10
0
  public int processInput() throws Exception {
    try {
      int motionInputsIndex = this.processMotionInputs();

      BasicArrayList list = this.getGameKeyEventList();

      int size = list.size();
      int key = 0;

      GameKeyEvent gameKeyEvent;

      for (int index = 0; index < size; index++) {
        gameKeyEvent = (GameKeyEvent) list.get(index);

        if (gameKeyEvent != null) {
          key = gameKeyEvent.getKey();

          if (this.processInput(key) == 1) {
            break;
          }
        }
      }

      this.clear();

      if (size > 0 || motionInputsIndex >= 0) {
        return 1;
      } else {
        return -1;
      }
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().EXCEPTION,
              this,
              GameInputStrings.getInstance().PROCESS_INPUT,
              e));
      return -1;
    }
  }
コード例 #11
0
  // @Override
  public void onCreate() {
    // Toast.makeText(this, "Music Service Created", Toast.LENGTH_LONG).show();

    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, "onCreate"));
    // PreLogUtil.put(CommonStrings.getInstance().START, this, "onCreate");
  }
  public BasicArrayList getList() {
    try {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().START, this, CommonStrings.getInstance().CONSTRUCTOR));

      final BasicArrayList list = new BasicArrayList();

      TouchButtonLocationHelper touchButtonLocationHelper = new TouchButtonLocationHelper();

      BasicTouchButtonCellPositionFactory basicTouchButtonCellPositionFactory =
          new BasicTouchButtonCellPositionFactory();

      FeaturedAnimationInterfaceFactoryInterfaceFactory
          featuredAnimationInterfaceFactoryInterfaceFactory =
              FeaturedAnimationInterfaceFactoryInterfaceFactory.getInstance();

      CommonButtons commonButtons = CommonButtons.getInstance();

      Animation animationInterface = NullAnimationFactory.getFactoryInstance().getInstance();

      BasicTouchInputFactory basicTouchInputFactory = BasicTouchInputFactory.getInstance();

      TouchButton LEFT =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton LEFT2 =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_SECOND_FROM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton LEFT3 =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton LEFT4 =
          new FullTouchButton(
              basicTouchInputFactory.LEFT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnLeftResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_SECOND_FROM_LEFT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT2 =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.BOTTOM_SECOND_FROM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT3 =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      TouchButton RIGHT4 =
          new FullTouchButton(
              basicTouchInputFactory.RIGHT,
              animationInterface,
              // (Animation)
              // featuredAnimationInterfaceFactoryInterfaceFactory.get(TouchButtonTurnRightResource.RESOURCE).getInstance(),
              commonButtons.NORMAL_BUTTON,
              basicTouchButtonCellPositionFactory.SECOND_FROM_BOTTOM_SECOND_FROM_RIGHT,
              touchButtonLocationHelper.getColumnsRemainderHalf(),
              touchButtonLocationHelper.getRowsRemainderHalf());

      list.add(LEFT);
      list.add(LEFT2);
      list.add(LEFT3);
      list.add(LEFT4);

      list.add(RIGHT);
      list.add(RIGHT2);
      list.add(RIGHT3);
      list.add(RIGHT4);

      if (basicTouchButtonCellPositionFactory.THIRD_FROM_BOTTOM_RIGHT
          != CellPositionFactory.getInstance().NONE) {
        TouchButton WEAPON =
            new TouchButton(
                basicTouchInputFactory.SPECIAL_BUTTON_FIVE,
                featuredAnimationInterfaceFactoryInterfaceFactory
                    .get(TouchButtonGenericActionResource.RESOURCE)
                    .getInstance(),
                commonButtons.NORMAL_BUTTON,
                basicTouchButtonCellPositionFactory.THIRD_FROM_BOTTOM_RIGHT,
                touchButtonLocationHelper.getColumnsRemainderHalf(),
                touchButtonLocationHelper.getRowsRemainderHalf());

        list.add(WEAPON);
      }
      return list;
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(
              CommonStrings.getInstance().EXCEPTION,
              this,
              CommonStrings.getInstance().GET_LIST,
              e));
      return BasicArrayListUtil.getInstance().getImmutableInstance();
    }
  }
コード例 #13
0
 protected void completedTask(Runnable task) {
   LogUtil.put(
       LogFactory.getInstance(COMPLETE_TASK + task, this, CommonStrings.getInstance().RUN));
 }
コード例 #14
0
 protected void startTask(Runnable task) {
   LogUtil.put(LogFactory.getInstance(START_TASK + task, this, CommonStrings.getInstance().RUN));
 }
コード例 #15
0
  public synchronized void runTask(Runnable task) {
    LogUtil.put(
        LogFactory.getInstance(CommonStrings.getInstance().START_LABEL + task, this, "runTask"));

    super.runTask(task);
  }